diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index 486795f8..30519659 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -751,3 +751,10 @@ Supersedes [[LRN-100]]. **Context**: V1-2.2 interior rule, Playwright 1.64.1 touch projects chromium-320 / chromium-375 vs webkit-375, equine main view, 2026-11-01. Taps at zone witness centre landed on junction points; zone taps recorded 18/21 (caudal) to 195/195 (cervical) at 320. Tool `.claude/audits/2026-11-01-v1-2-2-interior-tools/`. **Application**: Chromium touch tests press away from point discs (clearest fill point, margin) or ask `elementFromPoint`. Never use this tolerance as functional contract: explicit selection rules and Rust core guarantees stay authority (owner 2026-11-01). + +## LRN-109 — M6 worker musl image: verify child at caps needed brk, decode never did; derive seccomp in real image per child path (2026-11-01) (2026-11-01) +**Pattern**: In M6 worker musl image, allocator needed `brk` syscall when verify child heap grew at caps; decode paths measured before never needed it. Seccomp policy must be checked in real image for each new child path. Observation scoped to this image and this measure: not generalised to all allocators or all musl environments. + +**Context**: V1-2.3 verify child, `rust:1.99.0-alpine3.24` build (musl mallocng), distroless runtime, 2026-11-01. At-caps fixture under full filter died SIGSYS; strace derivation (`crates/worker/scripts/derive-seccomp.sh`) in Docker test stage showed `brk` only missing call. Decode traces (R1) showed neither `brk` nor `mprotect`. Owner approved `brk` in shared filter (brief 2026-11-01), wording of this entry owner-validated. + +**Application**: new child command or new input path (bigger frames, other library) → rerun seccomp derivation inside real image on that path before trusting allowlist; add a syscall only when trace proves it, with trace as justification; never infer from native glibc runs. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index 3aca585e..f1904e36 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -634,6 +634,14 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet - [x] P3 `run --jobs sheet-verify` (VerifyBackend, closed codes, no sweep), compose `worker-verify` (not started); at-caps verdict 24 689 B, 0.69 s debug natively - [x] P4 sandbox e2e (`pnpm db:sandbox verify-e2e` 7/7, cases a-h, at caps 185 ms worker); rehearsals before M6 and before M4 (DEV path): pgTAP 1859, types equal; hostile corpus (42) through the child. NOT run: `pnpm e2e:avatar` (targets DEV: owner decision) - [x] P5 docs (RUST §13, STORAGE §3.6, contract §6.4/§6.5/§12.3/§16.4, SUPABASE, DEPLOY, CLAUDE.md); check:all + e2e:shell 86 on 6aa85fe; security PASS (LOWs: 2 fixed, 3 open); verifier ECARTS(2) → hostile corpus added, e2e:avatar to owner; checkpoint + - [ ] Q owner reserves (brief « Décisions V1-2.3 / M6 et clôture des dernières réserves », on 96b19e5; contract `.claude/tasks/contracts/2026-11-01-v1-2-3-reserves.md`): M6 parameters + `brk` approved; CHANGES REQUIRED until proofs; sandbox only, no DEV, no merge, no V1-2.4 + - [ ] Q1 `pnpm db:sandbox avatar-e2e`: existing avatar suite, real worker default mode, sandbox only + - [ ] Q2 retry delay 2/5/10/20 s persisted in SQL (M6 amended in place, unapplied outside the sandbox), pgTAP + sandbox case + - [ ] Q3 input limits at and just beyond the caps (child + sandbox), tracked misclassifications asserted as current + - [ ] Q4 `brk` bounded: RLIMIT_AS and argument filters on the verify child + - [ ] Q5 throwaway sandbox account passwords generated per run + - [ ] Q6 LRN brk (owner wording) · Q7 docs · Q8 gates, security review, verifier, checkpoint + - [ ] residual risks, open, tracked: header > 64 KiB → `resource_limit` instead of `caps`; object over the policy → `drawing_missing` instead of `size_mismatch`; §16.11 queue inventory owed before any DEV activation - [ ] V1-2.4 wireframes (editor, review, admin entry) · V1-2.5 catalogue, admin space, rights, species, MFA · V1-2.6 editor level 1 · V1-2.7 preview, review, publication UI · V1-2.8 equine working copy and review preparation · V1-2.9 FR/EN acceptance and closure (owner checkpoints V1-2.3, V1-2.4, V1-2.6, V1-2.7, V1-2.8, V1-2.9 + each DEV operation of contract §16.11) ## Release readiness track (owner 2026-10-25, distinct from the functional roadmap; nothing here authorises a release or exposure) diff --git a/.claude/tasks/contracts/2026-11-01-v1-2-3-reserves.md b/.claude/tasks/contracts/2026-11-01-v1-2-3-reserves.md new file mode 100644 index 00000000..3c81c783 --- /dev/null +++ b/.claude/tasks/contracts/2026-11-01-v1-2-3-reserves.md @@ -0,0 +1,57 @@ +# 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.