Files
seismo-relay/tests/fixtures/minimate-bench-10-26-26-blastware
serversdownandClaude Opus 5.5 3948dc1a3c fix(decode): a Series-3 waveform's time comes from its Blastware filename
The review of this branch measured (and I re-measured) that the binary's
trigger -- ts2 minus the record time, from 1e76d08 -- is a second off on 260 of
prod's 1,394 waveforms (2026-09-30 snapshot): 199 late, 61 early.  A Blastware
filename encodes Blastware's own time to the second: it equals the report's
Event Time on 81/81 prod and 1,249/1,249 DL2 report-paired waveforms.

The cost of the second was real, not cosmetic:
- events is unique on (serial, timestamp), and on BE9558 the 61 early
  waveforms land on their histogram twin's second -- a fresh import wrote each
  waveform over its histogram's row (888 files -> 827 rows on dev);
- the release backfill would have moved 161 prod rows that v0.31.0 already had
  exactly right a second off.

Same-second collisions across all 11,827 prod-snapshot files: 61 with the
binary's times, 0 with waveform names.  Histograms keep the binary's ts1: their
name is Blastware's start time too (13,089/13,089) and ts1 runs a second early
on 97% of them, but with both on Blastware's times a waveform and its
histogram share a second 209 times -- the key cannot hold that.  Correcting
histogram times needs the key changed; not here.

- blastware_file.blastware_filename_time(): the inverse of
  blastware_filename(), V10.72 'AB0' names only, None for anything else.
- read_blastware_file(path, *, name=None): a waveform takes the name's time;
  save_imported_bw passes the upload's real name (it reads a temp file).
- insert_events' restamp matches only Blastware names (every unnamed upload is
  'imported.bw', so two events could share it) and, of several copies, moves a
  reviewed one with a time first (review items M1, M2).

Tests: the decoder (documented names, encoder round trip, other names), a
waveform's name time, a temp-named read, histograms unchanged, the twin
collision on BE9441's own ZI0 (binary 14:23:43, Blastware 14:23:42), and both
review items.  5 mutants, each caught.  Suite: only the 16 known failures.

Codec-library change: TOOL_VERSION to be bumped at release.  No schema change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-26 19:15:59 -04:00
..

Blastware downloading all 8 events from BE9441, recorded (2026-10-26)

BE9441 (S338.17, single shot, 4096 sps) on the dev box's serial port, shared on TCP by bridges/mm_link.py; Blastware connected over TCP, listed the events and copied all 8 to disk. Both directions, raw:

file direction size
blastware_requests.bin Blastware → unit (748 requests, each after a 41 03 SESSION_RESET) 17,757 B
unit_replies.bin unit → Blastware 364,972 B

Events (key → end), from Blastware's 5A walks. Four cross a 64 KB page (1, 3, 5, 7):

event start key end (STRT) 5A requests
0 01110000 01118a2c 70
1 01118a2c 011216c4 71 (crosses into page 0x12)
2 011216c4 0112a0b6 69
3 0112a0b6 011329d2 69 (crosses into 0x13)
4 011329d2 0113b072 68
5 0113b072 01143046 64 (crosses into 0x14)
6 01143046 0114b0b2 65
7 0114b0b2 01152f0e 64 (crosses into 0x15)

What it settled (measured): every request is the standard 16-byte payload, SUM8 checksum, and every 02 / 03 / 04 / 10 byte DLE-escaped (748/748 re-encode byte-identically). The 5A "offset" is a length (0x0200 per chunk, the remainder for TERM), followed by a 4-byte linear address; a walk is start, start+0x200, ... carrying into the page byte, then TERM at the next boundary for exactly the remainder. The first event's "metadata pages at 0x1002/0x1004" are its chunks at 0x0200 and 0x0400, escaped (10 02 00, 10 04 00).

blastware/: the files Blastware wrote in that session (Brian)

file event crosses a page
K441LTOF.ZI0 0 (01110000) no
K441LTOF.ZQ0 1 (01118a2c) yes, into 0x12
K441LTOF.ZV0 2 (011216c4) no
K441LTOG.000 3 (0112a0b6) yes, into 0x13
K441LTOG.050 4 (011329d2) no
K441LTOG.0A0 5 (0113b072) yes, into 0x14
K441LTOG.0L0 6 (01143046) no
K441LTOG.0S0 7 (0114b0b2) yes, into 0x15

After the fix (887e75d), SFM's own live downloads of all 8 events were byte-identical to Blastware's files (sha256), the 4 crossings included.

The unit's replies (measured on all 748): every 02/03/04/10 is escaped with a 10, exactly as in requests, and the checksum is SUM8 of the unescaped payload, 748/748. S3FrameParser keeps the escape bytes of 10 02/03/04 in its output and sums those too, which is why its checksum_valid is False on 502 of the 540 A5 replies. The "S3 checksums frequently fail" note in protocol._validate_frame describes the parser, not the unit.