docs(docs): V1-2.3 verification worker, M6, sandbox e2e and rehearsals

This commit is contained in:
bchanot committed 2026-11-01 17:38:07 +01:00
1 parent 5afb34ed0f
commit 7043d39ae0
7 files changed
+106 -10

No files matched your search

+41
View File
@@ -4454,3 +4454,44 @@ Ignored cargo tests: the three are one test, `pdf_serialize::l_report_with_real_
once per cargo run whose features build `pdf_serialize` (workspace, `cli`, `ts,pdf-read,pdf-write`). A timing print for
§10.7, 40 s in debug; run on request in release (2026-11-01: passed, 120 views, 46.5 MB, 5.2 s). The L report's export
itself is covered unignored (`pdf_budget`); it masks no required scenario.
## 13. V1-2.3: the server verdict in the worker (2026-11-01)
Owner brief « Validation définitive V1-2.2 » (V1-2.2 VERIFIED at `c73415a`): V1-2.3 along the V1-2 contract §16.4.
Contract `.claude/tasks/contracts/2026-11-01-v1-2-3-worker-verification.md`, plan
`.claude/tasks/plans/2026-11-01-v1-2-3-worker.md`. Sandbox only; DEV untouched.
| Part | What | Where |
|---|---|---|
| M6 | `claim_sheet_verifications`, `get_sheet_verification_input`, `complete_sheet_verification`, `fail_sheet_verification`, service role only (claims checked too); the verdict checked for its binding (stale) and its structure (malformed), nothing written otherwise | `supabase/migrations/20261101100000_sheet_verification_jobs.sql`, pgTAP `021` (51) |
| Link | the worker links `faunosteo-core` (default features: no PDF, no curation); `version` prints the core version | `crates/worker/Cargo.toml` |
| Child | `verify`: framed stdin (`[u32 LE header length][header JSON][document][base][drawings]`), `compute_verdict`, verdict JSON out; same sandbox as `decode`, its own limits (12 MiB in, 4 MiB out, 1 GiB, 60 s CPU, 90 s); a frame the child cannot read is a broken parent (`frame_invalid`), never content | `verify_frame.rs`, `verify.rs`, `limits.rs` |
| Spawner | per command: `Spawner::for_decode` (unchanged values), `Spawner::for_verify`; a verify output counts only when it parses as a JSON object | `spawn.rs` |
| Mode | `run --jobs sheet-verify`: no sweep; drawings fetched under the archive caps, anything else passed without bytes for the core to name; §6.5 rows mapped to closed worker codes; watchdog stage `VERIFY` 95 s | `run.rs`, `verify_job.rs`, `backend.rs`, `http.rs` |
| Compose | service `worker-verify`, profile `worker`, same hardening as `worker` | `docker-compose.yml` |
Seccomp: the verify child at the caps was killed by SIGSYS in the Alpine stage; the derivation
(`derive-seccomp.sh`, extended to trace `verify --no-seccomp` on the clean and at-caps frames) traced `brk`
(musl mallocng growing the heap for the core's many small allocations) and nothing else new. `brk` was added to the
allowlist shared by both children; it only moves the program break, bounded by `RLIMIT_AS`. A filter per command
would keep `decode` without it, for more code: not done, listed for the owner.
Proofs (2026-11-01):
- `pnpm worker:test`: unit 28, `job_loop` 11 (unchanged), `verify_loop` 15, sandbox 23 under the full filter
(clean sheet passed, at-caps sheet within the limits, empty environment, over-cap input, malformed frame,
violation killed), derivation « allowlist covers the trace ». `pnpm worker:image` ok. `pnpm rust:check` green.
- `pnpm db:sandbox verify-e2e` (real worker container, gateway on the sandbox network, no host port): 7 tests,
cases a to h of the contract: clean equine draft opened (about 60 ms in the worker); `svg_not_canonical` and
`drawing_missing` with their exits; `no_geometry` and `out_of_frame`; no decision or publication without a current
passed verdict, then approval and publication after it; stale and malformed completions leave the round
byte-identical; avatar and purge rows untouched by the verification mode; the working copy verified in place on
the shared drawing object; the at-caps document (1 059 150 bytes of text, 129 groups) verified in 185 ms by the
worker, 842 ms from submission (budget 120 s), on a 10 × 10 drawing (on the horse frame its markers fail
`marker_too_small`, the rule working).
- Upgrade rehearsals on the sandbox: from the state before M6, and from the state before M4 (the DEV state, M4 to
M6 in one `migration up`): pgTAP 1 859 PASS, `verify-e2e` 7/7, `types --check` equal.
- Not measured: the largest input the policy allows (a 2 MiB document, its 2 MiB base and four drawings, 6 MiB).
Choices for the owner: worker codes, attempt limit five, lease 10 minutes, verdict cap 4 MiB, service name
`worker-verify`, the shared `brk`, and that an object larger than the policy is passed without bytes (named
`drawing_missing` by the core, not `size_mismatch`).