Skip to content

Commit 19dfd19

Browse files
authored
doc(step-generation): liquidClass="none" is allowed in FormData but not in StepArgs (#19144)
# Overview We're running into bugs because there's confusion about when `liquidClass == "none"` is expected (e.g., RQA-4490). After tracing through the code, I think the policy is: - In the form data (`HydratedMoveLiquidFormData`), `null` means the user has not selected anything, and `"none"` (aka `NONE_LIQUID_CLASS_NAME`) means the user clicked "Don't use a liquid class," and otherwise the name of a liquid class (e.g., `"water"`) is expected. - In the step args (`TransferArgs`, `ConsolidateArgs`, `DistributeArgs`, `SharedTransferLikeArgs`), the value `"none"` is not allowed. The `liquidClass` must be the name of a liquid class like `"water"`, or `null`. Anyone who's converting from the FormData to StepArgs (PD and QT) is responsible for implementing this rule. In PD, `moveLiquidFormToArgs.ts` is responsible for translating `"none"` to `null` when creating the StepArgs (https://github.com/Opentrons/opentrons/blob/chore_release-pd-8.5.0/protocol-designer/src/steplist/formLevel/stepFormToArgs/moveLiquidFormToArgs.ts#L392). QT doesn't do that translation yet, and that's why it's crashing. ## Review requests I'm not saying this rule is a good idea, but it's the only way to make the existing code work. Our functions that take StepArgs (like the `transfer.ts` CommandCreator) will crash if you pass them `"none"`. ## Risk assessment Low. Comment-only change.
1 parent 3a74465 commit 19dfd19

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

protocol-designer/src/form-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export interface HydratedMoveLiquidFormData extends AnnotationFields {
343343
pickUpTip_location?: string | null
344344
pickUpTip_wellNames?: string[] | null
345345
preWetTip?: boolean | null
346-
liquidClass?: string | null
346+
liquidClass?: string | null // a liquid class name like "water" or "none" or null
347347
}
348348

349349
export interface HydratedMoveLabwareFormData extends AnnotationFields {

step-generation/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ export type SharedTransferLikeArgs = CommonArgs & {
309309
blowoutFlowRateUlSec: number
310310

311311
// ===== SETTINGS INTRODUCED WITH LIQUID CLASSES =====
312-
liquidClass: string | null
312+
liquidClass: string | null // a liquid class name like "water" or null; "none" is not allowed
313313
aspiratePositionReference: PositionReference
314314
aspirateZOffset: number
315315
aspirateSubmergeSpeed: number | null

step-generation/src/utils/liquidClassUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export const getCustomLiquidClassProperties = (
229229
}
230230

231231
export const getLiquidClassName = (
232-
liquidClass: string,
232+
liquidClass: string, // a liquid class name like "water", "none" is not allowed
233233
showBase?: boolean
234234
): string => {
235235
const allLiquidClassDefs = getAllLiquidClassDefs()

0 commit comments

Comments
 (0)