diff --git a/CLAUDE.md b/CLAUDE.md index 1e43377..335fc6c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -225,6 +225,10 @@ Read this first when picking the project back up. the read-back), #8 (`9492e49`, downloads stored through `save_imported_bw` with the unit's peaks/mic/vector sum overlaid and its range passed). #2 came with the `dev` merge. **#15 retracted** -- `sent` NULL is "unknown", by design. + Final review fixes: `dbd8a91` (wake before the reconnect's identity read), + `3a1d34a` ("already stored" by Blastware name too), `a72d3a9` (the 1A write + encoder refuses a patch that would not read back -- its offsets are 1024-sps + raw ones, #46). **Ring path measured the same night:** with THOR's watchdog off, a call-home reaches THOR when nobody holds the line, and **is lost when SFM holds it** -- the unit takes SFM's connection for the call, times out and does not retry. diff --git a/docs/instantel_protocol_reference.md b/docs/instantel_protocol_reference.md index 897126f..bfed858 100644 --- a/docs/instantel_protocol_reference.md +++ b/docs/instantel_protocol_reference.md @@ -11,7 +11,7 @@ | Date | Section | Change | |---|---|---| -| 2026-10-29 | §7.6.1, §6 | **The SUB 1A settings fields are read AFTER unescaping (measured, BE9441).** The unit escapes 02/03/04/10 in its replies and `S3FrameParser` keeps the `10` of `10 02/03/04`, so on the raw bytes an escaped mode, sample rate or interval shifts every field after it: BE9441 at Histogram / 4096 sps / 2 s read 0 sps and a 4098 s interval, and a Continuous unit read as Single Shot. After `unescape_reply`, every recorded reply (4 settings, two of them Blastware's own writes: 15 min, then 2 s) has one layout: **mode anchor−7, sample rate anchor−6 (u16 BE), histogram interval anchor−4 (u16 BE, s), record time anchor+6 (f32 BE)**. ⚠ The older table's "anchor−7 = constant 0x10" (and mode at anchor−8) was the escape in front of `04` at 1024 sps — right only at that rate. The channel block (`Tran`+28 scale, +33 range, +34 trigger) and the note strings are correct on the RAW bytes and wrong unescaped; 🔶 open: a trigger/alarm float that itself contains 02/03/04/10 would read shifted there. Also measured: **while monitoring, BE9441 answered the 1A reads with its device-info block** (`BE9441`, `Instantel` — the 0x01 reply), so no settings can be read then; the decoder leaves them unknown. The 2026-10-17 anchor question is untouched: every reply measured so far carries the anchor. Fixed in SFM `b320a53`. | +| 2026-10-29 | §7.6.1, §6 | **The SUB 1A settings fields are read AFTER unescaping (measured, BE9441).** The unit escapes 02/03/04/10 in its replies and `S3FrameParser` keeps the `10` of `10 02/03/04`, so on the raw bytes an escaped mode, sample rate or interval shifts every field after it: BE9441 at Histogram / 4096 sps / 2 s read 0 sps and a 4098 s interval, and a Continuous unit read as Single Shot. After `unescape_reply`, every recorded reply (4 settings, two of them Blastware's own writes: 15 min, then 2 s) has one layout: **mode anchor−7, sample rate anchor−6 (u16 BE), histogram interval anchor−4 (u16 BE, s), record time anchor+6 (f32 BE)**. ⚠ The older table's "anchor−7 = constant 0x10" (and mode at anchor−8) was the escape in front of `04` at 1024 sps — right only at that rate. The channel block (`Tran`+28 scale, +33 range, +34 trigger) and the note strings are correct on the RAW bytes and wrong unescaped; 🔶 open: a trigger/alarm float that itself contains 02/03/04/10 would read shifted there. Also measured: **while monitoring, BE9441 answered the 1A reads with its device-info block** (`BE9441`, `Instantel` — the 0x01 reply), so no settings can be read then; the decoder leaves them unknown. The 2026-10-17 anchor question is untouched: every reply measured so far carries the anchor. Fixed in SFM `b320a53`. ⚠ **The write side was not moved:** `_encode_compliance_config` still patches the raw bytes at the 1024-sps offsets (mode anchor−8), which at 2048/4096 sps rewrite the byte in front of the mode (measured on BE9441's 10-25 block); it now refuses a patch whose four fields do not read back as asked (`a72d3a9`) until rewritten on unescaped bytes (#46). | | 2026-10-27 | §3 writes | **⚠ RETRACTS the write-frame model (#46, measured).** Every Blastware request on record re-encodes under the uniform rule (02/03/04/10 escaped, SUM8): 3,869/3,869 frames in the Feb–Apr 2026 captures, plus BE9441's 26 write frames of 2026-10-26. A write's [4:6] is its data LENGTH. Config blocks are their header N + 2 bytes: event index (68) and trigger (82) are written as read plus `02 00` / `00 00` (constant on 15 sends); waveform data (69) and the 2,092-byte compliance image (71) are written whole, the latter in addressed chunks (params[2:4] = address; 1,024 B in March, 512 B with Blastware 10.74). The trailing two bytes are not a CRC and went out stale, so the unit evidently ignores them. "Only BW_CMD doubled", the "DLE-aware checksum", "offset = data[1] + 2" and "chunks 1,027 / 1,055 at offset 0x1004" were these frames read with their escape bytes in. The trigger block is read first (SUB 0x2E, 26 bytes); its byte 5 has been 01 / 03 / 04 by unit and session (meaning unknown). | | 2026-10-26 (5) | §7.8.9 | ✅ **The embedded event record: the instrument's trigger time, inside the 5A stream.** Every Blastware waveform file carries `00 28 05 00 ?? ?? fe 80 [trigger 8 B][stop 8 B]`, times as `dd mm yyyy(BE) 00 hh mm ss`. The trigger equals Blastware's report 1,320/1,320, the filename 7,935/7,935 and the unit's 0C record 10/10. It occurs once in the unit's own A5 payloads (8/8 events) and in SFM-only downloads (2/2): instrument data, not Blastware's. The footer's `ts2 - record time` is only an estimate, a second off on ~19%. Decoder rule, validation and an open case (3 waveform-named files the codec does not recognise) in §7.8.9. 🔶 The §7.5 `0C` "sub_code" timestamp variants look like the same 8-byte form read with its escapes. | | 2026-10-26 (4) | §3, §10 | **Replies follow the request rule; a write-frame suspicion (inferred).** Measured on all 748 reply frames of the 10-26 recording: the unit escapes exactly 02/03/04/10 with a `10`, and the checksum is **SUM8 of the unescaped payload**, 748/748. The long-held "S3 response checksums frequently fail SUM8" (`protocol._validate_frame`) is `S3FrameParser`'s own doing: it keeps the `10` of `10 02/03/04` in its output (consumers rely on that) and sums it, so 502/540 A5 replies read invalid. 🔶 **Inferred only:** `build_bw_write_frame`'s model ("raw except BW_CMD", "DLE-aware checksum") shows the same fingerprints as the retracted 5A model -- SUB 71's "offset 0x1004" reads as length 0x0400 escaped, and Blastware escapes `03` in write data (§3 note, 2026-04-20). A write whose payload holds a bare 02/03/04/10 may be malformed; one Blastware config-write capture settles it. Not acted on. | 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 74accc0..34506f2 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 @@ -664,7 +664,9 @@ From the page bench on BE9441 (MiniMate, modem `63.43.212.233`) and UM20147 (Micromate, RX55 `63.45.161.30`). Numbers as given at the bench. Fixes wait for a short plan; #14 waits for the line-hold decision above. -1. ✅ **Fixed `b320a53`** (the four anchor fields read after `unescape_reply`; mode −7, +1. ✅ **Fixed `b320a53`**; the write encoder refuses a patch that would not read back + (`a72d3a9`) -- its raw offsets are 1024-sps ones and need rewriting on unescaped + bytes (#46). (The four anchor fields read after `unescape_reply`; mode −7, rate −6, interval −4, record time +6; the channel block stays on raw bytes). **S3 settings decode reads before escapes are removed** -- BE9441 showed 0 sps and a 68.3-min interval (true: Histogram, 4096 sps, 2 s, per the 10-26 fixture @@ -681,7 +683,8 @@ a short plan; #14 waits for the line-hold decision above. 5. Stored S3 event: client "Terra-Mechanic" (last letter missing) -- unexplained. 6. Page: the Config tab shows the empty write form until Read in serial mode. 7. `/db/events` 500 "database is locked" on the first page load against a new DB. -8. ✅ **Fixed `9492e49`**: the download carries the assembled Blastware file and is +8. ✅ **Fixed `9492e49`**, plus `3a1d34a` ("already stored" also matches the Blastware + name: a histogram's row sits a second off its 0C time). The download carries the assembled Blastware file and is stored through `save_imported_bw` (`source.kind` "sfm-live"); the unit's 0C peaks, mic and vector sum are overlaid (the file path reads a histogram's vector sum as 0.503 vs 0.385, the mic as 0, and no sensitive range yet), and its range scales @@ -690,7 +693,8 @@ a short plan; #14 waits for the line-hold decision above. the file reader that Series 4 uses (`save_imported_idf`): a histogram gets no samples and is labelled Waveform. Fix: store S3 downloads through the file-import path (also aligns event times with v0.32.0). -9. ✅ **Fixed `ce441a0`** (one reconnect on an `OSError`, TCP only, identity checked, +9. ✅ **Fixed `ce441a0`**, plus `dbd8a91` (the reconnect wakes the unit before its + identity read). (One reconnect on an `OSError`, TCP only, identity checked, nothing re-sent). **S3 start over a modem:** the line dropped during the sensor check, the read-back hit `Broken pipe` and did not reconnect → 503 though the start @@ -710,6 +714,12 @@ a short plan; #14 waits for the line-hold decision above. ring instead of its ack is exactly unknown, and the row's `error` says it was sent. 16. Page: a 504 on a unit THOR holds should say "connected, but no reply -- another program may be holding this unit's line". +17. **Found by the Batch 1 review (open):** a MiniMate downloaded *while monitoring* + answers 1A with its device-info block, so no range is read and the stored + `.h5` samples assume Normal -- 8x off on a sensitive-range unit (the row's + peaks are the unit's, overlaid). Pre-existing on the old path too. The same + reply decodes a setup name of `:S338.17`. Live S3 downloads also no longer + keep the `.a5.pkl` wire record. - **Same-second collisions (SDM).** Two events of one unit in the same second collide on (serial, timestamp) — a DB-wide dedup property, not 1b's. - **423 without `Retry-After` (1c).** Add `Retry-After` to the 423 a request gets while a download holds the unit. - **A lost `0C` during a Series-3 list (1c).** The strict walk raises on a lost `0A`