diff --git a/CHANGELOG.md b/CHANGELOG.md index e9ab59d..5afeae5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -135,6 +135,68 @@ All notable changes to seismo-relay are documented here. - No schema change. - The over-range flags are on the decoded event only: not stored in the DB, sidecar or `.h5` yet. +- **Monitor logs (.MLG): SFM reads them and keeps each unit's monitoring + timeline** (`feat/mlg-import`, merged 2026-11-16). Spec + `docs/superpowers/specs/2026-11-09-mlg-unit-timeline-design.md`. + - **Why (Brian, 2026-11-09):** every unit sends an `.MLG` at every call-in, + whatever its mode. A continuous-mode unit sends no event file on a quiet + day, so its `.MLG` is the only proof it was monitoring. That proof is what + a shot report attaches for a unit that did not trigger. Outage history is + the second use. + - **The format, measured** (reference D.4, rewritten): + - an 18-byte prefix, then length-led 292-byte records + - each record ends in a CRC-16/AUG-CCITT over `[0:288]`, little-endian: + 3,329 / 3,329 records + - `minimateplus/mlg_file.py` reads it, checking every record's checksum, + and writes it: 16 / 16 real files rebuilt byte for byte + - the old unused writer in `blastware_file.py` (big-endian, a zero CRC + at the wrong end) is removed + - `minimateplus/crc.py` is the one CRC, now used by + `micromate/setup_block.py` too + - **Storage:** new tables `mlg_files` (one row per file received) and + `mlg_records` (one row per record, stored once). The original file is kept + under `//mlg/`. + - An empty file has no serial inside. It takes the longest known serial + its `` name starts with, or is stored as unresolved, + never guessed. + - Only plain serials become directories. + - **The timeline** (`sfm/mlg_timeline.py`): + - **sessions:** how each ended, its events, and its trigger level as + logged + - **gaps and what each means:** call-in, scheduled off, lost power, + stopped by a person, memory full, no restart after a call-in, records + missing + - **clock steps:** the unit's clock steps back an hour at its first + call-in after daylight saving ends + - **call-ins:** delivered, no_file (a Modem Exit that left no file) and + nothing_new (an empty file) + - **"Was it monitoring at T"** answers monitoring / not_monitoring / unknown, + naming the records and file behind the answer. It never claims more than + the records show: a gap across a missing call-in number (files are + numbered) reads unknown. + - **Routes:** `POST /db/import/mlg_file`; `GET /db/units/{serial}/timeline`, + `/db/units/{serial}/monitoring_at`, `/db/mlg_records` and + `/db/mlg_files/{id}` (the original, for printing). + - **Tools:** `scripts/import_mlg_dir.py` (bulk import, with a dry run) and + `scratch/check_mlg_vs_events.py` (cross-check against the event files' + footers). + - **Measured on DL2's 1,273-file sample** (BE6907 and BE12844 from 2026, + BE8081 from 2018–19): + - 0 errors, 0 unresolved + - BE8081's 785 Event Recorded records match its 785 event files, both ways + - every recorded event falls inside a session + - two real outages: BE6907 recorded nothing for 14 days from 2026-10-07, + and BE8081 didn't restart after a failed call over Labor Day 2019 + - ⚠ **Operational:** + - Two new tables are created on first start: no migration, no backfill, + no `TOOL_VERSION` bump (the event decode and the `.h5` files are + unchanged). + - Nothing arrives until `.MLG`s are imported. The watcher does not forward + them yet (`../series3-watcher`, Brian's call). + - DL2's full set (~86,000 files) loads with `scripts/import_mlg_dir.py`. + Load it from a robocopy copy: a Windows zip shifts summer file dates by + an hour. + - Terra-View shows none of it yet. ### Fixed - **The mic's own range: a range-1 mic reads an eighth.** @@ -236,6 +298,13 @@ All notable changes to seismo-relay are documented here. - **Reference D.6, "Reading a mismatch":** 256, 4,096 and 65,536 mean a number outgrew its 8-, 12- or 16-bit box. Every case so far is listed (Brian's observation, 2026-11-05). +- **Reference D.4, rewritten:** the `.MLG` format, measured. + - Its framing, CRC and fields. + - How Blastware writes the files: one per call-in, no record repeated, and + a Modem Exit that is not a file's last record was a call that left no file. + - How a session appears, and the cross-check against the event files. + - The old D.4.1–D.4.3 (a 308-byte header, a CRC at each record's start) are + kept, marked retracted. ## v0.34.0 — 2026-11-04 diff --git a/CLAUDE.md b/CLAUDE.md index 2b3b30e..20d3356 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -31,7 +31,7 @@ Read this first when picking the project back up. 3. switch ingest so reports are kept only for checking (retire the overlay) 4. stop the watchers forwarding reports - Until step 3, prod keeps the report as truth wherever one exists. -- **🔑 Monitor logs (.MLG) and each unit's timeline (2026-11-13, `feat/mlg-import`).** +- **🔑 Monitor logs (.MLG) and each unit's timeline (merged to `dev` 2026-11-16; next release).** - **What:** every unit sends an `.MLG` at every call-in, in every mode. SFM reads it (`minimateplus/mlg_file.py`, reference D.4) and keeps each unit's monitoring timeline: sessions, gaps and what they mean, clock steps, and the call-ins, including calls that