-
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): properly enable/disable robot update from file button #6483
Conversation
Codecov Report
@@ Coverage Diff @@
## edge #6483 +/- ##
=======================================
Coverage ? 56.36%
=======================================
Files ? 1058
Lines ? 16368
Branches ? 0
=======================================
Hits ? 9226
Misses ? 7142
Partials ? 0
Continue to review full report at Codecov.
|
Smoke tested... ✅ Regular upgrade via file ...and everything went smoothly (read: as smoothly as expected when the lack of motor control hardware attached to a bare Pi will make the health endpoint 503 without config modification) |
] | ||
|
||
SPECS.forEach(spec => { | ||
const { name, selector, state, expected, setup } = spec | ||
const args = spec.args || [] | ||
if (typeof setup === 'function') setup() |
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.
Fun fact: mock setup wasn't working at all in these tests...
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.
🙃
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.
Tested on my robot. Works as expected.
Just don't know how to test the case in the comment but looks like the unit test works so 👍
const OTHER_ROBOT_UPDATING = | ||
'Unable to update because the app is currently updating a different robot.' | ||
const NO_UPDATE_FILES = | ||
'Unable to retrieve update for this robot. Ensure your computer is connected to the internet and try again later.' |
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.
When does this happen? (Not having update files)
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.
Mainly this will happen in two cases:
- The user's computer is not connected to the internet
- It's not able to check the
releases.json
manifest from S3 for the robot updates - fix(app): cache robot releases manifest for offline usage #6494 makes this happen less often, so that it will only show up if the computer is not connected to the internet and it has never been connected long enough to download the latest update
- It's not able to check the
- The user has updated the latest version of the app but the robot update hasn't finished building / hasn't been uploaded to the release bucket
- So in the 30 to 60 min window right when the app release is cut
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.
Left a few questions, but tests are very thorough and code looks great
getViewableRobots.mockReturnValueOnce([ | ||
getViewableRobots.mockReturnValue([ |
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.
how come you switched mockReturnValueOnce
to mockReturnValue
?
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 mockReturnValue
is more accurate to how the selectors would actually behave; a selector (if it chose to) might call some selector it is dependent on multiple times with the same input, and you would expect the same output.
These tests weren't very well written (by me) with respect to mocks, so I've refactored to be more clear
getRobotByName.mockImplementation((state, name) => { | ||
return { ...mockReachableRobot, name } | ||
}) |
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.
Why would we overwrite the name
of the robot here? When I console.log
the name that gets passed in to the mock, it's undefined
.
Wouldn't we want to always just return the name of mockReachableRobot
, which is different than other-robot-name
? I.e.
getRobotByName.mockReturnValueOnce(mockReachableRobot)
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.
Oops, test was bad. Good catch!
const UPDATE_FROM_FILE_DESCRIPTION = ( | ||
<> | ||
If your app is unable to auto-download robot updates, you can{' '} | ||
<Link external href="https://www.opentrons.com/ot-app/"> | ||
download the robot update yourself | ||
</Link>{' '} | ||
and update your robot manually | ||
</> | ||
) |
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 descriptions like these go in 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 think yes. Do you feel like I should put more than the TODO comment above given the app does not currently have an i18n system?
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.
Ah missed the TODO comment. Do you know whether there are plans for the app to support i18n? If not, maybe @Opentrons/spddrs could consider taking this on as a longer term snacklog project we could pick at on Friday afternoons/during escalations or whatever. Or maybe we determine that it's just not worth it for the app to support i18n. Regardless, it's easy to keep kicking the can with this sort of stuff, and we should decide one way or another whether we'd like to commit to i18n or not.
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.
There are no plans that I'm aware of, but I think it's a great thing to tackle. There are a lot of TODO... i18n
comments in the app's codebase
expect(result).toBe('downgrade') | ||
}) | ||
|
||
it('should get update type when robot is matches the update', () => { |
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 name seems wrong. It should be something like should return reinstall type when robot matches the update
right?
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.
The update type is one of "upgrade", "downgrade", "reinstall", or null
, but sure, can tweak the description
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.
ohhh, I misunderstood what "update type" means in the description, I thought it meant "the update type of type upgrade", but that isn't the case
expect(result).toBe('upgrade') | ||
}) | ||
|
||
it('should get update type when robot is ahead of the update', () => { |
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 this should say should get downgrade type
or something right?
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!
Overview
This PR tackles a few things that were blocking each other in the Robot Settings page UI. Primarily, it ensures:
Fixes #5429
Changelog
<Card>
'sdisabled
proppointer-events: none
buildroot
moduleReview requests
Note: using the local dev server is a good way to create a "bad update server" condition.
Risk assessment
Hopefully pretty low, but since we're touching the update flow, a smoke test on a Buildroot robot update and a Balena robot migration couldn't hurt