feat(s4): change a Micromate's settings by serial, audited, schedule-checked

s4_change_settings runs the shared change core with a read-back verdict
for its state (as asked / unchanged / differs).  It reads the active
setup's name (unstripped), the preferences, trigger and setup blocks and
the schedule; patches the setup through micromate.setup_fields; sends
THOR's setup push (0xDA 68 73 82 83 71 72, now enableable) once; reads
the setup back.  Refused before sending: a monitoring unit, a value the
unit does not allow (422), a stale preview (SettingsChanged, 409), and --
shown as 'blocked' in the preview -- the factory setup, a schedule that
loads another setup, an unreadable schedule, or a block SFM has not seen
(ChangeRefused, 409).  s4_settings carries the editable fields.

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 21:43:03 -05:00
1 parent d0335dbbbd
commit c082f72d62
9 files changed
+407 -16

No files matched your search

+9 -7
View File
@@ -33,9 +33,11 @@ def _ready(responses):
return p, t
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_the_ceiling_is_start_stop_call_home_and_the_setup_push():
# Phase 4 (2026-11-02) added the call-home write and its confirm; phase 5
# (2026-11-03) the setup push: name, preferences, trigger, setup, confirms.
assert ENABLEABLE_WRITES == frozenset({0x96, 0x97, 0x7E, 0x7F,
0xDA, 0x68, 0x73, 0x82, 0x83, 0x71, 0x72})
def test_execute_sends_exactly_the_plans_frame_and_returns_the_ack():
@@ -54,10 +56,10 @@ def test_permission_ends_with_the_call():
def test_a_plan_beyond_the_ceiling_is_refused_and_nothing_is_sent():
# 0x71 (the setup-block write) stays above the ceiling until phase 5.
# 0xA8 (delete one event) stays above the ceiling (0x71 joined it in phase 5).
p, t = _ready([])
with pytest.raises(OpcodeRefused, match="ceiling"):
p.execute(WritePlan("setup push", (WriteStep(0x71, 0x0000, bytes(4)),)))
p.execute(WritePlan("delete", (WriteStep(0xA8, 0x0000, bytes(4)),)))
assert t.written == []
@@ -111,7 +113,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(0x71, 0),)) # subs now reads 0x71 too
object.__setattr__(plan, "steps", (WriteStep(0xA8, 0),)) # subs now reads 0xA8 too
with pytest.raises(OpcodeRefused):
p.execute(plan)
assert t.written == []
@@ -122,7 +124,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(0x71, 0)))
plan = Lying("x", (WriteStep(0x96, 0xFFFF), WriteStep(0xA8, 0)))
p, t = _ready([ACK_START])
with pytest.raises(OpcodeRefused):
p.execute(plan)