diff --git a/README.md b/README.md index 448fccd..a370c49 100644 --- a/README.md +++ b/README.md @@ -179,8 +179,8 @@ via a thread-safe `_LiveCache` (plain Python dict + `threading.Lock`): | `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}` | -| `GET` | `/device/events?serial=` | Lists a unit's events, either series, each with an opaque `event_id` (`serial:key:timestamp`). A MiniMate list reads headers only (no bulk download), on the normal timeout, and gives `record_type: null` (its event record does not say waveform or histogram; not decoded yet). A lost reply fails the list rather than shortening it | -| `POST` | `/device/events/download?serial=&event_id=` | Downloads one event, checks it, and stores it in SFM's database; returns `db_event_id` (file at `GET /db/events/{db_event_id}/blastware_file`). A stale `event_id` (unit erased or wrapped since the list) gets **409** without downloading, for both series; an `event_id` from another unit gets **422**, before any I/O. An event already stored — by an earlier download, or by THOR's watcher — returns its existing row and changes nothing (same `db_event_id`, `inserted: false`, `detail.already_stored: true`). The unit is busy for the whole download; other requests to it get 423 | +| `GET` | `/device/events?serial=` | Lists a unit's events, either series, each with an opaque `event_id` (`serial:key:timestamp`). A MiniMate list reads headers only (no bulk download), on the normal timeout, and gives `record_type: null` (its event record does not say waveform or histogram; not decoded yet). A lost walk reply fails the list rather than shortening it (a lost event-record reply still lists that event, without a timestamp) | +| `POST` | `/device/events/download?serial=&event_id=` | Downloads one event, checks it, and stores it in SFM's database; returns `db_event_id` (file at `GET /db/events/{db_event_id}/blastware_file`). A stale `event_id` (unit erased or wrapped since the list) gets **409** without downloading, for both series; an `event_id` from another unit gets **422**, before any I/O. An event already stored — by an earlier download, or by THOR's or Blastware's call-home watcher — returns its existing row and changes nothing (same `db_event_id`, `inserted: false`, `detail.already_stored: true`). The unit is busy for the whole download; other requests to it get 423 | **Cache bypass** — All cached endpoints accept `?force=true` to skip the cache and force a fresh read from the device. 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 5f1e194..a5e4dfe 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 @@ -346,6 +346,13 @@ Each safety piece arrives with its first real use, so nothing sits untested. 3's `record_type`, `null` today, be decoded); - an event past 64 KB, expecting the named 502; - a stale-id download, confirming no `5A` goes out; + - a download of an event Blastware's call-home already delivered (one + waveform, one histogram), expecting `already_stored`. This is the + only way to measure that Series 3's (serial, timestamp) agrees + between the unit's `0C` and the watcher's import; if it does not, + a download silently stores a duplicate row (never a downgrade). + Measured for Series 4: 1,016/1,016 watcher imports found by the + lookup (2026-10-21). - a dropped reply, via `bridges/mm_link.py`-style fault injection. - **Download = fetch, check, store** in SFM's database, the same as Series 3's `blastware_file` route, and returns the stored row's id. The @@ -460,14 +467,18 @@ matters to is named. - **Orphan files (SDM).** An event file in the store with no DB row is still overwritten by a download. - **Same-second collisions (SDM).** Two events of one unit in the same second collide on (serial, timestamp) — a DB-wide dedup property, not 1b's. - **423 without `Retry-After` (1c).** Add `Retry-After` to the 423 a request gets while a download holds the unit. -- **A lost `0C` during a Series-3 list.** The strict walk raises on a lost `0A` +- **A lost `0C` during a Series-3 list (1c).** The strict walk raises on a lost `0A` or `1F`, but a lost `0C` still lists the event with no timestamp and an `event_id` ending `:-`. Downloading that id skips the stale check and runs the - full `5A`, then refuses to store it (no timestamp means no filename), so it is - wasted transfer, not bad data. Fix: raise on a lost `0C` in strict mode, or + full `5A`. If the `0C` is lost again it is refused (no timestamp, no filename); + if it reads, whatever event now sits at that key is stored with no stale check: + self-consistent data, but possibly not the event that was listed. Fix: raise on a lost `0C` in strict mode, or refuse `:-` ids for Series 3. -- **A lost reply on a Series-3 TCP walk re-runs it once** under the adapter's +- **A lost reply on a Series-3 TCP walk re-runs it once (1c)** under the adapter's cold-boot retry before the 504, doubling time-to-error on a bad link. +- **A Series-3 download of an already-stored event still runs the full `5A`** + before the database lookup finds it (the lookup is on the SDM side, after the + device layer). Wasted transfer, not bad data (1c). ## Table 2: to be added later (both series)