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
One lost 1F reply made the list return 1 of 3 events as a 200, and on a
download gave a false 404. The list also ran on the 120 s download
timeout, so each lost reply stalled the walk 120 s with the unit locked.
- get_events() strict mode (headers_only, or only_key): a lost 0A reply,
a lost 1F(browse) reply on the success path and on the partial-record
path all re-raise their ProtocolError; a 1F that hands back a key
already walked raises ProtocolError("event chain did not advance ...").
Legacy calls (none of the new options) behave exactly as before --
pinned by tests of the same three faults under get_events().
- Series3Adapter.list_events runs on the default timeout (10 s on TCP);
download_event keeps 120 s.
- FakeProto gains optional lost-reply injection; its default is unchanged.
The repeat-key guard sits at the loop head, which is reached only for a
non-null key -- equivalent to checking each 1F's key, in one place.
Read-only; nothing new on the wire. No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Series3Adapter.download_event compared the timestamp only after
download_event_by_key had run the whole 5A. A stale id cost a full
download of the wrong event (minutes on cellular), could surface the
64 KB-page 502 instead of 409, and a lost 0C reply was reported as "the
unit was erased".
- get_events() gains only_key_timestamp: with only_key, if the target's 0C
says another time (or none), the target takes the existing bypass --
no 1F(arm), no POLL, no 5A. A new branch only; it adds no command.
- download_event_by_key(key4, *, expected_timestamp=None) passes it on.
- The adapter converts the id's stamp to that ISO form and checks, in
order: no event -> 404; no readable 0C timestamp -> 502 MalformedReply
("could not read ... record (0C)"); a different time -> 409 StaleEvent;
no frames -> 502.
- The fake's download mirrors the real walk (no frames on a mismatch) and
records what it was asked for.
- Legacy get_events() (none of the new options) is pinned by a test of
its exact call sequence and 5A arguments, written before the change.
Read-only; nothing new on the wire. No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
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
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
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
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
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
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
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
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
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
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
Folded into the existing Unreleased sections.
Added: MicromateClient.get_setup() (verified line by line against UM20147's
screen), micromate.setup_block.crc_ok() for 0x1A/0x08/0x2E, the config diff
harness, and the decoded setup in mm_client_check.
Changed: the 0x1A field map; channel blocks 4/5/6 are the active mic and two
stored mic setups; 0x1A reads the edit buffer and a load replaces it
byte-for-byte; the unit's own conversion constants (3.2808, 2.21); 0x08 is
preferences; the geophone scale confirmed from the unit's config; the 0x1C
sub-second tick; the never-write-modem-baud rule; two corrected 16-byte slips;
and the Series III anchor hypothesis, flagged inferred with no code change.
Fixed: the watcher overwriting previous sessions, and two stale bench-tool
labels.
Migration stays None -- additive modules only, no codec/store/DB change, no
TOOL_VERSION bump, no backfill.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Closes the gap the 10-13 recap named: config blocks were fetched but barely
read. Two keypad passes on UM20147 (10-17, 10-19), every byte that moved
attributed to a setting the operator named, then the map turned into code.
MicromateClient.get_setup() reads SUB 0x1A once and returns a MicromateSetup
-- record mode, sample rate, histogram interval, pre-trigger, stop mode,
record time, auto-stop, active sensors, trigger sources, trigger levels, mic
type and level, job number, scaled distance, notes. Measured fields only.
Every value matched UM20147's screen.
Findings that shape what comes next:
1. ONE CHECKSUM RULE (CRC-16/AUG-CCITT) covers 0x1A, 0x08 and 0x2E -- a free
integrity check on every config read. Thor's write omits it; the unit
computes it, so it is not a write obligation.
2. LOADING A SETUP REPLACES THE ACTIVE CONFIG BYTE-FOR-BYTE, and 0x1A reads
the keypad's edit buffer live. The name is the only link between a file
and its contents, and even its spelling varies (.MMB / .mmb).
3. THE SIX CHANNEL BLOCKS ARE 3 GEOPHONES + THE ACTIVE MIC + TWO STORED MIC
SETUPS. Read the mic from block 4 only.
4. THE UNIT CONVERTS UNITS WITH ITS OWN CONSTANTS (ft / 3.2808, lb / 2.21).
Convert back with them or 45 lb reads 44.89.
5. 0x08 IS THE PREFERENCES BLOCK; display units live there and never touch
the stored setup values.
6. NEVER WRITE MODEM BAUD OR MODEM TYPE REMOTELY -- the remote link is the
modem port.
INFERRED, Series III, no code changed: S3's 6-byte "stable anchor" sits where
Series IV keeps pre-trigger + stop mode, so an S3 unit in Auto stop mode may
lose it. One Blastware capture in Auto mode settles it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
MicromateClient.get_setup() reads SUB 0x1A once and returns a MicromateSetup:
record mode, sample rate, histogram interval, pre-trigger, stop mode, record
time, auto-stop, active sensors, trigger sources, the three geophone trigger
levels, mic type and (linear) mic trigger, job number, scaled distance, and
the four notes. MEASURED FIELDS ONLY -- everything graded inferred or
unknown in the reference stays in .raw.
micromate/setup_block.py holds the decode as pure functions (no I/O), plus
crc_ok(): one checksum rule for 0x1A, 0x08 and 0x2E. A failed checksum
raises SetupChecksumError (a ProtocolError) unless verify=False; a short
block raises either way.
Two things the decoder gets right that a naive one would not:
- the mic comes from channel block 4 (the ACTIVE mic), never blocks 5/6,
which hold the stored settings of whichever mic is NOT fitted;
- distance and charge weight convert back with the unit's own 3.2808 and
2.21, so 45 lb entered on the unit reads 45.0, not 44.89.
TESTS: 69 new. 15 real fixtures (2,103 B each) -- 14 UM20147 reads from the
10-17/10-19 keypad passes, chosen so every field takes at least two values,
plus UM12947's read from Thor's 9-24 capture (other firmware line).
Expected values are what the operator read off the unit's screen, never the
decoder's own output. Fixtures force-added, per the tests/fixtures/
convention. Full suite 541 passed; the 16 pre-existing failures
(test_bw_ascii_report.py 15, test_event_file_io.py 1) are unchanged.
VERIFIED ON HARDWARE: bridges/mm_client_check.py now prints the decoded
setup; against UM20147 every line matched the unit's screen (Brian, 10-19).
Also: the scratch harness uses the library checksum and checks all three
blocks; mm_client_check's stale labels fixed (0x06 content[4:8] is the
likely monitor-log count, not "unexplained"; 11.0BD is no longer "the first
one this code has met").
No codec, store or DB change; no backfill.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
23 more snapshots of UM20147, keypad-driven.
MEASURED: loading a .MMB replaces the active config byte-for-byte -- three
loads, each moving exactly the fields that differ, the loaded block identical
to the file's saved state, no load marker. The setup name's spelling
(.MMB/.mmb) depends on whether it was saved or loaded.
MEASURED: job number [40:42], report flags [39] (0x02 job no., 0x08 scaled
distance; 0x01 unknown); distance [30:34] in metres and charge weight
[34:38] in kg, converted bit-exactly with ft / 3.2808 and lb / 2.21 -- the
firmware's own constants, not the textbook ones. Scaled distance is not
stored. Location confirmed at [144].
MEASURED: 0x08 is the preferences block (display units at content[31]),
not an event index; switching units moves nothing in 0x1A. 0x1A, 0x08 and
0x2E share one checksum rule (N = content[0:2]; CRC over [0:N-2] at
[N:N+2]); 0x2C has none. 0x2C session timeout is at [118:120], encoding
unknown; modem baud is in none of the six blocks.
CORRECTED IN PLACE: the 9-24 notes-label offset (0x8A -> 0x7A) and
channel-block start (0x06BC -> 0x06AC), both 16-byte slips.
RULE: never write modem baud or modem type remotely -- the remote link is
the modem port.
No codec, store or DB change; no backfill.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Brian's hypothesis from the end of the 10-17 pass: selecting a .MMB
repopulates the active config, so a single load moves every field that
differs between two setups -- a check of the whole map in one step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44