The simulator refuses a channel slot the way the companion does

MockDevice raised DeviceCommandError for an index past its last slot.
The slot probe reads that error as a read that failed, not as the
firmware's "no such slot", so a probe on the simulator never finished.
The session never cached the slots under --mock, and anything that
insists on a complete read could not run there. The simulator now raises
the same RuntimeError that the companion's _ok raises for
ERR_CODE_NOT_FOUND, and the probe ends cleanly.

Refs: #25
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Opus 5.5 committed 2026-10-07 01:15:58 -04:00
1 parent 8cc111b2e8
commit eb55b51a12
1 file changed
+5 -1
+5 -1
View File
@@ -5295,7 +5295,11 @@ class MockDevice(Device):
async def get_channel(self, index: int) -> dict | None: # noqa: D102
if index >= self._max_channels:
raise DeviceCommandError(f"channel index {index} out of range")
# The same error that the real companion raises for the firmware's "no such
# slot" (``_ok`` on ``ERR_CODE_NOT_FOUND``). The slot probe reads it as the end
# of the slots. A DeviceCommandError here was a failed read to the probe, so a
# probe on the simulator was never complete, and the session never cached it.
raise RuntimeError(f"device rejected the command: channel index {index} out of range")
return self._channels.get(index)
async def set_name(self, name: str) -> None: # noqa: D102 - inherited docstring