The 2026-09-20 assessment had gone stale: the 64 KB download bug, "no live Series-4 path", the failing suite and the 8x Sensitive reading are all fixed, and the SFM / SDM split it was framed on is retired. Rewritten on the same plan, each claim re-checked against today's code: decoding and the store are production; the device side, both series by serial, is bench-proven behind the safety core but has no login, runs synchronously behind Terra-View's 60 s proxy, and is not used in the field yet; the lab tools left the image. Known issues now list the open Gitea issues (#6 first) and the overlay. The old text is `git show v0.36.0:docs/sfm_tool_status.md`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALX2R9LdWawLzUxwewZGA1
182 lines
11 KiB
Markdown
182 lines
11 KiB
Markdown
# SFM — where it actually stands as a tool
|
||
|
||
**Status as of 2026-12-04 (v0.36.0).** This is the honest assessment, not the
|
||
roadmap — `README.md § Roadmap` covers where it is *going*. Expect this file to
|
||
go stale; re-date it when you revise it. The previous assessment (2026-09-20,
|
||
v0.31.0) is `git show v0.36.0:docs/sfm_tool_status.md`.
|
||
|
||
---
|
||
|
||
## The framing
|
||
|
||
SFM is one module (Terra-View's ADR 0003 retired the old SFM / SDM split), but its
|
||
parts sit at very different levels of maturity:
|
||
|
||
| part | what it is | maturity |
|
||
|---|---|---|
|
||
| **Decoding** | `minimateplus/`, `micromate/`: bytes in, events out | **Production, measured.** Checked field by field against Blastware and Thor at archive scale. |
|
||
| **The store and ingest** | the DB, the waveform store, `/db/*`, `/db/import/*` | **Production.** Terra-View depends on it daily. |
|
||
| **The device side** | `/device/*`, live connections to units, both series | **Bench-proven, not field-proven.** Every feature works on a bench unit of each series, behind an audited safety core. No login, and nothing in production uses it yet. |
|
||
| **The lab** | `bridges/`, `scratch/`, `seismo_lab.py` | **Research tools.** Kept out of the production image since v0.36.0. |
|
||
|
||
In September the device side was "an emergency tool and a research project"
|
||
(Brian). That has changed more than anything else here: it now speaks both
|
||
series by serial, with dry runs, an audit table and read-backs. What it lacks is
|
||
not protocol work but **a login, long-running jobs, and field use**.
|
||
|
||
---
|
||
|
||
## 1. What you can rely on
|
||
|
||
### Production-grade — trust it
|
||
|
||
- **Series-3 decode.** The checker (`scratch/check_s3_decode.py`) decodes all
|
||
70,042 DL2 events (2016–2026) from their bytes alone and compares every field,
|
||
sample and interval with Blastware's own `_XML.XML` report.
|
||
- **80 of 88 fields match on every event**; every other field matches or is
|
||
accepted under a carve-out with its evidence.
|
||
- **Geophone samples** are exact on 6,524 / 6,524 waveforms; **histogram**
|
||
interval peaks have 0 mismatches on every file.
|
||
- Left, by Brian's decision (2026-11-11): the vector sum's last digit on 4
|
||
waveform/histogram twins, and 4 accelerations.
|
||
- **Series-4 (Thor) decode.** 3,807,158 / 3,807,165 samples exact across 459
|
||
files and three corpora of Thor's own CSV exports (the 7 others are Thor's own
|
||
rounding); production IDFW 575 / 575 with zero truncations. Since v0.36.0 a
|
||
Thor file's settings, notes and event time come from the file itself (2,027 /
|
||
2,027 against Thor's reports).
|
||
- **The ingest path.** The watchers forward each unit's files to
|
||
`/db/import/blastware_file` and `/db/import/idf_file`. This is how prod gets
|
||
its data, and it has run unattended for months.
|
||
- **`/db/*` read API.** Always on; Terra-View reads every fleet listing, event
|
||
detail and report from it.
|
||
- **The waveform store**: `.h5` + `.sfm.json` sidecars + the retained original
|
||
files, with operator review state preserved across regeneration. Events are
|
||
keyed unit + time + type.
|
||
|
||
### Bench-proven — works, not yet trusted in the field
|
||
|
||
- **Live device control by serial, both series** (`sfm/device_access/`, merged
|
||
2026-11-04): identify, status, settings read and change, event list and
|
||
download, start/stop monitoring, call-home on/off.
|
||
- Every write goes through one safety core: a fresh identity read, the run
|
||
state, a dry run showing the exact frames, a row in the `device_commands`
|
||
audit table, one send never retried, and a read-back.
|
||
- Verified on one bench unit per series (UM20147, BE9441); settings and
|
||
call-home changes were confirmed on the unit's own screen. MiniMate downloads
|
||
match Blastware's files byte for byte, including the 64 KB page crossings
|
||
that broke in September.
|
||
- Used from SFM's own page (`sfm/sfm_webapp.html`, Serial field). No Terra-View
|
||
page uses `/device/*` yet.
|
||
- **The `.MLG` monitor log and each unit's timeline** (v0.35.0). Every record's
|
||
checksum held on the files examined (3,329 / 3,329), and it builds sessions,
|
||
gaps and call-ins. The DL2 archive is not imported yet.
|
||
In prod, but its tables are **empty** until the watcher forwards `.MLG`s.
|
||
|
||
### Emergency-grade — you are the error handling
|
||
|
||
- **The rescue ladder.** Runbook Method A (`docs/runbooks/wedged_unit_recovery.md`:
|
||
point a wedged unit's modem at `bridges/ach_server.py` and answer its call)
|
||
and the blind stop tools (`/device/stop_monitoring_*`; `scripts/blind_stop.sh`,
|
||
`slow_drip.sh`, `spam_stop.sh`).
|
||
Each has worked in a real incident, used a handful of times by one person with
|
||
the runbook open. Method A runs from a checkout on the dev box, not the image.
|
||
- **The legacy, serial-less `/device/*` routes** (MiniMate only). Kept for the
|
||
rescue tools; the serial-named routes replace them for everything else.
|
||
|
||
### Research tools — useful, not products
|
||
|
||
- **`seismo_lab.py`**: 2,882 lines of Tkinter (Bridge / Analyzer / Query DB /
|
||
Inspector). Desktop-only, single-user, no tests.
|
||
- **`scratch/`**: the checker and the verification harnesses
|
||
(`verify_thor_against_csv.py`, `verify_against_ascii.py`) and the offset
|
||
detector (`offset_scan3.py`). The production numbers above rest on them, so
|
||
they matter, but they are analysis scripts.
|
||
- **`bridges/`**: probes, relays and recording bridges for the bench.
|
||
- **`docs/offset_investigation.md`**: an open investigation, not a feature.
|
||
|
||
---
|
||
|
||
## 2. What to use when
|
||
|
||
| you want to… | use | notes |
|
||
|---|---|---|
|
||
| Know if a unit is monitoring, its battery, its memory | SFM page → Serial → Status, or `GET /device/monitor/status?serial=…` | both series |
|
||
| Know whether call-home is on | `GET /device/call_home/state?serial=…` | both series |
|
||
| See how full a MiniMate's buffer is | `GET /device/events/storage_range` | MiniMate only; no event walk |
|
||
| List a unit's stored events | Events tab with a Serial, or `GET /device/events?serial=…` | a MiniMate's list reads headers only |
|
||
| Pull one event into the store | the Download button per event, or `POST /device/events/download?serial=…&event_id=…` | checked against the unit's own peaks before it is stored |
|
||
| Start or stop monitoring | the Live tab with a Serial, or `POST /device/monitor/start\|stop?serial=…` | try `dry_run=true` first; audited, read back |
|
||
| Change a unit's settings | Config tab: Preview, then Send (`POST /device/settings/change`) | refused while monitoring; nobody in the unit's menus while it sends |
|
||
| Reach a unit that will not answer | runbook Method A: **answer its call** | do not race its call-home |
|
||
| Get event data into the DB | the watchers → `/db/import/*` | not the live walk |
|
||
| Know whether a unit was monitoring at a time | `GET /db/units/{serial}/monitoring_at?at=…` | answers "unknown" until `.MLG`s are forwarded |
|
||
|
||
The single most useful habit still holds: **the cheap probes are cheap and the
|
||
event walk is not.** Do not list events to answer a yes/no question about a unit.
|
||
|
||
---
|
||
|
||
## 3. Known issues
|
||
|
||
| issue | impact | status |
|
||
|---|---|---|
|
||
| **No login on SFM at all** | 27 `/device/*` routes (16 of them POSTs) plus `/db/restore` and `/db/events/delete_bulk`, open to anything that reaches port 8200 | Design agreed (Terra-View as the authenticated jump host); not built. Terra-View's `docker-compose.yml` still publishes `8200:8200`. |
|
||
| **The API's try-it-out page is live** | `:8200/docs` can send any of the above, erase included | Unguarded. The SFM page's erase asks you to type the serial; `/docs` does not. |
|
||
| **Long device operations are synchronous** | Terra-View's `/api/sfm/*` proxy times out at 60 s; a long download over cellular can exceed it | Known design constraint. Must become start-a-job / poll before Terra-View drives units remotely. |
|
||
| **THOR and SFM contend for a Micromate's modem** | a call-home is lost while SFM holds the line | Brian (2026-10-29): keep the hold as is; the long-term fix is SFM answering call-ins itself. |
|
||
| **#6: a MiniMate stays connected after a call-in unless its events are deleted** | it does not resume monitoring | Open, Priority/High, from April. May be stale; triage first. |
|
||
| **#32: some events decode to ramps or garbage** | corrupts shape-based false-trigger detection | Open, needs more information. |
|
||
| **Prod still overlays Blastware's ASCII report** | where a report arrives, its peaks, notes, sample rate and record time replace SFM's decode | By design until the overlay is retired. Some decoded fields (displacement, time of peak, acceleration, sensor checks, the Monitor Log line, over-range flags) are not stored yet. |
|
||
| **`SUB 0x08` lifetime counter reads a meaningless number** | `/device/events/index` | Labelled "unreliable" on the SFM page. |
|
||
| **`backfill_sidecars.py --force` silently inserts DB rows** | store files with no DB row get one; the dry run does not count them | Known. Avoid `--force`; `TOOL_VERSION` gates regeneration anyway. |
|
||
| **Smaller open issues** | #52 (restamp follow-ups), #53 (unknown regions of Series-3 files), #55 (PDF footer), #57 (detect a unit's series from its reply) | Open, low to medium. |
|
||
|
||
**Fixed since September:** the 64 KB download bug (2026-10-26); the 8× reading on
|
||
Sensitive-range events (v0.34.0); the test suite now passes on a fresh checkout
|
||
(1,806 passed, 0 skipped).
|
||
|
||
---
|
||
|
||
## 4. What stands between this and a real tool
|
||
|
||
Roughly in dependency order.
|
||
|
||
**1. A login.** Everything remote is gated on this. SFM has none, and the
|
||
modem IP whitelist gives no protection because SFM *is* the whitelisted origin.
|
||
The agreed design delegates rather than builds: Terra-View becomes the
|
||
authenticated jump host (`/api/sfm/*` already sits behind its operator login and
|
||
passes any path through), and the `8200:8200` publish is dropped so Terra-View is
|
||
the only door.
|
||
|
||
**2. Long operations as jobs.** POST starts a job, GET polls. Retrofitting
|
||
this after Terra-View drives units through synchronous calls would be far worse
|
||
than designing for it first.
|
||
|
||
**3. Field use of the device side.** It has been proven on one bench unit per
|
||
series. Using it on deployed units, a little at a time, is what turns "works"
|
||
into "trusted".
|
||
|
||
**4. SFM answering call-ins itself** (ADR 0003's call-in server, after its staged
|
||
proof). It replaces Blastware's ACH and THOR as the receivers and ends the
|
||
modem contention.
|
||
|
||
**5. Retiring the Blastware report overlay.** The decoder is ready; the
|
||
remaining work is storing the decoded fields listed above and letting SFM's own
|
||
report read them.
|
||
|
||
**Done since September:** the 64 KB fix; a live Series-4 client and both series
|
||
by serial; confirmation on every serial-named write (dry run, preview, audit,
|
||
read-back); a suite that goes green on a fresh checkout. The planned "SDM
|
||
rename" is dropped: the repo becomes `sfm` instead (ADR 0003).
|
||
|
||
---
|
||
|
||
## The short version
|
||
|
||
The **data side is a real tool** and has been for months; the decoder now
|
||
matches Blastware field by field across ten years of files. The **device side
|
||
has grown from sharp instruments into a bench-proven tool for both series**,
|
||
with the safety core a real tool needs. The gap to using it on the fleet from
|
||
Terra-View is **a login, jobs instead of long calls, and field time** — not
|
||
protocol work.
|