fix(minimateplus): a one-event download names an event that crosses the 64 KB page boundary
Bench re-run 2026-10-26: BE9441 events 2 (0111c92c) and 19 (0118a4ca) end in
the next page, so STRT's 16-bit end offset reads lower than the start. The walk
then failed in bulk_waveform_term_v2 with a ValueError ('end_offset 0x2F06 must
be > last_chunk_counter 0xC92C') that the adapter's struct.error mapping did not
catch: a generic 500. Strict mode now refuses such an event by name right
after the probe -- 'crosses the unit's 64 KB page boundary ... the known 5A
page bug; not saved' -- before any chunk is sent. Not stored either way. The
page bug itself is unchanged (CLAUDE.md: needs a BW capture of a spanning event).
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
d56dde768d
commit
bf9e32cfc0
2 files changed
+24
No files matched your search
@@ -664,6 +664,16 @@ class MiniMateProtocol:
|
||||
raise ProtocolError(
|
||||
f"5A probe for {key4.hex()} carried no STRT record, so the event's end "
|
||||
"is unknown -- not downloaded")
|
||||
if strict and end_offset is not None and end_offset < start_offset:
|
||||
# The known 5A page bug: parse_strt_end_offset keeps only the low 16
|
||||
# bits, so an event that ends in the next 64 KB page reads as ending
|
||||
# before it starts, and the walk cannot follow it yet. BE9441's
|
||||
# events 2 and 19 (bench 2026-10-26) -- named here, before any chunk.
|
||||
raise ProtocolError(
|
||||
f"event {key4.hex()} crosses the unit's 64 KB page boundary (starts at "
|
||||
f"0x{start_offset:04X} in page 0x{key4[1]:02X}, ends at 0x{end_offset:04X} in "
|
||||
"the next) -- SFM cannot download such an event yet (the known 5A page bug); "
|
||||
"not saved")
|
||||
if end_offset is None:
|
||||
log.warning(
|
||||
"5A probe response did not contain a STRT record; "
|
||||
|
||||
@@ -99,3 +99,17 @@ def test_strict_raises_when_the_probe_has_no_strt():
|
||||
def test_the_legacy_walk_keeps_its_tolerance():
|
||||
frames = stream(a5_replies(), silent_from=40)
|
||||
assert 0 < len(frames) < 51 # short, returned, not raised -- as before
|
||||
|
||||
|
||||
def test_strict_names_an_event_that_crosses_the_64kb_page_boundary():
|
||||
"""BE9441 events 2 and 19 end in the next page (end offset < start offset);
|
||||
the walk cannot follow them yet. Refused by name, before any chunk is sent."""
|
||||
r = a5_replies()
|
||||
i = r[0].find(b"STRT")
|
||||
assert r[0][i + 6:i + 10] == bytes.fromhex("0111c92c") # the end key: same page
|
||||
r[0] = r[0][:i + 6] + bytes.fromhex("01122f06") + r[0][i + 10:] # ... now the next page
|
||||
p = mp.MiniMateProtocol(Replay(r))
|
||||
with pytest.raises(mp.ProtocolError, match="crosses the unit's 64 KB page boundary"):
|
||||
p.read_bulk_waveform_stream(KEY, stop_after_metadata=False, include_terminator=True,
|
||||
strict=True)
|
||||
assert p._transport.sent == 1 # the probe, and nothing after
|
||||
Reference in new issue
Block a user