fix(minimateplus): push_config_raw checks every block before the first write goes out (#46 review)

Review of b5037b0 (measured on 12 recorded SFM compliance reads): the read
keeps three escape bytes from its reply headers, so every real config image is
refused by write_image -- correctly, but only after 68 and 73 had been sent,
with a message saying nothing was.  All four blocks are now checked first; the
test feeds the block exactly as SFM's read produces it and asserts no frame is
sent (two went out without the check).

Config push stays unusable on purpose: fixing that read alone would let the
compliance encoder write some fields to the wrong bytes (e.g. 4,096 sps as
4,112) while the image still passes.  The rework -- logical read, encoding at
measured offsets with #48, a diff check, N pinned per SUB, an idle check, the
start/stop safeguards on POST /device/config -- is recorded in the spec and on
#46.  Start/stop frames are unchanged (verified byte-identical by the review).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-10-27 03:17:34 -04:00
1 parent 329f7f2abb
commit 20ea61e0e9
3 files changed
+45

No files matched your search

@@ -428,6 +428,21 @@ Each safety piece arrives with its first real use, so nothing sits untested.
value during a call-home is unmeasured** -- the change path would
refuse it as unknown. To measure: a MiniMate stop with ACH on, through
the bridge.
- ⚠ **MiniMate config push (#46): framing fixed (`b5037b0`), NOT
usable yet.** Review 2026-10-27, measured on recorded reads: (C1)
`read_compliance_config` keeps three escape bytes from its reply
headers, so every real config is refused -- now before any frame is
sent (`push_config_raw` checks all four blocks first); (C2) fixing that
read alone lets the encoder write some fields to the wrong bytes while
the image still passes the N+2 guard (e.g. 4,096 sps written as 4,112).
The rework: read the compliance block logically (reply page bytes +
data, unescaped), encode at the measured logical offsets (mode [5],
rate [6:8], interval [8:10], record time [18:22], trigger Tran+30,
alarm Tran+38) -- with #48 --, diff-check that only the requested
fields changed, pin N per SUB, refuse unless 0x1C reads idle, give
`POST /device/config` the start/stop safeguards, and test
`apply_config` from recorded replies. Review findings I2-I4, M1-M4
are in the #46 thread.
- Still owed:
- **before merging to dev, align `persist_download`'s already-stored
check with what v0.32.0 shipped** (dev `04acb99`; restamp `5737168`,