- minimateplus.protocol: call_home_enabled(raw) reads byte 5 of the UNESCAPED
0x2C payload (0x01 on / 0x00 off, measured 2026-04-20; anything else None --
bench finding #1's lesson: an escaped byte before it would move the raw
index); call_home_image(raw, enabled) is write_image's N + 2 image with byte 5
set and everything else as read, refusing a byte 5 never measured.
- MiniMateClient.read_call_home_raw() / write_call_home_image(image) (0x7E then
0x7F, each ack checked, never retried).
- Series3Adapter.call_home_state (wake, then 0x2C; no serial read, like status)
and change_call_home: the shared change core with a connect() identity check,
state 'enabled' / 'disabled' / 'unknown(0xNN)' (unknown sends nothing), the
plan showing both exact frames, a snapshot of both unescaped images.
- S3_CALL_HOME_FRAME_VERIFIED = False: a live change is refused (501) before any
connection until the frame is reproduced from Blastware's (next commit).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Brings 057df47 (fix 4844135, changelog be58b4f) from the decode checker's branch
-- Event.geo_range from the file's setup channel block (label+29: 0 Normal,
1 Sensitive, None not read), peaks and histogram PVS scaled by it,
write_event_hdf5(geo_range=None) using it -- and dev's v0.33.0 release commit
(6c7c6b0).
Conflicts, resolved as agreed with the decode session:
- sfm/waveform_store.py save_imported_bw: dev dropped the forced
geo_range="normal"; this branch keeps its geo_range parameter, now
Optional, default None -- an import uses the file's own range, an explicit
value (a live download's) still wins.
- CLAUDE.md: dev's newer 'Where things stand (updated 2026-11-01)' date.
Measured on the merged tree: K557J1KB.RQ0W (Sensitive waveform) decodes
0.019 / 0.055 / 0.019, PVS 0.061 -- Blastware's report -- and its imported
.h5 peaks 0.0194 / 0.055 / 0.0194 (forcing 'normal' gives 8x: 0.155 / 0.44).
M010HR6K.OA0H (Sensitive histogram) likewise. The live path still passes the
unit's 1A range or 'normal' when unread -- unchanged by this merge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
In the setup's channel blocks, the byte 29 after each geophone label is
the range: 0x00 Normal (10 in/s), 0x01 Sensitive (1.25 in/s). It matches
Blastware's GeoRange on 70,042 / 70,042 DL2 events, all three channels
agreeing on every one (35 Sensitive). SFM's live 1A has the same byte
at label+33. SFM assumed Normal, so every Sensitive event's peaks,
vector sum and .h5 samples read 8x high.
- Event.geo_range (0 / 1, None when not read -- channels disagreeing,
an unknown value or a missing block -- with a decode_problems entry).
- decode_blastware_bytes scales peaks and the histogram vector sum by it.
- event_hdf5.write_event_hdf5: geo_range defaults to None = the event's
own, else Normal; an explicit argument still wins.
- waveform_store.save_imported_bw and scripts/backfill_sidecars.py stop
forcing 'normal', so imports and the backfill store the file's range.
The waveform_store line was agreed with the parity session, which owns
that file; its own branch keeps a geo_range parameter, defaulting to
None at its next dev merge.
- The checker's SFM side converts at the event's range and reports
GeoRange; tests that pinned the old 8x gap now pin the fix, and the
saturation carve-out is still tested against an 8x value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
A Blastware event that reaches SFM without its ASCII report -- every DL2
event before 2025, and every event SFM downloads itself -- now carries
its sample rate, record time, pre-trigger, notes and event type, the
histogram vector sum the unit stores, and a mic reading at one count =
0.25 Pa. The new decode checker proves each against Blastware's own
_XML.XML reports for 70,042 DL2 events.
- CHANGELOG: Unreleased -> v0.33.0 with theme and Migration.
- TOOL_VERSION 0.33.0 (gates the backfill regeneration).
- pyproject, CLAUDE.md and README versions; README status entry and
roadmap (the Series-III codec item was long done; the file-only goal
added); CLAUDE.md 'Where things stand' brought up to v0.33.0.
Deploy: back up seismo_relay.db, then backfill_sidecars.py and
backfill_event_shape.py (~2 h on the NAS). No schema change, no
migration, event times do not move.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
The checker caught 280 regressions in the first mic fix: every one a dB
value at count 129, where 20 log10(129 x 0.25 Pa / 20 uPa) = 124.149997
rounds to 124.1 and Blastware prints 124.2. Blastware's dB offset sits in
[81.9383, 81.9385] -- any value there matches its dB(L) on 1,729,252 /
1,729,253 DL2 intervals (the last printed '0.000'); exact 81.93820 rounds
count 129 down, and the old 81.94 misses counts 119 and 132. Single
precision does not explain it. psi keeps 0.25 Pa per count, which
matches every interval.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
SFM converted mic counts to psi with a '~0.5 psi full-scale' guess
(0.0125 / 32768 psi per count). Measured against 1,729,253 DL2
histogram intervals' 'MicL Peak' columns: one count is exactly 0.25 Pa.
count x 0.25 Pa matches Blastware's psi(L) on every interval, and
20 log10(count x 0.25 Pa / 20 uPa) its dB(L) on all but 17 exact
half-way cases.
- event_file_io: _MIC_FS_PSI -> _MIC_PSI_PER_COUNT = 0.25 / 6894.757
(3.626e-5 psi per count, was 3.81e-7). The event's mic peak in psi,
and with it the .h5 mic trace (event_hdf5 back-solves its scale from
that peak), come right on events with no report.
- waveform_codec.mic_count_to_db: the offset is 20 log10(0.25 / 20e-6)
= 81.938, not 81.94 -- the old value missed 49 of those intervals at a
rounding edge (count 119 printed 123.4, 81.94 gave 123.451).
The decoded count was always right: count 16 on K441LTON.900 is
Blastware's 106.0 dB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Brings 0fc6806 (fix 625bc39, changelog dc42ae0) from the decode checker's
branch: a histogram's peak vector sum is the largest per-interval PVS the unit
stores (PVS^2 as uint32 BE), not a vector magnitude of per-channel interval
peaks. K441LTON.900 reads 0.385, as Blastware's report.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Every histogram interval carries its peak vector sum SQUARED, uint32 BE
in 0.005 in/s units: bytes [21:25] of a standard block (long documented
as 'constant 00 00' plus 'purpose unknown'), the last 4 bytes of a
sub-minute record (the undecoded 'meta_var'). sqrt(stored) x 0.005 is
the Geo PVS Blastware prints: 1,668,073 / 1,668,074 standard and 34.5 M
sub-minute DL2 intervals checked against the _XML.XML reports.
SFM computed the event's PVS from each channel's interval peak, which
can come from different moments, and read high on 86% of DL2's
histograms (T004JTRF.ME0H: 1.782 against Blastware's 1.358). It now
takes the largest stored interval value. histogram_codec.interval_pvs
returns the per-interval series; records gain 'pvs_sq'. Waveforms are
unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Blastware names a direct download K441LTON.900 and only its call-in copy
K441LTON.900H, so a folder of directly downloaded events cannot be sorted by
kind. SFM's own files now always carry the letter. It is read from the file's
own record-type byte (STRT[18], #41) by the new with_type_letter() -- not from
the recording mode: BE9441's K441LTOK.R10 is a waveform that triggered 2 s into
histogram K441LTOK.QZ0 (Histogram+Continuous). A file whose type does not read
keeps the plain name; a name never fails a download.
All three paths that name a MiniMate file SFM builds: the device-access
download (the page's event list), WaveformStore.save (the legacy route's store
copy, the bench call-in server), and the legacy /device/event/{i}/blastware_file
download. Verified on BE9441's recorded 5A walk: 0111f210 -> K441LTON.900H,
011106a0 -> K441LTOK.R10W, byte-identical to Blastware's files.
find_event_by_blastware_name tightens with it: a lettered name matches itself
and the letterless form, not the other letter (a waveform and a histogram in the
same second are different events); a letterless name still matches all three.
Store consequence: new downloads only; rows and files stored before keep their
names, and 'already stored' still finds them. No schema change, no migration.
The event list shows the plain name until the event is downloaded (the type is
not known before the 5A).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Brings ede6292 (fix 46daea1, changelog b6fc71b) from the decode checker's
branch. Completes #8's live S3 download path: a live histogram, whose direct
download name (K441LTON.900) carries no type letter, is now labelled from
STRT[18] instead of defaulting to Waveform.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
_encode_compliance_config patches the raw SUB 1A bytes at offsets measured at
1024 sps (April 2026), where the escape before 04 sits between the mode and the
anchor. b320a53 moved the decoder to the measured layout (unescaped: mode -7,
rate -6, interval -4, record time +6), which exposed the encoder: on BE9441's
recorded 10-25 Continuous / 4096 block a mode change rewrote the byte in front
of the mode, and on the 10-26 Histogram+Continuous / 2048 block a sample-rate
change landed one byte off. The old decoder read the same wrong bytes, so such
a write looked as if it had taken.
The encoder now decodes its own result with the decoder and raises ValueError
when mode, sample rate, interval or record time would not read back as asked
(or a field not asked for would change) -- before push_config_raw sends a byte.
No write offset is moved: rewriting the encoder on unescaped bytes is #46's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
A live Series-3 download was stored from the live 5A decode (store.save): a
histogram got no samples and nothing to plot (bench 2026-10-29). The download
now carries the assembled Blastware file (DownloadedEvent.bw_bytes, built by the
new blastware_file_bytes -- byte-identical to Blastware's own K441LTON.900 and
K441LTOK.R10), and persist_download stores it through save_imported_bw, the
path the watcher uses for Blastware's files, the way Series 4 already uses
save_imported_idf. The event is decoded from the file: histogram samples,
setup-block sample rate and record time (#44/#45). source.kind is 'sfm-live'.
The file path does not yet read three things right (measured on BE9441): a
histogram's vector sum (0.503 where Blastware and the unit say 0.385 -- the
decode checker's open finding), the mic peak (0), and a sensitive range. So the
unit's own 0C channel peaks, mic and vector sum are overlaid, as Series 4 does,
except an impossible vector sum (below the largest channel; BE9441's 0C read
-0.0, bench #4), and the unit's range is passed through for the stored samples.
Store consequence: new live MiniMate downloads only; existing rows and files are
untouched; no backfill, no migration. The record type still reads 'Waveform'
for a live histogram until #41 (record type from STRT[18]) lands from the decode
checker's branch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
The unit escapes 02/03/04/10 in every reply and S3FrameParser keeps the 10 of
10 02/03/04, so on the raw SUB 1A bytes an escaped mode, rate or interval
shifted every field after it: BE9441 at Histogram / 4096 sps / 2 s read back as
0 sps and a 4098 s interval (bench 2026-10-29), and a Continuous unit read as
Single Shot. The four anchor fields are now read from unescape_reply(data):
mode anchor-7, sample rate anchor-6, interval anchor-4, record time anchor+6 --
measured on all four distinct recorded replies, two of them Blastware's own
writes (15 min, then 2 s). The old 'anchor-7 = constant 0x10' was the escape
before 04 at 1024 sps.
The channel block and strings still read the raw bytes: their label offsets were
measured there and are wrong unescaped (pinned by a test). A reply with no
anchor -- BE9441's monitoring-time 1A answer was its device-info block -- leaves
all four None.
Store consequence: none; this is the live settings read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
STRT[18] is the record-type byte: 0x46 on every one of DL2's 6,577
waveform files, 0x0A on every one of its 63,535 histograms. The decoder
read the type from the filename's last letter, so an event with no
Blastware name -- SFM's own downloads, the call-in path -- or a manual
download ('.QZ0') came out 'Waveform' whatever it was.
The filename is now a cross-check that logs a disagreement; the bytes
win. An unknown byte (Manual / Event / Combo never occur in DL2) is
record_type None with a decode_problems entry, not a guess.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Brings the branch up to dev (41 commits) before the 1c bench fixes, which
touch code dev changed: the histogram reader (#47/#49, bench finding #2), the
v0.32.0 event-time rules, the Blastware file's setup-block fields (#44/#45),
and the decode checker for verifying stored S3 downloads.
One conflict: the top of the Series-III reference's change table -- both sides
added rows; kept all, in date order, CRLF preserved. CLAUDE.md, README,
blastware_file.py, models.py and database.py merged cleanly. Suite: the known
16 failures only (15 test_bw_ascii_report, test_save_imported_bw_without_report_
works_unchanged, which also fails on dev); 1237 passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- A matching event that now fails outright is a regression: compare_runs
walks the previous run's matching rows, so a check that collapses to
one error row no longer hides every field it used to match. Counts
moved are taken over the events both runs checked.
- The default baseline is the newest completed run (run.json written) of
the same scope; a 2,000-event sample is no baseline for a full run.
changes.md names the previous run's scope.
- The PVS saturation carve-out now needs Blastware's OORANGE, a channel
Blastware clamped at SFM's ceiling, and SFM's sum within three channels
at the ceiling -- an unclipped Sensitive-range channel read 8x can no
longer let an 8x sum through.
- 'Fields fully matching' needs a match: an always-empty element proves
nothing. Events without a report are a line of their own.
- CLAUDE.md: histogram PVS described correctly; 35 sub-minute histograms
plus 2 one-minute no-mic ones, not '~37 sub-minute'.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
A mismatch becomes 'accepted' only through a written carve-out whose
evidence does not rest on SFM's output. Saturation: Blastware clamps a
clipped channel to the range maximum and prints OORANGE, while the file
holds counts past full scale. SFM's value must sit at the ceiling
(r - 0.0006 .. r * 1.01), so a Sensitive-range event read 8x high on
SFM's Normal assumption stays a mismatch; a vector sum is accepted when
a clipped channel under it is at the ceiling. series_pairs() is now the
one place waveform rows and interval columns are paired.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Every field the report carries (bar its format version and Blastware's
file name), the notes in order, the job number, the channel list, every
waveform sample and every histogram interval column. Numbers match at
Blastware's printed precision, halves rounding away from zero; N/A and
empty text are no_reference; >100 needs SFM's above-range flag; OORANGE
is a mismatch unless a carve-out says otherwise. Waveform rows pair
cells with the channels still running, so channels that end early
(T438HGTZ.B30W) match, and any row-length disagreement is counted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
decode_blastware_bytes with no filename and no report: the values SFM
produces today in Blastware's field names, its notes, channels and raw
counts, with its Normal-range assumption kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
The reference for the Series 3 decode checker: scalars and value units,
channels, the job number, the user notes in order under their
operator-edited labels, waveform rows as printed (ragged where channels
end at different lengths) and histogram intervals. Seven real DL2
events as fixtures, each covering a case the comparison must handle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Without a paired ASCII report, a Blastware import stored no sample rate,
the record-type byte as its record time (every waveform read "70 s"), a
pre-trigger and sample count read from STRT bytes that are neither, and
blank notes (the reader stopped at the NUL after each label).
- The recording-setup block is found by structure -- 1c 08, the setup
name, NUL -- not by the name "Standard Recording Setup", which 37% of
DL2's files do not use. One match in each of 70,041 archive files.
- Sample rate (uint16 BE, name-42), pre-trigger (f32 BE, name-36) and
record time (f32 BE, name-30). A waveform's sample count is the
decoded count. A histogram gets a sample rate only: Blastware reports
neither a record time nor a pre-trigger for one.
- The setup name and the four user notes by position, as bw_ascii_report
reads them: the labels are operator-editable ("Seis. Loc:",
"Location:", "Project: ").
- STRT now yields only the waveform key.
Verified against Blastware's own _XML.XML event reports for the 70,042
DL2 archive events that have one (2016-2026): sample rate 70,042/70,042,
record time 6,524/6,524, pre-trigger 6,484/6,484, notes 70,042/70,042,
sample count 6,523/6,524 (one waveform the decoder ends 3 samples short;
separate). Events imported with an ASCII report are unchanged -- the
report still overlays.
Not changed: the waveform-time estimate still finds the record time by
the marker; moving it would add a validation constraint for 37% of files
and is to be measured first. The job number is not read yet (2,997
archive events carry one).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
0xA2 is CONFIRM ERASE on a MiniMate and ends a call-home on a Micromate, and the
legacy host/port routes had no identity check: only the MiniMate parser's
inability to read a Micromate's replies stood between Diagnostics' Erase and a
Micromate (phase 1c safeguard, agreed with Brian 2026-10-28).
_require_series3(unit_serial, expected) refuses (409, 'nothing sent') unless the
unit's own serial is Series 3 and, when ?serial= names one, that one:
- POST /device/config (+ /config/project) and /device/events/erase: the serial
connect() already reads -- no extra request;
- /device/rescue (when it writes call-home or erases) and POST /device/call_home:
one SUB 0x15 read (new MiniMateClient.read_serial).
Exempt, with the reason in a comment: legacy monitor start/stop, blind stop, slow
drip, spam -- 0x96/0x97 mean the same on both series (measured), and the rescue
tools must reach a unit too wedged to answer.
Tests: each guarded route refuses a unit answering UM20147 and a different BE
unit with no write call, proceeds for the named unit (normalised), reuses
connect()'s serial where it has one; the blind stop builds no client;
read_serial decodes BE9441's recorded 0x15 reply.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Review of b5037b0 (measured on 12 recorded SFM compliance reads): the read
keeps three escape bytes from its reply headers, so every real config image is
refused by write_image -- correctly, but only after 68 and 73 had been sent,
with a message saying nothing was. All four blocks are now checked first; the
test feeds the block exactly as SFM's read produces it and asserts no frame is
sent (two went out without the check).
Config push stays unusable on purpose: fixing that read alone would let the
compliance encoder write some fields to the wrong bytes (e.g. 4,096 sps as
4,112) while the image still passes. The rework -- logical read, encoding at
measured offsets with #48, a diff check, N pinned per SUB, an idle check, the
start/stop safeguards on POST /device/config -- is recorded in the spec and on
#46. Start/stop frames are unchanged (verified byte-identical by the review).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Measured against every Blastware request on record: the uploaded Feb-Apr 2026
captures (3,869 frames, 3,869 re-encode exactly) and BE9441's two sends on
2026-10-26 (26 write frames). A write is the standard 16-byte request plus its
data, every 02/03/04/10 escaped, SUM8 checksum; the length field is the data's
length. A config block starts with its own length N and is written as N + 2
bytes: event index (68) and trigger (82) as read plus 02 00 / 00 00 (constant on
15 sends), waveform data (69) and the 2,092-byte compliance image (71) whole.
The compliance image goes in addressed chunks (params[2:4] = address): 512 bytes
tonight (Blastware 10.74), 1,024 in March.
- framing.build_bw_write_frame: uniform escaping, SUM8, length = len(data).
RETRACTED: 'only BW_CMD doubled', the 'DLE-aware checksum', 'offset = data[1]
+ 2' -- fitted to frames still holding their escape bytes ('data 91, offset 90'
was 90 bytes and one escape). It got 7 of every 13 frames in a write wrong.
- protocol.write_image(): unescapes (callers may pass the parser's form), adds
the trailing two bytes to an N-byte block, and REFUSES anything else before a
byte is sent -- an edit beside a kept escape byte (the old encoder's anc-9
hazard) leaves an image one byte long.
- write_compliance_config_raw: 512-byte addressed chunks, then confirm 72.
- read_event_index / read_waveform_data_raw unescape before slicing (a block
holding 02/03/04/10 came out short); new read_trigger_config (SUB 0x2E).
- apply_config reads the unit's trigger block. RETRACTED: the block
'hardcoded from 3-11-26 -- no read exists'. Blastware reads it; byte 5 has
been 01 / 03 / 04 by unit and session, and the March copy (03) would have
changed BE9441's (01).
- The call-home write (7E) goes through write_image: its 127-byte 'read + 00 00'
is the 126-byte image (N = 0x7C). No Blastware 7E is on record here -- that
one is inferred from the other 77 write frames.
Tests: tonight's 26 and every Feb-Apr write frame rebuilt byte for byte; each
block as read written exactly as Blastware wrote it; the parser's form; the
stray-byte refusal; the reads against the unit's recorded replies; apply_config
writes BE9441's own trigger block. Six mutants, each caught. The old
test_write_frames.py (25 tests that had been skipping) runs now that the
captures are here, rewritten to the measured model.
Not yet sent to a unit: a config push changes settings, so its first live use
is a bench session with Brian. No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
README: the intro no longer calls the Series-IV binary codec 'on the roadmap';
a v0.32.0 status entry; the ingest and Database sections describe the restamp
and estimate rules; the NULL-timestamp roadmap item points at #52.
CHANGELOG: v0.32.0 dated 2026-10-27, when its content was final.
TOOL_VERSION comment: times come from the event record, not the name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
Second start through SFM, BE9441 2026-10-26 23:54:41: acked 0x69, and Brian saw
'starting, performing sensor check, recording' -- but the read-back's single
SESSION_RESET + POLL went out 2.3 s after the ack, inside the ~30 s sensor
check, and was never answered or re-sent (504 after 120 s, audit ca7b5b42).
Brian: every unit is set to sensor-check before monitoring, ~30 s, then
'Recording...'.
- MiniMateProtocol.wake(attempt_s, deadline_s): SESSION_RESET + POLL re-sent
every attempt_s until the unit answers, then the POLL data step; a named
timeout at the deadline. Reads only. MiniMateClient.wake() wraps it.
- The Series-3 change: after a START, the first read waits S3_SENSOR_CHECK_S
(30 s) before asking; every read then wakes with retries (every 5 s, up to
60 s). A stop is unchanged -- its read-back was confirmed three times tonight.
Tests: a unit deaf for 4 probes is asked a 5th time and answers; a unit that
never answers ends in the named timeout after ~6 probes; a start's first read
waits the sensor check, a stop's does not; every read is preceded by a wake.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Brian's requirements: the instrument's data is the only time source; a filename
is a cross-check, never a fallback (an event SFM receives itself has none).
The record (found by reading a seismo_lab Inspector dump; Series-III reference
§7.8.9): 00 28 05 00 ?? ?? | fe 80 | trigger | stop, times dd mm yyyy(BE) 00 hh
mm ss. Measured on 7,935 waveforms (DL2 + prod store): exactly one candidate
validates in every file; trigger = Blastware's report 1,320/1,320, = filename
7,935/7,935, = the unit's 0C record 10/10.
Provenance (requirement 6, measured): in Blastware's download of 8 BE9441
events the record -- with 24 B before and 22 after -- occurs exactly once in the
unit's own A5 reply payloads; SFM-only downloads (no Blastware) carry it too.
It is instrument data, not Blastware's.
- _embedded_event_record(): every fe 80 before the footer is a candidate; it
counts only with the lead bytes, two well-formed times (zero byte zero),
footer ts1 <= trigger <= stop, stop = footer ts2 or a second before, and a
length matching the record time. Exactly one must count; none or several is
a decode problem, never a guess.
- Without one: the footer estimate, timestamp_source 'estimate', a
decode_problems entry, a WARNING. No filename fallback.
- A filename that disagrees is logged; the decoded time is kept. A paired
report fills in only without a validated record (apply_report_to_event, the
sidecar dict overlay, event_to_sidecar_dict) and is logged when it disagrees.
- decode_blastware_bytes(raw, name=None): no file or name needed;
save_imported_bw uses it (no temp file). Event gains timestamp_source and
decode_problems; the sidecar records both.
- Histograms unchanged (#51): their record (fe f5) is noted, not used.
Tests: raw bytes with no name (ZI0, 7 BE12844 oracles), a disagreeing name, each
validation rule alone, two valid candidates, no filename fallback, report
precedence, sidecar. 7 mutants, each caught. Real data, decoded with no name:
7,961/7,961 waveforms on the record, 0 disagreements with filename or report;
10,433/10,433 prod histograms unchanged. Suite: only the 16 known failures.
Open (reported, not changed): 3 DL2 files named as waveforms whose body the
waveform codec does not recognise keep the footer start, 4 s off, as on dev.
None in prod.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
Series-3 waveform times carry Blastware's own (from the filename), re-stored
events move their rows instead of duplicating, prod's ISO-dated reports are
read, mic-off / mic-on sub-minute histograms decode right (#47, #49), Micromate
.h5 samples are on Thor's own scale (#42). Plus the Series-4 live protocol,
read-only client and setup decode (no shipped code path yet) and the SFM
Diagnostics tab.
TOOL_VERSION 0.31.0 -> 0.32.0: the deploy owes backfill_sidecars.py --force
--reparse-txt, backfill_thor_events.py, backfill_event_shape.py (~2 h on the
NAS), rehearsed on prod's 2026-09-30 store snapshot -- see Migration.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
Brings fix/waveform-time-restamp (847900b, abb671a, 3948dc1): insert_events
restamps a re-stored event's row by its Blastware filename; a paired report's
ISO-dated event time is read and survives a backfill; a waveform's time comes
from its filename. Deploy rehearsal on prod's 2026-09-30 snapshot (11,827
files): waveforms 1,016 -> 1,394 of 1,394 on Blastware's exact time, every id
kept, no row lost or merged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
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
Measured on BE9441 tonight, through the recording bridge:
- Monitoring flag 0x0B while recording a histogram (confirmed at the unit), 0x00
idle. Only 0x10 had been measured as monitoring (BE11529, 2026-04-08), so the
status showed 'not monitoring' and the change path refused the state as
unknown(0x0B) -- refused, not skipped, which is the design working. 0x0B joins
S3_RUN_STATES and S3_MONITORING_FLAGS as measured. The shared status's
'monitoring' now follows the change path's reading: None for an unmeasured
flag, never a guessed False.
- Free memory 0x000D0E04 arrived as 0d 0e 10 04. The parser keeps the 10 of a
10 02/03/04 escape, so every field counted from the end read one byte off:
419.84 V and 251,655,168 bytes for 6.76 V and 983,028. New
framing.unescape_reply() (also used by parse_strt_end_key) runs first.
Tests: the two recorded replies (idle 16:24, monitoring 18:47) decode to the
unit's own values; each escaped value in the last ten bytes decodes; the status
mapping for 00 / 10 / 0B / unmeasured. No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Measured 2026-10-26. A sub-minute histogram block is [00][segment][ctr LE][0a]
(5 bytes), then one record per interval of BIG-endian peak / half-period pairs
per channel, then 0000 and one more word, then a 7-byte trailer. A record is 20
bytes with the mic and 16 without (4 x channels + 4); the standard 32-byte block
is the same thing holding one record. The last block is short, not padded: it
holds only the intervals recorded and ends on 9c 06 00 42.
#47: a mic-off histogram (16-byte records) decoded to nothing, so a Blastware
import carried no histogram data and SFM's download check would refuse it.
BE9441's K441LTOK.QZ0 (2 s, 22 intervals; fixture) now matches its Blastware
export on 66/66 peaks and 66/66 frequencies.
#49: the old reader took the mic-on records as little-endian from byte 6 -- the
same bytes shifted by one, identical while every high byte is zero. It also
required byte 5 to be 0 (the first record's Tran peak high byte) and read the
last block at full stride, trimming what it overran.
Regression over every DL2 histogram with a Blastware ASCII export (13,089
files, interval counts + every geo peak, frequency and mic dB): old reader
13,087 exact, new 13,089. The two the old one got wrong were one interval each:
K440KZP4.560H #4764 (Long half-period 1 read as 257, mic peak 389 as 133) and
M462KZUD.6R0H #145 (mic peak 6 read as 262).
Walk: blocks follow by block_ctr + 1, or the next segment every 256 blocks; the
last block is bounded by its terminal tail; with no terminal tail the old
trimming rule remains as the fallback. Mic-off records give m_peak None and an
empty MicL channel, as a mic-off waveform does. Inferred, not yet seen in a
file: mic-off 1-minute (28-byte) and 15 s / 5 s mic-off strides.
Not fixed here, noted on #47: half_period_to_hz assumes 1024 sps (512/hp); the
2048-sps histogram's frequencies are 1024/hp.
Operational: a decoder change -- needs a TOOL_VERSION bump at release, then
backfill_sidecars.py + backfill_event_shape.py (~2 h on the NAS) to regenerate
stored histograms. No schema change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
The event-time fix makes a Blastware report's Event Time + Event Date
authoritative over the binary, which gives the trigger only to the second.
On prod's own data it never applied (measured on the 2026-09-30 store
snapshot, all 81 report-paired Series-3 waveforms):
- every one of those reports writes Event Date as ISO ('2026-08-14');
_parse_event_date read only 'August 14, 2026', so event_datetime was None
(Brian's own laptop writes the long form -- it follows the PC's settings);
- the sidecar's bw_report block never stored the event time, and
apply_bw_report_dict_to_event -- the backfill's overlay -- never set it.
The binary's trigger matched Blastware's printed time on 66 of the 81 and was
a second late on 15; 8 of those 15 hold the right time in prod today, so the
release backfill would have made them a second worse.
- _parse_event_date accepts ISO dates too (81/81 now parse to the time
Blastware printed; 0/81 before).
- _bw_report_to_dict stores event_datetime (additive key).
- apply_bw_report_dict_to_event applies it, as apply_report_to_event does.
Prod's sidecars were written by the old parser, so the deploy runs
backfill_sidecars.py with --reparse-txt to re-read the saved .TXTs.
Tests: both date forms, the round trip through the saved block, a block with
no time, and the backfill (--force --reparse-txt) on a prod-shaped row.
Suite: only the 16 known fixture failures.
Codec-library change (report parser): TOOL_VERSION to be bumped at release.
No schema or DB migration.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
Follow-ups from the review of 887e75d (verdict: keep, with fixes; no critical).
- The cap: a caller's max_chunks (client.py passes 128) now bounds only a walk
whose end is unknown. With STRT it cut every event past ~66 KB short --
2,545 of 63,500 archived histograms are bigger (the review's count, DL2).
Strict raised; legacy sent a TERM for most of the event, or a bare ValueError.
- A STRT claiming less than one 0x200 chunk, or more than 4 MiB (a sanity bound,
not a measured limit), is refused as a misread, in both modes -- once a bare
ValueError and a 500.
- TERM is sent only for a true tail (< 0x200). After an early end the legacy
walk returns what arrived and sends none.
- build_5a_request wraps build_bw_frame; the old 5A helpers are marked
superseded (kept for tests/test_5a_protocol.py) and their imports dropped.
Tests: all 8 recorded events (were 4) walk exactly as Blastware and rebuild its
own files; an end key holding escaped bytes; a 300 KB event past a 128 cap; both
misread-STRT refusals; the 1A frames BE9441 answered post-fix; the checksum
vectors retargeted. Mutants the review saw survive (no STRT un-escape; a
standard-request escape revert) and 3 new ones are each caught.
Measured on the way: a reply's checksum is SUM8 of its unescaped payload,
748/748. The 'S3 checksums frequently fail' note was the parser summing its
own kept escape bytes; noted, parser unchanged.
Docs: the crossing count corrected to four (events 1, 3, 5, 7); the remaining
stale 5A sections in CLAUDE.md annotated; the write-frame suspicion recorded as
inferred only. No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
A recording of Blastware downloading all 8 of BE9441's events (three crossing
a 64 KB page; tests/fixtures/minimate-bench-10-26-26-blastware/) settles it:
every one of its 748 requests is the standard 16-byte payload with a SUM8
checksum and every 02 / 03 / 04 / 10 byte DLE-escaped -- 748/748 re-encode
byte-identically. A 5A request is not a special frame: it is that payload with
a 2-byte LENGTH (0x0200 per chunk, the remainder for TERM) and a 4-byte linear
ADDRESS. The walk is the event's start, +0x200 at a time carrying into the page
byte, then TERM at the next boundary for exactly the remainder.
What the old model misread: the fixed 'offset 0x1002' is length 0x0200 escaped
(10 02 00); the first event's 'metadata pages at 0x1002/0x1004' are its chunks
at 0x0200 and 0x0400; the 16-bit counter could not leave the key's page.
- build_bw_frame escapes the four values (was 0x10 only); new s3_stuff().
- build_5a_request(address, length); parse_strt_end_key() -> the full 32 bits.
- read_bulk_waveform_stream: one linear walk, no event-1 special case; strict
mode keeps every refusal; an end at or before the start is refused as a
corrupt STRT (a page crossing is no longer refused -- it downloads).
Tests: all 540 Blastware 5A requests and all 208 others rebuilt byte for byte;
SFM's walks for events 0, 1, 3 and 7 send exactly Blastware's requests and,
fed Blastware's recorded replies, build whole events. In-page requests are
byte-identical to before. No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Bench re-run 2026-10-26: BE9441 events 2 (0111c92c) and 19 (0118a4ca) end in
the next page, so STRT's 16-bit end offset reads lower than the start. The walk
then failed in bulk_waveform_term_v2 with a ValueError ('end_offset 0x2F06 must
be > last_chunk_counter 0xC92C') that the adapter's struct.error mapping did not
catch: a generic 500. Strict mode now refuses such an event by name right
after the probe -- 'crosses the unit's 64 KB page boundary ... the known 5A
page bug; not saved' -- before any chunk is sent. Not stored either way. The
page bug itself is unchanged (CLAUDE.md: needs a BW capture of a spanning event).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
BE9441 never answered 5A chunk 0x7D06 of event 01122f06 -- twice (bench
2026-10-25 and 2026-10-26), each time rebooting ~11 s later. The request ended
'... 02 03': build_5a_frame wrote the checksum bare, and 0x02 is STX. Sent with
the checksum escaped ('10 02 03') the unit answered in 28 ms; so did chunk
0x7F06 (checksum 0x04) and 0x8B06 (0x10, which bare reads as DLE+ETX), and the
event downloaded whole and verified (21,504 x 3, peaks equal to the unit's).
Escape set {02, 03, 04, 10}: a Micromate's, measured on 251/251 THOR requests;
the MiniMate's own de-stuffing keeps 10 02/03/04 literal. About 1 chunk
request in 64 has such a checksum, so roughly half of all multi-chunk downloads
hit one.
Not changed (no evidence either way): build_bw_frame escapes only 0x10 in its
checksum; a keyed read whose checksum is 02/03/04 is untested. The BW 5A
byte-perfect tests skip on this box (captures absent) -- worth running where
they exist. No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Review of 352f694: the metadata-page detection fixed every observed stream but
was one case of a general rule. An A5 header is 12 bytes in the stripped sense
(TERM's 11); its raw length is 13 whenever the echoed address carries an inner
DLE pair -- the metadata pages at 0x1002 / 0x1004, but equally a sample chunk
or TERM boundary that lands there (inferred: ~1 in 128 events spanning
0x1000-0x1200, not in any capture). _raw_skip() counts it per frame, the way
probe_skip already did; _has_metadata_pages is gone. The reviewer measured
the rule reproducing the shipped bodies byte for byte on all 26 current-walk
streams on this box. Test: a chunk moved to 0x1002 yields the same body.
No DB or schema change; TOOL_VERSION not bumped (the file builder changed, the
.h5 decode did not).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Review of d73a27d: _await_poll_or_boot no longer reset the parser and pending
frames the way _recv_one(reset_parser=True) did, so a reused protocol object
with half a frame left over failed startup (UnexpectedResponse A4 vs A5).
Restored. Also: the banner check now runs before the tail is trimmed (a read
carrying >48 bytes after the banner lost it), and a banner caught during the
200 ms drain is reported, so startup goes straight to the re-poll loop instead
of the full timeout. Tests for all three.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
BE9441 on a serial cable (bench, 2026-10-25) twice sent "Operating System"
~3 s after the port opened and ignored the POLL sent before it; the request
then failed at the full receive timeout (502 after 15 s on /device/info, 504
after 120 s on a download). After a mid-download reboot it answered 8.8 s
after its banner -- the one measured readiness point.
startup()'s first POLL now stops waiting the moment the banner arrives (that
POLL will never be answered) and polls again every 2 s for up to 20 s. Without
a banner nothing changes: a silent unit fails at the normal timeout, with no
re-polling. Only SESSION_RESET and POLL are sent, so this is safe in front of
the change path too.
No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
BE9441 rebooted mid-download at the bench (2026-10-25): the chunk at 0x7D06
got one stray byte and then silence, the 5A loop logged "unexpected end-of-
stream -- proceeding to TERM", the TERM got no reply either, and the short event
(17,920 / 17,920 / 17,408 of 21,504 samples) was stored as a success.
read_bulk_waveform_stream(strict=True) now raises on every early end: no STRT,
a metadata page or chunk with no reply, a mid-stream terminator, the chunk cap,
or no TERM reply. get_events passes it for the strict walks (headers_only,
only_key) and, in strict mode, re-raises a 5A error instead of logging
"metadata unavailable" and returning the event without frames. The legacy
full walk is unchanged, call for call (strict passed only when on).
Tests replay BE9441's recorded session through the real MiniMateClient: whole,
event 1 comes back in full; with the 5A stream quiet from chunk 40 while the
walk is still answered -- the bench's reboot -- it raises "ended early".
No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
extract_body_bytes() and write_blastware_file() skipped 13 bytes on A5 frames
1 and 2 unconditionally, as if they were the global metadata pages (0x1002,
0x1004). Only the event-1 walk fetches those; a non-first event goes straight
from the probe to sample chunks (skip 12), so every non-first event SFM built
lost two bytes and decoded truncated (BE9441 event 1: 1,024 / 2,782 / 512
samples instead of 21,504, peaks far low). Frames now say which they are: each
A5 reply echoes its address, and both 0x1002 at frame 1 and 0x1004 at frame 2
must match. Rebuilt from the bench's logged bytes, event 1 decodes 21,504 x 3
with peaks equal to the unit's own 0C values.
Fixtures: BE9441's raw replies for events 0 and 1 (force-added).
Operational: affects only Series-3 files SFM assembled itself (live downloads,
bridges/ach_server.py) for non-first events -- not Blastware's own files, which
is what the production store ingests. Such files are two bytes short; their
.a5.pkl sidecars can rebuild them. No DB or schema change; codec unchanged
(TOOL_VERSION not bumped).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
BE9441 (MiniMate bench, 2026-10-25) answers b"BE9441\x00?": six characters,
the terminator, a leftover byte. rstrip(b"\x00") kept the "?", so the serial
read "BE9441\x00?" and the serial-named path refused every request as the wrong
unit (409). Seven-character serials fill the field to the terminator, which is
why no earlier unit showed it. The legacy /device/info output is cleaned too.
No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Final fix wave for phase 3 (start/stop monitoring), per the whole-phase review.
- I1 + M2: every failure after the send has started is a ChangeUnconfirmed
(audit_id, sent = "acknowledged" | "unknown", the cause's HTTP status) whose
message says the frame was sent and names the audit record -- the ring in
place of the ack, the four lost-ack follow-ups, and the three read-back
paths. Series4Session releases the line on it. Every audit finish goes
through one helper; a finish that fails is AuditIncomplete (500) and still
says what happened to the unit. The line is kept.
- I2: device_commands gains `sent` (1 acknowledged, 0 nothing sent, NULL
unknown) and `states` (before / seen / after), with an idempotent ADD COLUMN
in _migrate for a table created earlier on this branch.
- M1: a RADIO RING already buffered is caught before 0x96/0x97 goes out
(pre_send = read_unsolicited, one 10 ms transport read). That is a
CallHomeInProgress with sent=0, not ChangeUnconfirmed.
- M3: Series 3 reads the raw 0x1C flag (new MonitorStatus.state_flag); a byte
other than 0x00/0x10, or a short section, is unknown(...) and refused.
- M8: even_if_already on a unit already in the state notes that the read-back
proves nothing.
- M10: a scan pins `.protocol.execute(` to sfm/device_access/s4.py; both
scans fail closed on a file that does not parse.
- M11: docs corrected (CLAUDE.md phase-2 sentence, phase-3 bullet, REST list;
micromate/protocol.py scope and the 0x49 read_state docstring; s4.py; route
docstrings). "No command has ever been originated" is NOT retracted.
- M12: GET /db/device_commands normalises the serial.
- Minors: unused imports, S3 dry-run frames and 120 s timeout pinned, test
rename, serial-cache and short-0x49 tests, _RUN_STATES comment.
Schema: two NULLable columns on the branch-new device_commands table, added
by _migrate on open; no backfill. No codec change, TOOL_VERSION unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
One lost 1F reply made the list return 1 of 3 events as a 200, and on a
download gave a false 404. The list also ran on the 120 s download
timeout, so each lost reply stalled the walk 120 s with the unit locked.
- get_events() strict mode (headers_only, or only_key): a lost 0A reply,
a lost 1F(browse) reply on the success path and on the partial-record
path all re-raise their ProtocolError; a 1F that hands back a key
already walked raises ProtocolError("event chain did not advance ...").
Legacy calls (none of the new options) behave exactly as before --
pinned by tests of the same three faults under get_events().
- Series3Adapter.list_events runs on the default timeout (10 s on TCP);
download_event keeps 120 s.
- FakeProto gains optional lost-reply injection; its default is unchanged.
The repeat-key guard sits at the loop head, which is reached only for a
non-null key -- equivalent to checking each 1F's key, in one place.
Read-only; nothing new on the wire. No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Series3Adapter.download_event compared the timestamp only after
download_event_by_key had run the whole 5A. A stale id cost a full
download of the wrong event (minutes on cellular), could surface the
64 KB-page 502 instead of 409, and a lost 0C reply was reported as "the
unit was erased".
- get_events() gains only_key_timestamp: with only_key, if the target's 0C
says another time (or none), the target takes the existing bypass --
no 1F(arm), no POLL, no 5A. A new branch only; it adds no command.
- download_event_by_key(key4, *, expected_timestamp=None) passes it on.
- The adapter converts the id's stamp to that ISO form and checks, in
order: no event -> 404; no readable 0C timestamp -> 502 MalformedReply
("could not read ... record (0C)"); a different time -> 409 StaleEvent;
no frames -> 502.
- The fake's download mirrors the real walk (no frames on a mismatch) and
records what it was asked for.
- Legacy get_events() (none of the new options) is pinned by a test of
its exact call sequence and 5A arguments, written before the change.
Read-only; nothing new on the wire. No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
list_event_headers() walks every event's 0A/1E/0C/1F without starting a 5A.
download_event_by_key() downloads one event in full and walks past the others
without their 5A, stopping once it has it. Both ride two new keyword options on
get_events() (headers_only, only_key); the default path is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Follow-up to the ts1→ts2 fix: get the trigger to the second from the binary
alone, instead of falling back to the stop time (~record-duration late) for
no-report events.
The configured post-trigger record time is a big-endian float32 in the
recording-setup config block, exactly 30 bytes before the "Standard Recording
Setup" marker. _parse_record_time_seconds reads it; the waveform branch now
stamps trigger = ts2 - record_time. Verified: the field reads 1.0 / 2.0 / 3.0 s
across different setups in the corpus, and all 7 BE12844 oracle events now
decode to their exact Blastware trigger (N844LQHB 10:33:29) from the binary,
no paired .TXT needed. Falls back to ts2 (the stop) if the config block is
absent. A paired report's event_datetime stays authoritative (clock drift).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YDXjZCr4RqT2U3QvMDhgzf
read_blastware_file built ev.timestamp from footer ts1, which for a WAVEFORM is
the monitoring-session start (a unit arming at 06:00 stamps 06:00 on every event
that day) — so every waveform's time was hours off (vomit-list #3, "~4.5 h off").
The event time is footer ts2 (the recording stop); BW's displayed Date/Time is
the trigger = ts2 - record duration.
Root cause proven against the BE12844 oracle set: 5 of 7 events decoded to the
identical 06:00:13 (the shared session start); ts2 gives distinct plausible
event times (N844LQHB ts2 = 10:33:32, BW trigger 10:33:29 = ts2 - 3.0 s rectime).
* read_blastware_file now uses ts2 for waveforms (discriminated by which codec
decoded the body, not the filename — save_imported_bw passes a tmp name).
Histograms keep ts1 (the ~24 h window start, which IS the event time).
* Binary-only decode can't get the exact trigger: the STRT record-time byte is
a misparsed record-type marker (0x46=70), so ts2 (the stop, ~record duration
after the trigger) is the best estimate. A paired BW report carries the exact
trigger — apply_report_to_event now overlays event.timestamp from
report.event_datetime, matching the existing build-path override (line ~441).
Tests: waveform → ts2, histogram → ts1 unchanged, report → exact trigger.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YDXjZCr4RqT2U3QvMDhgzf