diff --git a/CHANGELOG.md b/CHANGELOG.md index 77478d7..4983325 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,40 @@ All notable changes to seismo-relay are documented here. --- +## v0.22.0 — 2026-07-03 + +Full-snapshot bundle support (SFM side). Adds the DB-snapshot, recent-waveform, +and gated-restore endpoints Terra-View drives to pull a complete prod→dev refresh +— the `seismo_relay.db` plus the waveform files behind recent events — in one +pass. Pairs with **Terra-View v0.17.0**'s "Create full snapshot (incl. SFM)" +control on Settings → Database. New logic lives in `sfm/db_snapshot.py`, kept +out of `server.py` so it's unit-testable without HTTP. + +### Added + +- **`GET /db/snapshot`** — streams a WAL-safe point-in-time copy of + `seismo_relay.db`, taken through the SQLite online backup API (not a raw + file grab), so the download stays consistent even while the ACH server is + writing under WAL. +- **`GET /db/waveforms/recent.zip?n=…`** — zips the on-disk files (event file + + its `.h5` / sidecar siblings) for the *n* most-recent events, arcname + `/`, so a dev box can restore chart-openable events without + hauling the entire waveform store. Events with no resolvable files on disk + are skipped. +- **`POST /db/restore`** — gated by `SFM_DB_RESTORE_ENABLED` (dormant → 404 + unless explicitly enabled; dev-only). Validates the uploaded DB first, takes + a WAL-safe `.pre-restore-` safety backup of the current DB, then swaps in + the restored DB + waveforms. Zip entries are path-traversal-guarded before + extraction. + +### Fixed + +- **Restore no longer blocks the event loop.** `/db/restore` runs its + synchronous DB/file work in a threadpool instead of `async def`, so a large + restore can't stall inbound ACH connections or other API requests. + +--- + ## v0.21.1 — 2026-06-01 Bug fixes against v0.21.0 surfaced after the first prod redeploy. Three diff --git a/README.md b/README.md index 8d41f7e..791f0b3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# seismo-relay `v0.21.0` +# seismo-relay `v0.22.0` A ground-up replacement for **Blastware** — Instantel's aging Windows-only software for managing seismographs. Supports both the **MiniMate Plus @@ -54,6 +54,11 @@ over direct RS-232 or cellular modem (Sierra Wireless RV50 / RV55). > flow through the existing Event Report PDF pipeline without a > separate renderer. Terra-View v0.13.0 ships in parallel and > closes Phase 1 of the SFM integration — see its CHANGELOG. +> **v0.22.0 (2026-07-03)** adds the SFM side of the full-snapshot +> bundle: `GET /db/snapshot` (WAL-safe DB copy), `GET /db/waveforms/ +> 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. > See [CHANGELOG.md](CHANGELOG.md) for full version history. --- @@ -210,6 +215,18 @@ optionally paired with their ASCII sidecar reports; both dedup by | `POST` | `/db/import/blastware_file` | Series III: `.AB0*` / `.N00` binaries + paired `_ASCII.TXT`. Source: `series3-watcher`. | | `POST` | `/db/import/idf_file` | Series IV: `.IDFH` / `.IDFW` binaries + paired `.IDFW.txt` / `.IDFH.txt`. Source: `thor-watcher`. | +### DB snapshot / restore endpoints + +Back the "full snapshot bundle" prod→dev refresh Terra-View orchestrates +(Settings → Database). Snapshot/zip are read-only; restore is gated and +dev-only. + +| Method | URL | Description | +|--------|-----|-------------| +| `GET` | `/db/snapshot` | WAL-safe point-in-time copy of `seismo_relay.db` via the SQLite online backup API. | +| `GET` | `/db/waveforms/recent.zip?n=…` | Zips the on-disk files (event file + `.h5` / sidecars) for the *n* most-recent events. | +| `POST` | `/db/restore` | Validate-first restore of an uploaded DB + waveforms; takes a WAL-safe pre-restore safety backup, path-traversal-guards the zip. Gated by `SFM_DB_RESTORE_ENABLED` (dormant → 404). | + --- ## minimateplus library diff --git a/pyproject.toml b/pyproject.toml index dafdc73..313e73d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "seismo-relay" -version = "0.21.1" +version = "0.22.0" description = "Python client and REST server for MiniMate Plus seismographs" requires-python = ">=3.10" dependencies = [