Commit Graph
605 Commits
Author SHA1 Message Date
serversdownandClaude Opus 5.5 f46afafdb4 tooling(scratch): check file-only setup and note fields against Blastware's XML reports
verify_bw_fields_against_xml.py decodes each Blastware event file the way
ingest does, without a report, and compares sample rate, record time,
pre-trigger, sample count, the four notes and the job number with the
event's _XML.XML report -- Blastware's full event report, which DL2 kept
for 70,042 events back to 2016 (ASCII reports exist only for 2025-26).
Every disagreement counts against SFM; there is no carve-out list yet.
The first piece of the decode checker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-10-29 17:20:47 -04:00
serversdownandClaude Opus 5.5 b4706a30f0 fix(decode): a Blastware file's setup and notes come from its recording-setup block (#44, #45)
Without a paired ASCII report, a Blastware import stored no sample rate,
the record-type byte as its record time (every waveform read "70 s"), a
pre-trigger and sample count read from STRT bytes that are neither, and
blank notes (the reader stopped at the NUL after each label).

- The recording-setup block is found by structure -- 1c 08, the setup
  name, NUL -- not by the name "Standard Recording Setup", which 37% of
  DL2's files do not use.  One match in each of 70,041 archive files.
- Sample rate (uint16 BE, name-42), pre-trigger (f32 BE, name-36) and
  record time (f32 BE, name-30).  A waveform's sample count is the
  decoded count.  A histogram gets a sample rate only: Blastware reports
  neither a record time nor a pre-trigger for one.
- The setup name and the four user notes by position, as bw_ascii_report
  reads them: the labels are operator-editable ("Seis. Loc:",
  "Location:", "Project: ").
- STRT now yields only the waveform key.

Verified against Blastware's own _XML.XML event reports for the 70,042
DL2 archive events that have one (2016-2026): sample rate 70,042/70,042,
record time 6,524/6,524, pre-trigger 6,484/6,484, notes 70,042/70,042,
sample count 6,523/6,524 (one waveform the decoder ends 3 samples short;
separate).  Events imported with an ASCII report are unchanged -- the
report still overlays.

Not changed: the waveform-time estimate still finds the record time by
the marker; moving it would add a validation constraint for 37% of files
and is to be measured first.  The job number is not read yet (2,997
archive events carry one).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-10-29 17:20:39 -04:00
serversdown a8c91809a6 chore(git): ignore symlinked example-events directory 2026-10-29 15:49:37 -04:00
serversdownandClaude Opus 5.5 184a03a5cd docs(changelog): Unreleased — tier model superseded by Terra-View ADR 0003
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-27 18:50:02 -04:00
serversdownandClaude Opus 5.5 560869ed61 merge: the SFM/SDM tier model marked superseded by Terra-View ADR 0003
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-27 18:50:02 -04:00
serversdownandClaude Opus 5.5 b69ff4171d docs(claude): mark the SFM/SDM tier model superseded by Terra-View ADR 0003
SFM is the whole seismograph module and "SDM" is retired; the codec
library stays pure; lab tools leave the production image and are ported
into sfm/ when they become production tools; the call-in server becomes
SFM's front door; the repo becomes `sfm` after the parity branch merges.
The old section stays in place below the banner as history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-27 15:04:02 -04:00
serversdownandClaude Opus 5.5 1aa07e75d9 docs(release): v0.32.0 README status and dedup notes, release date, TOOL_VERSION comment
README: the intro no longer calls the Series-IV binary codec 'on the roadmap';
a v0.32.0 status entry; the ingest and Database sections describe the restamp
and estimate rules; the NULL-timestamp roadmap item points at #52.
CHANGELOG: v0.32.0 dated 2026-10-27, when its content was final.
TOOL_VERSION comment: times come from the event record, not the name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-27 02:32:25 -04:00
serversdownandClaude Opus 5.5 04acb99310 docs(changelog): v0.32.0 — waveform times from the instrument's event record, estimates never merge
The release had not shipped, so its entries are corrected in place: the theme,
the time-source entry (the embedded event record, not the filename), the
estimate guard, and a note that the deploy rehearsal stands (record and filename
agree on all 1,394 prod waveforms).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-27 00:18:59 -04:00
serversdownandClaude Opus 5.5 3a6df9d7f4 merge: Series-3 waveform times from the instrument's embedded event record
Brings fix/waveform-time-from-record (f91949b, 6cfcd04, and a docs pointer): the
trigger comes from the event record the unit sends in its 5A stream, validated
strictly; a filename is only a cross-check; no validated record means a
flagged estimate that never overwrites, merges or duplicates a row.  Real data,
no names: 7,961/7,961 waveforms on the record, 0 disagreements.  Suite vs dev:
the same 16 failures, byte-identical reasons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-27 00:18:08 -04:00
serversdownandClaude Opus 5.5 7100d8344a docs(reference): point §7.8.9's open items at the Series-III audit, #53
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-27 00:17:15 -04:00
serversdownandClaude Opus 5.5 6cfcd04513 fix(sfm): an estimated event time never overwrites, merges into or duplicates a row
Brian: keep an event whose time is only an estimate (no validated embedded
event record) -- never discard a measurement for want of an exact timestamp --
but it must not silently cause an overwrite, merge or dedup collision.

insert_events, for timestamp_source 'estimate' (_estimate_guard):
- never restamps (moves) a row;
- if its file (a Blastware name) is already stored under another time, writes
  nothing -- no second row, the stored time kept;
- if a different event already holds that second, writes nothing -- the old
  upsert would have written this event over that one;
- otherwise stores it, or refreshes its own row at the same second, as before.
Each refusal is a WARNING naming both sides; the file and sidecar (which says
'estimate' and carries the decode problem) are already in the store.  A generic
upload name ('imported.bw') is not taken as identity.

