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

refactor(app-shell): Migrate protocols to "protocols" directory #13753

Merged

Conversation

mjhuff
Copy link
Contributor

@mjhuff mjhuff commented Oct 10, 2023

Closes RAUT-716

Overview

This PR is a follow-up to #13561, which addressed pre-parity protocol directory compatibility if a 7.0.0 and <7.0.0 version of the app were used on the same computer. Now that there will only be one supported app soon and all protocols can go in the same directory again, it makes sense to migrate protocols back to the more semantic and familiar directory name, "protocols".

More importantly, there's no need to support a function that checks all protocols in an old directory every time the app is launched - let's migrate all the protocols from the temp 7.0 directory to "protocols" then delete the folder. That way, our only necessary act of atonement moving forward is to check to see if the temp directory exists every startup (asynchronously!).

The one downside to this approach is if two protocols have the same name UUID - the older protocol in the protocol directory will be overwritten. Considering this scenario could only occur for the handful of users utilizing both versions of the app, odds are pretty good.

The error boundary added in the earlier PR will prevent this exact scenario from occurring again!

Test Plan

  • DO NOT OPEN THE APP YET.
  • Navigate to the parent directory of "protocols". /Users/Library/Application Support/Opentrons/ on Mac.
  • To test different behavior, make a copy of protocols-v7.0-supported in some other directory.
  • Open the app. Notice that any protocols in the v7.0-supported folder are moved into the protocols folder if they didn't exist there already. Notice that the v7.0-supported folder is deleted.
  • Protocols folder should be created if it doesn't already exist.

Changelog

  • Removed pre-app parity protocol migration.
  • Added post-app parity protocol migration.

Review requests

  • Double check my reasoning. I think this is the most effective long term solution...

Risk assessment

low but long term implications

…otocols folder exists

Migrates protocols to the protocols directory if protocols_v7.0-supported directory exists.
@mjhuff mjhuff requested review from sfoster1, shlokamin and a team October 10, 2023 20:21
@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

Merging #13753 (ab4661f) into chore_release-7.0.1 (dc4fe46) will decrease coverage by 0.06%.
Report is 8 commits behind head on chore_release-7.0.1.
The diff coverage is 22.50%.

Additional details and impacted files

Impacted file tree graph

@@                   Coverage Diff                   @@
##           chore_release-7.0.1   #13753      +/-   ##
=======================================================
- Coverage                71.23%   71.18%   -0.06%     
=======================================================
  Files                     2430     2430              
  Lines                    68447    68688     +241     
  Branches                  8043     8145     +102     
=======================================================
+ Hits                     48759    48894     +135     
- Misses                   17789    17885      +96     
- Partials                  1899     1909      +10     
Flag Coverage Δ
app 68.57% <22.50%> (-0.19%) ⬇️

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

Files Coverage Δ
app-shell/src/protocol-storage/file-system.ts 78.57% <100.00%> (ø)
...pp/src/organisms/ProtocolsLanding/ProtocolCard.tsx 0.00% <0.00%> (ø)
app-shell/src/protocol-storage/index.ts 37.33% <18.75%> (-4.00%) ⬇️
app/src/organisms/ProtocolDetails/index.tsx 41.57% <19.04%> (+1.34%) ⬆️

... and 17 files with indirect coverage changes

@mjhuff mjhuff marked this pull request as ready for review October 10, 2023 20:41
@mjhuff mjhuff requested a review from a team as a code owner October 10, 2023 20:41
@@ -344,6 +345,17 @@ export function ProtocolDetails(
setShowChooseRobotToRunProtocolSlideout(true)
}

const UNKNOWN_ATTACHMENT_ERROR = `${protocolDisplayName} protocol uses
instruments or modules from a future version of Opentrons software. Please update
Copy link
Contributor

Choose a reason for hiding this comment

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

The space between instruments and or is 2-space. Is this on purpose?
If not, ↓

Suggested change
instruments or modules from a future version of Opentrons software. Please update
instruments or modules from a future version of Opentrons software. Please update

@@ -79,13 +79,14 @@ export function ProtocolCard(props: ProtocolCardProps): JSX.Element | null {
)

const UNKNOWN_ATTACHMENT_ERROR = `${protocolDisplayName} protocol uses
instruments or modules from a future version of the app. Please update
instruments or modules from a future version of Opentrons software. Please update
Copy link
Contributor

Choose a reason for hiding this comment

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

same (2 spaces)

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.

The changes look good to me.
I tested this branch with macOS and Windows and both of them worked as expected.

@mjhuff mjhuff merged commit afffc45 into chore_release-7.0.1 Oct 11, 2023
@mjhuff mjhuff deleted the app-shell_post-pre-parity-protocols-migration branch October 11, 2023 20:50
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