fix(app-shell,app): Send labware files and runtime parameters over USB #14994
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.