feat(sfm): Series-3 call-home state and audited enable/disable, live send gated until its frame is verified (phase 4)

- minimateplus.protocol: call_home_enabled(raw) reads byte 5 of the UNESCAPED
  0x2C payload (0x01 on / 0x00 off, measured 2026-04-20; anything else None --
  bench finding #1's lesson: an escaped byte before it would move the raw
  index); call_home_image(raw, enabled) is write_image's N + 2 image with byte 5
  set and everything else as read, refusing a byte 5 never measured.
- MiniMateClient.read_call_home_raw() / write_call_home_image(image) (0x7E then
  0x7F, each ack checked, never retried).
- Series3Adapter.call_home_state (wake, then 0x2C; no serial read, like status)
  and change_call_home: the shared change core with a connect() identity check,
  state 'enabled' / 'disabled' / 'unknown(0xNN)' (unknown sends nothing), the
  plan showing both exact frames, a snapshot of both unescaped images.
- S3_CALL_HOME_FRAME_VERIFIED = False: a live change is refused (501) before any
  connection until the frame is reproduced from Blastware's (next commit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-11-02 16:57:55 -05:00
1 parent eeb55effe9
commit 8612cd9df7
5 files changed
+267 -6

No files matched your search

+19 -1
View File
@@ -20,6 +20,15 @@ THOR_IDF = Path(__file__).parent / "fixtures" / "thor-idf"
THOR_WRITES = Path(__file__).parent / "fixtures" / "micromate-writes"
def s3_call_home_raw(byte5: int = 0x01) -> bytes:
"""A MiniMate's 0x2C reply payload as S3FrameParser returns it (125 B, the
num_retries 3 kept as 10 03), laid out as the 4-20-26 captures measured
(BE11529): header 00 7C DC, [5] the enable, [6:46] the dial string."""
raw = b"\x00\x7c\xdc\x00\x00" + bytes([byte5]) + b"RADIO RING".ljust(40, b"\x00")
raw += bytes(117 - len(raw)) + b"\x10\x03"
return raw + bytes(125 - len(raw))
def um12947_call_home(enabled: bool = True) -> bytes:
"""UM12947's own 126-byte call-home content, as THOR read it (0x05 on, 0x04 off)."""
ex = json.loads((THOR_WRITES / "call-home-enable-disable.json").read_text())["exchanges"]
@@ -88,13 +97,14 @@ def default_s3_events():
class FakeMiniMateClient(_Base):
def __init__(self, serial="BE18193", *, monitoring=False, compliance="default", events=None,
monitor_states=None, write_error=None, serial_reported=None, wake_errors=None,
bare_requests_ignored=False, **kw):
bare_requests_ignored=False, call_home_raw=None, **kw):
super().__init__(**kw)
self.serial = serial
# As a monitoring MiniMate (measured 2026-04-08): on a fresh connection a
# read before SESSION_RESET + POLL goes unanswered. Off unless a test asks.
self.bare_requests_ignored = bare_requests_ignored
self._woken = False
self.call_home_raw = s3_call_home_raw() if call_home_raw is None else call_home_raw
# read_serial()'s answer (connect() keeps answering `serial`), and errors
# raised by wake() once a write has gone out -- the read-back's wakes.
self.serial_reported = serial if serial_reported is None else serial_reported
@@ -147,6 +157,14 @@ class FakeMiniMateClient(_Base):
self._bare_read("read_serial")
return self.serial_reported
def read_call_home_raw(self) -> bytes:
self._bare_read("read_call_home_raw")
return self.call_home_raw
def write_call_home_image(self, image: bytes) -> None:
self._write("call_home")
self.call_home_raw = bytes(image) # read back as the unit would store it
def get_monitor_status(self) -> MonitorStatus:
self._bare_read("get_monitor_status")
state = self.monitor_states.pop(0) if len(self.monitor_states) > 1 else self.monitor_states[0]