-
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-shell,app): Send labware files and runtime parameters over USB #14994
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SyntaxColoring
commented
Apr 24, 2024
SyntaxColoring
commented
Apr 24, 2024
SyntaxColoring
changed the title
fix(app-shell,app): Send labware files over USB
fix(app-shell,app): Send labware files and runtime parameters over USB
Apr 24, 2024
shlokamin
reviewed
Apr 25, 2024
The actual requirements turn out to be stricter than supporting the structured clone algorithm. For example, `Blob` is structured-cloneable, but doesn't work with Electron's IPC.
shlokamin
approved these changes
Apr 25, 2024
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.
nice work, the value.arrayBuffer()
conversion was very clever thinking
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Fixes RESC-247 and RQA-2627.
Test Plan
Changelog
When the Electron rendering process wants to send a USB message, it needs to do so through the Electron main process. This is a problem because some JavaScript types for those messages—
File
s andBlob
s andFormData
s—can't be sent over IPC. We've worked around this forPOST /protocols
requests by substituting aprotocolKey: string
in place of these problematic types, in the IPC message. The main process then finds that and reconstructs theFile
s andFormData
s from it.That implementation didn't account for labware files external to the protocol (RESC-247), nor did it account for new multipart fields for things like run-time parameters. (RQA-2627).
With this PR, the rendering process slurps all the file contents—protocol and labware—into memory, and then sends them over IPC. We still need to use a substitute structure for the
FormData
, and the main process still needs to reconstruct all of this back intoFormData
s andFile
s. But the reconstruction code no longer needs to be concerned with application-level ideas like "labware" and "protocols" and where those things live on the filesystem, which is intended to make all of this a bit more robust.Review requests
See my review comments.
Risk assessment
Medium.