diff --git a/api/src/opentrons/protocol_engine/commands/__init__.py b/api/src/opentrons/protocol_engine/commands/__init__.py index b8ad7ab0b57..3be0917b835 100644 --- a/api/src/opentrons/protocol_engine/commands/__init__.py +++ b/api/src/opentrons/protocol_engine/commands/__init__.py @@ -153,7 +153,6 @@ LoadPipetteCreate, LoadPipetteResult, LoadPipetteCommandType, - LoadPipettePrivateResult, ) from .move_labware import ( diff --git a/api/src/opentrons/protocol_engine/commands/command_unions.py b/api/src/opentrons/protocol_engine/commands/command_unions.py index 7623cc09f68..c86724c1124 100644 --- a/api/src/opentrons/protocol_engine/commands/command_unions.py +++ b/api/src/opentrons/protocol_engine/commands/command_unions.py @@ -1,7 +1,7 @@ """Union types of concrete command definitions.""" from collections.abc import Collection -from typing import Annotated, Type, Union, get_type_hints +from typing import Annotated, Literal, Type, Union, get_type_hints from pydantic import Field @@ -141,7 +141,6 @@ LoadPipetteCreate, LoadPipetteResult, LoadPipetteCommandType, - LoadPipettePrivateResult, ) from .move_labware import ( @@ -272,7 +271,6 @@ ConfigureForVolumeCreate, ConfigureForVolumeResult, ConfigureForVolumeCommandType, - ConfigureForVolumePrivateResult, ) from .prepare_to_aspirate import ( @@ -701,15 +699,9 @@ unsafe.UnsafeUngripLabwareResult, ] -# todo(mm, 2024-06-12): Ideally, command return types would have specific -# CommandPrivateResults paired with specific CommandResults. For example, -# a TouchTipResult can never be paired with a LoadPipettePrivateResult in practice, -# and ideally our types would reflect that. -CommandPrivateResult = Union[ - None, - LoadPipettePrivateResult, - ConfigureForVolumePrivateResult, -] +# todo(mm, 2024-10-28): This has been obsoleted by StateUpdate. Delete this. +# https://opentrons.atlassian.net/browse/EXEC-639 +CommandPrivateResult = Literal[None] # All `DefinedErrorData`s that implementations will actually return in practice. CommandDefinedErrorData = Union[ diff --git a/api/src/opentrons/protocol_engine/commands/configure_for_volume.py b/api/src/opentrons/protocol_engine/commands/configure_for_volume.py index 93a56ca8805..f4caee72c7f 100644 --- a/api/src/opentrons/protocol_engine/commands/configure_for_volume.py +++ b/api/src/opentrons/protocol_engine/commands/configure_for_volume.py @@ -7,7 +7,6 @@ from .pipetting_common import PipetteIdMixin from .command import AbstractCommandImpl, BaseCommand, BaseCommandCreate, SuccessData from ..errors.error_occurrence import ErrorOccurrence -from .configuring_common import PipetteConfigUpdateResultMixin from ..state.update_types import StateUpdate if TYPE_CHECKING: @@ -35,12 +34,6 @@ class ConfigureForVolumeParams(PipetteIdMixin): ) -class ConfigureForVolumePrivateResult(PipetteConfigUpdateResultMixin): - """Result sent to the store but not serialized.""" - - pass - - class ConfigureForVolumeResult(BaseModel): """Result data from execution of an ConfigureForVolume command.""" @@ -50,7 +43,7 @@ class ConfigureForVolumeResult(BaseModel): class ConfigureForVolumeImplementation( AbstractCommandImpl[ ConfigureForVolumeParams, - SuccessData[ConfigureForVolumeResult, ConfigureForVolumePrivateResult], + SuccessData[ConfigureForVolumeResult, None], ] ): """Configure for volume command implementation.""" @@ -60,7 +53,7 @@ def __init__(self, equipment: EquipmentHandler, **kwargs: object) -> None: async def execute( self, params: ConfigureForVolumeParams - ) -> SuccessData[ConfigureForVolumeResult, ConfigureForVolumePrivateResult]: + ) -> SuccessData[ConfigureForVolumeResult, None]: """Check that requested pipette can be configured for the given volume.""" pipette_result = await self._equipment.configure_for_volume( pipette_id=params.pipetteId, @@ -77,11 +70,7 @@ async def execute( return SuccessData( public=ConfigureForVolumeResult(), - private=ConfigureForVolumePrivateResult( - pipette_id=pipette_result.pipette_id, - serial_number=pipette_result.serial_number, - config=pipette_result.static_config, - ), + private=None, state_update=state_update, ) diff --git a/api/src/opentrons/protocol_engine/commands/configuring_common.py b/api/src/opentrons/protocol_engine/commands/configuring_common.py deleted file mode 100644 index f69cf41fef6..00000000000 --- a/api/src/opentrons/protocol_engine/commands/configuring_common.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Common configuration command base models.""" - -from dataclasses import dataclass -from ..resources import pipette_data_provider - - -@dataclass -class PipetteConfigUpdateResultMixin: - """A mixin-suitable model for adding pipette config to private results.""" - - pipette_id: str - serial_number: str - config: pipette_data_provider.LoadedStaticPipetteData diff --git a/api/src/opentrons/protocol_engine/commands/load_pipette.py b/api/src/opentrons/protocol_engine/commands/load_pipette.py index 5961272ae7c..3d9bdd83050 100644 --- a/api/src/opentrons/protocol_engine/commands/load_pipette.py +++ b/api/src/opentrons/protocol_engine/commands/load_pipette.py @@ -17,7 +17,6 @@ from .command import AbstractCommandImpl, BaseCommand, BaseCommandCreate, SuccessData from ..errors.error_occurrence import ErrorOccurrence -from .configuring_common import PipetteConfigUpdateResultMixin from ..errors import InvalidSpecificationForRobotTypeError, InvalidLoadPipetteSpecsError if TYPE_CHECKING: @@ -28,12 +27,6 @@ LoadPipetteCommandType = Literal["loadPipette"] -class LoadPipettePrivateResult(PipetteConfigUpdateResultMixin): - """The not-to-be-exposed results of a load pipette call.""" - - ... - - class LoadPipetteParams(BaseModel): """Payload needed to load a pipette on to a mount.""" @@ -73,9 +66,7 @@ class LoadPipetteResult(BaseModel): class LoadPipetteImplementation( - AbstractCommandImpl[ - LoadPipetteParams, SuccessData[LoadPipetteResult, LoadPipettePrivateResult] - ] + AbstractCommandImpl[LoadPipetteParams, SuccessData[LoadPipetteResult, None]] ): """Load pipette command implementation.""" @@ -87,7 +78,7 @@ def __init__( async def execute( self, params: LoadPipetteParams - ) -> SuccessData[LoadPipetteResult, LoadPipettePrivateResult]: + ) -> SuccessData[LoadPipetteResult, None]: """Check that requested pipette is attached and assign its identifier.""" pipette_generation = convert_to_pipette_name_type( params.pipetteName.value @@ -139,11 +130,7 @@ async def execute( return SuccessData( public=LoadPipetteResult(pipetteId=loaded_pipette.pipette_id), - private=LoadPipettePrivateResult( - pipette_id=loaded_pipette.pipette_id, - serial_number=loaded_pipette.serial_number, - config=loaded_pipette.static_config, - ), + private=None, state_update=state_update, ) diff --git a/api/src/opentrons/protocol_engine/state/tips.py b/api/src/opentrons/protocol_engine/state/tips.py index 7427c78ac4c..a6d31714b3f 100644 --- a/api/src/opentrons/protocol_engine/state/tips.py +++ b/api/src/opentrons/protocol_engine/state/tips.py @@ -11,7 +11,6 @@ Command, LoadLabwareResult, ) -from ..commands.configuring_common import PipetteConfigUpdateResultMixin from opentrons.hardware_control.nozzle_manager import NozzleMap @@ -67,15 +66,6 @@ def handle_action(self, action: Action) -> None: self._handle_state_update(state_update) if isinstance(action, SucceedCommandAction): - if isinstance(action.private_result, PipetteConfigUpdateResultMixin): - pipette_id = action.private_result.pipette_id - config = action.private_result.config - self._state.pipette_info_by_pipette_id[pipette_id] = _PipetteInfo( - channels=config.channels, - active_channels=config.channels, - nozzle_map=config.nozzle_map, - ) - self._handle_succeeded_command(action.command) elif isinstance(action, ResetTipsAction): @@ -103,6 +93,15 @@ def _handle_succeeded_command(self, command: Command) -> None: ] def _handle_state_update(self, state_update: update_types.StateUpdate) -> None: + if state_update.pipette_config != update_types.NO_CHANGE: + self._state.pipette_info_by_pipette_id[ + state_update.pipette_config.pipette_id + ] = _PipetteInfo( + channels=state_update.pipette_config.config.channels, + active_channels=state_update.pipette_config.config.channels, + nozzle_map=state_update.pipette_config.config.nozzle_map, + ) + if state_update.tips_used != update_types.NO_CHANGE: self._set_used_tips( pipette_id=state_update.tips_used.pipette_id, diff --git a/api/src/opentrons/protocol_runner/legacy_command_mapper.py b/api/src/opentrons/protocol_runner/legacy_command_mapper.py index 686560c1ca2..2a1ef28a359 100644 --- a/api/src/opentrons/protocol_runner/legacy_command_mapper.py +++ b/api/src/opentrons/protocol_runner/legacy_command_mapper.py @@ -731,7 +731,14 @@ def _map_instrument_load( result=pe_commands.LoadPipetteResult.construct(pipetteId=pipette_id), ) serial = instrument_load_info.pipette_dict.get("pipette_id", None) or "" - pipette_config_result = pe_commands.LoadPipettePrivateResult( + state_update = StateUpdate() + state_update.set_load_pipette( + pipette_id=pipette_id, + mount=succeeded_command.params.mount, + pipette_name=succeeded_command.params.pipetteName, + liquid_presence_detection=succeeded_command.params.liquidPresenceDetection, + ) + state_update.update_pipette_config( pipette_id=pipette_id, serial_number=serial, config=pipette_data_provider.get_pipette_static_config( @@ -754,16 +761,10 @@ def _map_instrument_load( # We just set this above, so we know it's not None. started_at=succeeded_command.startedAt, # type: ignore[arg-type] ) - state_update = StateUpdate() - state_update.set_load_pipette( - pipette_id=pipette_id, - mount=succeeded_command.params.mount, - pipette_name=succeeded_command.params.pipetteName, - liquid_presence_detection=succeeded_command.params.liquidPresenceDetection, - ) + succeed_action = pe_actions.SucceedCommandAction( command=succeeded_command, - private_result=pipette_config_result, + private_result=None, state_update=state_update, ) diff --git a/api/tests/opentrons/protocol_engine/commands/test_configure_for_volume.py b/api/tests/opentrons/protocol_engine/commands/test_configure_for_volume.py index 2279f2a0ebf..59e65ede181 100644 --- a/api/tests/opentrons/protocol_engine/commands/test_configure_for_volume.py +++ b/api/tests/opentrons/protocol_engine/commands/test_configure_for_volume.py @@ -19,7 +19,6 @@ from opentrons.protocol_engine.commands.configure_for_volume import ( ConfigureForVolumeParams, ConfigureForVolumeResult, - ConfigureForVolumePrivateResult, ConfigureForVolumeImplementation, ) from opentrons_shared_data.pipette.types import PipetteNameType @@ -85,9 +84,7 @@ async def test_configure_for_volume_implementation( assert result == SuccessData( public=ConfigureForVolumeResult(), - private=ConfigureForVolumePrivateResult( - pipette_id="pipette-id", serial_number="some number", config=config - ), + private=None, state_update=StateUpdate( pipette_config=PipetteConfigUpdate( pipette_id="pipette-id", serial_number="some number", config=config diff --git a/api/tests/opentrons/protocol_engine/commands/test_load_pipette.py b/api/tests/opentrons/protocol_engine/commands/test_load_pipette.py index 5884e015342..4d757f49a54 100644 --- a/api/tests/opentrons/protocol_engine/commands/test_load_pipette.py +++ b/api/tests/opentrons/protocol_engine/commands/test_load_pipette.py @@ -22,7 +22,6 @@ from opentrons.protocol_engine.commands.load_pipette import ( LoadPipetteParams, LoadPipetteResult, - LoadPipettePrivateResult, LoadPipetteImplementation, ) from ..pipette_fixtures import get_default_nozzle_map @@ -90,9 +89,7 @@ async def test_load_pipette_implementation( assert result == SuccessData( public=LoadPipetteResult(pipetteId="some id"), - private=LoadPipettePrivateResult( - pipette_id="some id", serial_number="some-serial-number", config=config_data - ), + private=None, state_update=StateUpdate( loaded_pipette=LoadPipetteUpdate( pipette_name=PipetteNameType.P300_SINGLE, @@ -158,9 +155,7 @@ async def test_load_pipette_implementation_96_channel( assert result == SuccessData( public=LoadPipetteResult(pipetteId="pipette-id"), - private=LoadPipettePrivateResult( - pipette_id="pipette-id", serial_number="some id", config=config_data - ), + private=None, state_update=StateUpdate( loaded_pipette=LoadPipetteUpdate( pipette_name=PipetteNameType.P1000_96, diff --git a/api/tests/opentrons/protocol_engine/state/test_pipette_store.py b/api/tests/opentrons/protocol_engine/state/test_pipette_store.py index caab429e26b..10ae35e5f4a 100644 --- a/api/tests/opentrons/protocol_engine/state/test_pipette_store.py +++ b/api/tests/opentrons/protocol_engine/state/test_pipette_store.py @@ -638,13 +638,10 @@ def test_add_pipette_config( pipette_lld_settings={}, ) - private_result = cmd.LoadPipettePrivateResult( - pipette_id="pipette-id", serial_number="pipette-serial", config=config - ) subject.handle_action( SucceedCommandAction( command=command, - private_result=private_result, + private_result=None, state_update=update_types.StateUpdate( pipette_config=update_types.PipetteConfigUpdate( pipette_id="pipette-id", diff --git a/api/tests/opentrons/protocol_engine/state/test_tip_state.py b/api/tests/opentrons/protocol_engine/state/test_tip_state.py index e0f0fd15669..72ba21fcfa1 100644 --- a/api/tests/opentrons/protocol_engine/state/test_tip_state.py +++ b/api/tests/opentrons/protocol_engine/state/test_tip_state.py @@ -94,7 +94,7 @@ def test_get_next_tip_returns_none( load_pipette_command = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id") ) - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -120,7 +120,9 @@ def test_get_next_tip_returns_none( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) @@ -155,7 +157,7 @@ def test_get_next_tip_returns_first_tip( pipette_name_type = PipetteNameType.P300_MULTI_GEN2 else: pipette_name_type = PipetteNameType.P1000_96 - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -181,7 +183,9 @@ def test_get_next_tip_returns_first_tip( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) @@ -210,7 +214,7 @@ def test_get_next_tip_used_starting_tip( load_pipette_command = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id") ) - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -236,7 +240,9 @@ def test_get_next_tip_used_starting_tip( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) @@ -299,7 +305,7 @@ def test_get_next_tip_skips_picked_up_tip( pipette_name_type = PipetteNameType.P300_MULTI_GEN2 else: pipette_name_type = PipetteNameType.P1000_96 - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -325,7 +331,9 @@ def test_get_next_tip_skips_picked_up_tip( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) @@ -348,7 +356,7 @@ def test_get_next_tip_skips_picked_up_tip( labware_id="cool-labware", num_tips=get_next_tip_tips, starting_tip_name=input_starting_tip, - nozzle_map=load_pipette_private_result.config.nozzle_map, + nozzle_map=config_update.config.nozzle_map, ) assert result == result_well_name @@ -366,7 +374,7 @@ def test_get_next_tip_with_starting_tip( load_pipette_command = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id") ) - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -392,14 +400,16 @@ def test_get_next_tip_with_starting_tip( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) result = TipView(subject.state).get_next_tip( labware_id="cool-labware", num_tips=1, starting_tip_name="B2", - nozzle_map=load_pipette_private_result.config.nozzle_map, + nozzle_map=config_update.config.nozzle_map, ) assert result == "B2" @@ -419,7 +429,7 @@ def test_get_next_tip_with_starting_tip( labware_id="cool-labware", num_tips=1, starting_tip_name="B2", - nozzle_map=load_pipette_private_result.config.nozzle_map, + nozzle_map=config_update.config.nozzle_map, ) assert result == "C2" @@ -437,7 +447,7 @@ def test_get_next_tip_with_starting_tip_8_channel( load_pipette_command = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id") ) - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -463,7 +473,9 @@ def test_get_next_tip_with_starting_tip_8_channel( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) @@ -511,7 +523,7 @@ def test_get_next_tip_with_1_channel_followed_by_8_channel( load_pipette_command = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id") ) - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -537,13 +549,15 @@ def test_get_next_tip_with_1_channel_followed_by_8_channel( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) load_pipette_command_2 = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id2") ) - load_pipette_private_result_2 = commands.LoadPipettePrivateResult( + config_update_2 = update_types.PipetteConfigUpdate( pipette_id="pipette-id2", serial_number="pipette-serial2", config=LoadedStaticPipetteData( @@ -569,7 +583,9 @@ def test_get_next_tip_with_1_channel_followed_by_8_channel( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result_2, command=load_pipette_command_2 + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update_2), + command=load_pipette_command_2, ) ) @@ -617,7 +633,7 @@ def test_get_next_tip_with_starting_tip_out_of_tips( load_pipette_command = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id") ) - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -643,7 +659,9 @@ def test_get_next_tip_with_starting_tip_out_of_tips( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) @@ -691,7 +709,7 @@ def test_get_next_tip_with_column_and_starting_tip( load_pipette_command = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id") ) - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -717,7 +735,9 @@ def test_get_next_tip_with_column_and_starting_tip( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) @@ -743,7 +763,7 @@ def test_reset_tips( load_pipette_command = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id") ) - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -770,7 +790,9 @@ def test_reset_tips( subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) @@ -808,7 +830,7 @@ def test_handle_pipette_config_action( load_pipette_command = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id") ) - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -834,7 +856,9 @@ def test_handle_pipette_config_action( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) @@ -947,7 +971,7 @@ def test_active_channels( load_pipette_command = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id") ) - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -973,7 +997,9 @@ def test_active_channels( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) @@ -1012,7 +1038,7 @@ def test_next_tip_uses_active_channels( load_pipette_command = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id") ) - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -1038,7 +1064,9 @@ def test_next_tip_uses_active_channels( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) @@ -1116,7 +1144,7 @@ def test_next_tip_automatic_tip_tracking_with_partial_configurations( load_pipette_command = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id") ) - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -1142,7 +1170,9 @@ def test_next_tip_automatic_tip_tracking_with_partial_configurations( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) @@ -1274,7 +1304,7 @@ def test_next_tip_automatic_tip_tracking_tiprack_limits( load_pipette_command = commands.LoadPipette.construct( # type: ignore[call-arg] result=commands.LoadPipetteResult(pipetteId="pipette-id") ) - load_pipette_private_result = commands.LoadPipettePrivateResult( + config_update = update_types.PipetteConfigUpdate( pipette_id="pipette-id", serial_number="pipette-serial", config=LoadedStaticPipetteData( @@ -1300,7 +1330,9 @@ def test_next_tip_automatic_tip_tracking_tiprack_limits( ) subject.handle_action( actions.SucceedCommandAction( - private_result=load_pipette_private_result, command=load_pipette_command + private_result=None, + state_update=update_types.StateUpdate(pipette_config=config_update), + command=load_pipette_command, ) ) diff --git a/api/tests/opentrons/protocol_runner/test_legacy_command_mapper.py b/api/tests/opentrons/protocol_runner/test_legacy_command_mapper.py index 8663c3e0a8d..c31c6a2e551 100644 --- a/api/tests/opentrons/protocol_runner/test_legacy_command_mapper.py +++ b/api/tests/opentrons/protocol_runner/test_legacy_command_mapper.py @@ -6,6 +6,7 @@ from opentrons.protocol_engine.state.update_types import ( LoadPipetteUpdate, LoadedLabwareUpdate, + PipetteConfigUpdate, StateUpdate, ) import pytest @@ -380,16 +381,19 @@ def test_map_instrument_load(decoy: Decoy) -> None: result=pe_commands.LoadPipetteResult(pipetteId="pipette-0"), notes=[], ), - private_result=pe_commands.LoadPipettePrivateResult( - pipette_id="pipette-0", serial_number="fizzbuzz", config=pipette_config - ), + private_result=None, state_update=StateUpdate( loaded_pipette=LoadPipetteUpdate( pipette_id="pipette-0", mount=expected_params.mount, pipette_name=expected_params.pipetteName, liquid_presence_detection=expected_params.liquidPresenceDetection, - ) + ), + pipette_config=PipetteConfigUpdate( + pipette_id="pipette-0", + serial_number="fizzbuzz", + config=pipette_config, + ), ), )