diff --git a/CLAUDE.md b/CLAUDE.md index f02d795..439f547 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -262,6 +262,19 @@ Read this first when picking the project back up. over) needs a BW capture of a spanning event first. Do not ship layer one alone without a loud truncation warning — a silently short event is the failure mode this codec has been bitten by repeatedly. + **Narrowed 2026-10-26 (BE9441, measured):** + - The one-event download now refuses a spanning event by name (502), before + any chunk. + - STRT carries the full 32-bit end key, so the page is there to use. + - A read-only test walk carrying the page byte got a proper reply for the + first chunk in the next page (`01 12 01 2c`). The second chunk, params + `… 01 12 03 2c`, got none: a raw `0x03` inside the params. + - Pages after `0x11` have counters with `02`/`03`/`04` bytes. Page `0x11` + has none, because event 1 skips `0x0000`–`0x05FF`. + - How Blastware encodes those bytes is the one unknown left. The capture to + take: Blastware downloading BE9441 event 2 (`0111c92c`) or 19 (`0118a4ca`) + through the recording bridge. Blastware's own files for both are fixtures + (`tests/fixtures/minimate-bench-10-25-26/blastware/`), as byte-exact targets. - **Open, not blocking:** 14 sensitive-range files show an exact 8x (= 10.0/1.25) units discrepancy; `scripts/backfill_sidecars.py --force` also inserts DB rows for store files that have none (one-time per store) and the diff --git a/docs/instantel_protocol_reference.md b/docs/instantel_protocol_reference.md index c6f01f1..bfe0129 100644 --- a/docs/instantel_protocol_reference.md +++ b/docs/instantel_protocol_reference.md @@ -11,6 +11,7 @@ | Date | Section | Change | |---|---|---| +| 2026-10-26 (2) | §7.8 | **The 64 KB page bug, narrowed (measured, BE9441).** Blastware's own downloads of all 20 events (Brian, `example-events/10-25-26 - thumps`) give byte-exact ground truth. SFM's downloads of events 0, 1, 3, 4 and 10 are **byte-identical** to Blastware's. Importing Blastware's files first (the watcher route) makes SFM's downloads of the same events return `already_stored`: the unit's 0C and Blastware's file agree on (serial, timestamp). For an event that crosses a page (event 2, `0111c92c` → STRT end key `01122f06`, full 32 bits) a read-only test walk with the page byte carried (params `00 01 12 01 2c`) got a proper A5 reply for the first chunk in page 0x12, echoing `01 12 01 2c`. The second chunk, `00 01 12 03 2c`, got no reply frame: a raw 0x03 (ETX) inside the params. Page 0x11 never shows this, because event 1 skips 0x0000–0x05FF, so no counter there has a 02/03/04 byte. Every later page does. ⚠ How Blastware encodes a lone 02/03/04 inside params is unknown: §7.8 says `10 02/03/04` is kept as a literal pair, which would shift the address. A wire capture of Blastware downloading BE9441 event 2 or 19 settles it. Blastware's files are fixtures (`tests/fixtures/minimate-bench-10-25-26/blastware/`). | | 2026-10-26 | §7.8 | **5A requests must DLE-escape a checksum that is a framing byte (measured, BE9441).** The request for chunk 0x7D06 of event 01122f06 ends `… 02 03`: a bare 0x02 checksum (STX) before ETX. BE9441 never answered it, twice on two days, and rebooted ~11 s later each time; that was the 'mid-download reboot' of 2026-10-25 (row below). Sent as `… 10 02 03` it answered in 28 ms. So did chunk 0x7F06 (checksum 0x04 → `10 04`) and 0x8B06 (checksum 0x10 → `10 10`; sent bare, that reads as DLE+ETX), and the event downloaded whole and matched the unit's peaks. Escape set {02, 03, 04, 10}: a Micromate's for every byte (251/251 THOR requests), and consistent with §7.8's de-stuffing rule (`10 02/03/04` literal). About 1 chunk request in 64 has such a checksum. ⚠ Not known: whether standard (non-5A) requests need the same. No such keyed-read checksum has been sent. Also measured on the re-run: events that end in the next 64 KB page (BE9441 events 2 and 19) read an end offset lower than their start (the known page bug); every other event downloaded whole and verified. | | 2026-10-25 | §7.2, §7.8, §6 | **MiniMate bench check, BE9441 (S338.17, mic disabled, serial cable). SFM read its 24-entry event index, listed 20 events, and downloaded 4.** Measured: (1) **§7.2: the 0x15 serial is a C string.** `"BE9441\x00?"`: a six-character serial leaves a stray byte after its NUL. (2) **§7.8: every A5 reply echoes the address it answers at `data[2:6]`.** The metadata pages come back as `01 11 10 02` and `01 11 10 04`; sample chunks as their own address, e.g. `01 11 66 6a`. The event-1 walk fetches the metadata pages as frames 1 and 2. A non-first event's walk fetches none and goes straight from the probe to sample chunks. SFM's body builder assumed metadata pages in every stream, so every non-first event it assembled was 2 bytes short and decoded truncated; it now checks the echoed addresses. The bug was in SFM's assembly; the protocol was as already documented. (3) **§6: the unit boots when its serial port opens.** It sent `Operating System` ~3 s after the port opened (twice) and ignored a POLL sent before that. After a mid-download reboot it answered 8.8 s after its banner (one data point). (4) **The unit rebooted once mid-download.** The chunk at 0x7D06 got one stray `0x41`, then silence, then the banner 11 s later. Cause unknown, inferred not measured: battery 6.33–6.37 V, a firmware reset. ⚠ **RETRACTED 2026-10-26:** the cause is measured, and it was our request. The chunk request had a bare 0x02 checksum. See the 2026-10-26 row. (5) The event index said 24 while the header walk listed 20 full records. **Inferred:** the other 4 are monitor-log entries. Single-shot events at 4096 sps with a 5 s record give **21,504 samples per channel** (5 s record + 0.25 s pre-trigger = 5.25 s at 4096 sps), all three channels equal, peaks equal to the unit's own 0C values. | | 2026-10-17 | §7.6.1 | 🔶 **OPEN — the 6-byte "stable anchor" may be two settings at their defaults, not a constant.** Series IV's `0x1A` has the same field order as the S3 compliance block, and a keypad diff pass on a Micromate (UM20147) measured the bytes in the anchor's position: `[f32 BE pre-trigger, negative seconds][record stop mode, 00 00 = Fixed]`. `be 80 00 00` is exactly −0.25 s. If S3 matches — **inferred, not measured on S3** — then any S3 unit set to Record Stop Mode = Auto (a basic Blastware Compliance Setup option) or a non-default pre-trigger loses the anchor, and `client.py` silently decodes no recording mode / sample rate / interval / record time and skips them on write. No S3 capture has ever been taken in Auto stop mode (see the 2026-03-09 Auto Window rows), which would explain why the anchor never broke. To settle: one BW capture with Record Stop Mode = Auto. See `docs/micromate_protocol_reference.md` → *The `0x1A` field map from a keypad pass*. | diff --git a/docs/superpowers/specs/2026-10-20-sfm-series4-parity-design.md b/docs/superpowers/specs/2026-10-20-sfm-series4-parity-design.md index 7781caa..70d8f82 100644 --- a/docs/superpowers/specs/2026-10-20-sfm-series4-parity-design.md +++ b/docs/superpowers/specs/2026-10-20-sfm-series4-parity-design.md @@ -384,9 +384,16 @@ Each safety piece arrives with its first real use, so nothing sits untested. itself remains. - ✅ **Stale id:** 409 after a header walk, with no 5A sent. - ✅ **A repeat download:** `already_stored`, nothing written. + - ✅ **Against Blastware's own files** (Brian's downloads of all 20 + events): SFM's events 0, 1, 3, 4 and 10 are **byte-identical** to + Blastware's. Importing Blastware's files first through the watcher + route makes SFM's downloads return `already_stored`, with no + duplicate rows. + - 🔶 **The 64 KB page bug** is narrowed. The page byte carries; a raw + 02/03/04 inside the params is the blocker. It needs a Blastware wire + capture of event 2 or 19 (CLAUDE.md, KNOWN BUG). - Still owed: - a histogram event (this unit records single shot); - - `already_stored` against Blastware's own copy; - start/stop through the new path, with Brian present; - a dropped reply via fault injection. It happened for real on 10-25, but that was our checksum bug, not a lossy link; diff --git a/tests/fixtures/minimate-bench-10-25-26/README.md b/tests/fixtures/minimate-bench-10-25-26/README.md index 57ebf6a..8382adf 100644 --- a/tests/fixtures/minimate-bench-10-25-26/README.md +++ b/tests/fixtures/minimate-bench-10-25-26/README.md @@ -13,3 +13,19 @@ the `0xA5` frames. Both events: single shot, 4096 sps, 5 s record + 0.25 s pre-trigger = 5.25 s = 21,504 samples per channel. Event 1 is the case that showed the body builder skipping 13 bytes on its second and third frames as if they were metadata pages (2 bytes lost, decode truncated at 1,024 / 2,782 / 512). + +## `blastware/`: Blastware's own downloads of the same events (Brian, 2026-10-25) + +| file | event | key | note | +|---|---|---|---| +| `K441LTMK.P00` | 0 | `01110000` | byte-identical to SFM's build (sha `589073a0…`) | +| `K441LTMK.Q10` | 1 | `0111646a` | byte-identical to SFM's build after the metadata-page fix (sha `e74c664d…`) | +| `K441LTMK.QZ0` | 2 | `0111c92c` | **crosses the 64 KB page boundary**: STRT end key `01122f06` | +| `K441LTML.T80` | 19 | `0118a4ca` | **crosses the 64 KB page boundary**: STRT end key `01190824` | + +On the 2026-10-26 re-run, SFM's own downloads of events 0, 1, 3, 4 and 10 were byte-identical to +Blastware's files, all five. QZ0 and T80 are the byte-exact target for a fix of the +page bug. Carrying the page byte is enough to address the first chunk in the next page +(0x0112012C answered). The second chunk (0x0112032C) puts a raw 0x03 in the request's +params, and the unit does not answer. How Blastware encodes 02/03/04 inside params is +unknown; it needs a wire capture of Blastware downloading one of these two events. diff --git a/tests/fixtures/minimate-bench-10-25-26/blastware/K441LTMK.P00 b/tests/fixtures/minimate-bench-10-25-26/blastware/K441LTMK.P00 new file mode 100644 index 0000000..e7c3b4c Binary files /dev/null and b/tests/fixtures/minimate-bench-10-25-26/blastware/K441LTMK.P00 differ diff --git a/tests/fixtures/minimate-bench-10-25-26/blastware/K441LTMK.Q10 b/tests/fixtures/minimate-bench-10-25-26/blastware/K441LTMK.Q10 new file mode 100644 index 0000000..d7912fc Binary files /dev/null and b/tests/fixtures/minimate-bench-10-25-26/blastware/K441LTMK.Q10 differ diff --git a/tests/fixtures/minimate-bench-10-25-26/blastware/K441LTMK.QZ0 b/tests/fixtures/minimate-bench-10-25-26/blastware/K441LTMK.QZ0 new file mode 100644 index 0000000..977cae3 Binary files /dev/null and b/tests/fixtures/minimate-bench-10-25-26/blastware/K441LTMK.QZ0 differ diff --git a/tests/fixtures/minimate-bench-10-25-26/blastware/K441LTML.T80 b/tests/fixtures/minimate-bench-10-25-26/blastware/K441LTML.T80 new file mode 100644 index 0000000..4762dc7 Binary files /dev/null and b/tests/fixtures/minimate-bench-10-25-26/blastware/K441LTML.T80 differ diff --git a/tests/test_minimate_body_no_metadata.py b/tests/test_minimate_body_no_metadata.py index d21554c..21b3781 100644 --- a/tests/test_minimate_body_no_metadata.py +++ b/tests/test_minimate_body_no_metadata.py @@ -77,6 +77,8 @@ def test_a_sample_chunk_at_0x1002_is_not_mistaken_for_a_header_byte(): GOLDEN = { # sha256 of STRT + body + footer, and of the written file + # Both written files are byte-identical to Blastware's own downloads of the same + # events (fixtures/minimate-bench-10-25-26/blastware/, compared below). # event 0's file is byte-identical to the one SFM stored at the bench before any fix "event0": ("29beabfe46a858587b8cdc6ee3f484473c07f96485e404f68c42c6aa1e298aa7", "589073a096d4f867c5ab8c697c82c4b635c7757fcfdd618b460f3b647c32ed7f"), @@ -112,3 +114,12 @@ def test_a_term_at_0x1002_is_not_mistaken_for_a_header_byte(): 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 + + +@pytest.mark.parametrize("which,bw", [("event0", "K441LTMK.P00"), ("event1", "K441LTMK.Q10")]) +def test_the_written_file_is_blastwares_own(which, bw, tmp_path): + ev = Event(index=0) + ev.timestamp = None + path = tmp_path / "x" + write_blastware_file(ev, a5_frames(which), path) + assert path.read_bytes() == (FIX / "blastware" / bw).read_bytes()