docs: the first MiniMate bench run -- four bugs found, what remains of the check

Series-III reference: the 0x15 serial is a C string (BE9441's "BE9441\x00?"),
A5 replies echo their address at data[2:6] (metadata pages only on the
event-1 walk), the unit boots on serial-port open (banner ~3 s, answered 8.8 s
after a reboot's banner), one mid-download reboot, and 24 index entries vs 20
listed events (inferred: monitor-log entries).  Spec: the MiniMate check's
first run, item by item, and what is still owed.  CLAUDE.md: the phase-1b
"unproven" line retracted in place, with the four bugs and the re-run owed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-10-25 18:19:14 -04:00
1 parent d73a27d2e3
commit 3898d03236
3 files changed
+47 -2

No files matched your search

+20 -2
View File
@@ -130,8 +130,26 @@ Read this first when picking the project back up.
series** -- the MiniMate list comes from headers only (no 5A), and a download series** -- the MiniMate list comes from headers only (no 5A), and a download
is checked and stored in SFM's DB (`db_event_id`). Bench-checked on UM20147: is checked and stored in SFM's DB (`db_event_id`). Bench-checked on UM20147:
5 events, a waveform that verified, a histogram, one call-up for the whole 5 events, a waveform that verified, a histogram, one call-up for the whole
sequence. ⚠ The MiniMate header walk is **unproven on a unit; a MiniMate sequence. ~~⚠ The MiniMate header walk is **unproven on a unit; a MiniMate
bench check is owed before the branch merges.** Next: 1c (webapp). bench check is owed before the branch merges.**~~ **2026-10-25, first
MiniMate bench run (BE9441, serial cable):** the header walk listed 20
events correctly, and the check found four bugs, all fixed and tested on its
logged bytes.
1. **Every non-first event SFM assembled was 2 bytes short.** The body
builder assumed the 0x1002/0x1004 metadata pages in every 5A stream; it
now reads each A5 reply's echoed address. This also affected legacy
`get_events` and `ach_server.py` files. Blastware's own files were not
affected.
2. **A reboot mid-download stored a partial event as a success.** A strict
5A stream now raises on any early end.
3. **The unit boots when its port opens** and ignores a POLL sent before the
`Operating System` banner. Startup now waits for it.
4. **The 0x15 serial is a C string** (`"BE9441\x00?"`).
Series-3 downloads are now checked against the unit's own 0C peaks before
being stored. ⚠ **A re-run with the fixes in place is still owed before
merge**, plus the rest of the check's scope (spec, phase 1b). Next: 1c
(webapp).
- **✅ Phase 3: start / stop monitoring by serial (2026-10-23) — built, - **✅ Phase 3: start / stop monitoring by serial (2026-10-23) — built,
reviewed, and bench-verified on UM20147 (2026-10-25).** Start acked in reviewed, and bench-verified on UM20147 (2026-10-25).** Start acked in
0.46 s and read back as monitoring at the first 2 s poll (during the sensor 0.46 s and read back as monitoring at the first 2 s poll (during the sensor
+3
View File
@@ -11,6 +11,7 @@
| Date | Section | Change | | Date | Section | Change |
|---|---|---| |---|---|---|
| 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. (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 plus 1 s pre-trigger), 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*. | | 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*. |
| 2026-08-26 | S7.6.2, S15 | **MULTI-INTERVAL HISTOGRAM BLOCKS - sub-minute intervals pack several per block.** The device always writes one minute of data per block, so a shorter histogram interval means more intervals packed into a longer block: 1 min -> 1 (the standard 32-byte block), 15 s -> 4 (stride 92), 2 s -> 30 (stride 612), with `stride = 12 + n * 20`. Each 20-byte record holds 8 x uint16 **little**-endian values (peak/half-period per channel) plus a 2-word tail whose first word is `0000` on every real interval. The standard block is big-endian - the variant is not. This recovers **415 files** (216 on BE18193 at 2 s, 199 on BE9440 at 15 s) that previously decoded to nothing, and before that were being accepted by the WAVEFORM codec and returning garbage up to 400x the device-reported PPV. | | 2026-08-26 | S7.6.2, S15 | **MULTI-INTERVAL HISTOGRAM BLOCKS - sub-minute intervals pack several per block.** The device always writes one minute of data per block, so a shorter histogram interval means more intervals packed into a longer block: 1 min -> 1 (the standard 32-byte block), 15 s -> 4 (stride 92), 2 s -> 30 (stride 612), with `stride = 12 + n * 20`. Each 20-byte record holds 8 x uint16 **little**-endian values (peak/half-period per channel) plus a 2-word tail whose first word is `0000` on every real interval. The standard block is big-endian - the variant is not. This recovers **415 files** (216 on BE18193 at 2 s, 199 on BE9440 at 15 s) that previously decoded to nothing, and before that were being accepted by the WAVEFORM codec and returning garbage up to 400x the device-reported PPV. |
| 2026-08-25 (3) | S7.6.1, S15 | **THE WAVEFORM BODY IS A RECORD CHAIN, NOT A TAG STREAM — supersedes the segment-header model entirely.** Records are self-delimiting: `off+2` is a uint16 BE length and `next = off + 2 + len`; the chain ends on a record whose chan_id is `0x06`. `off+8` holds a 3-valued mode enum - `02 00` (14-byte header, anchors, cumulative deltas), `01 00` (10-byte, no anchors, ABSOLUTE values), `00 03` (10-byte, no tags at all, raw 12-bit absolute). **`40 NN` is an ordinary int16 BE data block of length 2*NN+2**, never a header; reading it as a 2*NN+16 header is what made walks drift, and the 'variable prefix' of 0/2/4/6/8 bytes reported earlier the same day was walker drift, exactly `4 - (old_stop - true_record_start)`. Verified: chain terminates on `06` in 1387/1388 files; all four channels equal length in **1388/1388** (was 156/1388); ASCII sample-count exact 72/75 -> **75/75**, fully exact 70/75 -> **73/75**; device PPV on a live decode **1306/1306** waveform (mean abs ratio error 0.00000) and **4458/4459** histogram. Also eliminated the walker-over-read class: 24 of those files were histograms the waveform codec was wrongly accepting. The superseded model is retained as `decode_waveform_legacy` because `micromate/idf_file.py` pins it for Thor IDFW body-offset search. | | 2026-08-25 (3) | S7.6.1, S15 | **THE WAVEFORM BODY IS A RECORD CHAIN, NOT A TAG STREAM — supersedes the segment-header model entirely.** Records are self-delimiting: `off+2` is a uint16 BE length and `next = off + 2 + len`; the chain ends on a record whose chan_id is `0x06`. `off+8` holds a 3-valued mode enum - `02 00` (14-byte header, anchors, cumulative deltas), `01 00` (10-byte, no anchors, ABSOLUTE values), `00 03` (10-byte, no tags at all, raw 12-bit absolute). **`40 NN` is an ordinary int16 BE data block of length 2*NN+2**, never a header; reading it as a 2*NN+16 header is what made walks drift, and the 'variable prefix' of 0/2/4/6/8 bytes reported earlier the same day was walker drift, exactly `4 - (old_stop - true_record_start)`. Verified: chain terminates on `06` in 1387/1388 files; all four channels equal length in **1388/1388** (was 156/1388); ASCII sample-count exact 72/75 -> **75/75**, fully exact 70/75 -> **73/75**; device PPV on a live decode **1306/1306** waveform (mean abs ratio error 0.00000) and **4458/4459** histogram. Also eliminated the walker-over-read class: 24 of those files were histograms the waveform codec was wrongly accepting. The superseded model is retained as `decode_waveform_legacy` because `micromate/idf_file.py` pins it for Thor IDFW body-offset search. |
@@ -553,6 +554,8 @@ Unit 2: serial="BE11529" trail=70 11 firmware=S337.17
> ❓ **Still unknown:** `trail[0]` is unit-specific. Does not derive from serial string via sum, XOR, or modulo. Possibly written at factory calibration. Needs a third unit or write-command capture to determine. > ❓ **Still unknown:** `trail[0]` is unit-specific. Does not derive from serial string via sum, XOR, or modulo. Possibly written at factory calibration. Needs a third unit or write-command capture to determine.
> ⚠ **2026-10-25 — AMENDED (measured, BE9441).** The 8-byte serial field is a **C string, not null-padded**. A six-character serial leaves a stray byte after its terminator: BE9441 sends `42 45 39 34 34 31 00 3f` = `"BE9441\x00?"`. Stripping trailing NULs alone keeps the `?`; cut at the first NUL. Every unit seen before had a seven-character serial, which fills the field exactly to the terminator.
### 7.3 Full Config Response (SUB FE) — 0x98 bytes ### 7.3 Full Config Response (SUB FE) — 0x98 bytes
| Offset | Raw | Decoded | Certainty | | Offset | Raw | Decoded | Certainty |
@@ -354,6 +354,30 @@ Each safety piece arrives with its first real use, so nothing sits untested.
Measured for Series 4: 1,016/1,016 watcher imports found by the Measured for Series 4: 1,016/1,016 watcher imports found by the
lookup (2026-10-21). lookup (2026-10-21).
- a dropped reply, via `bridges/mm_link.py`-style fault injection. - a dropped reply, via `bridges/mm_link.py`-style fault injection.
**First run, 2026-10-25, on BE9441** (S338.17, mic disabled, serial
cable). It found four bugs; all four are fixed with tests built on its
logged bytes (`a8cc516`, `352f694`, `75d79ec`, `36f4e5d`, `d73a27d`).
- ✅ **List: 20 events,** in order, with distinct keys. The header walk
advances.
- ❌→✅ **A non-first event:** stored 2 bytes short, so it decoded
truncated. The body builder assumed metadata pages in every stream.
Fixed. A Series-3 download is now checked against the unit's own
peaks, so this class of bug is refused rather than stored.
- ❌→✅ **The first request after the port opens failed.** The unit
boots on connect, and its banner came ~3 s after the POLL had already
gone out. Fixed: startup waits for a unit it sees booting.
- ❌→✅ **A reboot mid-download stored a partial event as a success.**
This was the dropped reply, occurring live. Fixed: a one-event
download is whole or it is an error.
- Still owed:
- a re-run with the fixes in place;
- a histogram event (this unit records single shot);
- an event that *spans* the 64 KB page boundary. Event 3 sits in page
`0x12`, but within that one page;
- the stale-id check;
- `already_stored` against Blastware's copy;
- start/stop through the new path.
- **Download = fetch, check, store** in SFM's database, the same as - **Download = fetch, check, store** in SFM's database, the same as
Series 3's `blastware_file` route, and returns the stored row's id. The Series 3's `blastware_file` route, and returns the stored row's id. The
file and waveform are then served by the existing `/db/events/{id}/…` file and waveform are then served by the existing `/db/events/{id}/…`