Skip to content

Chore: Incremental mergeback of PD chore release 8.4.4 into edge #18170

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

Merged
merged 11 commits into from
Apr 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions protocol-designer/src/load-file/migration/8_4_4.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { swatchColors } from '../../components/organisms/DefineLiquidsModal/swatchColors'
import { getAdditionalEquipmentLocationUpdate } from './utils/getAdditionalEquipmentLocationUpdate'
import { getEquipmentLoadInfoFromCommands } from './utils/getEquipmentLoadInfoFromCommands'

import type { ProtocolFile } from '@opentrons/shared-data'
import type { Ingredients } from '@opentrons/step-generation'
import type { PDMetadata } from '../../file-types'
import type { DesignerApplicationData } from './utils/getLoadLiquidCommands'

export const migrateFile = (
appData: ProtocolFile<DesignerApplicationData>
): ProtocolFile<PDMetadata> => {
const {
designerApplication,
commands,
labwareDefinitions,
liquids,
robot,
} = appData

Check warning on line 19 in protocol-designer/src/load-file/migration/8_4_4.ts

Codecov / codecov/patch

protocol-designer/src/load-file/migration/8_4_4.ts#L11-L19

Added lines #L11 - L19 were not covered by tests

if (designerApplication == null || designerApplication?.data == null) {
throw Error('The designerApplication key in your file is corrupt.')
}
const ingredients = designerApplication.data.ingredients
const savedStepForms = designerApplication.data.savedStepForms

Check warning on line 25 in protocol-designer/src/load-file/migration/8_4_4.ts

Codecov / codecov/patch

protocol-designer/src/load-file/migration/8_4_4.ts#L21-L25

Added lines #L21 - L25 were not covered by tests

const migratedIngredients: Ingredients = Object.entries(
ingredients
).reduce<Ingredients>((acc, [id, ingredient]) => {
acc[id] = {
displayName: ingredient.name ?? '',
liquidClass: ingredient.liquidClass,
description: ingredient.description ?? null,
liquidGroupId: id,
displayColor: liquids[id].displayColor ?? swatchColors(id),
}
return acc
}, {})

Check warning on line 38 in protocol-designer/src/load-file/migration/8_4_4.ts

Codecov / codecov/patch

protocol-designer/src/load-file/migration/8_4_4.ts#L27-L38

Added lines #L27 - L38 were not covered by tests

const updatedInitialStep = Object.values(savedStepForms).reduce(
(acc, form) => {
const { id } = form
if (id === '__INITIAL_DECK_SETUP_STEP__') {
return {
...acc,
[id]: {
...form,
...getAdditionalEquipmentLocationUpdate(
commands,
robot.model,
savedStepForms
),
},
}
}
return acc
},
{}
)
const equipmentLoadInfoFromCommands = getEquipmentLoadInfoFromCommands(
commands,
labwareDefinitions
)
return {
...appData,
designerApplication: {
...designerApplication,
data: {
...designerApplication.data,
ingredients: migratedIngredients,
...equipmentLoadInfoFromCommands,
savedStepForms: {
...designerApplication.data.savedStepForms,
...updatedInitialStep,
},
},
},
}
}

Check warning on line 79 in protocol-designer/src/load-file/migration/8_4_4.ts

Codecov / codecov/patch

protocol-designer/src/load-file/migration/8_4_4.ts#L40-L79

Added lines #L40 - L79 were not covered by tests
51 changes: 3 additions & 48 deletions protocol-designer/src/load-file/migration/8_5_0.ts
Original file line number Diff line number Diff line change
@@ -4,50 +4,28 @@
POSITION_REFERENCE_BOTTOM,
} from '@opentrons/shared-data'

