SFM reaches Series-4 parity, and reads most of Blastware's report from the event file alone.
What changes
Series-4 parity (feat/series4-sfm-parity). One device door, by serial, for both series. Each change is audited, identity-checked, sent once and read back. Benched on BE9441 and UM20147.
reads and downloads
start / stop monitoring
call-home on / off
settings changes: preview → send → read back
It also fixes MiniMate request framing (#46) and the 5A walk across a unit's 64 KB page.
The file-only decode, groups A–D.47 of Blastware's 88 report fields now match on every DL2 event, about 6 before v0.33.0. Eight more match on all but one or two of 6,524 waveforms.
Fixed:
Sensitive-range events no longer read 8× high
the histograms that decoded wrongly now decode
histograms are no longer a day late
every histogram's start and stop are Blastware's own (#51)
the unit's serial, version, calibration and battery
the trigger source and levels
each interval's frequencies, vector sum and time
the peak dates and times
a waveform's time of peak and peak acceleration
Events are identified by unit + time + type (UNIQUE(serial, timestamp, record_type)), so a waveform and its histogram may share a second.
Prod still overlays a paired ASCII report onto the decode. Retiring that overlay is the plan's step 3, not part of this release.
Verified
Decode checker, all 70,112 DL2 event files: every fix proven by a full run with 0 regressions. After the parity merge, the run matches pre-parity dev on every verdict of every event.
Migration and backfills rehearsed twice on a copy of prod's 2026-09-30 snapshot (15,432 events), before and after the parity merge, with identical results:
migration: every row identical, integrity ok
backfill_sidecars.py: 11,944 files, 0 errors; 9,852 Series-3 histograms moved +1 s in place, 0 refused, no id lost, review state untouched; the 209 same-second waveform/histogram pairs now coexist
backfill_event_shape.py: exit 0, cleared_stale 0
Suite: 16 known failures, 1,566 passed.
Deploy
⚠ Schema migration plus an overnight backfill. Full notes are in CHANGELOG Migration.
Back up seismo_relay.db.
Deploy. SFM migrates by itself on first start: it re-keys events and creates device_commands.
In the sfm container, run python scripts/backfill_sidecars.py. TOOL_VERSION 0.34.0 gates it, so no --force. ⚠ About 64,000 events, roughly 12 h on the NAS. It moves every Series-3 histogram time +1 s in place.
Then run python scripts/backfill_event_shape.py --db-path bridges/captures/seismo_relay.db --store-root bridges/captures/waveforms.
Terra-View needs no change: twins pair by peak values, and rows are read by id.
**SFM reaches Series-4 parity, and reads most of Blastware's report from the event file alone.**
## What changes
**Series-4 parity** (`feat/series4-sfm-parity`). One device door, by serial, for both series. Each change is audited, identity-checked, sent once and read back. Benched on BE9441 and UM20147.
- reads and downloads
- start / stop monitoring
- call-home on / off
- settings changes: preview → send → read back
It also fixes MiniMate request framing (#46) and the 5A walk across a unit's 64 KB page.
**The file-only decode, groups A–D.** **47 of Blastware's 88 report fields now match on every DL2 event**, about 6 before v0.33.0. Eight more match on all but one or two of 6,524 waveforms.
- **Fixed:**
- Sensitive-range events no longer read 8× high
- the histograms that decoded wrongly now decode
- histograms are no longer a day late
- every histogram's start and stop are Blastware's own (#51)
- interval frequencies follow the sample rate (#50)
- **New from the file:**
- the job number
- the unit's serial, version, calibration and battery
- the trigger source and levels
- each interval's frequencies, vector sum and time
- the peak dates and times
- a waveform's time of peak and peak acceleration
- **Events are identified by unit + time + type** (`UNIQUE(serial, timestamp, record_type)`), so a waveform and its histogram may share a second.
Prod still overlays a paired ASCII report onto the decode. Retiring that overlay is the plan's step 3, not part of this release.
## Verified
- **Decode checker, all 70,112 DL2 event files:** every fix proven by a full run with 0 regressions. After the parity merge, the run matches pre-parity dev on every verdict of every event.
- **Migration and backfills rehearsed twice** on a copy of prod's 2026-09-30 snapshot (15,432 events), before and after the parity merge, with identical results:
- migration: every row identical, integrity ok
- `backfill_sidecars.py`: 11,944 files, 0 errors; 9,852 Series-3 histograms moved +1 s in place, 0 refused, no id lost, review state untouched; the 209 same-second waveform/histogram pairs now coexist
- `backfill_event_shape.py`: exit 0, `cleared_stale` 0
- **Suite:** 16 known failures, 1,566 passed.
## Deploy
⚠ **Schema migration plus an overnight backfill.** Full notes are in CHANGELOG *Migration*.
1. Back up `seismo_relay.db`.
2. Deploy. SFM migrates by itself on first start: it re-keys events and creates `device_commands`.
3. In the `sfm` container, run `python scripts/backfill_sidecars.py`. `TOOL_VERSION` 0.34.0 gates it, so no `--force`. ⚠ About 64,000 events, roughly 12 h on the NAS. It moves every Series-3 histogram time +1 s in place.
4. Then run `python scripts/backfill_event_shape.py --db-path bridges/captures/seismo_relay.db --store-root bridges/captures/waveforms`.
Terra-View needs no change: twins pair by peak values, and rows are read by id.
Fixes #46
Fixes #50
Fixes #51
#44 and #45 stay open for their Micromate half (no closing statement recorded yet). #48 stays open.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Parity of jobs with Series 3 for regular comms and settings (identify,
status, settings, events, download, monitor log, start/stop, call-home
enable/disable, setup push); Series-4 emergency tools deferred. A single
device-access layer: series from the serial prefix, identity confirmed
before any write, a per-unit lock, an 0xA2 opcode guard, read-back
verification of every change, distinct error codes, and an audit table.
Series-4 sessions ("stay on the line") now; Series-3 sessions after a bench
test of MiniMate hangup/DCD behaviour.
Includes the fix list found in the 2026-10-19 inventory, the to-be-added
table, and the RX55 container idea as a parking-lot item.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Brian's principle: talking to a Series 3 or a Series 4 unit is identical for
the user; only the serial prefix and each model's settings differ, and the
adapters absorb the rest.
Five places the draft broke it, now fixed: units are named the same way
(serial + address, no-serial kept only as a legacy Series-3 path); one set
of series-neutral response models with series-only fields under `detail`;
one opaque event_id for both; a uniform 501 "not supported for Series N
yet" instead of missing routes; and the webapp brought into scope with the
same screens for both. Adds an adapter table, contract tests that keep the
two adapters honest, and notes that existing Series-3 response shapes move
to the shared models (the webapp updates with them; Terra-View does not
call /device/*).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Nothing breaks between phases: the shared models apply when a request names
the unit by serial, and the legacy Series-3 path stays as it is until the
webapp (1c) and watch_unit.sh move over.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Ten tasks, test-first: the is_open fix, two client reads, core types, the
per-unit lock, both adapters, Series-4 sessions with ring safety,
DeviceAccess with the reaper and the contract tests, the endpoints, and a
read-only bench check on UM20147.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
0x06 content[0:4] moves from the bench tool into the client, tested against a real UM20147 read and its chain-walk count. read_unsolicited() reads without sending, for spotting RADIO RING on an idle session.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
The /device guard let every non-UM serial through before its held-line
check. FastAPI drops an undeclared `serial`, so `?serial=BE18193` on a
legacy route still ran Series-3 code at an address holding a Series-4
line -- the hole the guard exists to close. Serial-aware routes go
straight to DeviceAccess, which refuses that case itself; everything
else is checked. baud is no longer parsed (it is not in the address
key, and pydantic's coercion made "38400.0" a second way past).
Also, from the same review:
- RingWatchTransport clears its frame state on every write, so a stray
STX on an idle line cannot hide the ring that answers the next request.
- Series4Session.is_open reads _client once; held_serial() calls it
without the unit lock, and a concurrent hang-up between two reads was
an AttributeError (a 500).
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
get_event() now delegates to fetch_event(), which returns (blob, result).
The same peak-vector-sum self-check applies, so a DecodeMismatch still stops
the bytes from being stored. get_event() keeps its signature and behaviour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
THOR's watcher (and Blastware's ACH) store every event through
/db/import/idf_file and /db/import/blastware_file, with the paired report.
Storing a download of the same event afterwards overwrote that richer copy:
on Series 4 the file, .h5 and sidecar were rewritten (extensions dropped);
on Series 3 the row lost PVS, project strings and ZC frequencies and was
repointed at a second, review-less file set.
persist_download now looks up (serial, timestamp) first. A row there is
returned as it stands -- inserted false, detail.already_stored true -- with
no store call, no insert_events and no sidecar write. Never merge.
- DownloadedEvent gains `timestamp` (the unit's own event time) and
`record` (Series 4's 0x0C fields); both adapters set them.
- The Series-3 `event is None` guard now runs before backfill/save, with a
message that is true there ("nothing was stored").
- Tests build the watcher's state exactly as the import endpoints do and
prove the row dict, the sidecar bytes and the file mtimes are unchanged.
No schema change, no migration, no codec change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Without Thor's TXT report, save_imported_idf fills only the three PPVs.
The unit's 0x0C record -- already read for the list and the stale check --
also gives the peak vector sum and the sensor location, and they were
dropped: Terra-View showed a blank PVS, and find_twins (which matches on
PVS) could not link the event to its histogram twin.
persist_download now overlays DownloadedEvent.record onto the bridged
event before insert_events, filling only fields the file left empty
(creating PeakValues / ProjectInfo when absent). Not the mic: its 0x0C
decode reads a denormal, parked.
The sidecar is written by save_imported_idf before the overlay, so it
still has no vector sum; the DB row does. No schema change, no migration.
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
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
minimateplus's _extract_record_type returns "Waveform" for every 0C
record layout -- it cannot tell a histogram -- so a MiniMate histogram
was listed as "waveform". The fake's "Histogram" was a value the real
client never produces, which is why no test saw it.
- _s3_ref: record_type is always None, with
detail.record_type_note = "Series 3's event record does not say
waveform or histogram; not decoded yet".
- default_s3_events(): both events "Waveform", as the real client gives.
- The shared-shape contract test allows exactly {"record_type"} to be
None for Series 3 and nothing for Series 4.
Rows SFM stores for Series 3 still carry "Waveform" from the decode (the
same as the legacy blastware_file route); parked in the spec. No codec,
store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- Series4Session's docstring now states which errors keep the line: an
op raises a DeviceError only for a verdict on a healthy link (not
found, stale, unnameable), and _exchange keeps the line for those; any
library error means the link is suspect and hangs up. DecodeMismatch
is a library error and hangs up -- conservative. Later ops must keep
to it.
- Test: a micromate TimeoutError mid-download, on a fresh DeviceAccess
(no retry path), is NoAnswer, closes the client once and leaves no held
line. It pins existing behaviour; a mutation that keeps the line on
library errors makes it fail.
- README, event rows corrected in place: another unit's id is 422 (not
409); a stale id is 409 without downloading, both series; an event
already stored -- including by THOR's watcher -- returns its row and
changes nothing (detail.already_stored); MiniMate lists give
record_type null, on the normal timeout, and fail on a lost reply.
No code behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- New section "Left open by the phase 1b review (2026-10-21)", after the
1a one: twelve one-line items, each naming the phase it matters to
(retry re-running a whole download, last_used after a kept-line error,
verified:null's two meanings, mic naming + the S4 0x0C mic denormal,
500 detail text, the serial as a directory name, no server-level ring
test, S3 stored record_type, a fresh S4 download's gaps, orphan files,
same-second collisions, 423 Retry-After).
- The 1b bullets now give the owed MiniMate bench check's scope: a 3+
event list (1F(browse) after 1E(arm) without 1F(arm)), a non-first
event, a histogram (capture its 0C), an event past 64 KB (the named
502), a stale id (no 5A), and a dropped reply via mm_link-style fault
injection.
- The 1b "Download" bullet's "refreshes the row" is retracted in place:
the final review changed it to "returns the row, writes nothing".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
tests/fixtures/ is gitignored, so these were never committed. Since phase 1b
the test fakes read them, so on a fresh clone every test that builds a fake
Micromate -- phase 1a's included -- failed with FileNotFoundError. Same
precedent as tests/fixtures/micromate-setup/: UM20147's own bench events.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
micromate/opcodes.py holds WRITE_SUBS and the cross-series collision 0xA2.
MicromateProtocol._send reads the SUB of the bytes about to go out
(framing.request_sub) and refuses any write SUB not in allowed_writes, and
0xA2 unconditionally. Docstrings now say the reads-only policy is enforced.
request_sub also refuses any frame not in canonical form
(stuff(unstuff(body)) == body): an interior unescaped 02/03/04, a 10 XX
outside {02,03,04,10}, or a trailing lone DLE. What the gate checks is then
exactly what the unit parses.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
READ_SUBS catalogues every read; a SUB in neither table is refused, and
allowed_writes may only name catalogued writes. Tables are MappingProxyType,
_send checks the exact bytes it writes, check_transmit documents precedence.
Tests cover unknown opcodes, concatenation smuggling and table immutability.
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
The final fix wave's AuditIncomplete landed in _exchange's `except DeviceError`,
which keeps the line -- so on the nine ring / link-fault paths (and a refusal) a
failed audit write turned a hang-up into a held Series-4 line, blocking a THOR
call-home for up to the 5-minute idle hang-up and making "SFM hung up" false.
AuditIncomplete now carries release_line, set by every finish whose path hangs
up anyway, and _exchange honours it. Also pins the Series-3 change path's
retry=False again (the rewritten lost-ack test no longer could).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Bench, 2026-10-25, Brian's go per send: 0x96 acked in 464 ms and read back
monitoring at the first 2 s poll (during the sensor check); 0x97 acked in
116 ms, then 0x49 read a new value 0x01 for ~18 s (inferred: the unit's
call-home attempts after a stop) before idle; two stops to an idle unit acked
in 10 ms and changed nothing. Retracts "no command has ever been originated"
in place in CLAUDE.md and the reference's untested list; answers the spec's
stop-while-stopped question.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
4b911b1 (and its subject line) called UM20147's start/stop "the first commands
this project originated". The retracted CLAUDE.md line was always about Series
4: the minimateplus stack has sent Series-III writes (start/stop, config push,
erase, call-home config) since April 2026. Narrowed in CLAUDE.md and the
Micromate reference.
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
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 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
Series 4 downloads were checked (decoded PVS against the unit's); Series 3's
were stored unchecked (verified=None), so BE9441's two bad files went in as
successes at the bench (2026-10-25). verify_s3_download(): if the waveform
decodes, all three geophone channels must be the same length and each peak must
be the unit's own 0C peak to one 0.005 in/s step, or the download is refused
(MalformedReply, "not saved"). Unverified (stored, as before): no waveform
decode -- a histogram; 0 of ~430 fixture histograms decode as one -- or a
sensitive-range unit, whose scale is still open. The reason goes in
detail["check"].
A test puts the metadata-page bug back and the check refuses the file it
produced. Session-replay helpers move to tests/minimate_replay.py.
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 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
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
3898d03 rewrote docs/instantel_protocol_reference.md with LF endings (a 7,327-line
diff for 3 added lines). CRLF restored; the file's real change is the 3 lines.
Also: BE9441's 21,504 samples are 5 s record + 0.25 s pre-trigger at 4096 sps,
not '+ 1 s' (reference row, fixture README, test comment).
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
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 36f4e5d (measured): with the metadata-page bug put back, 4 of 7
BE12599 non-first waveforms decoded to nothing, and the check stored them
unverified as 'a histogram' -- the worst form of the bug it was built for.
Now: no waveform decode must decode as a histogram (stored unverified) or it is
refused; a waveform's record chain must end on its END record (0x06), as the
file reader requires -- cut-short streams have none; the structure checks run
for every unit and only the peak comparison is limited to a unit confirmed in
normal range (geo_range == 0; an unread range is no longer assumed normal);
a clipped blast at full scale on both sides counts as a match. Tests pin the
one-step tolerance, both ranges, the END record and the neither case.
No DB or schema change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
c32a9e7 made the download check read the 5A body; the Series-3 fake handed
back placeholder frames (['frame']), so 4 plumbing tests in
test_device_access_s3_events.py and test_device_access_event_dispatch.py
failed with "'str' object has no attribute 'data'" -- and that commit was
pushed without the failure set being read. The fake's one-event download now
carries what a real one does: BE9441 event 1's recorded frames, their decoded
waveform and the unit's own peaks for it. Those tests now see verified=True
on a whole event. Suite back to the 16 known fixture failures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Review of 75d79ec / d73a27d (mutation): removing the chunk-timeout raise went
unnoticed because the TERM raise also said 'ended early', and the no-STRT,
metadata-page, mid-stream-terminator and chunk-cap raises had no test at all;
a re-poll without SESSION_RESET passed because the test double ignored it.
Each refusal is now pinned by its own message, each verified by removing it
(bytecode caching off -- same-second, same-size rewrites reuse a stale .pyc).
The strict tests use the shared replay helpers, which load either fixture.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Re-review of 64273c0: nothing pinned the TERM skip -- a TERM cut one byte off
loses a byte after the END record, invisible to every decode and peak check.
Golden sha256 of both fixtures' bodies and written files (event 0's file is
byte-identical to the one SFM stored at the bench before any fix; event 1's is
the bench's 25,810 bytes plus the 2 recovered), and a TERM moved to 0x1002.
The clipped-blast test now sits two steps past full scale (32032 counts), so it
needs the carve-out. Spec: the TOOL_VERSION reason corrected (no stored file
is affected); a MicL-only waveform is now refused -- failing safe, bench-check.
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
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
Series-III reference: a 2026-10-26 row (5A checksum escape, measured), and the
2026-10-25 row's guessed cause of the mid-download reboot (battery, firmware)
retracted in place -- it was our request. CRLF kept. Spec: the re-run, item
by item, and what is still owed. CLAUDE.md: the phase-1b bullet brought up to
date.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Brian's Blastware downloads of BE9441's 20 events give ground truth. SFM's
re-run downloads of events 0, 1, 3, 4 and 10 are byte-identical to Blastware's
own files; imported first through the watcher route, the same events download
as already_stored (no duplicate rows -- the unit's 0C and Blastware's file agree
on serial + timestamp). Fixtures: Blastware's P00/Q10 (now asserted equal to
SFM's builds) and QZ0/T80, the two page-crossing events, as byte-exact targets.
The 64 KB page bug, narrowed by a read-only test walk: carrying the page byte
addresses the first chunk in page 0x12 (answered), but the next request carries
a raw 0x03 inside its params (counter 0x032c) and gets no reply. Pages after
0x11 have such counters; 0x11 does not (event 1 skips 0x0000-0x05FF). Needs a
Blastware wire capture of event 2 or 19 (recorded in CLAUDE.md, the Series-III
reference and the spec). No code 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
CLAUDE.md: the KNOWN BUG entry marked fixed (887e75d) with what settled it, and
retraction notes under the 5A sections that described the misreading (partial
stuffing, offset_hi 0x10 raw, 11-byte params, metadata pages 0x1002/0x1004).
Series-III reference: a 2026-10-26 (3) row. Spec: the MiniMate check updated.
Code comments that called the page bug open, updated; the adapter's struct.error
mapping kept as a defence, its message and test no longer naming the old bug.
Verified live on BE9441 the same day: all 8 events downloaded by serial, the 4
that cross a 64 KB page included, each whole and matching the unit's own peaks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Brian's Blastware files from the recorded session (events 0, 1, 3, 7 -- three
cross a 64 KB page) as fixtures; SFM's walk, fed Blastware's recorded replies,
writes each one byte for byte. Live the same day, SFM's own downloads of all 8
events were byte-identical to Blastware's (sha256), the 4 crossings included --
and events 2-5's shorter sample counts (20,490-21,011 vs 21,504) are in
Blastware's files too: the unit's own recording.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
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
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
Tonight's bridge recording of BE9441 (16:08-19:06) as a fixture, with
Blastware's files: Blastware's and SFM's requests in order (1,596, 722 of them
5A, 722 A5 replies), two Blastware config writes, SFM's stop, and three events.
Event 2 is a 4,096-sps, 2 s histogram of 71,088 bytes -- 139 requests, two 64 KB
crossings.
Measured live the same evening (SFM through the bridge, read-only downloads):
SFM's files for events 1 and 2 are byte-identical to Blastware's (sha256), the
71 KB histogram included -- the first event past the old cap downloaded from a
unit. Event 0, the mic-off histogram, was refused ('decodes as neither'), as
expected on this branch: its decoder fix (#47) is on dev.
The test, fed the recorded replies with max_chunks=128: SFM's walks send
exactly Blastware's 139 and 118 requests and rebuild both files byte for byte.
Reverting the STRT-sized cap (8acb951) fails it. No code change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
BE9441, 2026-10-26 23:41:48 (through the bridge): SFM's start (0x96, Blastware's
own bytes) was acked 0x69 and the unit began monitoring -- Brian saw it -- but
the read-back sent one bare 0x1C two seconds later and got nothing for 120 s,
so the change reported 'sent and acknowledged, but reading the state back
failed' (504, audit 0c1cf813). Nothing was retried.
A monitoring MiniMate ignores a bare request until SESSION_RESET + POLL
(measured 2026-04-08). The read-back had relied on the connect's wake; a stop's
read-back (18:53, the unit idle by then) never needed it. Every state read in
the change now goes through _woken_state: client.poll() (41 03, POLL, 41 03,
POLL -- the connect's own sequence), then 0x1C.
Test: after the send, every 0x1C read is preceded by a POLL. No codec, store or
DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
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: stopping by command or keypad with ACH enabled makes the unit call home
and upload events + MLG, which can take minutes. Fits UM20147's 0x01 after a
stop (10-25). Owed: measure a MiniMate stop with ACH on, through the bridge.
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
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
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
One block of sfm_webapp.html (/* <device-routing> */) holds every rule that
decides where a /device/ request goes or whether a series-specific control is
live: seriesFromSerial, unitQuery, deviceUrl, confirmedSeries, controlsFor,
changeSummary, downloadSummary. No DOM, no fetch, so the tests run it in Node.
The safety rules it pins: a control follows the unit's own /device/info answer,
never a typed serial alone, and stops counting when the serial is edited;
Diagnostics only for a confirmed Series 3, Hang up only for Series 4; config and
call-home writes off for both series until phases 4-5. Also a test that the
page's inline scripts parse together (shared global scope).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- A Serial field beside host/port. With one, the Live tabs use the serial-based
endpoints (both series); without, every read behaves as before.
- The series badge, Hang up (Series 4), Diagnostics (Series 3), call-home read and
the disabled config/call-home writes all follow applyControls() <- controlsFor()
on the unit's own /device/info answer; editing the serial, host or port drops
the confirmation. Erase additionally needs a confirmed Series 3.
- Every /device/ request goes through deviceRequest/deviceFetch <- deviceUrl
(a static test enforces it); the legacy per-event routes joined deviceUrl
(event_waveform / event_file, index in the path).
- The status panel and Device tab read both shapes (shared and legacy).
- In serial mode the connect skips the legacy storage_range read (one connection
fewer; a Micromate has no such route). Start/stop without a serial behave as
before; with one, only for a confirmed series.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- Load events with a serial lists the shared EventRef shape as a table: index,
time, type, PVS and the three peaks (or —), each row with its own Download.
- Download POSTs the row's event_id; SFM checks and stores it. The status bar
says what was stored (or that it already was), and the stored event opens
in the viewer. A refusal shows the server's detail verbatim.
- eventView() (device-routing block, Node-tested) reads both event shapes for
the table, the chips and the peaks bar.
- A list loaded without a serial keeps the chips and the per-index Load /
Save / Download buttons, unchanged; for a serial-loaded list those buttons
are off with a tooltip pointing at the rows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- With a serial, Start / Stop ask first ("Start monitoring on BE9441?"), then
POST once to the audited change -- never retried; both buttons stay off while
it is in flight, so a double click cannot send twice.
- The status bar shows changeSummary() of the ChangeResult, on a 409/502 too
(dry run, already-in-state, confirmed a -> b, or the outcome and read-back);
an error without one shows its detail verbatim; no reply from SFM says the
command may have been sent and where to look, rather than that nothing was.
- Then one status read updates the panel. The legacy 5 s confirm poll is not
used in serial mode; with a blank serial start/stop are unchanged.
- Diagnostics' Stop, which goes the same way in serial mode, shows the same
summary; deviceFetch errors carry it for any non-200 ChangeResult.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- Config, with a serial: Read shows the unit's shared UnitSettings (setup,
record mode, sample rate, record time, histogram interval, geo trigger,
notes; — for null) in place of the write form. settingsRows() is in the
device-routing block, Node-tested; the rows are rendered as text, since
setup names and notes come from the unit.
- Write stays off for both series (and without a serial), tooltip
"Coming in phase 5 (#46)"; Call Home write likewise, "Coming in phase 4".
- Call Home read follows controlsFor().callHomeRead; for a confirmed Series 4
the tab says "Not yet available for Series 4".
- Diagnostics: every button follows controlsFor().diagnostics (Task 3), and a
refresh for anything but a confirmed Series-3 unit sends nothing and says
why. Its requests carry the typed serial, so the server guard checks it.
- Without a serial the legacy reads are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Task 3's brief asked for them and they were missed: with a serial, the panel
now shows UnitStatus.device_time and event_count, "—" where null (Series 3
reports both as null). Without a serial the two fields stay hidden.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- CLAUDE.md: a 1c entry under Where things stand (serial mode, what follows
the unit's own answer, writes off until phases 4-5, the Node-run page tests)
and the legacy-route guard in the REST API notes, with why the stop tools
are exempt.
- Spec: the 1c build status; the ring-path Runs A/B are still owed before
serial mode is used on a unit that calls home to THOR; which parked 1c items
the page settles (CORS: same origin; the S4 mic is not shown).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- The arrow keys reached the legacy per-index waveform route in serial mode,
even with no list loaded (an unlocked MiniMate chain walk + 5A on the same
modem session). perIndexLive() is now the one rule for the per-index
buttons, the chips and the keyboard: live only for a list loaded without a
serial that has events.
- A failed reconnect left the previous unit's confirmation live (badge,
Diagnostics incl. the unguarded blind/slow-drip stops, call-home read).
connectUnit() now drops it before it identifies; only this answer confirms.
- Unit strings reached innerHTML: the Device tab's cards (active_setup, new in
1c) and its compliance/project tables now render as text, and Diagnostics'
error spans go through escapeHtml().
- CLAUDE.md: the ring-path Runs A/B are a merge gate (the spec's prerequisite
to a webapp sending serial), not only a use-time one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- micromate reference: the watchdog can check every 5 s, hourly or never
(Brian, operator-reported). The 10-14 "reconnects continuously" describes
that THOR's setting, not fixed behaviour; whether a check holds the line,
and how a call-home reaches THOR with the watchdog off, are unmeasured.
- spec, ring-path test: the old setup ("a unit THOR is not otherwise
watching") would not test the production path, since THOR receives a
call-home on its own connection. Revised: UM20147 as a THOR test unit; Run 0
baseline with the watchdog off; Run A with SFM holding the line; Run A2 and
Run B at the fleet's watchdog setting; after the 1c bench pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
GET /device/monitor/status?serial=UM...&run_state=true adds
detail.run_state = {code, name}. For the ring-path bench test: the code
during and after a call-home (0x01 for ~18 s after a stop, inferred to be
call-home attempts; 0x03 = calling home) is what the test watches. Opt-in
because it is one more round trip (~0.65 s on cellular); a plain status read
is unchanged. Series 3 has no 0x49 and ignores it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Asks the bench SFM for a Micromate's status on a fixed interval (Run B) or
once (Run A), with run_state=true, and logs each answer with its time as JSON
lines: HTTP status, seconds, the raw 0x49 code, and the detail of any refusal
(503 call-home-in-progress / could-not-connect). Read-only on the unit;
refuses :8200.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
C:\THORDATA\Logs\ (Brian). From the 2026-10-29 log: the watchdog reads each
unit's serial every ~15 s; Unit_CommandOutOfRange follows every ReadUnitStatus
for every unit (fleet-wide noise); after a manual THOR disconnect UM20147
answered neither SFM nor THOR's own reconnect ("Mismatch connection found").
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- Spec: the 1c bench pass on BE9441 and UM20147, each on its own modem, and
its 16 findings (a new 'Left open by the 1c bench' section). Ring-path
results, measured: with THOR's watchdog off a call-home reaches THOR when
nobody holds the line (Run 0, via ListenerAchTcp) and is lost when SFM holds
it (Run A: the unit times out and does not retry); with THOR polling, SFM gets
no reply and THOR is undisturbed (A2, step 1). Decision owed before merge:
the Micromate line hold.
- Micromate reference: retracts 'ListenerAchTcp never used' in place (it
accepted tonight's call-home; port 12345); a call-home that rings on another
receiver's connection is lost; a second TCP connection while THOR holds the
line is accepted but silent.
- CLAUDE.md: 1c status, the open decision, THOR's log location.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
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
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
BE9441 over a modem, 2026-10-29: the start was acked, but the modem closed the
line during the ~30 s sensor check, so the read-back's first wake hit
'[Errno 32] Broken pipe' and the change was reported 503 'not checked' although
the unit was monitoring. On an OSError in the read-back, a TCP unit is now
reconnected once, its serial checked against the named unit, and its state read.
Nothing is re-sent: the start still goes out exactly once. A serial cable is
never reconnected (opening a MiniMate's port reboots it), a second failure or a
silence (a cleanly closed line) ends 'not checked' as before, and a different
unit after the reconnect is refused (409, change unconfirmed).
Store consequence: none.
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
- Spec (Left open by the 1c bench): #1b320a53, #89492e49, #9ce441a0, #2 via the
dev merge 342c696; #15 retracted in place (sent NULL = unknown, by design).
- Series-III reference: a 2026-10-29 row -- the SUB 1A settings fields read after
unescaping (mode -7, rate -6, interval -4, record time +6), the old
'anchor-7 constant 0x10' was the escape before 04 at 1024 sps, the channel
block stays on raw bytes (open: a float containing an escapable byte), and a
monitoring BE9441 answers 1A with its device-info block. CRLF kept.
- CLAUDE.md: Batch 1 status.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
The reconnect in ce441a0 opened a fresh connection and sent a bare 0x15 (the
identity check) before any SESSION_RESET + POLL. It exists for a unit that has
just started -- sensor check, then monitoring -- and a monitoring MiniMate
ignores a bare request until woken (measured 2026-04-08), so the identity read
would have timed out and the start reported unconfirmed anyway. Now: open,
wake (the same retried wake the read-back uses), read the serial, read 0x1C --
the order the status read and the legacy write routes use. Still one
reconnect, TCP only, nothing re-sent.
The fake gains bare_requests_ignored (off unless a test asks): a fresh
connection's reads time out, with the real client's TimeoutError, until woken.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
persist_download checked 'already stored' on the unit's 0C time only, but a
histogram's row is stored at its file's time, a second earlier on most
histograms (#51): K441LTOK.QZ0 decodes to 16:06:34, its 0C says 16:06:35. So a
live download of an event the watcher had imported missed the check and
re-stored it -- UPSERTing over the watcher's row (Blastware's ZC frequencies and
vector sum lost) and rewriting its sidecar as sfm-live -- and every repeat live
download rewrote the files again.
New SeismoDb.find_event_by_blastware_name(): the row stored under the same
Blastware name (the event's second, per blastware_filename_time; the rule
_restamp_by_file uses), matching a direct name to the call-in copy's W/H name.
Any other name matches nothing. Also two comments from 9492e49 that said the
opposite of the code (the unit's peaks are overlaid; source.kind is a parameter).
Store consequence: none for existing rows; no schema change, no migration.
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
- Spec: #1, #8, #9 carry their review follow-ups (a72d3a9, 3a1d34a, dbd8a91);
new open finding 17 (a monitoring MiniMate's 1A has no range, so a download
then stores Normal-scaled samples; ':S338.17' setup name; no .a5.pkl kept).
- Series-III reference (CRLF kept): the 2026-10-29 row records that the write
encoder was not moved and now refuses a patch that would not read back.
- CLAUDE.md: the three fixes.
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
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 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
Since the decode checker's histogram-PVS fix (625bc39, merged 6945009) the file
reads a histogram's vector sum as the unit stored it: K441LTON.900 stores
0.200 / 0.385 / 0.255 and a vector sum of 0.3852, as Blastware's report (was
0.503). The 0C summary, read at fixed offsets, can shift (BE9441 read 0 and
-0.0, bench #4) -- and a shifted value can look plausible and pass the
impossible-value guard. So the row now takes the file's channel peaks and
vector sum.
Only when the unit's settings confirm Normal range: the file reader computes
every peak as if the range were Normal (_GEO_SENSITIVE_FS_INS is defined but
unused), so a Sensitive unit's file peaks are 8x off (the checker's 33
waveforms). For Sensitive, or a range not read (a monitoring unit's 1A has no
settings), the unit's own peaks stand, as before. The mic is always the
unit's: the file still reads it as 0. The 0C peaks remain the download check.
Store consequence: new live downloads only; no backfill, no migration.
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
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
With the decode checker's fixes merged (histogram vector sum 625bc39, mic psi
5644dbd, the file's geophone range 4844135), the event file reads everything
Blastware reports. So a live download's row and samples are now the file's:
peaks, vector sum, mic -- and the geophone range from the file's own setup
block, the setting when the event was recorded. The live 1A is the unit's
setting now, which may have changed since; it is the fallback only when the
file's range does not read.
Measured: K557J1KB.RQ0W (Sensitive waveform) downloaded with its settings unread
-- e.g. while monitoring -- stores 0.019 / 0.055 / 0.019 and PVS 0.061,
Blastware's report; its .h5 read 0.155 / 0.44 (8x) before. M010HR6K.OA0H
(Sensitive histogram) likewise. K441LTON.900 (Normal) stores Blastware's
values whatever the unit's current settings say, and its mic is 5.80e-4 psi
(Blastware: 106.0 dB(L)).
The unit's 0C summary stays the download check, and fills in the channel peaks
and vector sum only when the file's range does not read (never seen in DL2) and
the unit is not confirmed Normal -- the impossible-vector-sum guard kept there.
The mic is the file's always. Closes the range part of open finding #17.
Store consequence: new live downloads only; no backfill, no migration.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
New Appendix D.6 records the bytes and DL2 verification for every field
SFM reads from a Blastware event file: record type STRT[18], the
recording-setup block (sample rate k-42, pre-trigger k-36, record time
k-30, the four notes), the geophone range (label+29), each histogram
interval's PVS^2, and the mic scale (0.25 Pa per count, dB offset
81.9384). None of these were written down outside code and issues.
Retracted in place:
- D.3.1's STRT[20] = record time: it is 00 on 70,041 / 70,041 DL2 files.
- the 2026-08-26 reading of sub-minute histogram records as little-
endian: big-endian from byte 5 since v0.32.0 (#47/#49), and the
'2-word tail' is the PVS^2. Also in CLAUDE.md.
Measured for #48 (files only): the 1A 'stable anchor' be 80 00 00 00 00
is the setup's pre-trigger -0.25 s plus 00 00. It is present only on
the 3,886 / 6,541 DL2 waveforms recorded at exactly -0.25 s, and on no
histogram. The live 1A read is still unmeasured.
CLAUDE.md: Where things stand reflects the range fix on dev (6,524 /
6,524 waveforms exact); the 8x sensitive-range item and the MicL dB
item are marked resolved in place.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
The pre-trigger float in an event file's setup block varies from event
to event on the same unit, often on the same day (BE18193: -0.25 and
-0.248 on 2026-08-21; 253-256 samples at 1024 sps, -0.002 to -0.249 s
at 4096 sps), and Blastware reports the same per-event value as
Pre-triggerLength. So it is the event's own pre-trigger, and the note
written earlier today overstated what the files say about #48: the live
1A holds the setting, so a missing anchor in a file says little about
whether the live read loses its anchor. #48 stays open.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
The setup block has Series IV's 0x1A layout here too: report flags at
k - 9 (bit 0x02 = job number shown) and the number, uint16 BE, at k - 8,
kept while switched off. The flag matches Blastware's JobNumber on
2,997 / 2,997 DL2 events that print one and 66,986 / 66,986 that don't.
Every printed value is 1 and matches; hidden ones hold real numbers
(802, 1012, 1013, 622), so the value is only proven for 1.
- ProjectInfo.job_number_enabled / job_number, named as in
micromate.setup_block.
- write_event_hdf5 stores both as .h5 attrs when read (additive).
- The checker reports the number only when shown, and scores a number
only SFM shows as a mismatch. The old test that pinned JobNumber as
sfm_blank now checks only the ZC cases it also covered.
Not carried into the DB, the API or the PDF report yet (needs a column).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Stack-wide rule since 2026-11-02 (terra-view docs/tmi-stack.md, Terra-View's
rule 4): no inline JavaScript, because a test cannot load it. This page's tests
had to regex their code out of the HTML. Batch 2 edits both of the page's
scripts, so they come out first, verbatim:
- sfm/static/device_routing.js: the tested routing rules (157 lines)
- sfm/static/sfm_webapp.js: the rest of the page (2,274 lines)
The page loads them with <script src="static/..."> where the inline scripts
were, so load order and the onclick handlers are unchanged. Verified: putting
the files back inside those tags reproduces the old sfm_webapp.html byte for
byte, and a jsdom page check (served at http://sfm.local/, /static from disk,
no network) gives identical output before and after.
The server serves sfm/static/ at /static/, with Cache-Control: no-cache so a
browser revalidates (a cheap 304) and a new SFM never runs a cached old
script. Opened from disk, the page needs its static/ folder beside it.
Tests: the routing tests load the file instead of regexing the HTML; new
test_webapp_static pins no inline <script> in the page and the /static route
(through the whole app, middleware included).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Three causes behind the histograms the checker found decoding wrongly:
1. The file decoder tried the waveform codec first, whatever the record
type. It accepted BE9440 / BE9557 / BE17354's 2018 5 s histograms and
returned ~5x too many 'samples' (K440HDXX.XH0H: SFM 44,504, Blastware
6,976). The codec now follows STRT[18] (0x46 / 0x0A on 70,041 /
70,041 DL2 files); only an unknown type falls back to trial order, and a
chosen codec that fails is a decode problem rather than a silent switch.
2. The sub-minute layout check required each record's 'zero word' to be
0000. It is the high word of the interval's PVS squared, non-zero above
1.28 in/s, so a one-block histogram with a loud interval was not
recognised (T193KR5M.X90H, K440HA3C.JM0H, R352HFZ7.530H decoded to
nothing). The check is now the measured relation peak <= PVS <=
sqrt(3) * peak, which holds on 34,502,955 / 34,502,955 DL2 sub-minute
intervals. The no-terminal-tail trim uses the same test. Two test
builders wrote PVS bytes no real record has (one still in the retracted
little-endian layout); they now write peak^2 in the measured layout, and
the retraction test keeps a legacy builder of its own.
3. Checker carve-out interval-count-is-duration: Blastware's Number of
Intervals is (stop - start) / interval from the footer times, and its
own interval table lists one block fewer when the unit never wrote the
last minute. SFM matches the table (T193KSWP.FF0H: 2,880 vs 2,850).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
- #6 Config tab by serial: the empty legacy edit form stays hidden (settings
are read-only until phase 5); the settings box shows from the start, 'Not read
yet', and a different unit's settings are never left on screen.
- #10 A start/stop that went out but was not confirmed is no longer called
'failed'. The route now adds 'sent' (acknowledged / unknown) and 'audit_id'
to a ChangeUnconfirmed -- same status, same message -- and the page says
'Start monitoring not confirmed: <what happened, audit record>'.
- #12 Device tab by serial: the empty legacy Compliance/Project tables are
hidden behind a pointer to the Config tab; a Micromate's Firmware card reads
'Thor line (version not read)' (its version string is in 0x01, undecoded).
- #16 A 504 with nothing sent adds: the connection opened, so the modem is
reachable -- another program (THOR or Blastware) may be holding the line, or
the unit is busy. Measured 2026-10-29: THOR polling leaves SFM a 0-byte 504.
New logic lives in sfm/static/device_routing.js (firmwareLabel,
deviceErrorText, changeErrorText, serialPanes) under Node tests; the page glue
in sfm_webapp.js only applies them. Checked in jsdom against the real page
(served at a fake origin, /static from disk): all four, legacy mode unchanged,
no script errors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
run_change named its change and its target state from a start/stop bool. A
ChangeKind (action, want, became) now says what the change is called and which
state read back means it took; monitoring_change(start) gives exactly today's
names, call_home_change(enabled) the new ones. An optional snapshot hook
records what the unit holds after the change in the result and the audit row
(never the verdict; one that raises is recorded as its error).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- micromate: ENABLEABLE_WRITES gains 0x7E/0x7F (the call-home write and its
confirm; spec row 9, enable/disable only); MicromateClient.get_call_home_content()
returns the 126-byte 0x2C content.
- sfm/device_access: CallHomeState (serial, series, enabled, dial_string, detail
with byte5 and the whole block); s4_call_home_state reads bit 0 of [5] and the
dial string at [6:46]; s4_change_call_home runs the shared change core with
micromate.writes.plan_call_home_enabled -- built from the read run_change made
just before, and that same plan is the one sent. A unit calling home (run
state 0x03) is refused, nothing sent. The read-back judges the edited bit
only; the snapshot records both blocks and every changed offset -- [118:120]
is unit-maintained and always moves.
- The write-ceiling tests take 0x71 (the setup write, phase 5) as their
over-the-ceiling example now that 0x7E is enableable.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- 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
Ground truth: Blastware changing BE11529's call-home settings on 2026-04-20
(Remote Access -> Setup Unit), paired raw files of what it sent and what the
unit answered: the read, the enable (read 0x00 -> wrote 0x01), the disable
(read 0x01 -> wrote 0x00). From the unit's own read before each write, SFM's
0x7E frame (call_home_image + build_bw_write_frame) is Blastware's byte for
byte -- nothing but byte 5 differs from the read -- and the 0x7F confirm too.
Mutation-checked: inverting the byte SFM writes fails the test.
S3_CALL_HOME_FRAME_VERIFIED is now True; the gate stays tested shut by
monkeypatch, and a test pins that its comment names this proof.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- DeviceAccess.call_home_state (a read) and set_call_home (change=True: never
retried, audit required for a live change, dry run without one), routed by
series like start/stop. A config write is read back on its own window: up
to 3 reads, 1 s apart, not the monitoring one.
- Routes, serial required (422 without), all three serial-aware: the state as
a dict; enable / disable through _change_response, so their statuses are
start/stop's and an unconfirmed change carries sent + audit_id. The legacy
GET / POST /device/call_home are unchanged (a Micromate serial is still
refused there, 501).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
device_routing.js (Node-tested): call_home_state / call_home_on / call_home_off
routes (serial required); controlsFor gains callHomeChange (by serial, a
confirmed Series 3 or 4) and callHomeRead now covers a Series 4 by serial;
serialPanes gains callHomeForm / callHomeBox; callHomeRows renders the switch
(On / Off / 'Unknown (byte 5 = 0xNN)'), dial string and series;
changeErrorText takes the whole label ('Start monitoring', 'Enable call-home').
sfm_webapp.js: by serial the Call Home tab hides the legacy multi-field form
(Series 3 by host only) and shows the unit's switch with On / Off. Each asks
confirm(), sends one audited change, reports it with changeSummary /
changeErrorText, then re-reads quietly so the change's own result stays on
screen. A different unit's switch is never left showing. The new buttons are
wired with addEventListener, not onclick= (no inline JS).
Checked in jsdom against the real page: placeholder, read, Off (confirm, the
disable route, 'confirmed -- enabled -> disabled'), a serial edit clearing it,
legacy mode unchanged, no script errors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Two test-side breaks, found by the full suite after phase-4 task 6:
- test_micromate_framing's three whole-session tests pinned exact counts of a
gitignored corpus (bridges/captures/9-24-26 - micromate2, a symlink into the
main checkout). The full copy of the BW VM's captures on 2026-11-02 added
sessions: 287 responses / 241 reads / 287 requests, every one passing the same
per-frame checks. The counts are now floors (>= 251 / 218 / 251), so a lost
file still fails and a grown corpus does not.
- test_micromate_opcodes' beyond-the-ceiling permit took 0x7E, enableable since
the call-home commit (eeb55ef); 0x71 (the setup write, phase 5) replaces it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
call_home_image returns the unescaped N + 2 image, but the send path handed it
to write_call_home_config, whose write_image unescapes again -- and unescaping
is not idempotent: a real 0x10 before 02/03/04 loses its 0x10. A call-in time
of 16:02-16:04 (hour 0x10) is exactly that. One such time made the send refuse
before the wire yet audited as 'sent, acknowledgement lost'; two made it send a
block shifted by two bytes from [101] (num_retries and the time fields wrong).
The Blastware-frame test could not see it: it checked the image builder, not
the bytes the protocol framed.
- MiniMateProtocol.write_call_home_image(image) frames a built image once
(0x7E, ack 0x81, 0x7F, ack 0x80), raising ImageRefused before any byte when
it is not a whole block; write_call_home_config (the legacy multi-field path)
is write_image once + that. Its stale 127-byte docstring is gone.
- MiniMateClient.write_call_home_image uses it.
- The Series-3 change passes is_refusal=ImageRefused, so a pre-wire refusal is
audited as nothing sent (sent = 0), not as a lost ack.
Tests drive the real client -> protocol over a stub answering with BE11529's
recorded acks: the unit's own read, a 16:02 time, and 16:03 + 16:04 all go out
exactly as built; a short image is refused with nothing written.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- s4_change_call_home's read_state now returns an unknown(0xNN) run state as
it is, so the change core refuses it (UnitStateUnknown, nothing sent), as
start/stop already does; it checked only for calling_home.
- run_change records the snapshot on the lost-ack path too: after an ack is
lost, what the unit now holds (and, on Series 4, whether [118:120] moved) is
what tells whether the write landed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Every DL2 file ends in a valid footer: 0e 08 and two valid times on
70,041 / 70,041. The decoder took the first '0e 08 + plausible year'
instead, and 14 files also hold an earlier record, ~1.1 KB before the
end, with the stop time followed by zeros:
- a histogram started at its own stop -- a day late on BE9558's daily
histograms (K558L9XP.FK0H: 2025-10-08 19:10:01 for Blastware's
2025-10-07 19:14:08); T003LCYV.JD0H got no time at all;
- a waveform lost its stop, so the trigger was never computed and the
stop was stamped instead (K440I4LG.JK0W: 11:14:12 for 11:14:08).
The last 26 bytes are now taken when they are a footer; otherwise the
old search stands unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Brian's account: units come back from calibration with the internal
battery unplugged, so a comms-test trigger before the date is set
carries the default. DL2 holds 17 such events on 6 units, all within
1995-09-01 12:02 .. 09-03 11:24.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
CLAUDE.md 'Where things stand' now says plainly how prod uses a paired
Blastware ASCII report (save_imported_bw overlays its peaks, notes,
sample rate and record time onto SFM's decode), that only report-less
events run on the decoder alone, and that the overlay is scaffolding to
retire at step 3 of the plan. The checker status is brought up to dev:
18 of 88 fields, the remaining groups A-F in the proposed order.
README roadmap: the same framing and progress.
Protocol reference:
- D.3.3: the footer is the file's last 26 bytes; footer[18:24] is not
fixed (retracted).
- D.6.1: STRT[18] picks the codec.
- D.6.3: the job number.
- D.6.5: the PVS^2 high word is non-zero above 1.28 in/s (retracted
'reads 0000'); the peak/PVS consistency check; Blastware's Number of
Intervals is the monitoring time / the interval.
- D.6.7: refreshed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Group A of the file-only decode, every field matched against every DL2
report (2026-11-03):
- Identity block before the setup name, what the live read gets from
SUB FE: serial k-202, firmware k-147, DSP version k-138, calibration
date k-132 + 'by' k-128, manufacturer k-94, model k-72, firmware
minor k-193. Event.device_info (DeviceInfo gains calibration_date /
calibrated_by). Serial, Version and Calibration 69,983 / 69,983.
- Battery: uint16 hundredths of a volt at k-190 (Event.battery_volts).
69,729 exact; the other 254 are Blastware rounding half up.
- Trigger source: the two bytes between the embedded event record's
lead and fe 80, a bitmask (0x01 Tran 0x02 Vert 0x04 Long 0x08 MicL
0x200 Manual): 6,493 / 6,493. Event.triggered_by.
- Trigger settings in Series IV's 0x1A layout: sources bitmask k-19,
stop mode k-31 (0 = Fixed), each channel's float32 level at
label+30 (geo in/s, mic psi), mic type code at MicL+4 (2 = Linear
Weighting). Geo level 6,447 / 6,447, mic 4,403 / 4,403; Blastware
prints a level when its channel is a trigger source and the event
was not Manual. The mic level's dB uses 6895 Pa/psi (4,272 / 4,272
against 4,271 at 6894.757).
- .h5 attrs for all of them (additive).
- Checker: SFM's side reports the ten fields; the mic trigger level
follows the report's dB/psi. Carve-out
units-is-a-display-preference: dB or psi is Blastware's PC setting
when it wrote the report -- DL2's reports switch fleet-wide in 61
clean runs by write time, and no byte of the file separates them.
Two tests that pinned BatteryLevel / Calibration as blank now pin the
match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
K441LA17.IN0W's report says Units 'in/s and psi(L)' yet prints
MicTriggerLevel '125.0 dB(L)'. The value states its own unit, so that
is the one compared; the report's Units is the fallback. It was the
only MicTriggerLevel mismatch in DL2 (SFM's 0.005158 psi is 125.0 dB).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Measured at the bench 2026-11-03 (BE9441): while monitoring, a MiniMate answers
the 0x2C call-home read with its DEVICE-INFO block ('Instantel', 'MiniMate Plus',
its serial) -- as it answers 1A -- and idle again, minutes later, the call-home
block. SFM writes back only a block it just read, so a monitoring MiniMate's
call-home cannot be changed; the change core already refused (byte 5 read as
'unknown(0x6E)', nothing sent), but said so cryptically.
- minimateplus.protocol.is_call_home_block(raw): the block starts with its own
length 0x7C and is N (or N + 2) bytes unescaped; the device-info block fails it.
- The Series-3 change raises UnitStateUnknown (409) with 'did not return its
call-home settings -- a MiniMate answers the call-home read with its
device-info block while monitoring; stop monitoring first ... nothing sent',
for a dry run too. call_home_state returns enabled = None with that reason.
- The page's callHomeRows shows the reason in place of 'Unknown (byte 5 = ...)'.
A blind write while monitoring stays untested on purpose.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Measured at the bench 2026-11-03 (UM20147): monitoring, a Micromate returns its
real call-home block and ACKS a call-home write, but does not apply it -- three
read-backs unchanged, and its own menu says 'Feature disabled while monitoring'.
SFM now refuses up front (UnitStateUnknown, 409: '... is monitoring -- a Micromate
ignores call-home changes while monitoring ...; stop monitoring first -- nothing
sent'), dry run included, instead of sending a write the unit ignores.
And the block must be the call-home block: micromate.writes.is_call_home_content
checks its header is its own length (00 7C, N = 124 -- 00 7C DC on every read,
UM12947 and UM20147). plan_call_home_enabled refuses any other 126 bytes, the
change refuses before sending, and call_home_state says why (enabled = None).
At the bench this was checked by eye before the monitoring write.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- The page's top bar Firmware read '—' for a Micromate: Batch 2 gave the Device
tab's card firmwareLabel() but not populateDeviceBar. Seen at the bench
2026-11-03; checked in jsdom ('—' before, 'Thor line (version not read)' after).
- save_imported_bw's overlay comment said the waveform codec was undecoded and
gave +-10 in/s; the overlay now stays because production keeps a paired
Blastware report as the record until the file-only decode has no blanks
(flagged by the decode-checker session). Comment only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Benched 2026-11-03 on UM20147 and BE9441 (each on its own modem, one send per
go): idle, a no-op, off and on all acked, read back and confirmed on each unit's
menu; UM20147 accepts 0x00 at [5]. Monitoring, neither series takes a change: a
MiniMate answers 0x2C with its device-info block, a Micromate acks and ignores
('Feature disabled while monitoring'). Series 4 [118:120] is a function of the
block's content -- XOR 0x6D7D per bit-0 flip on two units, not a nonce. A stop's
call-in reached THOR when the ring followed the ack. UM20147's clock is an hour
ahead (DST). Spec, both protocol references (Series III: a CRLF row), CLAUDE.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Brings be5bab4 and its history from the decode checker's branch: a Blastware
file's job number; decode_blastware_bytes choosing the codec by STRT[18] and the
histogram layout check by peak <= PVS <= sqrt(3) peak; the footer as the file's
last 26 bytes (no day-late histograms); docs (reference Appendix D.6, the
file-only status).
Conflicts, both kept whole:
- CLAUDE.md: this branch's 'Narrowed 2026-10-26' 5A block stays, followed by
dev's 'Open, not blocking' line (the 8x sensitive-range item struck out --
resolved by the file's range).
- docs/instantel_protocol_reference.md (CRLF, byte-safe): the change-log rows in
date order -- dev's 2026-11-03 and 2026-11-02, this branch's 2026-11-03
(call home), 2026-10-29 and 2026-10-27 (#46, this branch only).
Suite on the merged tree: 1399 passed, the 16 known failures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Both settings are documented: the unit's Microphone Units (MiniMate Plus
manual s3.9.7, keypad Right Arrow + Setups: psi(L) / dB(L) / Pa(L)) and
Blastware's report preference (Blastware manual s4, Preferences > Units
and Channel). The report follows Blastware's, as DL2's fleet-wide
switches showed. Where the unit's own setting is stored is unmeasured.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Protocol reference:
- D.6.8 (new): the identity block (SUB FE's: serial, firmware, DSP version,
calibration date and 'by', model; battery), the trigger-source bitmask
in the embedded event record, and the trigger settings (sources, stop
mode, per-channel levels, mic type) with their DL2 counts. The
histogram 'terminal tail' 9c 06 00 42 looks like 9c 06 00 + the
serial's B (inferred).
- D.6.6: recorded data vs report units vs unit peaks, with the
MiniMate Plus (s3.9.7) and Blastware (s4) manual sections. Where the
unit stores its own Microphone Units is unmeasured; a keypad test is
proposed.
- D.6.9 (was D.6.7): refreshed, 28 of 88.
CLAUDE.md 'Where things stand' and the README roadmap follow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Group B of the file-only decode, measured on DL2 2026-11-03:
- Frequency = (sample rate / 2) / half-period: 527,915 / 527,915 cells
at 1024 sps and 1,725 / 1,725 at 2048. #50: half_period_to_hz took a
fixed 512 and halved every 2048-sps frequency; it now takes the rate
(default 1024). Blastware prints 'N/A' for a half-period of 0, '>100'
('>200' at 2048) at 5 samples or fewer, '<1.0' below 1 Hz.
- Each interval's vector sum, sqrt(PVS^2) at the event's range:
771,354 / 771,354.
- Interval size: uint16 seconds at k - 40 (Series IV [8:10]).
- Stop: the footer's (2,995 / 2,999 sampled; 4 print a second earlier).
Event gains histogram_interval_sec, interval_half_periods, interval_pvs
and stop_time; the .h5 gains /intervals/half_period/<ch>,
/intervals/pvs_ips and a histogram_interval_sec attr. The decoder walks
a histogram once (histogram_codec.channels_from_records) and takes the
event's PVS from the same records. The checker compares each interval
column, number or Blastware's word; the test that pinned Tran Freq Hz
as blank now pins the match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Blastware prints OORANGE for an interval's vector sum when it exceeds
the range in an interval where Blastware also clamped a channel: 17 / 17
DL2 cells, SFM's sum 10.01 .. 17.33 in/s (sqrt 3 x 10.005). The
saturation carve-out now covers intervals.Geo PVS in/s with that rule,
per interval, as it already did for PeakVectorSum. The 4 other cells
left mismatching sit 4e-6 past a rounding boundary (Blastware's
arithmetic is a hair lower) and stay mismatches.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Brian's intent (UM6047's trigger, notes typos, the backup unit), the
flow, the first-version fields, and what is measured: Series 3's
compliance block has Series 4's 0x1A layout; a whole 1A read assembles
to the 2,090 bytes Blastware writes back (exact on both 10-26 writes);
Blastware writes 00 00 at [26:28] and a per-unit constant after the
block.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Interval size (k - 40), the stop (footer ts2), frequency = (sample rate
/ 2) / half-period with Blastware's words for N/A, >100 / >200 and
<1.0, and each interval's vector sum with its OORANGE rule. The old
fixed-512 frequency formula is retracted in place. CLAUDE.md and the
README roadmap follow: 34 of 88.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
A scheduled start loads the setup it names, so a change to another
setup would be undone at the next start: read schedule.dat and refuse
that case. Configurable work-hours recording, without THOR's scheduler
or setup files, is the agreed next project.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Seven tasks: the Series 3 read assembly, one settings codec for both
series, the Micromate schedule read, each series' audited change, the
route (and the legacy write retired), and the page. Spans measured
from 75,958 Blastware reports. Bench after the final review, Brian's
go per send.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Brian: use the actual unit limits, not what has been used in the past.
Trigger 0.005-10 in/s in 0.001 steps (capped by the range), record time
1-90 s (Micromate) or the MiniMate manual's 1 MB table by sample rate
(13 s in Histogram Combo), job number 1-9999. The read-back reports any
value a unit does not take.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Unescape each 1A data frame, take data[11:], drop the one non-content
byte that starts every frame but the last: 2,090 bytes headed by
N = 2090, Series IV's 0x1A layout. Measured on BE9441's 10-26
recording (12 reads, both frame patterns); the read after each
Blastware write equals the image written. read_compliance_content is
strict (a missing frame raises) and unjudged (a monitoring unit's
device-info answer comes back for the caller to recognise).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
The events table was UNIQUE(serial, timestamp): one event per unit per
second. A unit records a waveform and a histogram in the same second
legitimately -- 209 times in prod's 2026-09-30 store once histograms
carry Blastware's start -- so the key is now (serial, timestamp,
record_type). Agreed with Brian 2026-11-03.
- Migration 3 rebuilds the table from its own current definition with
only the key swapped, in one transaction: every column, row and id is
kept (Terra-View reads rows by id) and the indexes are recreated.
Migration 1's check no longer mistakes the new key for a missing one.
- The upsert, the estimate guard and the restamp match on the type too.
The restamp also re-types a file's own row in place: before v0.33.0 a
row's type came from the filename, and a re-import under the file's
own type must not add a second row.
- An untyped event still refreshes the untyped row at its second (a
UNIQUE key treats NULLs as distinct).
- scripts/repair_unknown_serials.py checks the new key.
No time changes yet: that is the next commit, and they ship together.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Under the unit + time + type key, the test's untyped neighbour no longer
shared the imported waveform's key, so the waveform was stored as its
own row -- the neighbour untouched, which is what the test's name asks.
The guard's job is an estimate landing on another waveform's second, so
the neighbour is now a waveform. A companion test pins the case the new
key allows: an estimate beside a histogram at its second is stored
alongside it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
micromate/setup_fields.py: the fields an operator can change (record
mode, sample rate, interval, record time, geophone trigger, Series 3's
range and -- read-only until benched -- alarm, job number and its report
flag, the four notes by slot), the units' own limits from Instantel's
manuals, field-only byte patching (bit fields bit by bit; Series 3's
[26:28] as Blastware writes it; Series 4's CRC recomputed), the
read-back verdict compared by bytes, and the preview revision.
All 11 Blastware compliance writes reproduce from the block before them
(BE11529's first also shows Blastware re-rendering two mic levels
through its dB value; SFM echoes the unit's bytes); Series 4 keypad
fixtures reproduce pairwise.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
The footer's start runs a second early on 97% of histograms. Each
histogram carries an event record like a waveform's -- lead 00 28 05 00,
source 04 00, marker fe f5, then start and stop -- and it holds
Blastware's Histogram Start and Stop on 63,490 / 63,490 DL2 histograms.
On all 63,500 there is exactly one, its start 0 or 1 s after the
footer's and its stop 0 or 1 s before; that is the validation rule.
Without a validated record the footer's start stands, as a decode
problem.
Ships with the unit + time + type key (ea2dfc2), without which a
waveform and its histogram at the same second would collide. Three
tests that pinned the old footer start (one said 'for now', pointing at
#51) now pin the record's, which equals the file's Blastware name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
With the start right, the rest of Blastware's histogram timing follows,
measured on a 2,000-histogram DL2 sample:
- each interval's printed time is its end, start + (i + 1) x interval,
capped at the stop: 2,308,524 / 2,308,524 rows
(event_file_io.interval_times)
- each of Tran / Vert / Long / PVS / MicL's peak date and time is that of
the interval holding its first maximum: 2,000 / 2,000 each.
The checker compares intervals.Time and the ten peak date/time fields.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
MicromateProtocol.read_file: 0x94 + path, then 0x48 pages to an
all-zero reply -- THOR's frames byte for byte (UM12947, 2026-09-24),
including params[3] = 1 on 0x94 and params[7] = 1 on the first 0x48.
micromate.schedule parses the 260-byte records (two- and five-entry
schedules from THOR's captures) and names the scheduled starts that
would load a setup other than the active one, ignoring case. The
client gains the raw (unstripped) active-setup name and the prefs /
trigger / setup content reads a setup push sends back.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
s4_change_settings runs the shared change core with a read-back verdict
for its state (as asked / unchanged / differs). It reads the active
setup's name (unstripped), the preferences, trigger and setup blocks and
the schedule; patches the setup through micromate.setup_fields; sends
THOR's setup push (0xDA 68 73 82 83 71 72, now enableable) once; reads
the setup back. Refused before sending: a monitoring unit, a value the
unit does not allow (422), a stale preview (SettingsChanged, 409), and --
shown as 'blocked' in the preview -- the factory setup, a schedule that
loads another setup, an unreadable schedule, or a block SFM has not seen
(ChangeRefused, 409). s4_settings carries the editable fields.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Series3Adapter.settings reads the 1A block assembled into its 2,090
logical bytes and decodes it with micromate.setup_fields (a monitoring
unit's device-info answer is refused with 'stop monitoring first').
change_settings runs the shared change core: read the four settings
blocks, patch the settings block's fields, send Blastware's sequence
through push_config_raw with the event index, trigger and waveform blocks
as read, re-read. Refused before sending: monitoring, a value the unit
does not allow, a stale preview. push_config_raw's pre-check now raises
ImageRefused, so a refused image is audited as nothing sent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
DeviceAccess.change_settings refuses before any I/O a request with no
changes, a live change without its preview's revision, or no audit log,
then dispatches the series' change (never retried). The route returns
the preview (fields old -> new, warnings, blocked, revision) or the
result (fields old/new/now), statuses as the other changes, and marks
the cached by-host config dirty after a live change.
/device/config and /device/config/project now answer 410 with a pointer.
Deleted with them: MiniMateClient.apply_config / set_project_info and
the raw-offset _encode_compliance_config (#46 found it wrong), the
lab script poc_set_project.py and experiments.py's EXP6, both of which
wrote a live unit through it. Git keeps them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
The Config tab by serial is now the unit's edit form, headed 'On the
unit <serial> -- read HH:MM' and built from the server's editable
fields. Preview runs a dry run and shows old -> new, notes and anything
that blocks the change; Send (confirm) sends exactly what was previewed,
with its revision, then shows what the unit now holds and re-reads it.
An edit after a preview disables Send until the next preview. The
by-host form loses its write button; the read stays. Logic in
device_routing.js (Node-tested), glue in sfm_webapp.js, no inline JS.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
From the whole-branch review of phase 5:
- The preview's revision now covers the changes asked for, so a live
change must be exactly what was previewed (any API caller, not only the
page). It covers what the preview showed -- the settings block (and a
Micromate's setup name) -- not the blocks a write only echoes, which are
re-read at send and sent as read (a MiniMate's trigger block byte 5
differs by session, #46).
- The units' limits hold on the block that would result: a range, rate or
mode change alone can no longer leave a held trigger, alarm or record
time over them.
- Every MiniMate block read is logical, so push_config_raw no longer
unescapes again (a job number of 4098, 10 02, was refused at Send); the
preview runs the write's own block check, so a block it would refuse is
shown as blocked.
- A MiniMate's monitoring refusal says a stop makes it call in (spec).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
The reference gains D.6.10: the histogram's embedded event record (lead
00 28 05 00, source 04 00, marker fe f5, start, stop) and the interval
and peak-time rules, with 'histograms stay on ts1' retracted in place.
CLAUDE.md 'Where things stand' records the new events key -- any lookup
by event needs the type -- and 47 of 88; the README roadmap follows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Brings the checker's file-only decode work onto the parity branch so the
phase-5 bench runs on the code that will ship. One conflict, the CRLF
Series-III reference changelog: both kept, phase 5's row numbered
'2026-11-03 (5)' above dev's (4)/(3)/(2). test_event_ingest's live-
histogram dedup test asserted the stored row sits a second off the 0C
time -- the #51 bug, fixed on dev -- so its premise now reads the event's
own second; the dedup it tests still holds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Since #51 a waveform and a histogram recorded in the same second are two
events (UNIQUE(serial, timestamp, record_type)). persist_download's
'already stored?' checks matched any row at the second and any row under
the letterless Blastware name both twins share, so a live download of
one twin was skipped as stored. Both checks now hold to the download's
own type, read from its file (STRT[18]; IDFW / IDFH); an untyped row at
that second, or a download whose type does not read, still counts as
stored. find_event_by_blastware_name takes an optional record_type.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Bench 2026-11-04, BE9441 live: frame B of a 1A read arrived one byte long,
ending in a lone 0x10. When a frame's checksum byte is itself escaped
(02 / 03 / 04, about one frame in 85) the parser keeps the escape's 0x10
and strips only the byte after it. The 12 recorded reads never hit it,
so the assembled block was 2,091 bytes and SFM refused it as 'monitoring'.
read_compliance_content now passes the lengths it asked for (1024, 1024,
42) and that one stray byte is dropped; any other leftover still fails
is_compliance_content. The trimmed read decodes exactly as the old
decoder read the same reply.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Group D, part 1, measured on 400 DL2 waveforms (2026-11-04):
- time of peak = (first peak sample - pre-trigger samples) / sample
rate, per channel including the mic: 1,197 / 1,197 geophone values
- the vector sum's time, the same on sqrt(T^2 + V^2 + L^2): 398 / 399
- peak acceleration = the largest |v[i+1] - v[i]| x sample rate / g,
with Blastware's g = 9.81 m/s^2: 1,190 / 1,197 (the standard 9.80665
gives 1,073). Blastware's manuals: 'subtracts two velocity readings
and divides the result by the elapsed time between them'.
PeakValues gains *_time_of_peak, pvs_time and *_peak_accel_g, filled
for waveforms only. The checker reports them. Displacement (84% with
the manuals' half-cycle integral) and ZC frequency (46%) are not shipped
yet -- Blastware does something more there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Every printed acceleration in DL2 bounds Blastware's g; together they
leave [386.2236, 386.2240] in/s^2, and 386.2238 fits 19,475 / 19,479
values. The other 4 are one odd file (O117I1NK.R70W, whose peak times
are also off) and one sample mismatch. That is 9.81 m/s^2 (386.2205,
19,423) plus an unexplained offset, as with the mic's fitted dB offset.
The 59 values 9.81 left were all one last digit high.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
S3_ALARM_WRITE_MEASURED = True. At the bench on BE9441, with Brian's go,
the alarm went 1.0 -> 1.5 -> 1.0 in/s: each write acknowledged, read back
as sent, and shown in the unit's own setup menu. The write moved exactly
channel +39 of the three geophone blocks (the f32 at +38), where the
event files put it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
From the 2026-11-04 bench:
- A MiniMate settings preview warns that a change is lost if someone is in
the unit's setup menu: a write sent with the menu open was acknowledged
and read back, then lost on Cancel or Save -- the menu writes its own
copy of the whole block back (measured both ways on BE9441).
- The two bytes after the MiniMate settings block went out as 00 00 and
the unit took them; the preview note says so instead of 'unmeasured'.
- A Micromate call-home plan no longer warns about 0x00 / 0x01: UM20147
took both, each way, on 11-03 and 11-04, matching its menu.
- read_waveform_data_raw drops the escaped-checksum's stray 0x10, as the
settings read does (it failed closed: the write's block check refused
203 bytes).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Both protocol references, the spec's bench section and CLAUDE.md record
the bench: every settings change acknowledged, read back and confirmed on
the unit's screen, both units restored byte for byte; the escaped-
checksum stray byte (fixed); a MiniMate's open setup menu writes its
whole-block copy back on Cancel or Save, losing a remote change; the
alarm write at channel +38; [26:28] re-set by the unit while monitoring;
the first Micromate setup push with the unit's CRC equal to SFM's; the
Micromate scheduler switch in none of the blocks SFM reads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Everything by serial for both series (identify, status, settings, events,
download, start/stop, call-home on/off, settings change), live downloads
stored as the watcher stores them, the legacy config write retired.
Phase 4 benched 2026-11-03, phase 5 benched 2026-11-04 on BE9441 and
UM20147.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Everything by serial for both series, the audited changes (start/stop,
call-home, settings), the MiniMate wire fixes (#46, the 64 KB page, the
settings read as content), the legacy config write retired, the benches.
Operational: additive schema only (device_commands), no TOOL_VERSION bump,
no backfill from this branch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- CHANGELOG: Unreleased -> v0.34.0 — 2026-11-04, with the release theme
and a Migration section (schema re-key + overnight backfill that moves
every Series-3 histogram time by one second; rehearsed twice on a copy
of prod's 2026-09-30 snapshot).
- pyproject.toml, CLAUDE.md, README: 0.34.0 (README gains its status
entry).
- TOOL_VERSION 0.34.0: the codec changed, so the backfill regenerates.
Verified on dev before this commit: the full decode checker matches
pre-parity dev on every verdict of all 70,112 DL2 events (47 of 88
fields), group D part 1 ran clean on its branch, and the suite has only
the 16 known failures (1,566 passed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
SFM reaches Series-4 parity, and reads most of Blastware's report from the event file alone.
What changes
Series-4 parity (
feat/series4-sfm-parity). One device door, by serial, for both series. Each change is audited, identity-checked, sent once and read back. Benched on BE9441 and UM20147.It also fixes MiniMate request framing (#46) and the 5A walk across a unit's 64 KB page.
The file-only decode, groups A–D. 47 of Blastware's 88 report fields now match on every DL2 event, about 6 before v0.33.0. Eight more match on all but one or two of 6,524 waveforms.
UNIQUE(serial, timestamp, record_type)), so a waveform and its histogram may share a second.Prod still overlays a paired ASCII report onto the decode. Retiring that overlay is the plan's step 3, not part of this release.
Verified
backfill_sidecars.py: 11,944 files, 0 errors; 9,852 Series-3 histograms moved +1 s in place, 0 refused, no id lost, review state untouched; the 209 same-second waveform/histogram pairs now coexistbackfill_event_shape.py: exit 0,cleared_stale0Deploy
⚠ Schema migration plus an overnight backfill. Full notes are in CHANGELOG Migration.
seismo_relay.db.device_commands.sfmcontainer, runpython scripts/backfill_sidecars.py.TOOL_VERSION0.34.0 gates it, so no--force. ⚠ About 64,000 events, roughly 12 h on the NAS. It moves every Series-3 histogram time +1 s in place.python scripts/backfill_event_shape.py --db-path bridges/captures/seismo_relay.db --store-root bridges/captures/waveforms.Terra-View needs no change: twins pair by peak values, and rows are read by id.
Fixes #46
Fixes #50
Fixes #51
#44 and #45 stay open for their Micromate half (no closing statement recorded yet). #48 stays open.
🤖 Generated with Claude Code
https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
Parity of jobs with Series 3 for regular comms and settings (identify, status, settings, events, download, monitor log, start/stop, call-home enable/disable, setup push); Series-4 emergency tools deferred. A single device-access layer: series from the serial prefix, identity confirmed before any write, a per-unit lock, an 0xA2 opcode guard, read-back verification of every change, distinct error codes, and an audit table. Series-4 sessions ("stay on the line") now; Series-3 sessions after a bench test of MiniMate hangup/DCD behaviour. Includes the fix list found in the 2026-10-19 inventory, the to-be-added table, and the RX55 container idea as a parking-lot item. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44THOR's watcher (and Blastware's ACH) store every event through /db/import/idf_file and /db/import/blastware_file, with the paired report. Storing a download of the same event afterwards overwrote that richer copy: on Series 4 the file, .h5 and sidecar were rewritten (extensions dropped); on Series 3 the row lost PVS, project strings and ZC frequencies and was repointed at a second, review-less file set. persist_download now looks up (serial, timestamp) first. A row there is returned as it stands -- inserted false, detail.already_stored true -- with no store call, no insert_events and no sidecar write. Never merge. - DownloadedEvent gains `timestamp` (the unit's own event time) and `record` (Series 4's 0x0C fields); both adapters set them. - The Series-3 `event is None` guard now runs before backfill/save, with a message that is true there ("nothing was stored"). - Tests build the watcher's state exactly as the import endpoints do and prove the row dict, the sidecar bytes and the file mtimes are unchanged. No schema change, no migration, no codec change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44Series3Adapter.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_01SyJ2ip3Krb6dtdv2cXua44One 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_01SyJ2ip3Krb6dtdv2cXua44minimateplus's _extract_record_type returns "Waveform" for every 0C record layout -- it cannot tell a histogram -- so a MiniMate histogram was listed as "waveform". The fake's "Histogram" was a value the real client never produces, which is why no test saw it. - _s3_ref: record_type is always None, with detail.record_type_note = "Series 3's event record does not say waveform or histogram; not decoded yet". - default_s3_events(): both events "Waveform", as the real client gives. - The shared-shape contract test allows exactly {"record_type"} to be None for Series 3 and nothing for Series 4. Rows SFM stores for Series 3 still carry "Waveform" from the decode (the same as the legacy blastware_file route); parked in the spec. No codec, store or DB change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44micromate/opcodes.py holds WRITE_SUBS and the cross-series collision 0xA2. MicromateProtocol._send reads the SUB of the bytes about to go out (framing.request_sub) and refuses any write SUB not in allowed_writes, and 0xA2 unconditionally. Docstrings now say the reads-only policy is enforced. request_sub also refuses any frame not in canonical form (stuff(unstuff(body)) == body): an interior unescaped 02/03/04, a 10 XX outside {02,03,04,10}, or a trailing lone DLE. What the gate checks is then exactly what the unit parses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44c32a9e7was pushed with 4 tests failing a7214c50deBE9441 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_01SyJ2ip3Krb6dtdv2cXua44Bench 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_01SyJ2ip3Krb6dtdv2cXua44Tonight's bridge recording of BE9441 (16:08-19:06) as a fixture, with Blastware's files: Blastware's and SFM's requests in order (1,596, 722 of them 5A, 722 A5 replies), two Blastware config writes, SFM's stop, and three events. Event 2 is a 4,096-sps, 2 s histogram of 71,088 bytes -- 139 requests, two 64 KB crossings. Measured live the same evening (SFM through the bridge, read-only downloads): SFM's files for events 1 and 2 are byte-identical to Blastware's (sha256), the 71 KB histogram included -- the first event past the old cap downloaded from a unit. Event 0, the mic-off histogram, was refused ('decodes as neither'), as expected on this branch: its decoder fix (#47) is on dev. The test, fed the recorded replies with max_chunks=128: SFM's walks send exactly Blastware's 139 and 118 requests and rebuild both files byte for byte. Reverting the STRT-sized cap (8acb951) fails it. No code change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44Measured 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- With a serial, Start / Stop ask first ("Start monitoring on BE9441?"), then POST once to the audited change -- never retried; both buttons stay off while it is in flight, so a double click cannot send twice. - The status bar shows changeSummary() of the ChangeResult, on a 409/502 too (dry run, already-in-state, confirmed a -> b, or the outcome and read-back); an error without one shows its detail verbatim; no reply from SFM says the command may have been sent and where to look, rather than that nothing was. - Then one status read updates the panel. The legacy 5 s confirm poll is not used in serial mode; with a blank serial start/stop are unchanged. - Diagnostics' Stop, which goes the same way in serial mode, shows the same summary; deviceFetch errors carry it for any non-200 ChangeResult. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44- micromate reference: the watchdog can check every 5 s, hourly or never (Brian, operator-reported). The 10-14 "reconnects continuously" describes that THOR's setting, not fixed behaviour; whether a check holds the line, and how a call-home reaches THOR with the watchdog off, are unmeasured. - spec, ring-path test: the old setup ("a unit THOR is not otherwise watching") would not test the production path, since THOR receives a call-home on its own connection. Revised: UM20147 as a THOR test unit; Run 0 baseline with the watchdog off; Run A with SFM holding the line; Run A2 and Run B at the fleet's watchdog setting; after the 1c bench pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44GET /device/monitor/status?serial=UM...&run_state=true adds detail.run_state = {code, name}. For the ring-path bench test: the code during and after a call-home (0x01 for ~18 s after a stop, inferred to be call-home attempts; 0x03 = calling home) is what the test watches. Opt-in because it is one more round trip (~0.65 s on cellular); a plain status read is unchanged. Series 3 has no 0x49 and ignores it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44C:\THORDATA\Logs\ (Brian). From the 2026-10-29 log: the watchdog reads each unit's serial every ~15 s; Unit_CommandOutOfRange follows every ReadUnitStatus for every unit (fleet-wide noise); after a manual THOR disconnect UM20147 answered neither SFM nor THOR's own reconnect ("Mismatch connection found"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44device_routing.js (Node-tested): call_home_state / call_home_on / call_home_off routes (serial required); controlsFor gains callHomeChange (by serial, a confirmed Series 3 or 4) and callHomeRead now covers a Series 4 by serial; serialPanes gains callHomeForm / callHomeBox; callHomeRows renders the switch (On / Off / 'Unknown (byte 5 = 0xNN)'), dial string and series; changeErrorText takes the whole label ('Start monitoring', 'Enable call-home'). sfm_webapp.js: by serial the Call Home tab hides the legacy multi-field form (Series 3 by host only) and shows the unit's switch with On / Off. Each asks confirm(), sends one audited change, reports it with changeSummary / changeErrorText, then re-reads quietly so the change's own result stays on screen. A different unit's switch is never left showing. The new buttons are wired with addEventListener, not onclick= (no inline JS). Checked in jsdom against the real page: placeholder, read, Off (confirm, the disable route, 'confirmed -- enabled -> disabled'), a serial edit clearing it, legacy mode unchanged, no script errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44Measured at the bench 2026-11-03 (BE9441): while monitoring, a MiniMate answers the 0x2C call-home read with its DEVICE-INFO block ('Instantel', 'MiniMate Plus', its serial) -- as it answers 1A -- and idle again, minutes later, the call-home block. SFM writes back only a block it just read, so a monitoring MiniMate's call-home cannot be changed; the change core already refused (byte 5 read as 'unknown(0x6E)', nothing sent), but said so cryptically. - minimateplus.protocol.is_call_home_block(raw): the block starts with its own length 0x7C and is N (or N + 2) bytes unescaped; the device-info block fails it. - The Series-3 change raises UnitStateUnknown (409) with 'did not return its call-home settings -- a MiniMate answers the call-home read with its device-info block while monitoring; stop monitoring first ... nothing sent', for a dry run too. call_home_state returns enabled = None with that reason. - The page's callHomeRows shows the reason in place of 'Unknown (byte 5 = ...)'. A blind write while monitoring stays untested on purpose. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44- The page's top bar Firmware read '—' for a Micromate: Batch 2 gave the Device tab's card firmwareLabel() but not populateDeviceBar. Seen at the bench 2026-11-03; checked in jsdom ('—' before, 'Thor line (version not read)' after). - save_imported_bw's overlay comment said the waveform codec was undecoded and gave +-10 in/s; the overlay now stays because production keeps a paired Blastware report as the record until the file-only decode has no blanks (flagged by the decode-checker session). Comment only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44Benched 2026-11-03 on UM20147 and BE9441 (each on its own modem, one send per go): idle, a no-op, off and on all acked, read back and confirmed on each unit's menu; UM20147 accepts 0x00 at [5]. Monitoring, neither series takes a change: a MiniMate answers 0x2C with its device-info block, a Micromate acks and ignores ('Feature disabled while monitoring'). Series 4 [118:120] is a function of the block's content -- XOR 0x6D7D per bit-0 flip on two units, not a nonce. A stop's call-in reached THOR when the ring followed the ack. UM20147's clock is an hour ahead (DST). Spec, both protocol references (Series III: a CRLF row), CLAUDE.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua449b458b5into the parity branch (group A/B, #51 histogram timing) f24913189b