From faa53c7956171f6342550de5a3394b77c7a782fd Mon Sep 17 00:00:00 2001 From: bchanot Date: Fri, 30 Oct 2026 20:54:46 +0100 Subject: [PATCH] docs(docs): V1-2.2 view frame rule in RUST.md 12.11, contract, rendering --- docs/ANNOTATION-RENDERING.md | 21 ++++++++----- docs/development/RUST.md | 36 ++++++++++++++++++++++ docs/development/V1-2_ANATOMICAL_SHEETS.md | 3 +- 3 files changed, 52 insertions(+), 8 deletions(-) diff --git a/docs/ANNOTATION-RENDERING.md b/docs/ANNOTATION-RENDERING.md index d126f907..542dd588 100644 --- a/docs/ANNOTATION-RENDERING.md +++ b/docs/ANNOTATION-RENDERING.md @@ -65,13 +65,20 @@ changeset, never by the renderer. ## Views -A view renders on its `view_box` when set (the head view is the crop -`60 100 500 380` of the main drawing). Otherwise the canvas keeps the asset's -own `viewBox`, and falls back to `0 0 100 100` when the asset has none; the PDF -engine keeps whatever the asset has. A detail view with its own -`svg_asset_id` renders that asset, otherwise the first asset up its parent -chain. The root's `width` and `height` are removed; its other attributes are -kept (after sanitising). +A view renders on its frame (`anatomy::frame::view_frame`, V1-2.2 owner brief +2026-10-30): its `view_box` when set (the head view is the crop +`60 100 500 380` of the main drawing), otherwise the asset's own `viewBox` read +as a browser reads it (four numbers, positive width and height) and written +back in JavaScript number printing (`0,0,10,10` becomes `0 0 10 10`). Without +a usable frame the canvas falls back to `0 0 100 100` and the PDF view carries +no `viewBox`. A detail view with its own `svg_asset_id` renders that asset, +otherwise the first asset up its parent chain. The root's `width`, `height` +and `preserveAspectRatio` are removed (the default `xMidYMid meet` shows the +whole frame, which a `slice` would crop where the box is not the frame's); its +other attributes are kept (after sanitising). The verdict and the preview +refuse an annotation not entirely inside this same frame +(`verification.validation.out_of_frame`), so a drawing whose `viewBox` moved +away from the annotations is refused, never drawn without its markers. The editor canvas is inlined in the page, where `#id` resolves against the whole document. Since V1-2.2 (owner decision 2026-10-29) the core writes diff --git a/docs/development/RUST.md b/docs/development/RUST.md index d1e27f2c..6a0cf214 100644 --- a/docs/development/RUST.md +++ b/docs/development/RUST.md @@ -4162,3 +4162,39 @@ module). The reader suites share `tests/common/sheet_readers.rs`. Red first: wit wired, the reader, composer and PDF tests failed (3 of 14), then passed with the check. Mutations: V1 to V9 killed, and K1 to K11 of §12.9 rerun, all killed (20 of 20). Module: 560 015 → 560 377 B gzip -9 (+362 B), 1 513 968 → 1 515 246 B raw; Node's gzip 569 817 B (budget 600 000). + +### 12.11 The frame of a view (owner, 2026-10-30, defect 3) + +Brief « V1-2.2 : arbitrages propriétaire sur les trois MEDIUM » on `958228a`, point 3 (open item (3) of §12.10): a +geometric rule in the core, the source document never rewritten. + +| Point | Built | Where | +|---|---|---| +| Frame | `view_frame(view, drawing)`: the view's `view_box`, else the drawing root's `viewBox` read with the SVG grammar (`path::number_list`: four finite numbers separated by comma-wsp, width and height positive); `None` otherwise. One definition for both composers, the verdict and the preview | `anatomy/frame.rs`, `anatomy/path.rs` | +| Composers | both frame the view on it (`Frame::view_box`, JavaScript number printing; the canvas falls back to `0 0 100 100`, the PDF view drops an unusable `viewBox`) and remove the drawing's `preserveAspectRatio`, so the default `xMidYMid meet` shows the whole frame in the canvas box and in the clamped PDF raster | `anatomy/compose.rs` | +| Bounds | circle `cx ± r`, polygon points, path data read strictly (moveto, lines, cubic and quadratic curves with their `S`/`T` reflections, arcs in centre parameterisation with the radii scaled up as SVG 1.1 F.6 says); curves and arcs measured at their extremes, not their control points; a path a browser would not read whole (missing number, bad flag, unknown command, trailing comma, number out of range, no initial moveto) is `Unreadable` | `anatomy/path.rs`, `anatomy/frame.rs` | +| Rule | an annotation is in frame when its bounds are inside the frame, edges included (slack 1e-9 of the span); otherwise `annotation.geometry.out_of_frame` at `annotations[i].geometry`; a view drawn on a clean drawing with no frame is `view.frame.unknown` at `views[i]`; a view whose drawing is missing or refused is not measured (its own failure names it); a repeated view id is measured once, as the composers find it | `frame_faults`, `report::frame_issues` | +| Verdict | the issues join `issues`, the failure `verification.validation.out_of_frame` follows the drawing faults; never a `rules` failure | `domain/sheet/verdict.rs` | +| Preview | the same issues in `state().report.issues`, on the drawings held (draft, published, deprecated alike) | `domain/sheet/preview.rs` | + +Not covered by the rule: a view whose `view_box` is inside the drawing's area while the drawing moved elsewhere (the +annotations are in frame over an empty area); the rule proves the markers are visible, the review proves they sit on the +anatomy. Transforms inside the drawing move the drawing only; the reader removes the root's own `transform`. + +Tests: `sheet_frame` (12; on `958228a` 9 fail and the 3 that only accept pass): the equine draft +in frame; the reported drawing (the horse's `viewBox` moved by 10 000, its content translated back, pixel-identical, +read clean) refused with its 19 main-view annotations and the `out_of_frame` code alone, the head view untouched, the +document text unchanged; edges accepted; past an edge by 0.001 refused; curves inside although their control points are +out, arcs and rotated arcs out although their endpoints are in; unreadable path data; secondary views on their crop and +on their own drawing; a document `view_box` over the drawing's; `viewBox` spellings a browser reads and those it does +not (absent, zero or negative size, three or five numbers, `0x0`, `px`, `1e999`, empty); legitimate transforms (scaled +content, frame moved with its annotations); a missing drawing not measured; both composers on the measured frame without +the drawing's `preserveAspectRatio`. Unit tests of `path.rs`: 500 random cubics and 500 random arcs against 20 001 +samples each (bounds hold every sample and are no larger), the path and number grammars. Verdict and preview agree on +every case (`judged`). +Mutations (`.claude/audits/2026-10-30-v1-2-2-mutations-three-medium.py`, F1 to F16): 17 of 17 killed (F16 « frame +faults also a rules failure » survived the first run; the reported-drawing test now pins the failure list). +Oracles: none changed by this rule; the R3 canvas and highlight trees, the R4 digests and the step6 goldens pass as +frozen (no committed drawing carries a `preserveAspectRatio` or a `viewBox` in another spelling). +Module: 560 377 → 572 993 B gzip -9 (+12 616 B, the curve and arc measure), 1 515 246 → 1 544 834 B raw; Node's gzip +582 919 B (budget 600 000). diff --git a/docs/development/V1-2_ANATOMICAL_SHEETS.md b/docs/development/V1-2_ANATOMICAL_SHEETS.md index 664087c9..254f66c5 100644 --- a/docs/development/V1-2_ANATOMICAL_SHEETS.md +++ b/docs/development/V1-2_ANATOMICAL_SHEETS.md @@ -939,7 +939,7 @@ did not pass; the closed codes keep the categories apart. | Category | Example | Outcome | Retry | Exit | |---|---|---|---|---| -| Business validation | integrity error, caps exceeded, annotation without geometry | `verification_failed`, outcome `failed`, codes `verification.validation.*` and the issues | no | fix the draft, submit again | +| Business validation | integrity error, caps exceeded, annotation without geometry, annotation outside its view's frame | `verification_failed`, outcome `failed`, codes `verification.validation.*` and the issues | no | fix the draft, submit again | | Integrity | strict parse refused, drawing missing, size or sha256 mismatch, SVG refused, needing a removal or outside the stored form (§9.2), `object_conflict` | `verification_failed`, outcome `failed`, codes `verification.integrity.*` | no | fix or upload again; `object_conflict` follows §9.3 | | Transient worker error | database or Storage unreachable, worker restart | stays `verifying`, code recorded | yes, up to the limit | automatic | | Timeout or resource limit | child over its wall-clock or memory limit | stays `verifying`, code recorded | yes, up to the limit | reduce the document or the drawing if it repeats | @@ -1046,6 +1046,7 @@ Four stages, each a superset of the previous: | Caps of §1, all of them | yes | | | `verification.validation.caps` | | Every annotation has a geometry | yes | | | `verification.validation.no_geometry` | | Every reachable drawing present, size and sha256 equal to its row, read without removal, in the stored form of §9.2 | yes | | | `verification.integrity.*` | +| Every annotation entirely inside the frame of its view, edges included: the view's `view_box`, else the `viewBox` of the drawing it draws, read as a browser reads it (four numbers, positive width and height); curves and arcs measured on their shape; path data a browser would not read whole refused; a view drawn on a clean drawing without either has no frame. Measured on the views whose drawing reads clean; the document is never rewritten (owner brief 2026-10-30, RUST.md §12.11) | yes | | | `verification.validation.out_of_frame` (issues `annotation.geometry.out_of_frame`, `view.frame.unknown`) | | Fingerprint computed | yes | | | `verification.integrity.fingerprint` | | Verdict passed, on the current revision | | yes | yes | `verdict.missing`, `verdict.failed`, `verdict.stale` | | No `to_confirm` element (D2) | | yes | yes | `publish.to_confirm.open` |