test(minimateplus): pin the BE9441 bodies and files byte for byte, and the TERM's header skip
Re-review of 64273c0: nothing pinned the TERM skip -- a TERM cut one byte off
loses a byte after the END record, invisible to every decode and peak check.
Golden sha256 of both fixtures' bodies and written files (event 0's file is
byte-identical to the one SFM stored at the bench before any fix; event 1's is
the bench's 25,810 bytes plus the 2 recovered), and a TERM moved to 0x1002.
The clipped-blast test now sits two steps past full scale (32032 counts), so it
needs the carve-out. Spec: the TOOL_VERSION reason corrected (no stored file
is affected); a MicL-only waveform is now refused -- failing safe, bench-check.
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
64273c07d3
commit
f34f5c3376
3 files changed
+49
-2
No files matched your search
@@ -614,7 +614,9 @@ items were left for later on purpose:
|
||||
`states` to tables created from this branch. Prod: no migration, no backfill.
|
||||
- **The MiniMate bench fixes, for the changelog** (2026-10-25, reviewed).
|
||||
- **The body builder changed in the codec library** (`blastware_file.py`).
|
||||
`TOOL_VERSION` was not bumped, because the `.h5` decode did not change.
|
||||
`TOOL_VERSION` is not bumped, because no stored file is affected, so nothing
|
||||
is owed. The `.h5` regenerated from an `.a5.pkl` *would* change for a
|
||||
non-first event, but no store holds one (below).
|
||||
- **Operational consequence: none.** Measured: the dev store holds 0
|
||||
`.a5.pkl` files. Inferred: prod runs no SFM receivers, and it ingests
|
||||
Blastware's own files, which these functions never touch.
|
||||
@@ -632,6 +634,13 @@ items were left for later on purpose:
|
||||
that is taken as `POLL_DATA`'s reply. `connect()` then fails at the `0x15`
|
||||
check: an error, never corruption. A short drain after the re-poll would fix
|
||||
it if a bench shows it happens.
|
||||
- **The download check refuses what it cannot classify** (inferred, untested
|
||||
configurations). A waveform with the geophones disabled (MicL only) leaves
|
||||
Tran/Vert/Long empty, takes the histogram path and is refused; before
|
||||
`c32a9e7` it was stored unverified. Histogram+Continuous events have never
|
||||
been downloaded over 5A either. That is failing safe by design. A bench
|
||||
check on such a unit decides whether a MicL-only branch (END check, no peaks)
|
||||
is needed.
|
||||
|
||||
## Table 2: to be added later (both series)
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ def test_an_unknown_range_is_not_peak_checked():
|
||||
|
||||
|
||||
def test_a_clipped_blast_is_not_refused():
|
||||
ev = event({c: [0] * 99 + [32016] for c in ("Tran", "Vert", "Long")}, (10.0, 10.0, 10.0))
|
||||
ev = event({c: [0] * 99 + [32032] for c in ("Tran", "Vert", "Long")}, (10.0, 10.0, 10.0)) # 10.010 in/s: two steps past
|
||||
assert verify_s3_download(ev, NORMAL, body=GOOD)[0] is True
|
||||
|
||||
|
||||
|
||||
@@ -74,3 +74,41 @@ def test_a_sample_chunk_at_0x1002_is_not_mistaken_for_a_header_byte():
|
||||
moved = type(one)(**{**vars(one), "data": hdr[:4] + b"\x10\x02" + b"\x00" + hdr[6:] + payload})
|
||||
_s, got, _f = extract_body_bytes([frames[0], moved] + frames[2:])
|
||||
assert got == want
|
||||
|
||||
|
||||
GOLDEN = { # sha256 of STRT + body + footer, and of the written file
|
||||
# event 0's file is byte-identical to the one SFM stored at the bench before any fix
|
||||
"event0": ("29beabfe46a858587b8cdc6ee3f484473c07f96485e404f68c42c6aa1e298aa7",
|
||||
"589073a096d4f867c5ab8c697c82c4b635c7757fcfdd618b460f3b647c32ed7f"),
|
||||
# event 1's is the bench's 25,810 bytes plus the 2 the metadata-page bug cut
|
||||
"event1": ("25026e6f27b0e9e9508ceb49dcb0c44df688ee4f71c05b91826b088d4de68031",
|
||||
"e74c664daaf22d5ae4a7b2464bf6d7aca432f2a10e00fd20c8f6b176999e71b3"),
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("which", ["event0", "event1"])
|
||||
def test_the_body_and_file_are_byte_exact(which, tmp_path):
|
||||
"""Pins every header skip, the TERM's included: a TERM cut one byte off loses
|
||||
a byte after the END record, which no decode and no peak check can see."""
|
||||
import hashlib
|
||||
frames = a5_frames(which)
|
||||
strt, body, footer = extract_body_bytes(frames)
|
||||
ev = Event(index=0)
|
||||
ev.timestamp = None
|
||||
path = tmp_path / "x.P00"
|
||||
write_blastware_file(ev, frames, path)
|
||||
assert hashlib.sha256(strt + body + footer).hexdigest() == GOLDEN[which][0]
|
||||
assert hashlib.sha256(path.read_bytes()).hexdigest() == GOLDEN[which][1]
|
||||
|
||||
|
||||
def test_a_term_at_0x1002_is_not_mistaken_for_a_header_byte():
|
||||
"""The TERM's header (11 stripped bytes: one byte, its 4-byte address, zeros)
|
||||
takes 12 raw bytes when the address it echoes carries an inner DLE pair."""
|
||||
frames = a5_frames("event1")
|
||||
_s, want, _f = extract_body_bytes(frames)
|
||||
term = frames[-1]
|
||||
d = bytes(term.data)
|
||||
assert d[1:3] == b"\x01\x11" and d[3:5] != b"\x10\x02"
|
||||
moved = type(term)(**{**vars(term), "data": d[:3] + b"\x10\x02" + b"\x00" + d[5:]})
|
||||
_s, got, _f = extract_body_bytes(frames[:-1] + [moved])
|
||||
assert got == want
|
||||
Reference in new issue
Block a user