import { swatchColors } from '../../components/organisms/DefineLiquidsModal/swatchColors'
import {
DEFAULT_MM_TOUCH_TIP_OFFSET_FROM_EDGE,
PROTOCOL_DESIGNER_SOURCE,
} from '../../constants'
import { getDefaultPushOutVolume } from '../../utils'
import { getAdditionalEquipmentLocationUpdate } from './utils/getAdditionalEquipmentLocationUpdate'
import { getEquipmentLoadInfoFromCommands } from './utils/getEquipmentLoadInfoFromCommands'
import { getMigratedPositionFromTop } from './utils/getMigrationPositionFromTop'

import type {
LoadLabwareCreateCommand,
ProtocolFile,
} from '@opentrons/shared-data'
import type { Ingredients } from '@opentrons/step-generation'
import type { PDMetadata } from '../../file-types'
import type { DesignerApplicationData } from './utils/getLoadLiquidCommands'

export const migrateFile = (
appData: ProtocolFile<DesignerApplicationData>
appData: ProtocolFile<PDMetadata>

Check warning on line 22 in protocol-designer/src/load-file/migration/8_5_0.ts

Codecov / codecov/patch

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

Added line #L22 was not covered by tests
): ProtocolFile<PDMetadata> => {
const {
designerApplication,
commands,
labwareDefinitions,
liquids,
robot,
} = appData
const { designerApplication, commands, labwareDefinitions } = appData

Check warning on line 24 in protocol-designer/src/load-file/migration/8_5_0.ts

Codecov / codecov/patch

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

Added line #L24 was not covered by tests
if (designerApplication == null || designerApplication?.data == null) {
throw Error('The designerApplication key in your file is corrupt.')
}
const { savedStepForms, ingredients } = designerApplication.data
const migratedIngredients: Ingredients = Object.entries(
ingredients
).reduce<Ingredients>((acc, [id, ingredient]) => {
acc[id] = {
displayName: ingredient.name ?? '',
liquidClass: ingredient.liquidClass,
description: ingredient.description ?? null,
liquidGroupId: id,
displayColor: liquids[id].displayColor ?? swatchColors(id),
}
return acc
}, {})
const { savedStepForms } = designerApplication.data

Check warning on line 28 in protocol-designer/src/load-file/migration/8_5_0.ts

Codecov / codecov/patch

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

Added line #L28 was not covered by tests

const loadLabwareCommands = commands.filter(
(command): command is LoadLabwareCreateCommand =>
@@ -217,26 +195,6 @@
{}
)

const updatedInitialStep = Object.values(savedStepForms).reduce(
(acc, form) => {
const { id } = form
if (id === '__INITIAL_DECK_SETUP_STEP__') {
return {
...acc,
[id]: {
...form,
...getAdditionalEquipmentLocationUpdate(
commands,
robot.model,
savedStepForms
),
},
}
}
return acc
},
{}
)
return {
...appData,
metadata: {
@@ -247,11 +205,8 @@
...designerApplication,
data: {
...designerApplication.data,
ingredients: migratedIngredients,
...equipmentLoadInfoFromCommands,
savedStepForms: {
...designerApplication.data.savedStepForms,
...updatedInitialStep,
...savedStepsWithUpdatedMoveLiquidFields,
...savedStepsWithUpdatedMixFields,
},
3 changes: 3 additions & 0 deletions protocol-designer/src/load-file/migration/index.ts
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
import { migrateFile as migrateFileEightOne } from './8_1_0'
import { migrateFile as migrateFileEightTwo } from './8_2_0'
import { migrateFile as migrateFileEightTwoPointTwo } from './8_2_2'
import { migrateFile as migrateFileEightFourFour } from './8_4_4'
import { migrateFile as migrateFileEightFive } from './8_5_0'

import type {
@@ -64,6 +65,8 @@
// @ts-expect-error
'8.2.2': migrateFileEightTwoPointTwo,
// @ts-expect-error
'8.4.4': migrateFileEightFourFour,
// @ts-expect-error

Check warning on line 69 in protocol-designer/src/load-file/migration/index.ts

Codecov / codecov/patch

protocol-designer/src/load-file/migration/index.ts#L69

Added line #L69 was not covered by tests
'8.5.0': migrateFileEightFive,
}
export const migration = (
Loading
Oops, something went wrong.