fix(micromate): the call-home plan warns when it leaves THOR's observed values

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-10-22 17:47:07 -04:00
1 parent 9ecf6e6a0c
commit 0e46f3d83f
2 files changed
+42 -3

No files matched your search

+25
View File
@@ -187,3 +187,28 @@ def test_steps_cannot_be_reassigned():
plan = plan_stop_monitoring()
with pytest.raises(dataclasses.FrozenInstanceError):
plan.steps = ()
# ── warnings: where a plan leaves THOR's observed values ──────────────────────
def test_call_home_off_from_an_unobserved_start_value_carries_a_warning():
r = bytearray(_call_home_reads()[0])
r[5] = 0x01 # UM20147 reads 0x01, not THOR's 0x04/0x05
plan = plan_call_home_enabled(bytes(r), False)
assert any("unobserved" in w and "0x01 -> 0x00" in w for w in plan.warnings)
assert plan.describe()["warnings"] and plan.describe()["warnings"] == list(plan.warnings)
def test_call_home_on_when_already_on_says_it_changes_nothing():
r = next(x for x in _call_home_reads() if x[5] == 0x05)
plan = plan_call_home_enabled(r, True)
assert any("changes nothing" in w and "enabled" in w for w in plan.warnings)
@pytest.mark.parametrize("read_idx,enabled", [(0, True), (1, False)])
def test_thors_own_call_home_writes_carry_no_unobserved_warning(read_idx, enabled):
r = _call_home_reads()[read_idx]
plan = plan_call_home_enabled(r, enabled)
assert not any("unobserved" in w for w in plan.warnings)
assert plan.warnings == ()
assert plan_stop_monitoring().describe()["warnings"] == []