-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(app): clone run with RTPs from HistoricalProtocolRun #14959
Conversation
Here, I extend the useCloneRun hook to optionally create a new analysis for a protocol with RTP override values that will be referenced at protocol setup. This provides functionality for cloning a HistoricalProtocolRun with its RTP values preserved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the new terminal constant!
I'd probably spend some time grepping for the terminal run statuses in the app individually, because there are a few places we use them with slightly different names. Ex, in ProtocolRunHeader
we have RUN_OVER_STATUSES
. These should be refactored over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, just a few small things
const run = useNotifyRunQuery(runId).data | ||
const runTimeParameters = | ||
(isRunTerminal | ||
? run?.data?.runTimeParameters | ||
: mostRecentAnalysis?.runTimeParameters) ?? [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd add a little comment above here explaining why we're doing this — i can see myself forgetting a year from now 😛
<InfoScreen contentType="parameters" /> | ||
<InfoScreen | ||
contentType={ | ||
runStatus === RUN_STATUS_STOPPED ? 'runNotStarted' : 'parameters' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't quite right — a run could be stopped half way through a run. i think what we want to check here is whether a play action has been dispatched. so we'd do something like this:
const runActions = runRecord?.data.actions
const hasRunStarted = runActions?.some(
action => action.actionType === RUN_ACTION_TYPE_PLAY
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes more sense— thanks for the catch
const commandsFromQuery = useAllCommandsQuery(runId, null, { | ||
staleTime: Infinity, | ||
cacheTime: Infinity, | ||
}).data?.data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id add a comment here explaining that we're doing this because we only ever want one request done because its so heavy. i'd also disable this query whenever the run is NOT terminal so we don't unnecessarily take the performance hit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense to me as well
app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunRuntimeParameters.test.tsx
Outdated
Show resolved
Hide resolved
app/src/organisms/Devices/ProtocolRun/ProtocolRunRunTimeParameters.tsx
Outdated
Show resolved
Hide resolved
RUN_STATUS_SUCCEEDED, | ||
RUN_STATUS_STOPPED, | ||
] as RunStatus[]).includes(lastRunStatus.current), | ||
!(RUN_STATUSES_TERMINAL as RunStatus[]).includes(lastRunStatus.current), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be able to remove this typing when RUN_STATUSES_TERMINAL
is typed
case 'parameters': | ||
bodyText = 'No parameters specified in this protocol' | ||
break | ||
case 'moduleControls': | ||
bodyText = 'Connect modules to see controls' | ||
break | ||
case 'runNotStarted': | ||
bodyText = 'Run was never started' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add these to i18n? you'll have to pass it down as a prop since components
doesn't have i18n
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can, but am I wrong in thinking we removed that translation object prop somewhere along the way? Do we remember the reason for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah lets use i18n here — you can use the useTranslation
hook directly from this component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, i don't wanna block this from merging so all the comments i left can be addressed in a follow up
<InfoScreen contentType="parameters" /> | ||
<InfoScreen | ||
contentType={ | ||
!hasRunStarted && runStatus === RUN_STATUS_STOPPED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont think we care whether the run has been stopped right? we just care if its has been started
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do need to check whether the run has been stopped because otherwise we will show "run never started" immediately when starting protocol setup for a non-RTP protocol, and we actually want to show "no parameters" in that case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case 'parameters': | ||
bodyText = 'No parameters specified in this protocol' | ||
break | ||
case 'moduleControls': | ||
bodyText = 'Connect modules to see controls' | ||
break | ||
case 'runNotStarted': | ||
bodyText = 'Run was never started' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah lets use i18n here — you can use the useTranslation
hook directly from this component
* edge: (194 commits) fix(app): clone run with RTPs from HistoricalProtocolRun (#14959) fix(api): Filter out `air_gap()` calls as higher-order commands (#14985) fix(app): fix infinitely re-rendering/never rendering firmware success toasts (#14981) feat(api): add option to ignore different tip presence states (#14980) feat(opentrons-ai-client) add input textbox to container (#14968) fix(app): add robotSerialNumber to proceedToRun event (#14976) fix(api): remove homing patch fix for right mount when a 96-channel is attached (#14975) feat(api-client,app,react-api-client): upload splash logo from desktop app (#14941) fix(robot-server): notify /runs when a non-current run is deleted (#14974) feature(api, robot-server): Allow fixit commands to recover from an error (#14908) feat(hardware-testing): enable multi sensor processing in liquid probe (#14883) fix(app): prevent "run again" banner from rendering after navigating away from the current run (#14973) refactor(components): refactor roundtab stories (#14956) refactor(protocol-designer): assign module slot in createFileWizard instead of modal (#14951) fix(app, api-client): fix choose protocol slideout issue (#14949) refactor(protocol-designer): tip position modal max values round down (#14972) feat(app): add tiprack selection step to quick transfer flow (#14950) ci(shared-data): install dependencies in workflow (#14958) fix(components): fix icon stories (#14969) feat(opentrons-ai-client): introduce react-markdown to chat display component (#14965) ...
closes RQA-2601
Overview
Here, I extend the useCloneRun hook to optionally create a new analysis for a protocol with RTP
override values that will be referenced at protocol setup. This provides functionality for cloning a
HistoricalProtocolRun with its RTP values preserved.
Test Plan
Changelog
useCloneRun
to optionally trigger a new protocol analysis, properly invalidate queries to/runs
and/protocols
Parameters
andRunPreview
runTimeParameters
key onRun
typeInfoScreen
for run canceled before beginningReview requests
auth, @shlokamin per pairing
Risk assessment
medium