Skip to content

Commit ef660be

Browse files
mjhuffrclarke0
andauthored
fix(robot-server): Harmonize error recovery camera field name (#20221)
Closes RQA-4807 To denote image capture on protocol error, the HTTP API uses the `errorRecoveryCameraEnabled` field except for `GET /camera`, in which case we use `errorRecoveryEnabled`. The JS code expects the shape of the camera settings to conform to the pattern elsewhere. To keep the HTTP API and the app consistent, let's update our one usage of `errorRecoveryEnabled` to `errorRecoveryCameraEnabled`. --------- Co-authored-by: Rhyann Clarke <[email protected]>
1 parent 02e4ce8 commit ef660be

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

api/src/opentrons/protocol_engine/execution/command_executor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ async def capture_error_image(self, running_command: Command) -> None:
248248
# Only capture photos of errors if the setting to do so is enabled
249249
if (
250250
camera_enablement.cameraEnabled
251-
and camera_enablement.errorRecoveryEnabled
251+
and camera_enablement.errorRecoveryCameraEnabled
252252
):
253253
# todo(chb, 2025-10-25): Eventually we will need to pass in client provided global settings here
254254
image_data = await self._camera_provider.capture_image(

api/src/opentrons/protocol_engine/resources/camera_provider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class CameraSettings(BaseModel):
2727
liveStreamEnabled: bool = Field(
2828
..., description="Enablement status for the Opentrons Live Stream service."
2929
)
30-
errorRecoveryEnabled: bool = Field(
30+
errorRecoveryCameraEnabled: bool = Field(
3131
..., description="Enablement status for camera usage with Error Recovery."
3232
)
3333

@@ -83,7 +83,7 @@ async def get_camera_settings(self) -> CameraSettings:
8383
return self._camera_settings_callback()
8484
# If we are in analysis or simulation, return as if the camera is enabled
8585
return CameraSettings(
86-
cameraEnabled=True, liveStreamEnabled=True, errorRecoveryEnabled=True
86+
cameraEnabled=True, liveStreamEnabled=True, errorRecoveryCameraEnabled=True
8787
)
8888

8989
async def capture_image(

api/tests/opentrons/protocol_engine/commands/test_capture_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ async def test_raises_camera_disabled_error(
136136
CameraSettings(
137137
cameraEnabled=False,
138138
liveStreamEnabled=False,
139-
errorRecoveryEnabled=False,
139+
errorRecoveryCameraEnabled=False,
140140
)
141141
)
142142

api/tests/opentrons/protocol_engine/execution/test_command_executor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ class _TestCommand(
566566
CameraSettings(
567567
cameraEnabled=True,
568568
liveStreamEnabled=True,
569-
errorRecoveryEnabled=True,
569+
errorRecoveryCameraEnabled=True,
570570
)
571571
)
572572

@@ -743,7 +743,7 @@ class _TestCommand(
743743
CameraSettings(
744744
cameraEnabled=True,
745745
liveStreamEnabled=True,
746-
errorRecoveryEnabled=True,
746+
errorRecoveryCameraEnabled=True,
747747
)
748748
)
749749

api/tests/opentrons/protocol_engine/test_protocol_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ def test_add_camera_settings(
13281328
) -> None:
13291329
"""It should dispatch an AddCameraSettingsAction action."""
13301330
settings = CameraSettings(
1331-
cameraEnabled=True, liveStreamEnabled=True, errorRecoveryEnabled=True
1331+
cameraEnabled=True, liveStreamEnabled=True, errorRecoveryCameraEnabled=True
13321332
)
13331333
decoy.when(subject.state_view.camera.get_enablement_settings()).then_return(
13341334
settings

robot-server/robot_server/camera/provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def get_camera_settings(self) -> CameraSettings:
3535
return CameraSettings(
3636
cameraEnabled=self._camera_settings_store.get_camera_enabled(),
3737
liveStreamEnabled=self._camera_settings_store.get_live_stream_enabled(),
38-
errorRecoveryEnabled=self._camera_settings_store.get_error_recovery_camera_enabled(),
38+
errorRecoveryCameraEnabled=self._camera_settings_store.get_error_recovery_camera_enabled(),
3939
)
4040

4141
async def process_image_capture(

robot-server/robot_server/runs/router/camera_router.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async def add_camera_settings(
8686
liveStreamEnabled=request_body.data.liveStreamEnabled
8787
if request_body.data.liveStreamEnabled is not None
8888
else False,
89-
errorRecoveryEnabled=request_body.data.errorRecoveryCameraEnabled
89+
errorRecoveryCameraEnabled=request_body.data.errorRecoveryCameraEnabled
9090
if request_body.data.errorRecoveryCameraEnabled is not None
9191
else False,
9292
)
@@ -111,7 +111,7 @@ async def add_camera_settings(
111111
data=CameraEnable(
112112
cameraEnabled=response_data.cameraEnabled,
113113
liveStreamEnabled=response_data.liveStreamEnabled,
114-
errorRecoveryCameraEnabled=response_data.errorRecoveryEnabled,
114+
errorRecoveryCameraEnabled=response_data.errorRecoveryCameraEnabled,
115115
)
116116
),
117117
status_code=status.HTTP_201_CREATED,

0 commit comments

Comments
 (0)