From 1aa07e75d9011d75bbc369245c19b70d6f82d80a Mon Sep 17 00:00:00 2001 From: serversdown Date: Tue, 27 Oct 2026 02:32:25 -0400 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL --- CHANGELOG.md | 2 +- README.md | 37 ++++++++++++++++++++++++++++++++--- minimateplus/event_file_io.py | 2 +- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e73b44..d396d67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to seismo-relay are documented here. --- -## v0.32.0 — 2026-10-26 +## v0.32.0 — 2026-10-27 **Event times you can trust, and Series 4 mapped end to end.** Two threads. diff --git a/README.md b/README.md index 807b18c..882f5b0 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ A ground-up replacement for **Blastware** — Instantel's aging Windows-only software for managing seismographs. Supports both the **MiniMate Plus (Series III)** and the **Micromate (Series IV / "Thor")** families: Series III via the live RS-232 / TCP wire protocol *and* Blastware ACH file -ingest; Series IV currently via Thor TXT-paired IDF file ingest, with the -binary codec on the roadmap. +ingest; Series IV via Thor IDF file ingest (binary codec verified per-sample +against Thor's own exports), plus a read-only live client in `micromate/`. Built in Python. Runs on Windows, Linux, or macOS. Connects to instruments over direct RS-232 or cellular modem (Sierra Wireless RV50 / RV55). @@ -59,6 +59,21 @@ over direct RS-232 or cellular modem (Sierra Wireless RV50 / RV55). > recent.zip` (recent events' waveform files), and a gated > `POST /db/restore` (`SFM_DB_RESTORE_ENABLED`, dev-only). Terra-View > v0.17.0 drives them to pull a one-pass prod→dev refresh. +> **v0.32.0 (2026-10-27)** makes stored event times trustworthy. +> - **Series-III waveform times** now come from the instrument's own event +> record, which the unit sends inside its 5A stream. They used to be stamped +> with the monitoring-session start, hours off. The new time matches +> Blastware on every one of 1,320 report-paired waveforms, with no filename +> needed. +> - **Re-storing an event at its corrected time moves its row in place**, +> instead of duplicating it. +> - **Sub-minute histograms recorded with the mic off now decode** (#47, #49). +> - **Micromate `.h5` samples are on Thor's own scale** (#42). +> - **Series IV:** the live protocol is mapped (`docs/micromate_protocol_reference.md`) +> and has a read-only client. +> +> ⚠ The deploy owes a backfill and moves stored waveform times; see the +> changelog's *Migration*. > See [CHANGELOG.md](CHANGELOG.md) for full version history. --- @@ -209,6 +224,8 @@ Used by watcher daemons to push field-collected event files into the SFM DB + waveform store. Both accept multipart uploads of binary event files optionally paired with their ASCII sidecar reports; both dedup by `(serial, timestamp)` and UPSERT device-authoritative fields on re-import. +Since v0.32.0 a Series-III event re-stored at a corrected time is matched by +its Blastware filename and moved in place (see *Database* below). | Method | URL | Description | |--------|-----|-------------| @@ -348,6 +365,20 @@ resets to `0x01110000` after every erase, so timestamps are the correct dedup field. Migration handles the transition transparently on first startup. +**Since v0.32.0**, `insert_events` also matches a row by its Blastware filename +(Blastware names only; a generic upload name like `imported.bw` says nothing): + +- **A corrected time moves the row.** An event re-stored at a corrected time — + the v0.32.0 backfill, or a watcher re-forward — has its existing row moved in + place, keeping its id and review. +- **A taken second is refused.** If a different file already holds that second, + nothing is written. +- **An estimate never changes a row.** An event whose time is only an estimate + (no validated embedded event record; see Series-III reference §7.8.9) is still + stored, but its time never moves, merges into or duplicates a row. + +Every refusal is logged as a warning. + **`device_family` (added v0.19.0)** discriminates Series III from Series IV at the SQL level. Set by every import path; the UI dispatches on it to render mic units correctly (Series III: psi → dBL conversion; Series @@ -607,7 +638,7 @@ Implementation steps (concrete): - [ ] Locate "Sensor Check" byte in compliance config (need capture with Disabled vs Before-monitoring). - [ ] Call Home — map time slots 3/4 offsets; confirm `modem_power_relay_enabled`. - [ ] RV55 DCD/DTR — newer RV55 firmware doesn't assert DCD by default; units don't resume monitoring after call-home disconnect (`--restart-monitoring` flag deferred). -- [ ] **NULL-timestamp duplicate-row dedup.** A small handful of events (2 known on prod as of 2026-05-22) have `events.timestamp IS NULL` because the codec couldn't extract a timestamp from the binary footer. The `UNIQUE(serial, timestamp)` constraint doesn't fire on `NULL` (SQL semantics: `NULL ≠ NULL`), so every `--force` backfill INSERTs a new row instead of UPSERTing the existing one. Cleanup: a one-shot SQL query that keeps only the newest row per `(serial, blastware_filename)` and deletes the rest. Longer-term: extend the unique key to `(serial, COALESCE(timestamp, blastware_filename))` or reject inserts with NULL timestamp. +- [ ] **NULL-timestamp duplicate-row dedup (#52).** A small handful of events (2 known on prod as of 2026-05-22) have `events.timestamp IS NULL` because the codec couldn't extract a timestamp from the binary footer. The `UNIQUE(serial, timestamp)` constraint doesn't fire on `NULL` (SQL semantics: `NULL ≠ NULL`), so every `--force` backfill INSERTs a new row instead of UPSERTing the existing one. Cleanup: a one-shot SQL query that keeps only the newest row per `(serial, blastware_filename)` and deletes the rest. Longer-term: extend the unique key to `(serial, COALESCE(timestamp, blastware_filename))` or reject inserts with NULL timestamp. - [ ] **Histogram body sub-format with `byte[5] != 0`.** ~3 events on prod (`T190LD5Q.LD0H`, `O121L4L1.GU0H`) use a histogram body my walker doesn't recognize — the first block has `byte[5] = 0x01` or `0x07` instead of `0x00`, and the entire body lacks the `1e 0a 00 00` tail signature. Codec returns 0 valid blocks; their DB PVS comes from the bw_report ASCII overlay (which BW computed from the same binary, so the DB columns are correct). Only the `.h5` waveform plot is empty. Cracking the sub-format would unlock the plot. Needs binary+ASCII pairs from a few `byte[5]!=0` events; same RE approach as the K558 case. - [ ] **Histogram body sub-format with `byte[5] == 0x00` but undecodable.** Observed 2026-05-28 on BE17353 (S353) events: `S353L4H2.FZ0H`, `S353L4H2.P00H`, `S353L4H3.7O0H`, `S353L4H3.E10H`. Body starts `00 00 00 01 0a 00 XX 00 ...` which LOOKS like a valid histogram block header (marker 0x000a at byte[4:6] ✓, byte[5]=0x00 normal-format ✓), but the walker finds zero data blocks across the whole body. Likely an extra header before the block stream OR a different tail signature than `1e 0a 00 00`. Smaller body lengths (1900-2100 bytes) suggest these may be short-recording histogram variants. Same operational impact as the byte[5]!=0 case: event ingests cleanly, DB peaks correct via bw_report overlay, only the chart is empty. Worth dumping a hex view of one body to diagnose. - [ ] **Sensor-check waveform extraction from the BW binary.** BW's Event Report PDFs include a narrow panel on the right side of the waveform plot showing each channel's response to the sensor self-check signal (a damped sinusoid for geo, sawtooth-at-test-freq for mic). Our parser captures the test RESULTS (`test_freq_hz`, `test_ratio`, `test_amplitude_mv`, `test_results` pass/fail) and the PDF + modal display them as text — but BW's per-sample sensor-check waveform isn't accessible to us today. Two paths to add it: (a) RE the binary to find where the sensor-check samples are stored — could be a section before STRT, after the footer, or in a separate sub-record; protocol reference doesn't currently mention it. (b) If samples aren't in the binary, synthesize a representative waveform from the test parameters (damped sinusoid at `test_freq_hz` with damping from `test_ratio`). Path (a) is the honest answer; path (b) is decorative. Until either lands, the text-only sensor-check display in the report is fine. diff --git a/minimateplus/event_file_io.py b/minimateplus/event_file_io.py index f8c8108..3b6be84 100644 --- a/minimateplus/event_file_io.py +++ b/minimateplus/event_file_io.py @@ -50,7 +50,7 @@ SIDECAR_KIND = "sfm.event" # bumped without a `pip install` re-run — leading to confusing stale # version stamps in sidecars. Bump this constant and CHANGELOG.md # together at release time. -TOOL_VERSION = "0.32.0" # waveform times from the BW name, report dates, histogram reader; gates the backfill regen +TOOL_VERSION = "0.32.0" # waveform times from the event record, report dates, histogram reader; gates the backfill regen try: # Best-effort: prefer the installed metadata when it's NEWER than the