From 080e8f47044050d38da264d912de6408d3c762a4 Mon Sep 17 00:00:00 2001 From: serversdown Date: Wed, 21 Oct 2026 01:45:33 -0400 Subject: [PATCH] docs: serial parameter, settings/hangup endpoints, single-worker rule, cool-down prerequisite for 1c Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44 --- CLAUDE.md | 7 +++++++ README.md | 12 ++++++++++++ .../specs/2026-10-20-sfm-series4-parity-design.md | 6 ++++++ 3 files changed, 25 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 5295dd1..29138f0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1410,8 +1410,15 @@ GET /device/event?host=1.2.3.4&tcp_port=9034&index=0 GET /device/monitor/status?host=1.2.3.4&tcp_port=9034 ← battery, memory, mode POST /device/monitor/start?host=1.2.3.4&tcp_port=9034 ← start recording POST /device/monitor/stop?host=1.2.3.4&tcp_port=9034 ← stop recording +GET /device/settings?serial=UM20147&host=1.2.3.4&tcp_port=9034 ← shared-model settings, either series +POST /device/hangup?host=1.2.3.4&tcp_port=9034 ← release a held Series-4 line ``` +`serial=` (UM = Series 4, BE/BA = Series 3) on `/device/info`, `/connect`, +`/monitor/status`, `/settings` returns the shared model, uncached. A `UM` serial on any +other `/device/*` route is 501; serial-less requests at a held Series-4 address are 409. +SFM must run a single uvicorn worker (locks and held lines are per process). + Server retries once on `ProtocolError` for TCP connections (handles cold-boot timing). ### DB read endpoints (query seismo_relay.db written by ach_server.py) diff --git a/README.md b/README.md index 83a897c..cbb56a1 100644 --- a/README.md +++ b/README.md @@ -177,10 +177,22 @@ via a thread-safe `_LiveCache` (plain Python dict + `threading.Lock`): | `POST` | `/device/monitor/start` | Sends SUB 0x96; immediately evicts status cache | | `POST` | `/device/monitor/stop` | Sends SUB 0x97; immediately evicts status cache | | `POST` | `/device/call_home` | Reads, patches specified fields, writes back to device | +| `GET` | `/device/settings` | Recording settings in the shared model, either series; serial required; never cached | +| `POST` | `/device/hangup` | Releases a held Series-4 line now; `{"hung_up": bool}` | **Cache bypass** — All cached endpoints accept `?force=true` to skip the cache and force a fresh read from the device. +**Serial-named requests (Series 3 and 4)** — `/device/info`, `/device/connect`, +`/device/monitor/status` and `/device/settings` accept `serial` (`UM...` = Series 4 +Micromate, `BE...`/`BA...` = Series 3 MiniMate Plus) and return one shared model +for either series. Serial-named requests are **not cached** and ignore `force`. +Without `serial` the legacy Series-3 behaviour is unchanged. Any other `/device/*` +route given a `UM` serial answers **501** ("not supported for Series 4 yet"), and a +serial-less request at an address holding a Series-4 line answers **409** (use +`POST /device/hangup` first). Series-4 lines are held open between requests, so +SFM must run a **single uvicorn worker**: locks and held lines are per process. + **Cache stats** — `GET /cache/stats` returns hit/miss counts and TTL info; `DELETE /cache/device` clears the device cache immediately. diff --git a/docs/superpowers/specs/2026-10-20-sfm-series4-parity-design.md b/docs/superpowers/specs/2026-10-20-sfm-series4-parity-design.md index 1c4bb69..0e74831 100644 --- a/docs/superpowers/specs/2026-10-20-sfm-series4-parity-design.md +++ b/docs/superpowers/specs/2026-10-20-sfm-series4-parity-design.md @@ -332,6 +332,12 @@ Each safety piece arrives with its first real use, so nothing sits untested. - 1b. Event list and download for both series (rows 4–5). - 1c. **The webapp:** serial + address, and the same read panels for both series. + - **HARD PREREQUISITE:** before any poller or webapp sends `serial`, add a + per-address cool-down after a RADIO RING: call-ups to that address answer + 503 + `Retry-After` until it expires, and `POST /device/hangup` clears it. + The length must come from the unit's measured call-home retry timing (a + bench test). Without it a poller can re-grab the modem's single TCP + session through every retry, and the call never reaches THOR. 2. **Encoder + opcode guard + dry run + frame-reproduction tests.** Still nothing sent. 3. **Start/stop monitoring** (row 7): the first live write, at the bench.