Skip to content
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

feat(app): ODD add error codes to protocol failed modal #13158

Merged
merged 4 commits into from
Jul 27, 2023

Conversation

shlokamin
Copy link
Member

@shlokamin shlokamin commented Jul 24, 2023

Overview

This PR adds an error code to the ODD's protocol failed modal. It does so by recursively looking for the "highest priority" error, which is the error with the lowest status code (preferring non generic status codes).

i.e. 2000 is higher priortity than 3000, but 2001 is higher priority than 2000

closes RCORE-799

Test Plan

  • Tested on ODD using the protocol attached

Screenshot 2023-07-24 at 5 46 06 PM

Changelog

  • show error code in run failed modal on ODD

Risk assessment

Low

@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

Merging #13158 (51f32d2) into edge (76eece6) will increase coverage by 0.36%.
The diff coverage is 81.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##             edge   #13158      +/-   ##
==========================================
+ Coverage   72.11%   72.47%   +0.36%     
==========================================
  Files        1531     2359     +828     
  Lines       50773    64921   +14148     
  Branches     3144     7225    +4081     
==========================================
+ Hits        36614    47051   +10437     
- Misses      13650    16124    +2474     
- Partials      509     1746    +1237     
Flag Coverage Δ
app 71.39% <81.25%> (+27.52%) ⬆️
components 63.08% <ø> (-1.41%) ⬇️
labware-library 49.17% <ø> (-0.35%) ⬇️
protocol-designer 47.29% <ø> (ø)
react-api-client 64.25% <ø> (ø)
step-generation 87.17% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...OnDeviceDisplay/RunningProtocol/RunFailedModal.tsx 82.60% <81.25%> (ø)

... and 847 files with indirect coverage changes

@@ -134,3 +131,63 @@ const SCROLL_BAR_STYLE = css`
border-radius: 11px;
}
`

const _getHighestPriorityError = (error: RunError): RunError => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gonna move all of these utils into a shared place in a follow up PR since ill need to use the public function for the desktop app

@shlokamin shlokamin marked this pull request as ready for review July 24, 2023 21:47
@shlokamin shlokamin requested review from a team as code owners July 24, 2023 21:47
@shlokamin shlokamin requested review from brenthagen and koji and removed request for a team July 24, 2023 21:47
createdAt: string
detail: string
}
import type { RunError } from '@opentrons/api-client'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can put this line before ModalHeaderBaseProps

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah sorry i think it was after a weird merge, should be fixed now

@@ -44,11 +39,13 @@ export function RunFailedModal({
const { stopRun } = useStopRunMutation()
const [isCanceling, setIsCanceling] = React.useState(false)

if (errors == null) return null
if (errors == null || errors.length === 0) return null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to keep errors == null ?
errors type is RunError[] which errors would not get null or undefined?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right now errors are optional:

interface RunFailedModalProps {
  runId: string
  setShowRunFailedModal: (showRunFailedModal: boolean) => void
  errors?: RunError[]
}

because of what we get back from react query, so this is just to make type checking happy. if we want to get rid of this check then inside of RunSummary before we render RunFailedModal we have to make sure runRecord?.data.error is not null

Copy link
Contributor

@koji koji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on a DVT and it worked as expected.

@shlokamin shlokamin merged commit 31c4c87 into edge Jul 27, 2023
42 checks passed
@shlokamin shlokamin deleted the app_odd-update-run-failed-modal branch July 27, 2023 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants