chore(memory): V1-2.2 closure, mutations rerun on final code, BDR-092, LRN-108, V1-2.3 contract

This commit is contained in:
bchanot committed 2026-11-01 16:38:53 +01:00
1 parent 0edef2f66d
commit 5eca08688a
7 files changed
+123 -10

No files matched your search

@@ -12,7 +12,7 @@ nonzero (the layer's rule), stroke out. Conservative widest-disc search (disc cr
off, arcs add an f32 drift bound), refuses in doubt (0.03 px band measured). Caps: 4 096 vertices, 4 096 cells, 2²⁵ edge
distances per sheet, over them refused. Arcs as browsers store them: nonzero radius below 2⁻²⁰ unreadable, endpoints equal in f32 draw no arc, the spread of
one-ulp variants added to the deviation and their extremes to the bounds. Codes
`annotation.geometry.interior_too_small` / `verification.validation.marker_interior_too_small` (proposal).
`annotation.geometry.interior_too_small` / `verification.validation.marker_interior_too_small` (approved by the owner 2026-11-01).
## Threshold
@@ -29,7 +29,7 @@ Equine at 320 widest disc: caudal 4.951 px, sacral 11.30, thoracic 11.47, cervic
test on a 90 % ring, fill only and as shipped; equine zones take a real press.
- Chromium touch adjustment: a tap up to ~10 px around a point's disc goes to the point (chromium-320/375, not
webkit-375); every equine zone keeps a tappable interior (320: caudal 18/21 … cervical 195/195).
- Mutations: 29 killed, 2 equivalent (Z22 prune, Z25 unreachable).
- Mutations, rerun on the final code `c73415a` (closure): 29 killed, 2 equivalent (Z22 prune, Z25 unreachable); see Closure.
- References: no frozen oracle, golden, N-1 copy, seed or PDF digest touched; app 566 incl. PDF suites pass.
- Ignored cargo tests: one timing test (`pdf_serialize::l_report_with_real_rasters_costs_what_it_costs`) × 3 feature
runs; passed in release (5.2 s).
@@ -49,3 +49,19 @@ Equine at 320 widest disc: caudal 4.951 px, sacral 11.30, thoracic 11.47, cervic
check:all passed: cargo 2 350 passed, 0 failed, 3 ignored (one timing test × 3 runs); core-wasm 65, supabase 128, app 566;
e2e:ui 227 (incl. canvas-clicks 99 and interior-clicks 102, six projects); Docker app image, worker test and image.
e2e:shell 86 on the isolated sandbox. WASM 580 428 B gzip -9 native, 580 522 in the app image (margin 19 478 B).
## Closure (owner brief « Validation définitive V1-2.2 », 2026-11-01)
- Owner verdict: VERIFIED on `c73415a` (BDR-092, V1-2 contract §17.7). Codes `interior_too_small` /
`marker_interior_too_small` approved. Six LOWs accepted and still tracked (TODO V1-2 section), never declared fixed.
- Verifier history: on `8dd2d78` ECARTS(3), three documentation gaps fixed in `03be75b` (the earlier result is not a
conformity). Fresh verifier on the closed state (`de2dfb3..e190dfc`): I1-I6 and I8 MET, I7 ECARTS(1): Z7, Z19, Z24
of the mutation script anchored on code that left with `03be75b` / `86dce16`, so the recorded count was not
reproducible on the final HEAD. Fixed: anchors moved to the final code, whole script rerun on `c73415a`: 29 killed,
Z22 and Z25 equivalent. Z23 survived its integration suite there (the `f32` spread of `86dce16` refuses those arcs on
its own) and is killed by the unit test `a_tiny_arc_radius_is_not_read`; the script now runs it on `--lib`. The
final conformity therefore rests on this rerun plus the verifier's other findings (cargo 17 + 19 tests, Playwright
interior-clicks 102 on six projects, WASM 580 428 B native, references diff empty).
- Security: three passes PASS, no MEDIUM open on `86dce16`; `c73415a` = one LOW fix (sampling skipped).
- Gates on `c73415a`: check:all passed; e2e:shell 86 on the isolated sandbox; WASM 580 522 B gzip in the app image.
- Memory: LRN-108 (Chromium touch adjustment, observation only, never a selection contract).
@@ -1,7 +1,9 @@
# V1-2.2 last MEDIUM (brief « fermeture du dernier MEDIUM », 2026-11-01), mutation run: Z = the
# interior rule (anatomy::interior, path outline, frame placement, codes), plus the 2026-11-01
# decision mutants whose anchors this change moved (S1, S8, F16). Z23-Z25 cover the fixes after the
# security review of 8dd2d78. Each mutant is applied to its
# security review of 8dd2d78. Z7, Z19, Z24 re-anchored on the final code c73415a (verifier
# 2026-11-01: their first anchors left with 03be75b and 86dce16); Z23 run on the unit suite since 86dce16, whose
# f32 spread refuses the same arcs on its own in sheet_marker_visibility. Each mutant is applied to its
# source file, its cargo suite runs, the file is restored. Run from the repo root.
import subprocess
F='crates/core/src/anatomy/frame.rs'
@@ -17,7 +19,7 @@ muts=[
('Z4 every point inside',I,' if inside { nearest } else { -nearest }',' if inside || true { nearest } else { -nearest }',VIS),
('Z5 closing edge dropped',I,' for (&a, &b) in closing.zip(subpath.iter()) {',' for (&a, &b) in closing.skip(1).zip(subpath.iter().skip(1)) {','--lib'),
('Z6 deviation not taken off',I,' let radius = clearance(outline, rule, centre) - outline.deviation;',' let radius = clearance(outline, rule, centre);','--lib'),
('Z7 chord deviation not recorded',P,' self.outline.deviation = self.outline.deviation.max(bend * step * step / 8.0);\n','','--lib'),
('Z7 chord deviation not recorded',P,' self.outline.deviation = self.outline.deviation.max(deviation);\n','','--lib'),
('Z8 one chord per curve',P,' let count = wanted.clamp(1.0, MAX_CURVE_CHORDS as f64) as usize;',' let count = wanted.clamp(1.0, 1.0) as usize;',VIS),
('Z9 budget never spent',I,' budget.work -= evaluated * edges;\n','','--lib'),
('Z10 vertex overflow ignored',I,' !outline.overflow && self.cells(edge_count(outline)) > 0',' self.cells(edge_count(outline)) > 0',VIS),
@@ -29,12 +31,12 @@ muts=[
('Z16 tolerance in units, not px',F,' let tolerance = INTERIOR_TOLERANCE_PX / scale;',' let tolerance = INTERIOR_TOLERANCE_PX;',VIS),
('Z17 closepath keeps the subpath',P,' self.quadratic_control = None;\n self.open_subpath();\n }',' self.quadratic_control = None;\n }','--lib'),
('Z18 cubic bend underestimated',P,' let bend = 6.0\n',' let bend = 1.0\n','--lib'),
('Z19 arc bend on the smaller radius',P,' let count = self.chords(ellipse.rx.max(ellipse.ry) * ellipse.sweep * ellipse.sweep);',' let count = self.chords(ellipse.rx.min(ellipse.ry) * ellipse.sweep * ellipse.sweep);','--lib'),
('Z19 arc bend on the smaller radius',P,' let radius = ellipse.rx.max(ellipse.ry);\n let spread',' let radius = ellipse.rx.min(ellipse.ry);\n let spread','--lib'),
('Z20 unmeasured accepted',F,' return Placement::InteriorUnmeasured;',' return Placement::InFrame;',VIS),
('Z21 cells past the cap',I,' || evaluated + 4 > affordable\n','','--lib'),
# Security review of 8dd2d78 (MEDIUM tiny arc radius, LOWs), fixed after the first run.
('Z23 tiny arc radius read',P,' if tiny(arc.rx) || tiny(arc.ry) {\n return None;\n }\n','',VIS),
('Z24 arc f32 drift dropped',P,' radius * ARC_F32_DRIFT,',' 0.0,','--lib'),
('Z23 tiny arc radius read',P,' if tiny(arc.rx) || tiny(arc.ry) {\n return None;\n }\n','','--lib'),
('Z24 arc f32 drift dropped',P,' radius * ARC_F32_DRIFT + spread,',' spread,','--lib'),
# Equivalent: bounds and outline share one reader, a path with bounds always has an outline.
('Z25 path without outline accepted (equivalent)',F,' _ => Placement::InteriorUnmeasured,',' _ => Placement::InFrame,',VIS),
# Second security review (03be75b): f32 endpoint equality, arc f32 spread.
+12
View File
@@ -686,3 +686,15 @@ Also kept by owner: per-document-instance prefix required on top of per-view pre
**Alternatives**: cap on viewBox dims (rejected: bypass by scale); document owning main frame (heavier model change); TS-side check (rejected: Rust by default, one definition).
**Extension 2026-11-01** (same rule, owner brief « décisions »): frame usable only within browser-faithful range (edges ≤ 2^20, span ≥ 1, aspect ≤ 100, far edge ≤ 256 spans); marker visible size ≥ 4 CSS px at 320 × 568 → `verification.validation.marker_too_small`. RUST.md §12.11, §12.13.
## BDR-092 — V1-2.2 VERIFIED: 4 px interior rule, codes approved, six LOWs accepted and tracked (2026-11-01)
- **Status**: accepted
**Decision**: V1-2.2 VERIFIED by owner 2026-11-01 (brief « Validation définitive V1-2.2 »). Zone or drawn trigger (polygon, path) must fill disc of 4 px diameter at 320 × 568 preview, nonzero rule, stroke never counted; conservative measure, compute caps, refusal in doubt. Codes approved: `annotation.geometry.interior_too_small`, `verification.validation.marker_interior_too_small`. Equine accepted unchanged.
**Rationale**: 4 px = approved point threshold; equine min widest disc 4.951 px (caudal). Conservative (under-estimate) measure never accepts shape browser fills less; browser probe on 3 engines confirms. Evidence `.claude/audits/2026-11-01-v1-2-2-interior-evidence.md`, RUST.md §12.14, V1-2 contract §17.7.
**Accepted LOWs (tracked, NOT fixed, stay in TODO V1-2 section)**: (1) fully overlapping marker discs: no rule, human review must find them before publication, no claim of individual selectability; (2) arc rotation sub-pixel error, bounded, tests kept; (3) arc tangent to frame edge refused (conservative); (4) f32 arc margin is bounded estimate (≤ 0.13 unit measured on model); (5) verification cost of all-arc sheet (~1.8 s native worst); (6) relative path commands accumulated in f32 (contrived worst 6 % of span). Complex-sheet duration monitored at editor validations on real devices.
**Alternatives**: larger threshold (6 px) refused equine; renderer-based measure (new dependency, WASM budget); area threshold (thin sliver keeps area). Rejected.
**Status**: accepted
+7
View File
@@ -744,3 +744,10 @@ Supersedes [[LRN-100]].
**Context**: V1-2.2 frame range rules, disc a quarter of frame in 286 px box, painted-pixel count, WebKit 27.2 / Chromium 156 / Firefox 157 (Playwright 1.64.1), 2026-11-01. First span floor 2⁻²⁰ withdrawn on this measure; floor set to 1 unit (factor 32 from WebKit's last exact span 2⁻⁵).
**Application**: bound SVG frame spans and offsets by browser f32 range before trusting geometry; derive floors from painted pixels in all three engines, never from f64 math alone.
## LRN-108 — Chromium touch emulation sends taps ~10 px around point disc to the point; WebKit does not (observation, not contract) (2026-11-01)
**Pattern**: Chromium touch emulation redirects taps near small targets: in V1-2.2 tap grid, taps up to ~10 px around point marker's visible disc went to the point, not to zone under finger. Not seen under WebKit. Experimental, browser-dependent observation, never a selection guarantee.
**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).
+16 -2
View File
@@ -614,13 +614,27 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet
- [x] N4 scale bypass: projected visible size rule (owner 2026-11-01: 4 px at 320 × 568, measured equine min 4.97 px), verdict + preview, closed code; numeric guard (finite, non-degenerate, value/transform bounds, f32 precision vs magnitude and frame), Rust vs browser edge cases
- [x] N5 gates: cargo all features, clippy, mutations, wasm size, check:all on final HEAD, e2e:ui, e2e:shell if sandbox, C8 Docker + mutations
- [ ] N6 fresh verifier + security on final HEAD (old MEDIUMs, f32/f64 residue); memory BDR + 2 LRN (dedup); checkpoint
- [ ] O last MEDIUM, zone without interior (brief « V1-2.2 : fermeture du dernier MEDIUM », 2026-11-01, on de2dfb3; contract `.claude/tasks/contracts/2026-11-01-v1-2-2-interior.md`)
- [x] O last MEDIUM, zone without interior (brief « V1-2.2 : fermeture du dernier MEDIUM », 2026-11-01, on de2dfb3; contract `.claude/tasks/contracts/2026-11-01-v1-2-2-interior.md`)
- [x] O1 measure: flattened outline (polygon, path curves/arcs with a chord deviation bound), fill rule (layer = nonzero), widest inscribed disc search (deterministic, capped), projected at 320 × 568
- [x] O2 rule in `frame::annotation_placement` after the bounds rule; closed codes; verdict + preview; docs (ANNOTATION-RENDERING, RUST.md, V1-2 §6.7)
- [x] O3 tests: back-and-forth, near-flat, self-intersection both rules, curves/arcs near zero, small legit, transforms/scales, threshold edges, equine; browser concordance fixture + spec on 3 engines
- [x] O4 gates: wasm ≤ 600 000, mutations, check:all, e2e:shell sandbox, ignored tests documented, PDF unchanged; fresh verifier + security
- [x] O5 memory: 3 LRN (WebKit snapping, Firefox client rects, WebKit tiny spans); LOW overlap recorded; checkpoint
- [ ] V1-2.3 drawings and worker verification (M6) · 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)
- [x] V1-2.2 CLOSED: VERIFIED by the owner 2026-11-01 (brief « Validation définitive V1-2.2 », code `c73415a`, BDR-092, contract §17.7); codes `interior_too_small` / `marker_interior_too_small` approved; LRN-108 (Chromium touch, observation only). Final verifier on the closed state: ECARTS(1) (three mutation anchors stale since 03be75b/86dce16) → re-anchored, script rerun on the final code (evidence « Closure »)
- [ ] V1-2.2 accepted LOWs, TRACKED, not fixed (owner 2026-11-01; never mark fixed without a fix and proof):
- [ ] fully overlapping marker discs: no rule; human review must find them before any publication (V1-2.7 review screen, V1-2.8 equine preparation)
- [ ] arc rotation sub-pixel error (bounded, tests kept)
- [ ] arc exactly tangent to a frame edge refused (conservative bounds)
- [ ] `f32` arc margin a bounded estimate (≤ 0.13 unit measured on a model)
- [ ] verification cost of an all-arc sheet (~1.8 s native): watch complex-sheet durations at the editor validations on real devices (V1-2.6) and the worker at-caps timing (V1-2.3)
- [ ] relative path commands accumulated in `f32` (contrived worst 6 % of the span)
- [ ] V1-2.3 worker verification (M6), owner go 2026-11-01 (brief « Validation définitive V1-2.2 »); contract `.claude/tasks/contracts/2026-11-01-v1-2-3-worker-verification.md`; sandbox only, DEV untouched, no merge, STOP at owner checkpoint (server workflow V1-2.1 to V1-2.3)
- [ ] P1 M6 SQL: claim / input / complete (structure check, failed verdict without groups) / fail, closed worker codes, attempt limit, audit; pgTAP allowed + denied; types; sandbox test-db
- [ ] P2 child `verify`: framed stdin input, core verdict, output cap, sandbox (rlimits, seccomp re-derived); spawner limits per command
- [ ] P3 `run --jobs sheet-verify`: backend RPCs + Storage downloads, failure classification §6.5, fake-backend tests per row; compose service under `worker` profile
- [ ] P4 sandbox e2e: pass, each failure, stale/malformed, avatars and purges unaffected, publication gate, working copy in place, at-caps timing; upgrade rehearsal; e2e:avatar unchanged
- [ ] P5 docs, gates (rust:check, worker:test, worker:image, check:all, e2e:shell), fresh verifier + security, memory, checkpoint
- [ ] 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)
Inventory: `.claude/audits/2026-10-25-functional-inventory.md`. Each item: treat or qualify before any release or public exposure; not fixed now unless an active critical flaw is shown.
@@ -15,7 +15,7 @@ Owner brief « V1-2.2 : fermeture du dernier MEDIUM », 2026-11-01, on `de2dfb3`
radius away from every edge (implicit closing edges included); deterministic search, capped; over
the caps the annotation is refused (fail closed), never accepted.
- I3 Closed codes, the approved ones unchanged: issue `annotation.geometry.interior_too_small`,
verdict `verification.validation.marker_interior_too_small` (implementer's proposal, to confirm).
verdict `verification.validation.marker_interior_too_small` (implementer's proposal; approved by the owner 2026-11-01, brief « Validation définitive V1-2.2 »).
Verdict and preview agree. The document and the drawings never rewritten.
- I4 Tests: back-and-forth path, near-flat polygon, self-intersection under both rules, curves and
arcs of near-zero area, small legitimate filled shapes, drawing transforms and extreme scales,
@@ -0,0 +1,62 @@
# Contract: V1-2.3 worker verification (M6)
Owner brief « Validation définitive V1-2.2 », 2026-11-01 (V1-2.2 VERIFIED at `c73415a`, BDR-092):
start V1-2.3 along the validated plan, V1-2 contract §16.4 (objective, prerequisites, tests,
acceptance), §6.4 (server verdict), §6.5 (failures), §12.3 (M6). Branch
`feature/v1-2-anatomical-sheets`. Sandbox stack only; DEV and production untouched; no merge;
no V1-2.4; STOP at the owner checkpoint (server workflow V1-2.1 to V1-2.3).
## Criteria
- W1 M6 `sheet_verification_jobs`, forward-only, service role only (revoked from `public`,
`anon`, `authenticated`), `security definer`, `search_path = ''`:
`claim_sheet_verifications(limit)` (clamped, `for update skip locked`, rounds `verifying` with no
live lease, token + `locked_at` set, `attempts` incremented, an expired lease counted, the attempt
limit closing the round `verification_failed` / `unavailable`);
`get_sheet_verification_input(review_id, lease_token)` (the frozen document and the base as text,
the referenced drawing rows registered for the sheet: asset id, sha256, byte size, bucket, object
key; nothing for a stale token or status);
`complete_sheet_verification(review_id, lease_token, verdict)` (accepted only while `verifying`
with the live token; binding = the round's sheet, version, revision, review; a passed verdict's
group keys = `general`, the document's view and zone ids and the base's removed ones, its drawings
= the document's asset ids with the rows' sha256; a failed verdict accepted without groups or
drawings, its code from the closed list; else `stale` or `malformed`, nothing written; moves to
`open` or `verification_failed` / `failed`; audited);
`fail_sheet_verification(review_id, lease_token, code)` (closed worker codes; claimable again
below the limit, `verification_failed` / `unavailable` at it; audited).
pgTAP allowed and denied cases; `database.types.ts` regenerated; publication still refused
without an approved round whose passed verdict is current.
- W2 Child `verify`: the same binary, empty environment, rlimits and seccomp installed before
reading stdin; reads one framed input (binding, rows, document, base, drawing bytes) under the
per-command input cap; runs `faunosteo_core` `compute_verdict`; writes the verdict JSON under the
output cap. The parent never parses the document or the drawings. Seccomp allowlist derived again
for this path (Docker `test` stage).
- W3 Spawner per command: input cap, output cap, deadline and memory per command (`decode`
unchanged); `verify` sized on the at-caps fixture (about 13 MiB input).
- W4 Mode `run --jobs sheet-verify`: claim, input, Storage downloads (missing object = drawing
missing for the core, never a worker failure), child, completion; transient, timeout, resource and
crash outcomes reported by `fail_sheet_verification` with a closed code; a broken sandbox stops
the worker. Avatar and purge processing unchanged in the default mode; the verification mode runs
no sweep. RPC body cap of this mode raised to the verdict size.
- W5 Compose service of its own under the `worker` profile (read-only, `cap_drop: ALL`, same
hardening as `worker`); sandbox start of the verification worker; never started on DEV.
- W6 Tests: `pnpm worker:test` (sandbox, seccomp derivation), unit and fake-backend job tests for
each §6.5 row, hostile corpus through the child, e2e on the sandbox stack (clean sheet passes,
each failure and its exit, stale or malformed completion writes nothing, avatars and purges
unaffected, publication refused without a current passed verdict, the sandbox working copy
verified in place with its shared drawing, verification time at the caps within budget), upgrade
rehearsal from the DEV state (Git fixture of the DEV drawing, §12.3), `pnpm e2e:avatar` unchanged.
- W7 Docs describe only what is implemented: V1-2 contract §6.4, §6.5, §12.3, §16.4; STORAGE.md
worker section; RUST.md; SUPABASE.md; DEPLOY.md / compose notes; CLAUDE.md.
- W8 Gates: `pnpm rust:check`, `pnpm worker:test`, `pnpm worker:image`, sandbox `test-db` and
`types --check`, `pnpm check:all` on the final HEAD, `pnpm e2e:shell` on the sandbox; fresh
verifier and security reviews on the final HEAD.
## Proposals for the owner (checkpoint)
Closed worker failure codes, attempt limit (five), lease duration, the service name: chosen by the
implementer, listed at the checkpoint for confirmation.
## Out of scope
DEV and production (every §16.11 operation), screens, V1-2.4 onwards, merge, deploy.