fix(anatomy): V1-2.2 model arcs as browsers store them

Second security review: endpoints equal in f32 draw no arc, as in
browsers; an arc carries the spread of its f32 variants (endpoint or
radius moved one ulp) in its deviation and their extremes in its
bounds. Probe and mutants extended.
This commit is contained in:
bchanot committed 2026-11-01 13:04:43 +01:00
1 parent 03be75beed
commit 86dce16b09
5 files changed
+141 -19

No files matched your search

+20 -7
View File
@@ -4382,12 +4382,12 @@ validated equine; below, a tap target smaller than the points'.
| `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; 96 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 15 shapes in the
1280, WebKit 1280 and 375 touch; 102 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 16 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 9 refused fill no 4 px disc in any
engine (the ninth, an arc radius of `1e-49`, fills nothing at all); 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,
the core never claims more than the browser fills (at most 0.5 px under it); the 10 refused fill no 4 px disc in any
engine (an arc radius of `1e-49` and an arc between endpoints one `f32` point apart fill nothing at all); 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.
@@ -4416,10 +4416,23 @@ reader). Informational: verdict and preview may differ by a libm ulp between nat
threshold; the verdict has no production caller yet (V1-2.3). Verifier ECARTS(3), all documentation: this section's
pointer from §12.13, the × 1.235 assertion, the audit tools committed.
Mutations (`.claude/audits/2026-11-01-v1-2-2-mutations-interior.py`): 26 killed, 2 equivalent: Z22 (the floor prune
Second security review, on `03be75b`: PASS, the radius MEDIUM closed, two siblings of the same `f32` class, fixed. Browsers
store path points in `f32`: an arc whose endpoints are one `f32` point (`A20 20 0 1 1 40.000001 50` from `40 50`) draws
nothing there, while `f64` drew a full circle; the core now compares the endpoints as stored and draws no arc either
(`an_arc_between_endpoints_equal_in_f32_draws_nothing`, probe `arc-endpoints-equal-in-f32`). An ill-conditioned arc (a
flat ellipse along its chord) moves far for one ulp of an endpoint: the core draws the same arc with an endpoint or a
radius moved by one `f32` ulp (six variants), adds the largest distance between them at 33 parameters to the deviation,
and adds the variants' extremes to the bounds (`an_ill_conditioned_arc_carries_its_f32_spread`: the reported needle,
18 units past the chord, inside the bounds; a semicircle of radius 1 000 keeps 0.84 units, its centre moving as the square
root of an ulp, as in the browsers). An estimate of the browser's input rounding, compared point to point; the arc
arithmetic drift raised to `4 × 2⁻²³` of the radius. Bounds of every arc grow by a few ulps (an arc flush with the frame's
edge counts them). LOW kept, pre-existing, outside the diff: relative commands accumulate in the browser's `f32` current
point; the worst aligned case (4 096 segments at the 256-span offset limit) drifts 6 % of the span, contrived.
Mutations (`.claude/audits/2026-11-01-v1-2-2-mutations-interior.py`): 29 killed, 2 equivalent: Z22 (the floor prune
removed; a cell that cannot reach the floor never holds an accepted disc) and Z25 (a path without an outline accepted;
unreachable). S1, S8 and F16 of the previous scripts, whose anchors moved, re-anchored and killed. Module 579 357 B gzip -9
(native build; +5 124 B, budget 600 000, margin 20 643 B).
unreachable). S1, S8 and F16 of the previous scripts, whose anchors moved, re-anchored and killed. Module 580 438 B gzip -9
(native build; +6 205 B, budget 600 000, margin 19 562 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