fix(sfm): legacy Series-3 writes and erase refuse a unit that does not answer as Series 3
0xA2 is CONFIRM ERASE on a MiniMate and ends a call-home on a Micromate, and the legacy host/port routes had no identity check: only the MiniMate parser's inability to read a Micromate's replies stood between Diagnostics' Erase and a Micromate (phase 1c safeguard, agreed with Brian 2026-10-28). _require_series3(unit_serial, expected) refuses (409, 'nothing sent') unless the unit's own serial is Series 3 and, when ?serial= names one, that one: - POST /device/config (+ /config/project) and /device/events/erase: the serial connect() already reads -- no extra request; - /device/rescue (when it writes call-home or erases) and POST /device/call_home: one SUB 0x15 read (new MiniMateClient.read_serial). Exempt, with the reason in a comment: legacy monitor start/stop, blind stop, slow drip, spam -- 0x96/0x97 mean the same on both series (measured), and the rescue tools must reach a unit too wedged to answer. Tests: each guarded route refuses a unit answering UM20147 and a different BE unit with no write call, proceeds for the named unit (normalised), reuses connect()'s serial where it has one; the blind stop builds no client; read_serial decodes BE9441's recorded 0x15 reply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
1 parent
c3746a6a01
commit
1cb11abcef
3 files changed
+232
-4
No files matched your search
@@ -1212,6 +1212,11 @@ class MiniMateClient:
|
||||
log.debug("poll: startup handshake")
|
||||
proto.startup()
|
||||
|
||||
def read_serial(self) -> str:
|
||||
"""The unit's own serial (SUB 0x15), on an open, polled session. The
|
||||
cheap identity read the legacy write routes check before writing."""
|
||||
return _decode_serial_number(self._require_proto().read(SUB_SERIAL_NUMBER)).serial
|
||||
|
||||
def wake(self, attempt_s: float = 5.0, deadline_s: float = 60.0) -> None:
|
||||
"""SESSION_RESET + POLL, re-sent until the unit answers (see
|
||||
MiniMateProtocol.wake) -- for a unit that may be busy, e.g. sensor-checking
|
||||
|
||||
Reference in new issue
Block a user