Tests: each rule, an estimate on a free second kept, generic names, and an
import end to end (a corrupted record next to a different event's second).
3 mutants, each caught.  Suite vs clean origin/dev: the same 16 failing tests,
failure reasons byte-identical; 582 passed vs 553.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-27 00:15:32 -04:00
serversdownandClaude Opus 5.5 f91949be89 fix(decode): a Series-3 waveform's time comes from the instrument's embedded event record
Brian's requirements: the instrument's data is the only time source; a filename
is a cross-check, never a fallback (an event SFM receives itself has none).

The record (found by reading a seismo_lab Inspector dump; Series-III reference
§7.8.9): 00 28 05 00 ?? ?? | fe 80 | trigger | stop, times dd mm yyyy(BE) 00 hh
mm ss.  Measured on 7,935 waveforms (DL2 + prod store): exactly one candidate
validates in every file; trigger = Blastware's report 1,320/1,320, = filename
7,935/7,935, = the unit's 0C record 10/10.

Provenance (requirement 6, measured): in Blastware's download of 8 BE9441
events the record -- with 24 B before and 22 after -- occurs exactly once in the
unit's own A5 reply payloads; SFM-only downloads (no Blastware) carry it too.
It is instrument data, not Blastware's.

- _embedded_event_record(): every fe 80 before the footer is a candidate; it
  counts only with the lead bytes, two well-formed times (zero byte zero),
  footer ts1 <= trigger <= stop, stop = footer ts2 or a second before, and a
  length matching the record time.  Exactly one must count; none or several is
  a decode problem, never a guess.
- Without one: the footer estimate, timestamp_source 'estimate', a
  decode_problems entry, a WARNING.  No filename fallback.
- A filename that disagrees is logged; the decoded time is kept.  A paired
  report fills in only without a validated record (apply_report_to_event, the
  sidecar dict overlay, event_to_sidecar_dict) and is logged when it disagrees.
- decode_blastware_bytes(raw, name=None): no file or name needed;
  save_imported_bw uses it (no temp file).  Event gains timestamp_source and
  decode_problems; the sidecar records both.
- Histograms unchanged (#51): their record (fe f5) is noted, not used.

Tests: raw bytes with no name (ZI0, 7 BE12844 oracles), a disagreeing name, each
validation rule alone, two valid candidates, no filename fallback, report
precedence, sidecar.  7 mutants, each caught.  Real data, decoded with no name:
7,961/7,961 waveforms on the record, 0 disagreements with filename or report;
10,433/10,433 prod histograms unchanged.  Suite: only the 16 known failures.

Open (reported, not changed): 3 DL2 files named as waveforms whose body the
waveform codec does not recognise keep the footer start, 4 s off, as on dev.
None in prod.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-26 23:59:22 -04:00
serversdownandClaude Opus 5.5 895ce4917e chore(release): v0.32.0 — event times you can trust, and Series 4 mapped
Series-3 waveform times carry Blastware's own (from the filename), re-stored
events move their rows instead of duplicating, prod's ISO-dated reports are
read, mic-off / mic-on sub-minute histograms decode right (#47, #49), Micromate
.h5 samples are on Thor's own scale (#42).  Plus the Series-4 live protocol,
read-only client and setup decode (no shipped code path yet) and the SFM
Diagnostics tab.

TOOL_VERSION 0.31.0 -> 0.32.0: the deploy owes backfill_sidecars.py --force
--reparse-txt, backfill_thor_events.py, backfill_event_shape.py (~2 h on the
NAS), rehearsed on prod's 2026-09-30 store snapshot -- see Migration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-26 19:32:19 -04:00
serversdownandClaude Opus 5.5 4058dec641 docs(changelog): waveform times from the Blastware filename, restamp in place, ISO report dates
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-26 19:30:28 -04:00
serversdownandClaude Opus 5.5 5737168173 merge: Series-3 waveform times from the Blastware filename; a corrected time moves its row instead of duplicating it
Brings fix/waveform-time-restamp (847900b, abb671a, 3948dc1): insert_events
restamps a re-stored event's row by its Blastware filename; a paired report's
ISO-dated event time is read and survives a backfill; a waveform's time comes
from its filename.  Deploy rehearsal on prod's 2026-09-30 snapshot (11,827
files): waveforms 1,016 -> 1,394 of 1,394 on Blastware's exact time, every id
kept, no row lost or merged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-26 19:29:38 -04:00
serversdownandClaude Opus 5.5 3948dc1a3c fix(decode): a Series-3 waveform's time comes from its Blastware filename
The review of this branch measured (and I re-measured) that the binary's
trigger -- ts2 minus the record time, from 1e76d08 -- is a second off on 260 of
prod's 1,394 waveforms (2026-09-30 snapshot): 199 late, 61 early.  A Blastware
filename encodes Blastware's own time to the second: it equals the report's
Event Time on 81/81 prod and 1,249/1,249 DL2 report-paired waveforms.

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

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

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

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

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-26 19:15:59 -04:00
serversdownandClaude Opus 5.5 a0fd5fcc25 docs(changelog): sub-minute histograms read big-endian, mic on and off (#47, #49)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-26 18:35:13 -04:00
serversdownandClaude Opus 5.5 6ed46dc3a3 merge: sub-minute histograms read big-endian from byte 5, mic on and off -- issues #47, #49
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-26 18:35:12 -04:00
serversdownandClaude Opus 5.5 dfc5aefef7 fix(histogram_codec): read multi-interval blocks big-endian from byte 5, mic on and off (#47, #49)
Measured 2026-10-26.  A sub-minute histogram block is [00][segment][ctr LE][0a]
(5 bytes), then one record per interval of BIG-endian peak / half-period pairs
per channel, then 0000 and one more word, then a 7-byte trailer.  A record is 20
bytes with the mic and 16 without (4 x channels + 4); the standard 32-byte block
is the same thing holding one record.  The last block is short, not padded: it
holds only the intervals recorded and ends on 9c 06 00 42.

#47: a mic-off histogram (16-byte records) decoded to nothing, so a Blastware
import carried no histogram data and SFM's download check would refuse it.
BE9441's K441LTOK.QZ0 (2 s, 22 intervals; fixture) now matches its Blastware
export on 66/66 peaks and 66/66 frequencies.

#49: the old reader took the mic-on records as little-endian from byte 6 -- the
same bytes shifted by one, identical while every high byte is zero.  It also
required byte 5 to be 0 (the first record's Tran peak high byte) and read the
last block at full stride, trimming what it overran.

Regression over every DL2 histogram with a Blastware ASCII export (13,089
files, interval counts + every geo peak, frequency and mic dB): old reader
13,087 exact, new 13,089.  The two the old one got wrong were one interval each:
K440KZP4.560H #4764 (Long half-period 1 read as 257, mic peak 389 as 133) and
M462KZUD.6R0H #145 (mic peak 6 read as 262).

Walk: blocks follow by block_ctr + 1, or the next segment every 256 blocks; the
last block is bounded by its terminal tail; with no terminal tail the old
trimming rule remains as the fallback.  Mic-off records give m_peak None and an
empty MicL channel, as a mic-off waveform does.  Inferred, not yet seen in a
file: mic-off 1-minute (28-byte) and 15 s / 5 s mic-off strides.

Not fixed here, noted on #47: half_period_to_hz assumes 1024 sps (512/hp); the
2048-sps histogram's frequencies are 1024/hp.

Operational: a decoder change -- needs a TOOL_VERSION bump at release, then
backfill_sidecars.py + backfill_event_shape.py (~2 h on the NAS) to regenerate
stored histograms.  No schema change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-26 18:30:09 -04:00
serversdownandClaude Opus 5.5 abb671a440 fix(decode): a paired report's event time is read in ISO form and survives a backfill
The event-time fix makes a Blastware report's Event Time + Event Date
authoritative over the binary, which gives the trigger only to the second.
On prod's own data it never applied (measured on the 2026-09-30 store
snapshot, all 81 report-paired Series-3 waveforms):

- every one of those reports writes Event Date as ISO ('2026-08-14');
  _parse_event_date read only 'August 14, 2026', so event_datetime was None
  (Brian's own laptop writes the long form -- it follows the PC's settings);
- the sidecar's bw_report block never stored the event time, and
  apply_bw_report_dict_to_event -- the backfill's overlay -- never set it.

The binary's trigger matched Blastware's printed time on 66 of the 81 and was
a second late on 15; 8 of those 15 hold the right time in prod today, so the
release backfill would have made them a second worse.

- _parse_event_date accepts ISO dates too (81/81 now parse to the time
  Blastware printed; 0/81 before).
- _bw_report_to_dict stores event_datetime (additive key).
- apply_bw_report_dict_to_event applies it, as apply_report_to_event does.

Prod's sidecars were written by the old parser, so the deploy runs
backfill_sidecars.py with --reparse-txt to re-read the saved .TXTs.

Tests: both date forms, the round trip through the saved block, a block with
no time, and the backfill (--force --reparse-txt) on a prod-shaped row.
Suite: only the 16 known fixture failures.

Codec-library change (report parser): TOOL_VERSION to be bumped at release.
No schema or DB migration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-26 18:26:26 -04:00
serversdownandClaude Opus 5.5 847900baeb fix(sfm): a re-stored event at a corrected time moves its row instead of duplicating it
The waveform event-time fix (a84a46e / 1e76d08, on dev since 2026-09-20)
changed what time a Series-3 waveform decodes to: the trigger, where v0.31.0
stamped the monitoring-session start -- hours off.  events is unique on
(serial, timestamp), so re-storing an old event at its corrected time matched
nothing and inserted it a second time.

Measured 2026-10-26: files stored with v0.31.0 (prod's code), then dev's
backfill_sidecars --force -- the release's own deploy step -- gave every
waveform two rows, one at each time.  N844LQHB.ZT0W (BE12844): 06:00:13 and
10:33:29, its false-trigger mark only on the wrong-time copy.  A Blastware
re-forward of an old event would do the same with no backfill at all.  Prod
has not run the new decoder, so it holds no duplicates yet.

insert_events now matches a row by its stored file first (serial +
blastware_filename; a Blastware name encodes the serial and the second): one
under another time is moved to the new time in place -- same id, review kept --
and the usual refresh follows.  When a different stored file already holds the
corrected second, nothing moves and nothing is written; the old upsert wrote
this event's file and peaks over that other event's row.  Rows with no stored
file are matched on time alone, as before.

Tests: the move (id, review, refresh), a different file, no file, the
collision, a duplicate already at the new time, and the release backfill end
to end on a v0.31.0-shaped row.  Re-checked across versions: v0.31.0 import,
then this branch's backfill -- 5 real files, every row corrected in place, no
duplicates.  Suite: only the 16 known fixture failures.

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_01MUHR251NLznsFvPSrfegqL
2026-10-26 18:18:23 -04:00
serversdownandClaude Opus 5.5 6690434ecf docs(changelog): Micromate .h5 samples on Thor's own LSB (#42)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 13:49:07 -04:00
serversdownandClaude Opus 5.5 a5373deae7 merge: Thor .h5 samples on Thor's own LSB -- issue #42
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 13:48:41 -04:00
serversdownandClaude Opus 5.5 e506bcff9b fix(sfm): Thor .h5 samples use Thor's LSB, not the MiniMate count scale (#42)
Every idf-import .h5 converted Thor's raw geo counts with the MiniMate
body-codec scale, full_scale / _GEO_INT16_FS.  A Thor count is
0.000310308 in/s (micromate.idf_file._GEO_LSB_IPS), so the float samples
disagreed with the event's own peak by a constant:

  10/32768 (until 686ab6e, 2026-08-25)   samples -1.65%
  10/32000 (since)                       samples +0.71%

v0.30.0's LSB fix (726c2ce) never reached this path.  It corrected the
decoder's peaks, which were already right in the DB, sidecar and h5
peak attrs.  The sample arrays go through the shared .h5 writer instead.

write_event_hdf5 now takes geo_ips_per_count.  save_imported_idf and
backfill_thor_events (which replays the same bridge with its own write)
both pass _GEO_LSB_IPS.  MiniMate callers are unchanged.

Measured: all 8 thor-idf fixtures (4 IDFW + 4 IDFH, 24 channels) go from
max|sample| / peak = 1.00706 to 1.00000 through the real ingest path.

Operational consequence: no schema change, no migration, TOOL_VERSION
not bumped here.  Existing idf-import .h5 files keep the wrong scale
until regenerated: scripts/backfill_thor_events.py (--force, or bump
TOOL_VERSION at release), then backfill_event_shape.py, because the
offset detector reads these samples.  Series-3 files are unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 13:05:51 -04:00
serversdownandClaude Opus 5.5 618fcb7770 docs(changelog): Series-4 config decoding -- get_setup(), the 0x1A map, and one checksum rule
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
2026-10-19 18:41:35 -04:00
serversdownandClaude Opus 5.5 fa017b0ee7 merge: Series-4 config decoding -- the setup block mapped from the keypad, and get_setup()
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
2026-10-19 18:40:28 -04:00
serversdownandClaude Opus 5.5 6bd45b56ec docs(claude): get_setup() exists -- the checksum is wired in, not pending
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-19 18:20:39 -04:00
serversdownandClaude Opus 5.5 b3aff4ed66 feat(micromate): get_setup() -- the setup block decoded, checksum-verified, and read off a real unit
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
2026-10-19 18:20:25 -04:00
serversdownandClaude Opus 5.5 a74d3c9b00 docs(series4): loading a setup is an exact replacement -- plus the prefs block, a checksum rule, and the firmware's own unit constants
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
2026-10-19 17:30:37 -04:00
serversdownandClaude Opus 5.5 7c010e42a4 docs(claude): leave the next config step written down -- load a setup and diff it
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
2026-10-17 02:41:13 -04:00
serversdownandClaude Opus 5.5 56b8aac4cb docs(series4): the 0x1A field map from a keypad pass -- a CRC, an edit buffer, and three mic blocks that are not channels
47 snapshots of UM20147 while settings were changed on its own keypad, one
at a time.  Every byte that moved is accounted for; nothing outside 0x1A
moved.

MEASURED (operator named setting + values): record mode [5] (01 Waveform,
02 Manual, 03 Histogram, 04 Combo -- S3's encoding, one byte later than the
S3 analogy put it), sample rate [6:8], histogram interval [8:10] s,
pre-trigger [12:16] f32 negative s (all four values), stop mode [17], record
time [18:22] f32, auto-stop [23], active-sensor and trigger-source bitmasks
[25]/[29], trigger level at channel +30 (geo in/s, mic psi).

MEASURED: the trailer is CRC-16/AUG-CCITT over content[0:2088] -- 47/47 and
a second unit.  Thor's write omits it, so it is read-side integrity, not a
write obligation.

MEASURED: blocks 1-3 are geophones, block 4 is the ACTIVE mic (a byte copy
of 5 or 6), 5 and 6 are the stored linear / SLM mic setups.  No separate
mic-type byte; block 4's +4:8 code is the type.  Promotes the 10-15 "+4
channel type" guess; retracts "+46:48 is a trigger-source flag" in place.

MEASURED: 0x1A reads the keypad's edit buffer live; discard reverts;
commit timing differs by widget (list / spinner / sub-window).

INFERRED, Series III: the 6-byte "stable anchor" sits exactly where Series
IV keeps pre-trigger (-0.25 s) + stop mode (Fixed).  An S3 unit in Auto
stop mode would lose it and decode no mode/rate/interval/record time.  Not
measured on S3; noted in instantel_protocol_reference.md, code untouched.

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
2026-10-17 02:22:00 -04:00
serversdownandClaude Opus 5.5 75cbe23214 fix(micromate): config watcher no longer overwrites the previous session -- and checks the 0x1A CRC
`watch` saved every session as `watch-000..NNN`, so each run silently
overwrote the last.  Harmless while those snapshots were clock ticks; data
loss once they were findings.  Labels now default to `watch-MMDD-HHMM-NNN`
(`--prefix` overrides).

Each 0x1A change also prints its trailer check: CRC-16/AUG-CCITT over
content[0:2088], stored BE at content[2090:2092].  Measured on 47/47
snapshots of UM20147 plus UM12947's 9-24 capture; a mismatch means a short
or corrupt read, or a layout this does not assume.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-17 02:22:00 -04:00
serversdownandClaude Opus 5 ba021df6b2 docs(claude): say where config decoding actually stands -- set up, waiting on a keypad press
"Where things stand" said config decoding "needs a bench session varying one
setting at a time -- not desk work", which was true when written and now sends a
reader off to build tooling that exists.  This is the same staleness that had
the file claiming micromate/ had no live client.

What it now says, because these are the things that cost time to rediscover:

- The harness is scratch/mm_config_diff.py and the baseline is already captured.
- THE METHOD IS VERIFIED VIABLE: all five config blocks are bit-stable, so any
  byte differing between two snapshots IS the setting.  That was the open
  question about whether the Series III approach transfers at all.
- Start with SAMPLE RATE.  A large distinctive power of two pins endianness in
  one shot; a boolean toggle moves one byte 0 -> 1 and teaches nothing.
- The keypad works.  No Windows VM, no contending for the modem's single TCP
  session.
- `sg dialout -c` is required to open /dev/ttyACM0, because the group membership
  exists in /etc/group but not in shells started before it was added -- AND THE
  FAILURE LOOKS LIKE A DEAD UNIT, which is worth a line on its own.
- watch-001..005 on disk are clock ticks, not findings.
- channel+24 = 3.1030800342559814, independently confirming _GEO_LSB_IPS to
  1.1e-8 and 32,226.05 counts exactly.
- The rest of that channel map is GRADED and the grades are load-bearing: +4
  "channel type" and the +8:24 uint16 split are single-setup guesses, recorded
  as guesses on purpose.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-16 19:09:58 -04:00
serversdownandClaude Opus 5 66171ffe36 docs(series4): the 0x1A channel blocks -- graded, because one of these is strong
and two are guesses

Six 48-byte channel blocks at content[1708], stride exactly 48: Tran, Vert,
Long, Mic, LMic, SMic.  (Mic is 3 chars, so a 4+-printable scan misses it and
the stride looks like 96 across that gap.)

RECORDED IN THREE EXPLICIT GRADES, because I wrote them in one voice first and
that is the failure mode this reference already carries retractions for -- the
0x0C float from a single sample, the cost model fitted to sub-1 KB responses,
offset detector v1.  All three were an interpretation presented with the
confidence of a measurement.

MEASURED, and the one worth having: channel+24 is a float32 BE reading
3.1030800342559814 on all three geo channels.  Divided by 10,000 that is
0.00031030800342559815 -- the documented _GEO_LSB_IPS to 1.1e-8.  It implies
10.0/3.10308 = 3.222605 V full scale, which at 10,000 counts/V gives 32226.05
counts, the documented figure exactly.

That is an INDEPENDENT confirmation of a number that until now rested purely on
statistical inference: _GEO_LSB_IPS was pinned by intersecting 991,415 rounding
constraints from Thor's own CSV exports.  The unit reports it directly.  Two
unrelated derivations agreeing to eight digits.  It is also almost exactly half
Series III's 6.206053 (ratio 1.99997, the residual being S3's rounded display
value).

Also measured: the units strings ("in."/"/s.", "psi"/"(L)", "dB"/"(A)") are
literal ASCII, and Tran/Vert/Long are byte-identical EXCEPT +47, which reads
0x01 on Tran and Vert and 0x00 on Long.

INFERRED (one setup, one unit): that +24 is the calibration constant rather than
another field holding the same number -- the arithmetic proves the number, not
the field's purpose; and that +47 is an enable or trigger-source flag.

GUESSED, explicitly flagged not to build on: +4 as a uint32 "channel type", from
six correlated observations in a single setup; and +8:24 as eight uint16 BE
values, where the split itself is an assumption.

TOOLING FIX in the same commit, from a real miss: the volatile baseline ran four
reads over eight seconds, so it never crossed a minute boundary and never saw
the minutes byte.  Five "changes" then came in a row that were just the clock.
Hours and the date would have slipped through identically.  An empirical noise
floor only catches what moves WHILE sampling, so 0x1C's known clock span
(content[2:10]) is now seeded regardless, and the report says which bytes were
observed versus seeded.  Memory-free is deliberately left unmasked -- it moves
only when the unit records, which is worth being told about.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-15 14:35:54 -04:00
serversdownandClaude Opus 5 711277131a feat(micromate): a config diff harness -- and the blocks turn out to be bit-stable
The Series III config map was built by changing one setting and seeing which
bytes moved.  Whether that method transfers to Series IV depended on an
unmeasured question: how much of a config block moves ON ITS OWN.  If a block
carries a clock or a counter, every diff arrives polluted and there is no way to
tell the real answer from the noise in a single pair.

MEASURED ON UM20147 (11.0BD), FOUR READS BACK TO BACK, NOTHING TOUCHED:

  0x1A compliance    2103 B    0 bytes moved
  0x2C call home      137 B    0
  0x2E trigger         39 B    0
  0x08 event index    101 B    0
  0x01 device info    163 B    0
  0x1C monitor status  59 B    2  (and those two are explained below)

Every config block held every byte still, so the method transfers directly and
needs no noise floor subtracted.  That was the open question.

scratch/mm_config_diff.py drives it: `volatile` establishes the floor, `snap`
saves a labelled read of all five blocks, `diff` reports changed runs with each
plausible field interpretation (u8/u16be/u32be/f32be) and reports any volatile
bytes separately rather than silently hiding them.

CORRECTION TO content[6] OF 0x1C, long recorded only as "NOT the hour": it is a
sub-second tick, ~4020 counts/second in steps of exactly 4, wrapping at 256 --
about a 64 ms period, consistent with the low 6 bits of a millisecond counter.
Consequence worth knowing: a 0x1C block is never byte-identical to itself, so
any "has the status block changed?" check answers yes ~15 times a second.
Compare named fields, never whole blocks.

I nearly recorded that byte wrong, and the trap is cheap enough to document:
sampled once per second it reads as a smooth monotonic counter at ~16/s with a
16-second wrap.  Twelve consecutive samples supported it.  It is aliasing -- a
64 ms counter read once a second is noise that happens to look tidy.  Measure a
counter back to back before trusting any rate from spaced samples.

Also: the settings do not have to be changed from THOR.  The unit's own keypad
works, which needs no Windows VM and does not contend for the modem's single
TCP session.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-15 12:28:40 -04:00
serversdownandClaude Opus 5 4c29820831 docs(changelog): the Series-4 call-home session, and two more corrections
Folded into the existing Unreleased sections.

Added: bridges/mm_ach_server.py, flagged as implementing the listener path only.

Changed: the captured ACH session (101 frames, every command already
implemented bar one); the two call-home paths and what decides between them; the
0xA2 collision with series III's CONFIRM ERASE; monitor-while-calling-home
blocking erase while THOR reports success; THOR rewriting unit IPs from the
call-home source; and the CLAUDE.md refresh.

Fixed: mm_client_check misreporting its own request count, the ACH server
buffering its output and leaving modem chatter as a hex dump, and .gitignore
missing capture artefacts beside tracked bridge source.

TWO ENTRIES CORRECT THIS FILE'S OWN EARLIER TEXT, which is the part worth
reading: 0x06 content[4:8] was recorded here as "a constant, 9 on both units"
and is the monitor-log count; SUB 0x49 was recorded as two states and has three.

Migration stays None -- no codec, store, DB or schema change and no TOOL_VERSION
bump -- but the note now says explicitly that THE 0xA2 COLLISION IS DOCUMENTATION
RATHER THAN A FIX.  minimateplus can already send 0xA2 as the last step of its
erase sequence, and nothing yet stops a future shared path confusing the two
meanings.  A guard is outstanding, and a reader deciding whether this release is
safe deserves to know that.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-15 00:06:45 -04:00
serversdownandClaude Opus 5 8b48b3f42b merge: the Series-4 call-home session, captured end to end
Closes the last protocol unknown.  A MITM between UM12947's modem and THOR
1.5.0.29 captured a complete working ACH session: 101 request frames, 101
responses, 0 bad checksums, 34,872 B of event data in 65 seconds.

EVERY COMMAND IN A REAL ACH SESSION IS ONE micromate/protocol.py ALREADY
IMPLEMENTS -- POLL, BULK_DOWNLOAD, STATE, EVENT_RECORD, EVENT_NEXT,
STORAGE_RANGE, MONITOR_STATUS, ARM_EVENT, SERIAL, EVENT_FIRST -- bar one.

Three findings that change how a receiver must be built:

1. CALL-HOME HAS TWO PATHS, decided by who holds the modem's single TCP
   session.  If something is already connected, the unit's RADIO RING travels up
   THAT connection; if nothing is, the modem dials out to a listener.  THOR's
   UnitWatchDogTimer reconnects continuously, so THOR usually holds the slot --
   which is why probes and relays saw "connected, no reply" all afternoon.  That
   was contention, not a fault.

2. SUB 0xA2 ENDS A CALL-HOME ON SERIES IV AND IS CONFIRM ERASE ON SERIES III.
   Same opcode, same 0x5D response, opposite consequence.  minimateplus and
   micromate already share a transport, so any shared path must dispatch on
   series before that byte reaches a wire.  This is a hazard in code that
   already ships, which is the main reason this merge should not wait.

3. "MONITOR WHILE CALLING HOME" SILENTLY BLOCKS ERASE, and THOR reports the
   session successful anyway.  A receiver therefore cannot rely on erase to
   manage storage -- the server-side high-water mark is load-bearing, and the
   condition is detectable from event count plus free memory on every call.

Two corrections to entries made earlier this month: 0x06 content[4:8] is the
monitor-log count rather than a constant, and SUB 0x49 has a third state (0x03,
in-call-home) which is why that flag is tested for non-zero.

bridges/mm_ach_server.py implements the LISTENER path only and says so; the
poller half -- holding outbound connections and watching for the ring -- is the
next piece of work.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-15 00:05:47 -04:00
serversdownandClaude Opus 5 9c8eb5c5b8 docs(claude): refresh "Where things stand" -- it claimed there was no live client
Stale since 2026-09-26, and wrong in two ways that matter to anyone picking the
project up:

- "micromate/ still has no live client -- it is codec-only."  There has been a
  full client since 2026-10-02: framing/protocol/client + models, 119 tests,
  verified on hardware across both firmware lines and both transports.
- "the inbound call-home session is the only protocol unknown left."  It was
  captured end to end on 2026-10-14.  There are no protocol unknowns left.

Replaced with the current state, and added the three things a reader most needs
up front: that ACH has TWO paths decided by who holds the modem's single session
(so silence from a probe is usually contention with THOR, not a fault); that
0xA2 ends a call-home on series IV and CONFIRMS ERASE on series III across a
shared transport; and that monitor-while-calling-home blocks erase while THOR
calls the session a success, which makes the server-side high-water mark
load-bearing.

Also named the real remaining gap honestly: config decoding, not protocol.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-14 19:51:46 -04:00
serversdownandClaude Opus 5 7645c91ae2 docs(series4): monitor-while-calling-home blocks erase, and THOR calls it success
Manual 11.4.4: a Micromate can call home WHILE IT CONTINUES TO MONITOR, or pause
monitoring and send.  UM12947 is on the former, which is why the captured session
logged "CANNOT DOWNLOAD MONITOR LOG" and "CANNOT DELETE ALL EVENTS -- The unit is
monitoring".

THOR REPORTS THAT SESSION AS "SESSION COMPLETED SECCESSFULLY" ANYWAY.  The
refusals are INFO lines.  From outside, a unit quietly accumulating looks
identical to one being managed correctly.

Correcting my own framing from earlier today: I flagged "Delete Events and Logs
from Unit = Yes" as a risk to the test data.  It is TMI's normal and necessary
fleet setting -- without it a unit fills up and re-offers every event on every
call.  A unit left on monitor-while-calling-home is the misconfigured one, and
drifts toward a full buffer by itself.

DESIGN CONSEQUENCE FOR SFM: a receiver cannot rely on erase to manage storage.
The erase can fail for a reason the unit considers normal, so the server-side
high-water mark is LOAD-BEARING rather than an optimisation -- it is the only
thing preventing a full re-download every session.  Series III's ach_state.json
(downloaded_keys / max_downloaded_key) is the pattern and has to carry over
deliberately.

Also a detectable fleet-health signal: "memory filling AND deletes refused" is
visible on every call from 0x06's event count and 0x1C's memory fields.  Worth
surfacing precisely because THOR calls it success.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-14 18:37:10 -04:00
serversdownandClaude Opus 5 08d2d31a09 docs(series4): a complete ACH session captured -- and 0xA2 is a loaded gun
MITM between UM12947's modem and THOR 1.5.0.29: 101 request frames, 101
responses, 0 bad checksums, 34,872 B of event data in 65 seconds.

EVERY COMMAND IN A REAL ACH SESSION IS ONE WE ALREADY IMPLEMENT -- POLL, SERIAL,
STORAGE_RANGE, MONITOR_STATUS, STATE, ARM_EVENT, EVENT_FIRST/NEXT, EVENT_RECORD,
BULK_DOWNLOAD -- except one.

SUB 0xA2 ENDS A CALL-HOME, AND COLLIDES WITH SERIES III'S ERASE.  The session's
final command is 0xA2 at offset 0xFFFF, answered 0x5D, and THOR's log at that
instant reads "StartMonitoringAfterCallhome / Switching unit back to monitoring".
So on series IV it means exit call-home and resume monitoring.

On SERIES III, 0xA2 -> 0x5D is CONFIRM ERASE -- the last step of
0xA3/0x1C/0x06/0xA2, after which the unit's memory is cleared.  Same opcode, same
response SUB, opposite consequence.  This is the most dangerous collision found
in this protocol: minimateplus and micromate already share a transport, and
sending 0xA2 to a MiniMate Plus to "end a session" erases it.  Any shared path
must dispatch on series before that byte goes near a wire.

It also corroborates the firmware string found by static analysis in September,
CMD_EXIT_CALL_HOME_DELETE_EVENTS_START_MONITORING.

TWO CORRECTIONS TO EARLIER ENTRIES OF MINE:

- 0x06 content[4:8] was recorded on 2026-10-01 as "9 on both units regardless of
  count -- a constant, not a count".  It reads 47 here, where THOR's log twelve
  minutes earlier reported "Monitor Log count: 45" on the same unit.  It is
  almost certainly the monitor-log count; both units reading 9 just meant both
  held 9 records.

- SUB 0x49 was recorded as 0x00 idle / 0x02 monitoring.  It reads 0x03 throughout
  this session, ten for ten -- a distinct in-call-home state.  Precisely why the
  rule is "test for non-zero": a client checking == 0x02 would call a unit
  mid-call-home idle.

Also softened the claim that mm_ach_server is "built on the wrong model".
ListenerAchTcp HAS now accepted a connection -- when nothing else holds the
modem's single session, the unit dials out and the listener takes it; when THOR
already holds a connection, the ring rides that instead.  Both paths are real.
The listener model is valid, it just loses the race against anything already
connected -- which explains every failed probe and relay attempt today as
contention rather than bugs.

And noted: THOR rewrites a unit's stored IP from the call-home source address, so
a relay silently poisons THOR's record of where that unit lives.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-14 18:35:38 -04:00
serversdownandClaude Opus 5 8f67608e0f feat(micromate): answer a RADIO RING the way THOR does -- SERIAL, immediately
THOR's ACH log exposed two differences between what it does on seeing a ring and
what we were doing, and either could explain why the unit never answered us:

              | ours              | THOR
  command     | POLL (0x5B)       | ReadSerialNumber (0x15)
  delay       | 8 s (grace window)| 36 ms

We sat silent for the whole grace window and then asked a different question.
The unit may well have given up long before we spoke.

So the grace window now ENDS THE MOMENT a RING is seen, and the ring is answered
with SERIAL first -- which is THOR identifying which unit rang before doing
anything else.  The push-vs-pull experiment the window was built for is
unaffected: silence still runs the full duration.

This does not change the bigger finding that mm_ach_server is built on the wrong
model for a PAD-connected unit -- THOR's working path is a POLLER holding an
outbound connection, not a listener.  But if a unit whose modem dials out can be
made to answer on the inbound path too, that is worth knowing before the rewrite,
and it costs two small changes to find out.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-14 18:12:14 -04:00
serversdownandClaude Opus 5 90ac7ff76a docs(series4): SOLVED -- call-home is an in-band wake signal, not a dial-out
From THOR's own ACH log, 4,414 lines, UM12947 over an RX55.  This overturns the
model this document has carried from the start and explains every confusing
result of the past weeks.

A MICROMATE DOES NOT DIAL ANYBODY.  It emits the ASCII string "RADIO RING" over
its serial port, and that text travels up a TCP connection THE SERVER ALREADY HAS
OPEN TO THE UNIT.  The server recognises it and runs a session on that same
connection.

  17:18:17  TcpClientSystemNet    #1: RADIO RING IS RECEIVED FROM IP:63.45.161.30 Port:9034
  17:18:17  ListenerAchRadioRing  #2 RADIO RING IS DETECTED
  17:18:17  ConnectorWorkerThread Process Request: ReadSerialNumber
  17:18:18  ListenerAchRadioRing  #3 RADIO RING UNIT SERIAL NUMBER = UM12947
  17:18:18  ACHManager            #8 RADIO RING STARTED A NEW SESSION

TcpClientSystemNet is THOR's outbound TCP CLIENT -- the ring arrives on the
connection THOR itself opened to unit:9034, the ordinary call-UP path.  No
inbound connection, no dial, nothing to accept.  THOR keeps that connection alive
on purpose: UnitWatchDogTimer reconnects continuously, 1,039 log lines in 37
minutes.

THOR's OTHER ACH path was never used.  ListenerAchTcp logs "Waiting for a ACH
connection on Port 12346" and in 4,414 lines NEVER ACCEPTED ONE.  All twelve ACH
events came through ListenerAchRadioRing.

CONSEQUENCE: bridges/mm_ach_server.py is built on the wrong model for this
deployment.  It listens for an inbound connection -- ListenerAchTcp's model, the
one THOR never exercises here.  The right shape is a POLLER that holds an
outbound connection to each unit, watches the stream for RADIO RING, identifies
the unit, and runs a session on the same socket.

That also dissolves the single-session contention that dogged every experiment
today: the receiver must hold the modem's one session slot PERMANENTLY.  Our
probes and MITM attempts were not fighting a bug, they were fighting the design.

Also captured: the full ACH state machine (15 steps), the eight request types
with counts, and two corroborations -- StartMonitoringAfterCallhome matches the
firmware string found by static analysis in September, and ReadEventRecordCount
returning "Event count: 19" independently supports the SUB 0x06 event-count
finding.

Flagged, unexplained: events are addressed as 90000001 (length 4076) in THOR's
ACH path, where our chain walk returns 055d4a81 for an event of exactly that
length.  Same event, different address space.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-14 17:55:50 -04:00
serversdownandClaude Opus 5 52d18b0d5d docs(series4): OBSERVED -- THOR's ACH side is POLL, byte-identical to ours
First capture of THOR's half of a Micromate call-home, taken with ach_mitm.py
between UM12947's modem and a THOR 1.5.0.29 ACH server on port 8070.

THOR sends POLL (SUB 0x5B, offset 0x0030) and NOTHING ELSE -- four times over
~21 s, then gives up.  No greeting, no answer to the RADIO RING, no CONNECT.

And that POLL is BYTE-IDENTICAL to what micromate.protocol builds:
build_request(SUB_POLL, 0x0030) reproduces all four frames exactly.

So the ACH session is PULL, and bridges/mm_ach_server.py already implements it
correctly.  The "inbound call-home session" -- carried for weeks as the last
protocol unknown -- was never a separate protocol at all.  It is the ordinary
command set on an inbound socket, exactly as series III's 72 captured sessions
suggested it would be.

THE OPEN PROBLEM IS NOW CLEARLY ELSEWHERE.  In the same capture the unit sent
only "RADIO RING", four times, and never a protocol frame.  THOR polled four
times and got nothing -- identically to our own server in three attempts the
same afternoon.  THE VENDOR'S OWN SOFTWARE FAILS THE SAME WAY WE DO, which
eliminates the receiver as a suspect and places the fault between modem and
unit.

Established: cellular healthy (151 ms connect, outbound dial works), bytes do
reach us from the unit's side, modem serial config matches spec (115200 8N1, no
flow control, PAD/TCP), cable is FTDI and cold-booted with it attached.  Not
established: whether the unit or the modem emits "RADIO RING" -- it is the
literal string in this unit's own 0x2C dial-string field, and the cheap
disambiguation is to disconnect the unit and see if it still appears.

Next step is a config diff against a working deployed unit's modem, not more
protocol work.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-14 16:42:18 -04:00
serversdownandClaude Opus 5 fc0a7b2a88 chore: ignore capture artefacts beside the bridge scripts
A stale Windows checkout had ten March-era capture files staged as new and
deleted from the working tree -- .bin/.log/.set artefacts in bridges/ and
bridges/s3-bridge/ that .gitignore never covered, since it only had
/bridges/captures/.

Deliberately NOT ignoring /bridges/s3-bridge/ wholesale: proxy.py and
s3_bridge.py live there and are tracked.  Only the artefact extensions.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-14 16:33:44 -04:00
serversdownandClaude Opus 5 3fa2a4035e fix(micromate): the ACH server now names modem chatter, and flushes its output
Three things the first real call-in exposed.  UM12947's modem dialled in at
14:16:56 from 63.45.161.30 -- the network path works -- and sent 60 bytes of
"RADIO RING", space-padded and newline-separated, four times.

1. THAT IS MODEM CHATTER, NOT THE UNIT, and the server left it as a hex dump to
   interpret by hand.  CLAUDE.md already records that an RV50/RV55 "sends
   \r\nRING\r\n\r\nCONNECT\r\n over TCP to the caller even with Quiet Mode
   enabled"; an RX55 on AirLink OS says RADIO RING instead.  The server now
   recognises the known modem strings and says so.

   ⚠ The diagnostic value is in what was MISSING: four RINGs and NO CONNECT.
   RING means the modem is ringing the serial device, CONNECT means something
   answered.  Rings without a connect, plus no answer to POLL, means TCP is fine
   and the unit is not on the other end of the serial link.  The server now
   prints that conclusion and the three things to check -- cabled at all, cable
   chipset (FTDI/CDC-ACM only, never Prolific), and a cold boot with the cable
   attached, since the USB-A host port only enumerates at power-on.

2. STDOUT WAS BLOCK-BUFFERED.  With output redirected, every print sat in a
   buffer, so the log read EMPTY while a call was in progress and the session was
   only discoverable on disk afterwards.  For a tool whose whole job is to be
   watched during a one-shot event, that is close to useless.  Line-buffered now.

3. THE DOCSTRING PROMISED SCANNERS LEAVE NO TRACE ON DISK, AND THEY DID.  The
   failed-handshake path created a session directory unconditionally -- my own
   loopback sanity check produced one.  Now a connection that sends nothing AND
   fails the handshake is discarded with no directory; one that sent something
   unprompted is always kept, because that is the interesting case.

Also recorded in session.json: modem_chatter, ring_count and a diagnosis string,
so a session can be triaged without re-reading the raw bytes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-14 14:21:42 -04:00
serversdownandClaude Opus 5 67de2c18da fix(tooling): mm_client_check reported THOR's request count, not its own
The download line computed `size // 1024` -- THOR's chunk size -- while the
download used the 16 KB default.  So a 72,560 B event that took 5 requests was
printed as "71 chunks", and I nearly read a working 16 KB download as a broken
1 KB one.  A diagnostic that misreports what it did is worse than one that says
nothing.

Now prints the real count and the size used: "5 req @ 16384 B".

Verified by counting the frames in a capture of that run: 5 x SUB 0x5A at
offsets 0x4000 0x4000 0x4000 0x4000 0x1b70, summing to exactly 72,560.  That is
also the FIRST time the 16 KB chunk size has run through the real download loop
on hardware -- previously only the probe had issued 16 KB single requests, and
the loop itself had only been exercised at 1024 B against THOR's frames and at
16 KB against simulated responses.

Also recorded: USB identification for the Micromate's own ports.  Its PC port is
2504:0300 (Instantel Inc. MICROMATE COM PORT), appearing as CDC-ACM, against
0403 FTDI and 067b Prolific for the USB-A host-port cables.  Address it by
/dev/serial/by-id/ and not /dev/ttyACM<n>, because the number moves whenever
another CDC-ACM device appears -- which has already cost a session aimed at a
TMI-Seismo MCU by mistake.

And: passing one through to a Proxmox guest hot-plugs with no VM restart via
`qm set <vmid> -usb0 host=2504:0300`.  UM20147 is now on tmi-dev (10.0.0.44)
this way, which means the unit can be driven from the dev VM directly instead of
relaying commands.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-14 12:46:01 -04:00
serversdownandClaude Opus 5 bdf4909d2a docs(series4): no Micromate has ever been observed calling home
Correcting an implication I made.  The 72 ach_inbound_* sessions in
bridges/captures/ are MiniMate Plus, and I framed the Series III ACH setup as
though it transfers to a Micromate.  It is not known to.

What we actually have for Series IV is prior, not observation:

- THOR manual 6.2 and the firmware's own strings
  (CMD_EXIT_CALL_HOME_DELETE_EVENTS_START_MONITORING, "Call Home Deleting
  Events") say the unit dials in and waits to be told what to do -- server-driven,
  the same shape as Series III's pull model.
- UM12947's 0x2C dial string reads literally "RADIO RING", which is modem ANSWER
  vocabulary rather than a destination.  With the RV50 debug string
  ATQ1 ATE0 ATS0=2 ... RADIO RING -- ATS0=2 being auto-answer-after-2-rings --
  that reads as the unit arranging to ACCEPT calls, i.e. the call-UP path.  Which
  argues the ACH destination lives in the modem, as it does for series III.

If both priors hold, mm_ach_server.py is just MicromateClient on an inbound
socket and the unknown evaporates.  But there is a specific failure mode worth
naming in advance:

THE MICROMATE DEMONSTRABLY TALKS AT TO ITS MODEM.  If it drives an AT dial for
call-home, that exchange happens on the SERIAL LINK and a TCP listener sees none
of it.  So the first experiment has an AMBIGUOUS NULL -- no connection could mean
the trigger did not fire, or that the interesting part is invisible from the
network.  The escalation is a serial-level capture between unit and modem, not
more fiddling with the server.

Recorded in both the protocol reference and the server's own docstring, so
whoever runs the experiment reads the caveat before being puzzled by a silence.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-03 01:54:31 -04:00
serversdownandClaude Opus 5 4579896b6d feat(micromate): inbound ACH server -- and the push-vs-pull experiment
The inbound call-home session is the last unmapped part of the Series IV
protocol, and it may well not be a separate protocol at all.  Series III's
answer, from the 72 ach_inbound_* sessions on disk, is that the unit DIALS IN AND
THEN WAITS: ach_server.py accepts the socket, wraps it in SocketTransport ->
MiniMateClient, runs the ordinary handshake and drives with the ordinary command
set.  If Series IV behaves the same way, this file is just MicromateClient
attached to an inbound socket.

THE ONE QUESTION THAT MATTERS IS PUSH VS PULL, and no packet capture can answer
it -- you have to connect and keep quiet.  So the server says NOTHING for --grace
seconds after accepting.  Bytes in that window mean the unit speaks first, and it
reports the hex, the ASCII, and whether they parse as a response frame (series III
sends an "Operating System" banner on cold boot, so a banner is the likely shape).
Silence means pull, and the normal handshake follows.

READ-ONLY, and deliberately more so than its series III sibling: that one has
"rescue actions" that stop monitoring and disable ACH on a runaway unit, and
those are absent here.  No command has ever been originated against a unit by
this project, and an inbound session is the worst place to break that.  --depth
defaults to walking the event chain WITHOUT downloading.

Captures land as raw_bw_*/raw_s3_* so scratch/mm_frame_parse.py reads the pair
with no arguments, plus a session.json recording what was learned -- including
the push flag, which is the result worth keeping.  The session directory is
created only after the handshake succeeds, so a port scanner leaves nothing on
disk.

Smoke-tested both paths against a fake unit that dials in: PULL detected over
silence and driven to a full chain walk (33 frames, 0 bad checksums, parses with
the existing tool), and PUSH detected from a 10-byte banner with the frame-parse
attempt reported honestly as "none parsed".

Worth recording for the setup: for series III the call-home DESTINATION lived in
the MODEM's config (ACEmanager), not in the seismograph.  If that holds for the
RX55 then nothing on the instrument needs changing, which keeps the no-writes
line intact.  If it has to come from the unit, its 0x2C block holds a 40-byte
dial string -- and writing that is THOR's job, not ours.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-03 01:25:53 -04:00
serversdownandClaude Opus 5 263daa0f96 docs(changelog): the Series-4 event chain, and two corrections to this file
Folded into the existing Unreleased sections.

Added: the event chain (list_events / iter_events / download_event / get_event /
decode_error) with the 74-frame replay test behind it, the per-event PVS decode
self-check, and 0x06 as the event count.

Changed: 16,384 B per request with the byte-driven loop the silent clamp forces;
the retraction of the 0x5A streaming mode; and the hardware verification across
both firmware lines and transports, including that event keys collide across
units.

Fixed: the 64 KB download cap, and the probe's own control being circular.

TWO OF THESE CORRECT THIS FILE'S OWN EARLIER ENTRY, which is the part worth
reading:

- The previous entry stated "~0.65 s per round trip, regardless of payload" and
  drew the advice "minimise round trips, not bytes".  Measured against a 14 KB
  response, cost is ~0.21 s + bytes/2,350.  Every sample behind the old claim was
  under 1 KB, so the byte term was small and uniform and per-command cost looked
  constant -- a narrow-range fit extrapolated past its evidence.  The advice now
  splits: status work is round-trip bound, downloads are throughput bound, and
  the 16 KB chunk size is a ~30% win rather than 14x.

- The previous Migration note said nothing under micromate/ was touched, which
  the preceding merge had already made false; this merge changes the download
  loop as well.  Still Migration: None -- no codec, store, DB or TOOL_VERSION
  change, and no shipped path calls the loop that changed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-02 19:28:18 -04:00
serversdownandClaude Opus 5 4a11eadc91 merge: the Series-4 event chain, a 64 KB cap closed, and a cost model corrected
Step 4 of docs/micromate_client_spec.md plus what measuring it turned up.
Read-only throughout; still nothing in this project has ever originated a
command against a unit.

The event chain: MicromateEventRef, list_events(), iter_events(),
download_event(), get_event() and decode_error().  The load-bearing test replays
THOR's captured six-event session and asserts every byte we emit matches its 74
frames, while decoding all six events and cross-checking each waveform's peak
vector sum against the float the device computed itself.

Three things hardware found that captures could not:

1. A 64 KB DOWNLOAD CAP, one event away from biting.  The 0x5A chunk offset was
   a uint16 because every offset THOR sends fits in two bytes; UM20147 holds a
   72,560-byte event.  params[0:4] is one 4-byte field (chunk 0 puts the key
   there), so a uint32 is byte-identical below 65,536 and reaches past it.
   Confirmed on the unit: 71 chunks, exact size.  This is the Series III 64 KB
   page-boundary bug wearing a different hat, and that one is still open.

2. NO 0x5A STREAMING MODE -- retracted.  The offset field is simply a byte count
   and the device returns offset + 11 bytes in one frame.  But the probe that
   killed the hypothesis showed 1024 B is THOR's choice, not the device's limit:
   the ceiling is 16,384, and above it the device CLAMPS SILENTLY with correct
   bytes and no error.  That is why the download loop now tracks its offset by
   bytes received rather than striding by chunk index.

3. CELLULAR COST IS NOT INDEPENDENT OF PAYLOAD.  I had it as ~0.65 s per round
   trip regardless of size and built design advice on it.  Measured against a
   14,176 B response: t ~ 0.21 s + bytes/2,350.  The old figure was right for a
   1 KB response and was a narrow-range fit extrapolated past its evidence --
   every sample behind it was under 1 KB.  Status work is round-trip bound;
   downloads are throughput bound, so 16 KB chunks save ~30%, not 14x.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
2026-10-02 19:27:15 -04:00