From eb55b51a12adbe327d8596b3f64ebe92205b3057 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Martineau Date: Wed, 7 Oct 2026 01:15:58 -0400 Subject: [PATCH] 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) --- meshterm/core/connection.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meshterm/core/connection.py b/meshterm/core/connection.py index b27fdef..6cf11d9 100644 --- a/meshterm/core/connection.py +++ b/meshterm/core/connection.py @@ -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