feat(sfm): Series-4 call-home state and audited enable/disable (phase 4)
- micromate: ENABLEABLE_WRITES gains 0x7E/0x7F (the call-home write and its confirm; spec row 9, enable/disable only); MicromateClient.get_call_home_content() returns the 126-byte 0x2C content. - sfm/device_access: CallHomeState (serial, series, enabled, dial_string, detail with byte5 and the whole block); s4_call_home_state reads bit 0 of [5] and the dial string at [6:46]; s4_change_call_home runs the shared change core with micromate.writes.plan_call_home_enabled -- built from the read run_change made just before, and that same plan is the one sent. A unit calling home (run state 0x03) is refused, nothing sent. The read-back judges the edited bit only; the snapshot records both blocks and every changed offset -- [118:120] is unit-maintained and always moves. - The write-ceiling tests take 0x71 (the setup write, phase 5) as their over-the-ceiling example now that 0x7E is enableable. 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
1dd5bfa464
commit
eeb55effe9
7 files changed
+213
-13
No files matched your search
@@ -16,7 +16,7 @@ from micromate.framing import FLAGS_THOR, build_request # noqa:
|
||||
from micromate.opcodes import ENABLEABLE_WRITES, OpcodeRefused # noqa: E402
|
||||
from micromate.protocol import ACK_DATA_LEN, TimeoutError as MmTimeout, UnexpectedResponse # noqa: E402
|
||||
from micromate.writes import ( # noqa: E402
|
||||
WritePlan, WriteStep, plan_call_home_enabled, plan_start_monitoring,
|
||||
WritePlan, WriteStep, plan_start_monitoring,
|
||||
plan_stop_monitoring,
|
||||
)
|
||||
from test_micromate_protocol import frame, proto # noqa: E402
|
||||
@@ -33,8 +33,9 @@ def _ready(responses):
|
||||
return p, t
|
||||
|
||||
|
||||
def test_the_ceiling_is_start_and_stop_only():
|
||||
assert ENABLEABLE_WRITES == frozenset({0x96, 0x97})
|
||||
def test_the_ceiling_is_start_stop_and_call_home():
|
||||
# Phase 4 (2026-11-02) added the call-home write and its confirm.
|
||||
assert ENABLEABLE_WRITES == frozenset({0x96, 0x97, 0x7E, 0x7F})
|
||||
|
||||
|
||||
def test_execute_sends_exactly_the_plans_frame_and_returns_the_ack():
|
||||
@@ -53,10 +54,10 @@ def test_permission_ends_with_the_call():
|
||||
|
||||
|
||||
def test_a_plan_beyond_the_ceiling_is_refused_and_nothing_is_sent():
|
||||
content = bytes(5) + b"\x05" + bytes(120)
|
||||
# 0x71 (the setup-block write) stays above the ceiling until phase 5.
|
||||
p, t = _ready([])
|
||||
with pytest.raises(OpcodeRefused, match="ceiling"):
|
||||
p.execute(plan_call_home_enabled(content, False))
|
||||
p.execute(WritePlan("setup push", (WriteStep(0x71, 0x0000, bytes(4)),)))
|
||||
assert t.written == []
|
||||
|
||||
|
||||
@@ -110,7 +111,7 @@ def test_a_duck_typed_plan_is_refused():
|
||||
def test_a_forged_step_in_a_real_plan_is_refused_at_the_step():
|
||||
p, t = _ready([])
|
||||
plan = plan_start_monitoring()
|
||||
object.__setattr__(plan, "steps", (WriteStep(0x7E, 0),)) # subs now reads 0x7E too
|
||||
object.__setattr__(plan, "steps", (WriteStep(0x71, 0),)) # subs now reads 0x71 too
|
||||
with pytest.raises(OpcodeRefused):
|
||||
p.execute(plan)
|
||||
assert t.written == []
|
||||
@@ -121,7 +122,7 @@ def test_a_forged_step_hidden_behind_a_good_plan_is_refused():
|
||||
@property
|
||||
def subs(self):
|
||||
return frozenset({0x96})
|
||||
plan = Lying("x", (WriteStep(0x96, 0xFFFF), WriteStep(0x7E, 0)))
|
||||
plan = Lying("x", (WriteStep(0x96, 0xFFFF), WriteStep(0x71, 0)))
|
||||
p, t = _ready([ACK_START])
|
||||
with pytest.raises(OpcodeRefused):
|
||||
p.execute(plan)
|
||||
|
||||
Reference in new issue
Block a user