Files
faunosteo/.claude/tasks/contracts/2026-11-01-v1-2-3-reserves.md

58 lines
4.4 KiB
Markdown

# Contract: V1-2.3 owner reserves (brief « Décisions V1-2.3 / M6 et clôture des dernières réserves »)
Owner brief 2026-11-01 on `96b19e5`: M6 parameters approved (five worker codes, 5 attempts, lease
10 min, verdict 3 MiB child / 4 MiB SQL, `worker-verify`, `verify-e2e`); `brk` approved in the
shared seccomp filter; verdict CHANGES REQUIRED until the proofs below exist. Branch
`feature/v1-2-anatomical-sheets`. Sandbox stack only; DEV (containers `supabase_*_faunosteo`, its
queues, purges, secrets and accounts) untouched; no merge; no V1-2.4; no deploy; STOP at the
checkpoint. The base contract `2026-11-01-v1-2-3-worker-verification.md` (W1-W8) still holds,
W6 `pnpm e2e:avatar unchanged` replaced by Q1.
## Criteria
- Q1 Avatar e2e isolated: `pnpm db:sandbox avatar-e2e` runs the existing avatar suite
(`packages/supabase/tests/e2e/avatar-flow.e2e.ts`, every case kept) against the sandbox, with the
real worker image in its default mode (avatars + sweep) on the sandbox network only, after M6.
No DEV container, network, key or queue is reachable from the run: the suite needs its database
container named explicitly (no DEV default), its purge acceleration touches only the run's own
account, its accounts are throwaway with random passwords. `scripts/avatar-e2e.sh` (DEV) is not
run. DEV container start times unchanged after every run.
- Q2 Retry delay (owner decision §4): a technical failure reported by `fail_sheet_verification`
makes the round claimable again only after 2 s, 5 s, 10 s, 20 s (after attempts 1, 2, 3, 4);
attempt 1 immediate; the fifth failure closes the round `verification_failed` / `unavailable`
as before. Persisted in SQL (a hidden column on the round, not granted to `authenticated`), so
no worker sleeps and any worker honours it; RPC names, arguments and answers unchanged. Verdict
failures (validation, integrity) are never retried (complete). Unchanged: attempt counter,
lease, dead-lease interruption path (immediate, the lease being the wait), stale and malformed
protections (a stale fail writes nothing, delay included). pgTAP: each delay, no claim before it,
claim after it, stale fail, final attempt. Sandbox e2e: a technical failure retried by the real
worker no earlier than its delay, the worker serving another round meanwhile.
- Q3 Input limits: at the maximum the policy allows (document 2 097 152 bytes of `content::text`,
base 2 097 152, four drawings totalling 6 291 456 bytes, each at most 2 097 152) the child under
the full sandbox and the real worker on the sandbox both produce a verdict accepted by SQL,
within the 120 s budget, measured; just beyond: document and drawing at +1 byte refused before
the worker (save, registration, bucket), drawings over the total or the count → verdict failed
`verification.validation.caps` (business, not a worker failure), input over 12 MiB refused by
the child. The two tracked misclassifications (`resource_limit` for a header over 64 KiB,
`drawing_missing` for an object over the policy) asserted as current behaviour, labelled
tracked, never presented as fixed.
- Q4 `brk` bounded: the verify child under the real filter and limits is still killed or aborted
by RLIMIT_AS (large and small-chunk growth), the `mmap` exec and signal argument filters, and a
denied syscall; no other syscall added.
- Q5 Sandbox account password: no password literal for throwaway sandbox accounts in the sandbox
script and its test helpers; generated per run, never written to Git, a log or a command line.
The DEV seed accounts (`supabase/seed.sql`) and DEV secrets untouched.
- Q6 Memory: LRN with the owner's wording (scoped to the M6 worker musl image, not generalised).
- Q7 Docs describe only what is implemented (V1-2 contract §6.4, §6.5, §12.3, §16.4; STORAGE.md
§3.6; RUST.md §13; SUPABASE.md sandbox table; CLAUDE.md lines); the four residual risks tracked
in TODO, open.
- Q8 Gates on the final HEAD: PGlite, sandbox `test-db` and `types --check`, `test`, `verify-e2e`,
`avatar-e2e`, upgrade rehearsals (before M6, before M4), `pnpm worker:test`, `pnpm worker:image`,
`pnpm check:all`, `pnpm e2e:shell`; 42 hostile SVG kept in the child proofs; fresh security
review and fresh verifier.
## Out of scope
DEV and production (every §16.11 operation, including the queue inventory, which stays owed),
screens, V1-2.4 onwards, merge, deploy; fixing the two tracked misclassifications.