Files
faunosteo/.claude/tasks/contracts/2026-10-30-v1-2-2-reserved-ids.md
T

3.1 KiB

Contract: V1-2.2 reserved ids (PDF halo collision)

Owner brief « V1-2.2 : correction de sécurité PDF et poursuite A6 », 2026-10-30, on 2f1f076 (branch feature/v1-2-anatomical-sheets). Diff under review: the working tree against 2f1f076.

Problem

crates/core/src/anatomy/compose.rs::compose_highlight (PDF view) keeps the drawing's ids and writes its halo filter osteo-halo next to them. Before the fix it skipped writing its filter when the drawing already held a filter#osteo-halo, and a non-filter element holding the id before the first <defs> won url(#osteo-halo) resolution. A sheet drawing could thus replace, divert or hide the PDF markers.

Criteria (each must hold on the diff)

  • C1 The shared SVG reader (anatomy/svg/mod.rs::read_svg) refuses any kept element (root included) whose id is a reserved id, with a closed, stable reason reserved_id (SvgRejection::ReservedId).
  • C2 The decision is exact-name (reserved set, not a prefix): historical drawings holding osteo-overlays (the equine draft drawing, sha256 0ea5202f…, which is the DEV object) still read with no removal; no historical asset changes byte-wise.
  • C3 No bypass: letter case (ASCII), XML character references, whitespace, look-alike or invisible characters, xml:id, prefixed attributes or prefixed SVG elements, CSS escapes and percent-encoded url( targets either refuse the drawing or never leave a reserved id in the tree a composer receives.
  • C4 clean_svg (upload cleaning) refuses it (reserved_id) with no stored form, after active content is classified; the verdict, the preview, the loaded sheet, the upload tool and the PDF snapshot gate (pdf/write/input.rs, snapshot_invalid / asset reserved_id) answer it through the same reader.
  • C5 Composers are fail-closed: compose_highlight and compose_canvas refuse a tree holding a reserved id (ComposeError::ReservedId), and the highlight always writes the engine's own filter; no path remains where a drawing-supplied element named osteo-halo reaches the PDF view.
  • C6 No existing control weakened: every other reader rule, cap, reference check, scoping and the PDF/archive readers unchanged; frozen oracles, R4 digests, step6 goldens, N-1 copies untouched (declared divergences applied in tests only).
  • C7 Other internal collisions audited (ids the composition writes, canvas scope fv., layer attributes, filter result names) and either covered or argued absent.
  • C8 Tests cover: a valid drawing; filter id="osteo-halo"; the id on other elements; references to it; adversarial spellings; the PDF keeping its own halo (behavioural, through the export session); equine non-regression and historical fingerprints; the shipped wasm module.
  • C9 Docs updated (RUST.md §12.9, V1-2 contract §9.2 table and closed codes, ANNOTATION-RENDERING); the R5 ledger target renamed with the test.
  • C10 A6: the owner README gives precise Illustrator steps for …-presentation.svg and …-internal-css.svg (names and variants unchanged), no fabricated Illustrator file, A6 not claimed.

Out of scope

No SQL, no Supabase DEV, no worker, no merge, no V1-2.3.