Skip to content

Commit 3a54180

Browse files
authored
fix(protocol-designer): migrate null blowout location (#18764)
Previously, we erroniously allowed a user to save a form with disposal or blowout checkbox on, but no blowout location selected from the dropdown. For the 8.5.0 release, we enforce a stepform error if the blowout location is left unselected. In order to prevent this error popping up for users who migrate older protocols in which the blowout location was unselected, we migrate the blowout location to the first available trash or waste chute ID. Closes RQA-4311 ## Test Plan and Hands on Testing - upload protocol attached to this ticket - open the transfer form > advanced dispense settings, and verify that the disposal blowout location is set to the trash bin, and the form has no errors ## Changelog - add migration to fill a blowout field if it was previously saved while null ## Review requests see test plan ## Risk assessment low
1 parent b428e4b commit 3a54180

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

protocol-designer/release-notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Use Opentrons-verified liquid classes to automatically define transfer settings
3333
- During a mix, push out is set to 0 by default for all mixes except for the last, to avoid multiple push out actions. You can choose your own push out volume in a mix step menu.
3434
- Choose a new tip drop location from the dropdown menu when an uploaded protocol is missing a tip drop location.
3535
- Protocol Designer correctly updates adapter and labware combination definitions when you upload a protocol designed in Protocol Designer v7.0.0 or earlier.
36-
- When adding a disposal volume, a blowout location is now required.
36+
- When adding a disposal volume, a blowout location is now required. Older protocols that specified a blowout with no location selected will be updated to blowout in a loaded trash bin or waste chute.
3737
- No longer allow touch tip with incompatible labware. This changes the behavior of imported protocols that had touch tip on incompatible labware.
3838
- If multiple labware end up in the same slot at the same time due to deleting/rearranging steps, an error appears on the protocol timeline.
3939
- If a Heater-Shaker step is created with a a heater set and a timer, the protocol will now wait until the temperature is reached before counting down the timer.

protocol-designer/src/load-file/migration/8_5_0.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import first from 'lodash/first'
12
import floor from 'lodash/floor'
23
import min from 'lodash/min'
34

@@ -40,6 +41,18 @@ const getMigratedBlowoutFlowRate = (
4041
? getDefaultBlowoutFlowRate(Number(form.volume), pipetteSpecs, tipRackDef)
4142
: null
4243

44+
const getMigratedBlowoutLocation = (
45+
form: FormData,
46+
firstTrashBinOrWasteChuteId: string | null
47+
): string | null => {
48+
const { blowout_checkbox, blowout_location, disposalVolume_checkbox } = form
49+
const doesBlowoutNeedMigration =
50+
(blowout_checkbox === true || disposalVolume_checkbox === true) &&
51+
blowout_location == null
52+
return doesBlowoutNeedMigration && firstTrashBinOrWasteChuteId != null
53+
? firstTrashBinOrWasteChuteId
54+
: blowout_location
55+
}
4356
export const migrateFile = (
4457
appData: ProtocolFile<PDMetadata>
4558
): ProtocolFile<PDMetadata> => {
@@ -68,6 +81,31 @@ export const migrateFile = (
6881
return acc
6982
}, {})
7083

84+
const initialDeckSetupStep = Object.values(savedStepForms).find(
85+
form => form.id === '__INITIAL_DECK_SETUP_STEP__'
86+
)
87+
const firstTrashBinOrWasteChuteId =
88+
first([
89+
...Object.keys(
90+
(initialDeckSetupStep?.trashBinLocationUpdate as Record<
91+
string,
92+
string
93+
>) ?? {}
94+
),
95+
...Object.keys(
96+
(initialDeckSetupStep?.wasteChuteLocationUpdate as Record<
97+
string,
98+
string
99+
>) ?? {}
100+
),
101+
]) ?? null
102+
103+
if (firstTrashBinOrWasteChuteId == null) {
104+
console.error(
105+
'No trash bin or waste chute found in the initial deck setup step. Protocol file may have been corrupted.'
106+
)
107+
}
108+
71109
const savedStepsWithUpdatedMoveLiquidFields = Object.values(
72110
savedStepForms
73111
).reduce((acc, form) => {
@@ -82,6 +120,7 @@ export const migrateFile = (
82120
liquidClass,
83121
aspirate_touchTip_checkbox,
84122
dispense_touchTip_checkbox,
123+
blowout_location,
85124
// intentionally destructure but do not pass these deprecated fields
86125
aspirate_delay_mmFromBottom,
87126
dispense_delay_mmFromBottom,
@@ -104,6 +143,10 @@ export const migrateFile = (
104143
'touchTipDisabled'
105144
)
106145

146+
const migratedBlowoutLocation = getMigratedBlowoutLocation(
147+
form,
148+
firstTrashBinOrWasteChuteId
149+
)
107150
const matchingAspirateLabwareWellDepth = getMigratedPositionFromTop(
108151
labwareDefinitions,
109152
loadLabwareCommands,
@@ -216,6 +259,7 @@ export const migrateFile = (
216259
...(migratedBlowoutFlowRate != null
217260
? { blowout_flowRate: migratedBlowoutFlowRate }
218261
: {}),
262+
blowout_location: migratedBlowoutLocation,
219263
},
220264
}
221265
}
@@ -266,6 +310,12 @@ export const migrateFile = (
266310
pipetteSpecs,
267311
tipRackDef
268312
)
313+
314+
const migratedBlowoutLocation = getMigratedBlowoutLocation(
315+
form,
316+
firstTrashBinOrWasteChuteId
317+
)
318+
269319
return {
270320
...acc,
271321
[id]: {
@@ -291,6 +341,7 @@ export const migrateFile = (
291341
...(migratedBlowoutFlowRate != null
292342
? { blowout_flowRate: migratedBlowoutFlowRate }
293343
: {}),
344+
blowout_location: migratedBlowoutLocation,
294345
},
295346
}
296347
}

0 commit comments

Comments
 (0)