Release v0.34.0 — Series-4 parity, and most of Blastware's report from the event file alone #59

Merged
serversdown merged 245 commits from dev into main 2026-11-04 18:19:24 -05:00
6 changed files with 68 additions and 10 deletions
Showing only changes of commit c790e20116 - Show all commits

No files matched your search

+9 -6
View File
@@ -22,6 +22,7 @@ from .opcodes import CROSS_SERIES_COLLISIONS, WRITE_SUBS, OpcodeRefused
from .setup_block import crc_ok from .setup_block import crc_ok
_CONFIRM = 0xFFFF _CONFIRM = 0xFFFF
_CALL_HOME_OBSERVED = (0x00, 0x01, 0x04, 0x05) # content[5] values units have held
# block content sizes THOR's offsets were observed at (all on UM12947 / 11.0CB) # block content sizes THOR's offsets were observed at (all on UM12947 / 11.0CB)
_PREFS_LEN, _TRIGGER_LEN, _SETUP_LEN, _CALL_HOME_LEN = 90, 28, 2092, 126 _PREFS_LEN, _TRIGGER_LEN, _SETUP_LEN, _CALL_HOME_LEN = 90, 28, 2092, 126
@@ -113,9 +114,10 @@ def plan_call_home_enabled(call_home: bytes, enabled: bool) -> WritePlan:
Bit 0 of `[5]` is the enable. 🔶 UM12947 (THOR's unit) read 0x05 enabled / Bit 0 of `[5]` is the enable. 🔶 UM12947 (THOR's unit) read 0x05 enabled /
0x04 disabled, bit 2 set in both; UM20147 reads 0x01 (measured, phase-2 dry 0x04 disabled, bit 2 set in both; UM20147 reads 0x01 (measured, phase-2 dry
run). So on UM20147 "off" writes 0x00, a value no capture shows being run). So on UM20147 "off" writes 0x00 -- measured at the bench 2026-11-03
written: the target value there is unobserved, and the plan's `warnings` (and again 11-04): 0x01 <-> 0x00 acknowledged, read back, and matched in the
say so. `[118:120]` is unit-maintained and THOR echoes it. unit's own menu. A value outside those four still carries a warning.
`[118:120]` is unit-maintained and THOR echoes it.
""" """
if len(call_home) != _CALL_HOME_LEN: if len(call_home) != _CALL_HOME_LEN:
raise ValueError(f"call-home content must be {_CALL_HOME_LEN} B " raise ValueError(f"call-home content must be {_CALL_HOME_LEN} B "
@@ -128,9 +130,10 @@ def plan_call_home_enabled(call_home: bytes, enabled: bool) -> WritePlan:
what = "call-home " + ("enable" if enabled else "disable") what = "call-home " + ("enable" if enabled else "disable")
start = call_home[5] start = call_home[5]
warnings = [] warnings = []
if start not in (0x04, 0x05) or b5 not in (0x04, 0x05): if start not in _CALL_HOME_OBSERVED or b5 not in _CALL_HOME_OBSERVED:
warnings.append(f"content[5] 0x{start:02X} -> 0x{b5:02X}: THOR was only ever " warnings.append(f"content[5] 0x{start:02X} -> 0x{b5:02X}: no unit has been seen "
"seen writing 0x04/0x05 (UM12947); this value is unobserved") "holding this value (0x04/0x05 UM12947 by THOR, 0x00/0x01 UM20147 "
"by SFM); it is unobserved")
if b5 == start: if b5 == start:
warnings.append(f"the unit is already call-home {'enabled' if enabled else 'disabled'}" warnings.append(f"the unit is already call-home {'enabled' if enabled else 'disabled'}"
" -- this write changes nothing") " -- this write changes nothing")
+4
View File
@@ -633,6 +633,10 @@ class MiniMateProtocol:
data_rsp = self._recv_one(expected_sub=rsp_sub) data_rsp = self._recv_one(expected_sub=rsp_sub)
raw = unescape_reply(data_rsp.data)[11:] # unescaped, as read_event_index raw = unescape_reply(data_rsp.data)[11:] # unescaped, as read_event_index
# An escaped checksum byte leaves its 0x10 behind (bench 2026-11-04; see
# assemble_compliance_content): one stray byte beyond what was asked is dropped.
if len(raw) == length + 1 and raw[-1:] == b"\x10":
raw = raw[:-1]
log.debug("read_waveform_data_raw: got %d bytes", len(raw)) log.debug("read_waveform_data_raw: got %d bytes", len(raw))
return raw return raw
+7 -2
View File
@@ -69,7 +69,12 @@ _S3_SETTINGS_STEPS = ((0x68, "event index (as read)"), (0x73, "confirm B"),
(0x82, "trigger block (as read)"), (0x83, "trigger confirm"), (0x82, "trigger block (as read)"), (0x83, "trigger confirm"),
(0x69, "waveform data (as read)"), (0x74, "confirm C"), (0x72, "confirm A")) (0x69, "waveform data (as read)"), (0x74, "confirm C"), (0x72, "confirm A"))
_S3_TAIL_WARNING = ("the two bytes after the settings block go out as 00 00 (Blastware sends " _S3_TAIL_WARNING = ("the two bytes after the settings block go out as 00 00 (Blastware sends "
"its own constant; effect unmeasured)") "its own constant; the unit took it at the bench 2026-11-04)")
# Measured at the bench 2026-11-04 (BE9441): a write sent while the setup menu was open
# was acknowledged and read back, then lost when the operator pressed Cancel or Save --
# the menu writes its own copy of the whole block back.
_S3_MENU_WARNING = ("if someone is in this unit's setup menu, this change is lost when they "
"leave it (Cancel or Save writes the menu's copy back)")
S3_RUN_STATES = {0x00: "idle", 0x10: "monitoring", 0x0B: "monitoring"} S3_RUN_STATES = {0x00: "idle", 0x10: "monitoring", 0x0B: "monitoring"}
@@ -525,7 +530,7 @@ class Series3Adapter:
for sub, what in _S3_SETTINGS_STEPS] for sub, what in _S3_SETTINGS_STEPS]
return {"action": "settings write", "blocked": list(st["blocked"]), "steps": steps, return {"action": "settings write", "blocked": list(st["blocked"]), "steps": steps,
"fields": field_rows(st["setup"], st["image"], 3, st["changes"]), "fields": field_rows(st["setup"], st["image"], 3, st["changes"]),
"revision": st["revision"], "warnings": [_S3_TAIL_WARNING]} "revision": st["revision"], "warnings": [_S3_MENU_WARNING, _S3_TAIL_WARNING]}
def send() -> dict: def send() -> dict:
b = st["blocks"] b = st["blocks"]
+8
View File
@@ -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"]) 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) sent = b"".join(_payload(f)[16:] for f in t.sent if _payload(f)[2] == 0x71)
assert sent == block + b"\x00\x00" 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"])
+12 -2
View File
@@ -193,12 +193,22 @@ def test_steps_cannot_be_reassigned():
def test_call_home_off_from_an_unobserved_start_value_carries_a_warning(): def test_call_home_off_from_an_unobserved_start_value_carries_a_warning():
r = bytearray(_call_home_reads()[0]) 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) 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) 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(): 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) r = next(x for x in _call_home_reads() if x[5] == 0x05)
plan = plan_call_home_enabled(r, True) plan = plan_call_home_enabled(r, True)
+28
View File
@@ -121,3 +121,31 @@ def test_a_leftover_that_is_not_the_stray_escape_is_not_trimmed():
sfm_read = READS[8] sfm_read = READS[8]
odd = [sfm_read[0] + b"\x55", sfm_read[1], sfm_read[2]] 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))) 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