fix(sfm): a monitoring MiniMate's call-home says 'stop monitoring first', not 'unknown(0x6E)'

Measured at the bench 2026-11-03 (BE9441): while monitoring, a MiniMate answers
the 0x2C call-home read with its DEVICE-INFO block ('Instantel', 'MiniMate Plus',
its serial) -- as it answers 1A -- and idle again, minutes later, the call-home
block.  SFM writes back only a block it just read, so a monitoring MiniMate's
call-home cannot be changed; the change core already refused (byte 5 read as
'unknown(0x6E)', nothing sent), but said so cryptically.

- minimateplus.protocol.is_call_home_block(raw): the block starts with its own
  length 0x7C and is N (or N + 2) bytes unescaped; the device-info block fails it.
- The Series-3 change raises UnitStateUnknown (409) with 'did not return its
  call-home settings -- a MiniMate answers the call-home read with its
  device-info block while monitoring; stop monitoring first ... nothing sent',
  for a dry run too.  call_home_state returns enabled = None with that reason.
- The page's callHomeRows shows the reason in place of 'Unknown (byte 5 = ...)'.

A blind write while monitoring stays untested on purpose.

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-03 14:19:19 -05:00
1 parent 9820a5389f
commit 5326e99ac2
5 files changed
+71 -6

No files matched your search

+34
View File
@@ -145,3 +145,37 @@ def test_a_pre_wire_refusal_is_recorded_as_nothing_sent():
((_, row),) = audit.rows.items()
assert (row["outcome"], row["sent"]) == ("failed", 0)
assert row["error"].startswith("refused before sending")
# Measured 2026-11-03 (BE9441): while monitoring, a MiniMate answers the 0x2C read
# with its DEVICE-INFO block ("Instantel", "MiniMate Plus", its serial), not its
# call-home block -- as it answers 1A. Idle again, it returns the call-home block.
# SFM says so plainly instead of "run state unknown(0x6E)".
def device_info_shaped(serial=b"BE9441"):
"""Shaped like BE9441's reply (its first bytes: 00 00 00 08 'Instantel')."""
block = b"\x00\x00\x00\x08Instantel".ljust(26, b"\x00") + b"MiniMate Plus".ljust(16, b"\x00") + serial
return block.ljust(126, b"\x00")
def test_a_call_home_block_is_told_from_the_device_info_block():
from minimateplus.protocol import is_call_home_block
assert is_call_home_block(s3_call_home_raw()) is True
assert is_call_home_block(device_info_shaped()) is False
@pytest.mark.parametrize("dry_run", [True, False])
def test_a_monitoring_minimate_is_told_to_stop_first_and_nothing_is_sent(dry_run):
fake = FakeMiniMateClient(call_home_raw=device_info_shaped())
with pytest.raises(UnitStateUnknown) as e:
change(adapter(fake), enabled=True, dry_run=dry_run)
msg = str(e.value)
assert "monitoring" in msg and "stop" in msg and "nothing sent" in msg
assert e.value.http_status == 409 and fake.writes == []
def test_the_call_home_state_of_a_monitoring_minimate_says_why():
st = adapter(FakeMiniMateClient(call_home_raw=device_info_shaped())).call_home_state(TCP, "BE18193")
assert st.enabled is None
assert "monitoring" in st.detail["reason"]
+7
View File
@@ -327,3 +327,10 @@ def test_call_home_rows():
assert r[0] == [["Call-home", "On"], ["Dial string", "RADIO RING"], ["Series", 4]]
assert r[1] == [["Call-home", "Off"], ["Dial string", "—"], ["Series", 3]]
assert r[2][0] == ["Call-home", "Unknown (byte 5 = 0x07)"]
def test_call_home_rows_say_why_a_switch_did_not_read():
r = run(["callHomeRows", [{"enabled": None, "dial_string": None, "series": 3,
"detail": {"byte5": "0x6E", "reason": "not readable while monitoring -- stop it first"}}]])
assert r[0][0] == ["Call-home", "not readable while monitoring -- stop it first"]