fix(anatomy): V1-2.2 refuse zones without a usable interior

A polygon or path zone or trigger must fill a disc of 4 CSS px on the
320 x 568 preview under the layer's nonzero rule, stroke left out:
conservative widest-disc search on the flattened outline, caps and a
per-sheet budget, closed codes interior_too_small and
marker_interior_too_small. Browser probe on six projects.
This commit is contained in:
bchanot committed 2026-11-01 12:19:08 +01:00
1 parent de2dfb392e
commit 8dd2d78d38
18 files changed
+1852 -38

No files matched your search

+10 -1
View File
@@ -123,7 +123,16 @@ suite needs Docker in the runner for the sandbox.
100.9 left of it; Chromium keeps the fraction on a click, rounds a tap), so a
real press keeps 1.5 px of margin from any edge it tests; below that margin
the spec asks the browser's own hit test (`elementFromPoint`) at the exact
point. Firefox, WebKit
point. `e2e/ui/interior-clicks.spec.ts` runs on the same six projects
(V1-2.2, the interior rule): the core's probe cases
(`e2e/fixtures/interior-probe.json`, generated and drift-checked by
`crates/core/tests/interior_probe.rs`, `MAKE_INTERIOR_PROBE=1` rewrites it) in
the phone preview's 286 × 310 box (harness `e2e/harness/interior.{html,ts}`,
dev server only), then the equine zones in the canvas harness. Chromium's touch
adjustment gives a point the taps up to about 10 px around its disc
(measured 2026-11-01, `chromium-320` and `chromium-375`; WebKit 375 does
not), so the real press on an equine zone goes where its fill lies farthest
from every disc. Firefox, WebKit
and the 412 × 915 viewport join every suite at V1-5
(contract §12.5). WebKit's system libraries may need `sudo` (owner action).
Desktop WebKit is not iOS Safari: the owner's manual check on a real iPhone
+69
View File
@@ -4342,3 +4342,72 @@ security review measured its consequence (MEDIUM, open, owner decision): a zone
(an outline traced twice in opposite directions) or a near-collinear polygon passes the 4 px rule, paints no interior
and is hit only on its 2-unit stroke (0.28 CSS px on the equine phone scale), in the three engines. Closing it needs a
filled-area measure (nonzero rule) or a « zone without interior » issue.
### 12.14 The last MEDIUM: zone without interior (owner, 2026-11-01)
Brief « V1-2.2 : fermeture du dernier MEDIUM » on `de2dfb3`: the decisions of §12.13 confirmed (threshold, frame rule,
bounds, codes `too_small` / `marker_too_small`, isolation, canvas passes, PDF order and bytes, R3 transforms, R4.1
manifest, the five former `fixme`); a zone without a usable filled interior refused by the verifier, in the core.
**Rule** (`anatomy::interior`, called by `frame::annotation_placement` after the bounds rule, so by the verdict and the
preview): a polygon or a path annotation (zone or trigger) must fill a disc of `MIN_VISIBLE_PX` 4 CSS px across on the
smallest preview (§12.13: main 286 × 310, detail 254 × 191, `xMidYMid meet`). Circles keep their exact disc measure.
| Part | What and why | Where |
|---|---|---|
| Fill rule | `nonzero` (`LAYER_FILL_RULE`): the layer writes no `fill-rule`, the composition root carries none, the drawing's sits in its own group (§12.12). The measure takes either rule; `evenodd` is tested, never used by the layer | `interior::FillRule` |
| Stroke | never counted: the measure reads the fill alone, whatever the shape's `pointer-events` (`all` on zones and triggers, its 2-unit stroke taken by the browser too) | |
| Outline | a polygon's points; a path read by the one SVG path reader (`path::path_outline`, same grammar and `±2²⁰` bound as `path_bounds`), each subpath closed by the fill, a lone moveto adding nothing; cubics, quadratics and arcs cut into chords: over a parameter step `h` a chord departs from its curve by at most `K h² / 8`, `K` bounding the second derivative (cubic `6 max‖Δ²‖`, quadratic `2‖Δ²‖`, arc `max(rx, ry) × sweep²`, the radii as scaled to reach the endpoint); chords asked within 0.05 px (`INTERIOR_TOLERANCE_PX`), at most `MAX_CURVE_CHORDS` 64 per curve, the largest deviation recorded | `path::Outline` |
| Measure | the widest disc whose centre the rule puts inside and every edge (closing edges included) at least the radius away: the disc crosses no edge, so all of it has the centre's winding number; the deviation taken off the radius. Conservative: a nonzero fill running on past an inner edge is not counted (pentagram: 3.09 measured, 3.82 filled) | `interior::widest_disc` |
| Search | polylabel's subdivision: square cells from one covering the outline, a cell's best centre at most its centre's radius plus its half diagonal, the most promising cell cut first (a max-heap ordered by `total_cmp`), cells below 0.05 px never cut; deterministic. Refuses in doubt: measured, the first L accepted at its elbow holds 4.026 px | |
| Caps | 4 096 outline vertices (`MAX_OUTLINE_VERTICES`), 4 096 cells per shape, one budget of `2²⁵` edge distances per sheet (`MAX_INTERIOR_WORK`, 0.35 s natively at 8 192 edges × 4 096 cells; the equine takes about 10⁵): a shape over them is refused, never accepted | `interior::Budget` |
| Refusal | issue `annotation.geometry.interior_too_small` (« fills no interior wide enough to tap », or « too complex for the interior measure »), verdict `verification.validation.marker_interior_too_small` after `marker_too_small`, never a rules failure; the document never rewritten | `report.rs`, `verdict.rs` |
Threshold, measured before freezing (equine draft, 320 × 568, widest disc across): caudal 4.951 px, sacral 11.30,
thoracic 11.47, cervical 12.17, lumbar 14.15, head trigger 29.13. 4 px keeps the approved threshold of the points (a point
shows a 4 px disc, a zone must hold one) and refuses no equine shape; the caudal zone now falls first when the horse is
scaled, past × 1.2378 (4.951 / 4), before the junctions (× 1.2414). Above 4.95 px the threshold would refuse the
validated equine; below, a tap target smaller than the points'.
| Proof | Result |
|---|---|
| `sheet_marker_visibility::shapes_without_a_usable_interior_are_refused` | each accepted before this rule (bounds pass): a path forth and back, a triangle traced back on itself, the same square twice in opposite directions, a 1 px diagonal sliver, a cubic and an arc travelled there and back, a 2 px ellipse turned 45°, an L of 3.3 px arms (3.87 px): `interior_too_small`, `marker_interior_too_small` |
| `small_shapes_that_fill_are_accepted` | a 4.5 px tall triangle, a 6 px disc of two arcs, a cubic lens, an L of 3.6 px arms (4.22 px), a pentagram of winding 2 (6.18 px; 3.26 under evenodd) |
| `the_interior_threshold_holds_at_its_edge` | L at 4.030 px accepted, 4.019 (doubt band) and 3.995 refused |
| `the_interior_follows_the_projection` | the same L at ten units per px, at the offset limit (256 spans), in a one-unit frame (286 px per unit) |
| `drawing_transforms_never_change_the_interior`, `a_shape_too_complex_to_measure_is_refused` | a drawing scaled × 1 000 changes nothing; 4 096 vertices measured, 4 097 refused (polygon and path) |
| equine | `the_equine_draft_shows_every_marker_on_the_phone_preview` passes; `the_equine_threshold_falls_on_the_caudal_zone_then_the_junctions`: × 1.235 accepted, × 1.24 the caudal zone alone (failures `[marker_interior_too_small]`), × 1.25 with the three junctions |
| `interior` unit tests | square, pentagram under both rules, forth and back, two opposite loops, deviation taken off, stop and floor, budget shared and spent, 60 random polygons (self-intersecting included) under both rules: never wider than a dense grid, every rim point filled |
| `path` unit tests | 300 random cubics, quadratics and arcs: every curve point within the recorded deviation of its chords, the deviation within 0.05 unless capped (arcs whose radii the endpoints scale up); closepath restarts at the subpath start; vertex cap |
Browsers (`apps/app/e2e/ui/interior-clicks.spec.ts`, the six click projects: Chromium 1280, 375 and 320 touch, Firefox
1280, WebKit 1280 and 375 touch; 90 passed, and `canvas-clicks.spec.ts` 99 unchanged). The probe
(`e2e/fixtures/interior-probe.json`, written and drift-checked by `tests/interior_probe.rs`) gives 14 shapes in the
preview's 286 × 310 box (one unit per CSS px) with the core's verdict and widest disc. For each, the browser's own fill
(`pointer-events="fill"`, stroke out) is sampled every 0.25 px and its widest disc taken by an exact distance transform:
the core never claims more than the browser fills (at most 0.5 px under it); the 8 refused fill no 4 px disc in any
engine; the 6 accepted take a real click or tap at the core's centre and the hit test at 32 points of 90 % of its radius,
fill only and as shipped. A drawing root `fill-rule="evenodd"` leaves the pentagram filled at its centre (isolation).
Then the equine shapes in the canvas: the core's disc hit test-clear (samples under a point's disc aside, at most a
quarter), and a real press where the fill lies farthest from every disc records the zone.
Chromium's touch adjustment, measured (tool `.claude/audits/2026-11-01-v1-2-2-interior-tools/`, taps every 2 px of each
equine zone's own hit area, 400 ms apart): a tap up to about 10 px around a point's disc goes to the point on
`chromium-320` and `chromium-375`, not on `webkit-375`. Taps recorded as the zone at 320 px: caudal 18/21, sacral 51/67,
lumbar 87/104, thoracic 72/97, cervical 195/195, trigger 278/284 (the rest to the neighbouring junctions and points, or to
nothing at the edges); WebKit 375: 91 to 99 %. Every equine zone keeps a tappable interior; near a point, Chromium's
targeting goes to the point, a browser behaviour the measure does not model (no selection redesign in V1-2.2).
Known limitation (owner, 2026-11-01, LOW accepted): a visible disc covering another marker entirely, or the only
interior of a zone, takes its taps; no rule refuses it. The human review identifies overlapping markers before a sheet
is published; no proof here claims that every marker is individually selectable when two overlap entirely. The arc
rotation reduced in `f32` by browsers (sub-pixel, §12.13) stays bounded by the `2²⁰` number bound, its tests kept.
Mutations (`.claude/audits/2026-11-01-v1-2-2-mutations-interior.py`): 24 killed, Z22 (the floor prune removed) survives
as equivalent, a cell that cannot reach the floor never holding an accepted disc; S1, S8 and F16 of the previous scripts,
whose anchors moved, re-anchored and killed. Module 579 180 B gzip -9 (+4 946 B, budget 600 000, margin 20 820 B).
Ignored cargo tests: the three are one test, `pdf_serialize::l_report_with_real_rasters_costs_what_it_costs`, counted
once per cargo run whose features build `pdf_serialize` (workspace, `cli`, `ts,pdf-read,pdf-write`). A timing print for
§10.7, 40 s in debug; run on request in release (2026-11-01: passed, 120 views, 46.5 MB, 5.2 s). The L report's export
itself is covered unignored (`pdf_budget`); it masks no required scenario.
@@ -1048,6 +1048,7 @@ Four stages, each a superset of the previous:
| 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) and usable within the range rules browsers draw faithfully (owner brief 2026-11-01: edges within 2²⁰, spans from 1 unit, aspect at most 100, farthest edge at most 256 smaller spans); 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`) |
| Every annotation in frame shows at least 4 CSS px on the smallest preview, the editor at 320 × 568 (main view box 286 × 310, detail view box 254 × 191, `xMidYMid meet`): a point's visible disc (`2 × max(2, r − 12)`), a trigger circle's diameter, a polygon's or a path's smaller side (curves and arcs on their shape). Same views, same frame; the document is never rewritten (owner brief 2026-11-01, RUST.md §12.13) | yes | | | `verification.validation.marker_too_small` (issue `annotation.geometry.too_small`) |
| Every polygon or path annotation in frame fills a disc of 4 CSS px on the same preview: under the `nonzero` rule the layer fills with, its stroke left out, a centre inside the fill at least the radius from every edge (closing edges included), curves and arcs cut into chords whose deviation is taken off; measured within `interior::MAX_OUTLINE_VERTICES` 4 096 vertices and one budget of `2²⁵` edge distances per sheet, refused past them; refused in doubt (owner brief « fermeture du dernier MEDIUM » 2026-11-01, RUST.md §12.14) | yes | | | `verification.validation.marker_interior_too_small` (issue `annotation.geometry.interior_too_small`) |
| 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` |