Skip to content

Commit 5da5aaf

Browse files
authored
fix(step-generation): blowout waste chute bug (#18908)
closes AUTH-2086
1 parent 0512aa4 commit 5da5aaf

File tree

4 files changed

+45
-56
lines changed

4 files changed

+45
-56
lines changed

step-generation/src/__tests__/blowoutUtil.test.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import {
1010
getInitialRobotStateStandard,
1111
makeContext,
1212
SOURCE_LABWARE,
13-
TROUGH_LABWARE,
1413
} from '../fixtures'
1514
import {
16-
blowoutLocationHelper,
1715
DEST_WELL_BLOWOUT_DESTINATION,
16+
mixBlowoutLocationHelper,
1817
SOURCE_WELL_BLOWOUT_DESTINATION,
1918
} from '../utils'
2019
import { curryCommandCreator } from '../utils/curryCommandCreator'
@@ -56,8 +55,8 @@ describe('blowoutLocationHelper', () => {
5655
}
5756
vi.mocked(curryCommandCreator).mockClear()
5857
})
59-
it('blowoutLocationHelper curries blowout with source well params', () => {
60-
blowoutLocationHelper({
58+
it('mixBlowoutLocationHelper curries blowout with source well params', () => {
59+
mixBlowoutLocationHelper({
6160
...blowoutArgs,
6261
blowoutLocation: SOURCE_WELL_BLOWOUT_DESTINATION,
6362
})
@@ -74,7 +73,7 @@ describe('blowoutLocationHelper', () => {
7473
},
7574
})
7675
})
77-
it('blowoutLocationHelper curries waste chute commands when there is no well', () => {
76+
it('mixBlowoutLocationHelper curries waste chute commands when there is no well', () => {
7877
const wasteChuteId = 'wasteChuteId'
7978
invariantContext = {
8079
...invariantContext,
@@ -86,7 +85,7 @@ describe('blowoutLocationHelper', () => {
8685
},
8786
},
8887
}
89-
blowoutLocationHelper({
88+
mixBlowoutLocationHelper({
9089
...blowoutArgs,
9190
destLabwareId: wasteChuteId,
9291
invariantContext: invariantContext,
@@ -99,8 +98,8 @@ describe('blowoutLocationHelper', () => {
9998
wasteChuteId,
10099
})
101100
})
102-
it('blowoutLocationHelper curries blowout with dest plate params', () => {
103-
blowoutLocationHelper({
101+
it('mixBlowoutLocationHelper curries blowout with dest plate params', () => {
102+
mixBlowoutLocationHelper({
104103
...blowoutArgs,
105104
blowoutLocation: DEST_WELL_BLOWOUT_DESTINATION,
106105
})
@@ -117,15 +116,15 @@ describe('blowoutLocationHelper', () => {
117116
},
118117
})
119118
})
120-
it('blowoutLocationHelper curries blowout with an arbitrary labware Id', () => {
121-
blowoutLocationHelper({
119+
it('mixBlowoutLocationHelper curries blowout with an arbitrary labware Id', () => {
120+
mixBlowoutLocationHelper({
122121
...blowoutArgs,
123-
blowoutLocation: TROUGH_LABWARE,
122+
blowoutLocation: 'dest_well',
124123
})
125124
expect(curryCommandCreator).toHaveBeenCalledWith(blowOutInWell, {
126125
pipetteId: blowoutArgs.pipette,
127-
labwareId: TROUGH_LABWARE,
128-
wellName: 'A1',
126+
labwareId: 'destPlateId',
127+
wellName: 'A2',
129128
flowRate: blowoutArgs.flowRate,
130129
wellLocation: {
131130
origin: 'top',
@@ -135,8 +134,8 @@ describe('blowoutLocationHelper', () => {
135134
},
136135
})
137136
})
138-
it('blowoutLocationHelper returns an empty array if not given a blowoutLocation', () => {
139-
const result = blowoutLocationHelper({
137+
it('mixBlowoutLocationHelper returns an empty array if not given a blowoutLocation', () => {
138+
const result = mixBlowoutLocationHelper({
140139
...blowoutArgs,
141140
blowoutLocation: null,
142141
})

step-generation/src/__tests__/mix.test.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ describe('mix: advanced options', () => {
364364
volume,
365365
times,
366366
changeTip: 'always',
367-
blowoutLocation: blowoutLabwareId,
367+
blowoutLocation: 'source_well',
368368
wells: ['A1', 'B1', 'C1'],
369369
} as MixArgs
370370

@@ -408,6 +408,8 @@ describe('mix: advanced options', () => {
408408
flowRate: 2.2,
409409
}),
410410
blowoutHelper(blowoutLabwareId, {
411+
labwareId: 'sourcePlateId',
412+
wellName: well,
411413
wellLocation: {
412414
origin: 'top',
413415
offset: {
@@ -425,9 +427,9 @@ describe('mix: advanced options', () => {
425427
volume,
426428
times,
427429
changeTip: 'always',
428-
blowoutLocation: blowoutLabwareId,
430+
blowoutLocation: 'dest_well',
429431
touchTip: true,
430-
wells: ['A1', 'B1', 'C1'],
432+
wells: ['A1'],
431433
} as MixArgs
432434

433435
const result = mix(args, invariantContext, robotStateWithTip)
@@ -470,6 +472,8 @@ describe('mix: advanced options', () => {
470472
flowRate: 2.2,
471473
}),
472474
blowoutHelper(blowoutLabwareId, {
475+
labwareId: 'sourcePlateId',
476+
wellName: 'A1',
473477
wellLocation: {
474478
origin: 'top',
475479
offset: {
@@ -594,7 +598,7 @@ describe('mix: advanced options', () => {
594598
touchTip: true,
595599
aspirateDelaySeconds: 10,
596600
dispenseDelaySeconds: 12,
597-
blowoutLocation: blowoutLabwareId,
601+
blowoutLocation: 'source_well',
598602
volume,
599603
times,
600604
changeTip: 'always',
@@ -654,6 +658,8 @@ describe('mix: advanced options', () => {
654658
}),
655659
delayCommand(12),
656660
blowoutHelper(blowoutLabwareId, {
661+
labwareId: 'sourcePlateId',
662+
wellName: well,
657663
wellLocation: {
658664
origin: 'top',
659665
offset: {
@@ -679,7 +685,7 @@ mock_pipette.mix(
679685
final_push_out=2,
680686
)
681687
mock_pipette.flow_rate.blow_out = 2.3
682-
mock_pipette.blow_out(mock_dest_plate["A1"].top(z=3.3))
688+
mock_pipette.blow_out(mock_source_plate["A1"].top(z=3.3))
683689
mock_pipette.touch_tip(mock_source_plate["A1"], v_offset=-3.4)
684690
mock_pipette.drop_tip()
685691
mock_pipette.pick_up_tip(location=mock_tip_rack_1)
@@ -695,7 +701,7 @@ mock_pipette.mix(
695701
final_push_out=2,
696702
)
697703
mock_pipette.flow_rate.blow_out = 2.3
698-
mock_pipette.blow_out(mock_dest_plate["A1"].top(z=3.3))
704+
mock_pipette.blow_out(mock_source_plate["B1"].top(z=3.3))
699705
mock_pipette.touch_tip(mock_source_plate["B1"], v_offset=-3.4)
700706
mock_pipette.drop_tip()
701707
mock_pipette.pick_up_tip(location=mock_tip_rack_1)
@@ -711,7 +717,7 @@ mock_pipette.mix(
711717
final_push_out=2,
712718
)
713719
mock_pipette.flow_rate.blow_out = 2.3
714-
mock_pipette.blow_out(mock_dest_plate["A1"].top(z=3.3))
720+
mock_pipette.blow_out(mock_source_plate["C1"].top(z=3.3))
715721
mock_pipette.touch_tip(mock_source_plate["C1"], v_offset=-3.4)
716722
`.trim()
717723
)
@@ -721,7 +727,7 @@ mock_pipette.touch_tip(mock_source_plate["C1"], v_offset=-3.4)
721727
const args: MixArgs = {
722728
...mixinArgs,
723729
touchTip: true,
724-
blowoutLocation: blowoutLabwareId,
730+
blowoutLocation: 'dest_well',
725731
volume,
726732
times,
727733
changeTip: 'always',
@@ -745,7 +751,7 @@ mock_pipette.mix(
745751
dispense_flow_rate=2.2,
746752
)
747753
mock_pipette.flow_rate.blow_out = 2.3
748-
mock_pipette.blow_out(mock_dest_plate["A1"].top(z=3.3))
754+
mock_pipette.blow_out(mock_source_plate["A1"].top(z=3.3))
749755
mock_pipette.touch_tip(mock_source_plate["A1"], v_offset=-3.4)
750756
mock_pipette.drop_tip()
751757
mock_pipette.pick_up_tip(location=mock_tip_rack_1)
@@ -758,7 +764,7 @@ mock_pipette.mix(
758764
dispense_flow_rate=2.2,
759765
)
760766
mock_pipette.flow_rate.blow_out = 2.3
761-
mock_pipette.blow_out(mock_dest_plate["A1"].top(z=3.3))
767+
mock_pipette.blow_out(mock_source_plate["B1"].top(z=3.3))
762768
mock_pipette.touch_tip(mock_source_plate["B1"], v_offset=-3.4)
763769
mock_pipette.drop_tip()
764770
mock_pipette.pick_up_tip(location=mock_tip_rack_1)
@@ -771,7 +777,7 @@ mock_pipette.mix(
771777
dispense_flow_rate=2.2,
772778
)
773779
mock_pipette.flow_rate.blow_out = 2.3
774-
mock_pipette.blow_out(mock_dest_plate["A1"].top(z=3.3))
780+
mock_pipette.blow_out(mock_source_plate["C1"].top(z=3.3))
775781
mock_pipette.touch_tip(mock_source_plate["C1"], v_offset=-3.4)
776782
`.trim()
777783
)

step-generation/src/commandCreators/compound/mix.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import {
99

1010
import * as errorCreators from '../../errorCreators'
1111
import {
12-
blowoutLocationHelper,
1312
curryCommandCreator,
1413
curryWithoutPython,
1514
formatPyStr,
1615
formatPyWellLocation,
1716
getIsSafePipetteMovement,
1817
getSlotInLocationStack,
1918
indentPyLines,
19+
mixBlowoutLocationHelper,
2020
reduceCommandCreators,
2121
} from '../../utils'
2222
import {
@@ -401,7 +401,7 @@ export const mix: CommandCreator<MixArgs> = (
401401
}),
402402
]
403403
: []
404-
const blowoutCommand = blowoutLocationHelper({
404+
const blowoutCommand = mixBlowoutLocationHelper({
405405
pipette: data.pipette,
406406
sourceLabwareId: data.labware,
407407
sourceWell: well,

step-generation/src/utils/misc.ts

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ export function getWellsForTips(
359359
// Set blowout location depending on the 'blowoutLocation' arg: set it to
360360
// the SOURCE_WELL_BLOWOUT_DESTINATION / DEST_WELL_BLOWOUT_DESTINATION
361361
// special strings, or to a labware ID.
362-
export const blowoutLocationHelper = (args: {
362+
export const mixBlowoutLocationHelper = (args: {
363363
pipette: BlowoutParams['pipetteId']
364364
sourceLabwareId: string
365365
sourceWell: BlowoutParams['wellName']
@@ -381,41 +381,25 @@ export const blowoutLocationHelper = (args: {
381381
offsetFromTopMm,
382382
invariantContext,
383383
} = args
384-
if (!blowoutLocation) return []
385-
const {
386-
labwareEntities,
387-
trashBinEntities,
388-
wasteChuteEntities,
389-
} = invariantContext
390-
const trashOrLabware = getTrashOrLabware(
391-
labwareEntities,
392-
wasteChuteEntities,
393-
trashBinEntities,
394-
destLabwareId
395-
)
384+
if (!blowoutLocation) {
385+
return []
386+
}
387+
const { trashBinEntities, wasteChuteEntities } = invariantContext
396388

397-
let labware: LabwareEntity | null = null
389+
let labwareId: string | null = null
398390
let well: string | null = null
399391
if (blowoutLocation === SOURCE_WELL_BLOWOUT_DESTINATION) {
400-
labware = invariantContext.labwareEntities[sourceLabwareId]
392+
labwareId = sourceLabwareId
401393
well = sourceWell
402394
} else if (blowoutLocation === DEST_WELL_BLOWOUT_DESTINATION) {
403-
labware =
404-
trashOrLabware === 'labware'
405-
? invariantContext.labwareEntities[destLabwareId]
406-
: null
407-
well = trashOrLabware === 'labware' ? destWell : null
408-
} else {
409-
// if it's not one of the magic strings, it's a labware or waste chute or trash bin id
410-
labware = invariantContext.labwareEntities?.[blowoutLocation]
411-
well = trashOrLabware === 'labware' ? 'A1' : null
395+
labwareId = destLabwareId
396+
well = destWell
412397
}
413-
414-
if (well != null && trashOrLabware === 'labware' && labware != null) {
398+
if (well != null && labwareId != null) {
415399
return [
416400
curryCommandCreator(blowOutInWell, {
417401
pipetteId: pipette,
418-
labwareId: labware.id,
402+
labwareId: labwareId,
419403
wellName: well,
420404
flowRate,
421405
wellLocation: {
@@ -426,7 +410,7 @@ export const blowoutLocationHelper = (args: {
426410
},
427411
}),
428412
]
429-
} else if (trashOrLabware === 'wasteChute') {
413+
} else if (wasteChuteEntities[blowoutLocation] != null) {
430414
return [
431415
curryCommandCreator(blowOutInWasteChute, {
432416
pipetteId: pipette,

0 commit comments

Comments
 (0)