fix: bench follow-ups -- the setup-menu warning, observed call-home values, waveform read
From the 2026-11-04 bench: - A MiniMate settings preview warns that a change is lost if someone is in the unit's setup menu: a write sent with the menu open was acknowledged and read back, then lost on Cancel or Save -- the menu writes its own copy of the whole block back (measured both ways on BE9441). - The two bytes after the MiniMate settings block went out as 00 00 and the unit took them; the preview note says so instead of 'unmeasured'. - A Micromate call-home plan no longer warns about 0x00 / 0x01: UM20147 took both, each way, on 11-03 and 11-04, matching its menu. - read_waveform_data_raw drops the escaped-checksum's stray 0x10, as the settings read does (it failed closed: the write's block check refused 203 bytes). 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
55c7b7b5ae
commit
c790e20116
6 files changed
+68
-10
No files matched your search
@@ -231,3 +231,11 @@ def test_push_config_raw_writes_a_logical_block_with_a_literal_escape_byte_intac
|
||||
c.push_config_raw(b["event_index"], block, b["trigger"], b["waveform"])
|
||||
sent = b"".join(_payload(f)[16:] for f in t.sent if _payload(f)[2] == 0x71)
|
||||
assert sent == block + b"\x00\x00"
|
||||
|
||||
|
||||
# Bench 2026-11-04 (BE9441): a write sent while the unit's setup menu was open was
|
||||
# acknowledged and read back -- and then lost when the operator pressed Cancel or
|
||||
# Save: the menu writes its own copy of the WHOLE block back. The preview says so.
|
||||
def test_the_preview_warns_that_an_open_setup_menu_loses_the_change():
|
||||
r = change(FakeMiniMateClient(), {"geo_trigger_ips": 0.05}, dry_run=True)
|
||||
assert any("setup menu" in w and "lost" in w for w in r.plan["warnings"])
|
||||
@@ -193,12 +193,22 @@ def test_steps_cannot_be_reassigned():
|
||||
|
||||
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
|
||||
r[5] = 0x03 # a value no unit has been seen holding
|
||||
plan = plan_call_home_enabled(bytes(r), False)
|
||||
assert any("unobserved" in w and "0x01 -> 0x00" in w for w in plan.warnings)
|
||||
assert any("unobserved" in w and "0x03 -> 0x02" in w for w in plan.warnings)
|
||||
assert plan.describe()["warnings"] and plan.describe()["warnings"] == list(plan.warnings)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("start,enabled", [(0x01, False), (0x00, True)])
|
||||
def test_um20147s_values_are_observed_since_the_bench(start, enabled):
|
||||
# Bench 2026-11-03 (UM20147): 0x01 -> 0x00 and 0x00 -> 0x01 both acknowledged, read
|
||||
# back, and matched in the unit's own menu (and again 2026-11-04).
|
||||
r = bytearray(_call_home_reads()[0])
|
||||
r[5] = start
|
||||
plan = plan_call_home_enabled(bytes(r), enabled)
|
||||
assert not any("unobserved" in w for w in 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)
|
||||
|
||||
@@ -121,3 +121,31 @@ def test_a_leftover_that_is_not_the_stray_escape_is_not_trimmed():
|
||||
sfm_read = READS[8]
|
||||
odd = [sfm_read[0] + b"\x55", sfm_read[1], sfm_read[2]]
|
||||
assert not is_compliance_content(assemble_compliance_content(odd, lengths=(1024, 1024, 42)))
|
||||
|
||||
|
||||
# The same artifact on the waveform-data read a settings write echoes back: it asks
|
||||
# for 0xCA = 202 bytes; one extra trailing 0x10 is the escaped checksum's DLE.
|
||||
# (Unfixed, it fails closed: the write's own block check refuses 203 bytes.)
|
||||
class _Replies:
|
||||
def __init__(self, data):
|
||||
self._data = data
|
||||
self.sent = []
|
||||
|
||||
def __call__(self, frame):
|
||||
self.sent.append(frame)
|
||||
|
||||
|
||||
def _waveform_proto(data_reply: bytes):
|
||||
from types import SimpleNamespace
|
||||
p = mp.MiniMateProtocol(object())
|
||||
p._send = _Replies(None)
|
||||
replies = [SimpleNamespace(data=bytes(11)), SimpleNamespace(data=bytes(11) + data_reply)]
|
||||
p._recv_one = lambda expected_sub=None, **kw: replies.pop(0)
|
||||
return p
|
||||
|
||||
|
||||
def test_the_waveform_read_drops_an_escaped_checksums_stray_byte():
|
||||
block = (200).to_bytes(2, "big") + bytes(range(198)) + b"\x17\x17" # N = 200, plus its 2 tail bytes
|
||||
assert _waveform_proto(block).read_waveform_data_raw() == block
|
||||
assert _waveform_proto(block + b"\x10").read_waveform_data_raw() == block
|
||||
assert _waveform_proto(block + b"\x55").read_waveform_data_raw() == block + b"\x55" # anything else is kept
|
||||
Reference in new issue
Block a user