diff --git a/.claude/audits/2026-10-29-v1-2-2-mutations-arbitrations.py b/.claude/audits/2026-10-29-v1-2-2-mutations-arbitrations.py new file mode 100644 index 00000000..a21c8902 --- /dev/null +++ b/.claude/audits/2026-10-29-v1-2-2-mutations-arbitrations.py @@ -0,0 +1,30 @@ +# V1-2.2 owner arbitrations, mutation run (evidence .claude/audits/2026-10-29-v1-2-2-evidence.md §7): each +# mutant is applied to its source file, its cargo suite runs (`lib` = the crate's unit tests), the file is +# restored. Run from the repo root. +import subprocess +muts=[ + ('A1 reader accepts dangling','crates/core/src/anatomy/svg/mod.rs',' refs::check_targets(&sanitized.root)?;\n','','svg_scope'), + ('A2 cleaning accepts dangling','crates/core/src/anatomy/svg/clean.rs','check_targets(&read.root)','Ok::<(), super::tree::SvgRejection>(())','svg_clean'), + ('A3 canvas ids not scoped','crates/core/src/anatomy/compose.rs',' scope_ids(&mut root, &id_scope(view_id));\n','','svg_scope'), + ('A4 url() references not scoped','crates/core/src/anatomy/compose.rs'," _ if attr.value.contains('(') => scope_url_targets(&attr.value, scope),"," _ if false => scope_url_targets(&attr.value, scope),",'svg_scope'), + ('A5 verdict ignores the stored form','crates/core/src/domain/sheet/verdict.rs',' Ok(read) if stored_form(&read.root) != text =>',' Ok(read) if false && stored_form(&read.root) != text =>','sheet_verdict'), + ('A6 preview ignores the stored form','crates/core/src/domain/sheet/preview.rs',' if stored_form(&root) != text {',' if false {','sheet_preview'), + ('A7 cleaning uploads the original bytes','crates/core/src/anatomy/svg/clean.rs',' accepted(outcome, stored, preview, read.removed)',' accepted(outcome, String::from_utf8_lossy(bytes).into_owned(), preview, read.removed)','svg_clean'), + ('A8 removal ignores dependents','crates/core/src/domain/sheet/edit.rs',' if named_elsewhere {',' if false && named_elsewhere {','sheet_edit'), + ('A9 colour bound unchecked','crates/core/src/anatomy/svg/sanitize.rs',' if value > limit || bytes.get(index) != Some(&separator) {',' if bytes.get(index) != Some(&separator) {','svg_clean'), + ('A10 glued name accepted','crates/core/src/anatomy/svg/sanitize.rs',' _ if glued => return None,',' _ if false && glued => return None,','lib'), + ('A11 mixed units accepted','crates/core/src/anatomy/svg/sanitize.rs',' _ if *percentages.get_or_insert(percent) != percent => return None,',' _ if *percentages.get_or_insert(percent) != percent && false => return None,','lib'), + ('A12 rgba with three components','crates/core/src/anatomy/svg/sanitize.rs',' _ if rest.starts_with("rgba(") => (4, 5),',' _ if rest.starts_with("rgba(") => (3, 5),','svg_clean'), +] +for name,path,old,new,suite in muts: + src=open(path).read() + if src.count(old)!=1: + print(name,'ANCHOR NOT FOUND x',src.count(old)); continue + open(path,'w').write(src.replace(old,new)) + target='--lib' if suite=='lib' else f'--test {suite}' + try: + r=subprocess.run(['bash','-c',f'. scripts/rust-env.sh && cargo test -q -p faunosteo-core {target} 2>&1 | tail -3'],capture_output=True,text=True) + out=r.stdout + print(f"{name} ({suite}): {'KILLED' if 'FAILED' in out else ('COMPILE-ERR' if 'could not compile' in out else 'SURVIVED')}", flush=True) + finally: + open(path,'w').write(src) diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index d72f6cf1..3532d37a 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -572,6 +572,14 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet - [x] F SVG classification + cleaning (§9.2): active/external removals classed in the sanitiser walk, `clean_svg(bytes)` (clean / cleanable / rejected), cleaned bytes ≤ 2 MiB, fixpoint property test, hostile corpus, cairo + ImageMagick exports (owner editor exports pending) - [x] G wasm facade (`PreviewBuilder`, `PreviewSheet`, `clean_svg`, free ops) + ts-rs types + index; core-wasm proofs (equine preview = bundle index + fingerprint, mismatches, replace without re-read, hostile corpus in fresh instances) - [x] H docs (RUST.md §12, contract §6.7/§8.1/§9.2/§10/§17.4, CLAUDE.md, sheet-model rule), gates, fresh reviews, evidence, memory, commit + push. Reviews: verifier ECARTS(6) then ECARTS(3) (A6 owner exports, A12 covered by check:all, helper recorded); security PASS ×2, every MEDIUM fixed except owner decisions below. check:all green on 741c25c and 8294d54 (rerun on final). Open for owner: dangling #id across inlined drawings (scope ids per view or refuse), clean file uploaded as original bytes (§9.2), stricter-than-table refusals and the edit-command reading (§8.1, §9.2 « for the owner's confirmation »), cairo rgb() colours lost on cleaning, editor exports pending. Open for V1-2.3: M6 must accept a failed verdict without groups/drawings; R2 view.parent.cycle quadratic; PreviewSheet under CoreRuntime poison/recovery at V1-2.5 + - [ ] I owner arbitrations (brief « V1-2.2 : arbitrages du propriétaire et finalisation », 2026-10-29, on 17d9199): READY FOR REVIEW kept; fixtures and isolated stacks only, DEV untouched; no merge; STOP at checkpoint, no V1-2.3 + - [x] I1 SVG references: a dangling `#id` refused by the one reader (`dangling_reference`, cleaning classifies active content first); ids scoped per view in `view.canvas` (core composition, stored bytes and PDF views untouched); tests: valid, absent, same ids in two views, cross-view attempt, many references to one id, repeated composition + - [x] I2 serialisation, owner go 2026-10-29 (option « canonique + serveur »): every accepted file uploaded in one canonical form (`` + LF + core serialisation); verdict (`svg_not_canonical`, code `verification.integrity.svg_not_canonical`) and PreviewSheet refuse a stored drawing in another form; upload tool too; DEV equine object already canonical (sha256 0ea5202f… unchanged); contract §6.4, §6.5, §9.2, §9.3, §9.5; RUST.md §12 + - [x] I3 cairo colours: strict numeric `rgb()` / `rgba()` kept in presentation attributes and `style`; `url(` outside the document, `expression(`, scripts, active CSS still refused; tests (colours kept, dangerous refused, fixpoint, shapes and references kept) + - [x] I4 edit commands, owner go 2026-10-29 (option « refus atomique »): `remove` refused `has_dependents` when any dependent is not a descendant (view: drawn annotations, child views, links opening it; annotation category; region; finding zone: linked annotations; reference: citing findings); finding descendants still go with their parent; contract §8.1 amended + - [x] I5 A6 inventory: Inkscape / Illustrator / Figma (version, drawing, steps, file name, folder, tests, status); Inkscape not installed → owner go 2026-10-29 to download it; inkscape.org answered 504 / timed out, so the Ubuntu archive package 1.4.3 (sha256 = signed index) + 22 libs fetched with `apt-get download`, unpacked in the scratchpad (no install, no sudo); 3 real exports + generator committed; Illustrator / Figma owner procedure; A6 stays open + - [x] I6 wasm size: contributors measured, optimisation options for later steps; cap and test kept; owner go 2026-10-29: `--remove-name-section` in scripts/wasm-build.sh (debug `name` section, 279 KB raw, −30 691 B gzip measured) + - [ ] I7 gates: rust:check, SVG security suites, property + mutation, wasm + ts-rs, size, check:all; fresh verifier + security; evidence, memory, commit + push - [ ] 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) ## 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-10-29-v1-2-2-core.md b/.claude/tasks/contracts/2026-10-29-v1-2-2-core.md index 782bdff5..cb8a2444 100644 --- a/.claude/tasks/contracts/2026-10-29-v1-2-2-core.md +++ b/.claude/tasks/contracts/2026-10-29-v1-2-2-core.md @@ -68,3 +68,28 @@ commit `ac71c5b` (V1-2.1 verified by the owner). Diff under review: `ac71c5b..HE - `pnpm rust:check` (fmt, clippy, all core feature suites, ts-rs export, cargo deny). - `pnpm wasm:build` then `pnpm --filter @faunosteo/core-wasm test:run` (the size budget is 600 000 B). - `cargo test -p faunosteo-core --test sheet_verdict` (and the other five suites). + +## Owner arbitrations at the checkpoint (2026-10-29, contract §17.4, last six rows) + +Brief « V1-2.2 : arbitrages du propriétaire et finalisation » on `17d9199`. Diff under review for this round: +`17d9199..HEAD`. The criteria above still hold; these are added. + +- B1 A local reference (`href`, `xlink:href`, `url(#…)`) to an id the drawing does not define is refused + (`dangling_reference`) by `read_svg` (stored drawings, verdict, preview, PDF snapshot gate) and by `clean_svg`, the + latter only after active content is classified. Valid internal references keep working. +- B2 `view.canvas` (on `LoadedSheet` and `PreviewSheet`) scopes every id and local reference of the drawing to its view + (`fv..`); two canvases inlined in one page never resolve into each other; composition deterministic; stored + bytes, sha256, fingerprints, archive snapshots and PDF views untouched. Tests: valid, absent, same ids in two views, + cross-view attempt, many references to one id, repeated composition (`tests/svg_scope.rs`). +- B3 Every accepted file (clean or cleanable) is uploaded in the stored form (`serialize::stored_form`); verdict + (`verification.integrity.svg_not_canonical`), preview (`not_canonical`) and the upload tool refuse another form; the + equine drawing's sha256 `0ea5202f…` and the fingerprint `12d78872…` unchanged. +- B4 Strict numeric `rgb()` / `rgba()` kept; `url(` outside the document, `expression(`, scripts, active CSS and every + other function still removed or refused; the cairo export keeps colours, shapes and references; fixpoint. +- B5 `sheet.edit` `remove` refused atomically (`has_dependents`, document unchanged) while `dependents` holds anything + but descendants; a removal never adds a referential issue (property test). +- B6 A6: real Inkscape 1.4.3 exports committed with their generator and provenance; Illustrator and Figma are not + produced or imitated; A6 stays open until the owner's files arrive. +- B7 Wasm: `--remove-name-section` only; the 600 000-byte cap and `size.test.ts` unchanged. +- B8 Still: no SQL change, no protected reader modified (A13), the N-1 copies and frozen oracle files untouched (declared + changes applied in tests only), no DEV operation, no merge.