v1.40.0 — sector primitives, and a despeckle that adapts to the image
Two fixes, both surfaced by a real logo and a real chart rather than by a synthetic test.
Sectors — pie slices and donut segments — as real arcs
The one primitive that cannot be recognised from an outline alone, and the shape every chart is made of. --primitives now turns a four-slice pie chart from 2323 bytes of Bézier into 488 bytes of four true SVG arcs — editable as arcs in Illustrator, and readable as arcs by a CAD tool.
It came out of a five-way bakeoff: five genuinely different algorithms, each in its own git worktree, each held to the same fixed bar — fire on a real traced pie and ring, stay silent on photographs, produce a smaller file, keep the suite green — then independently reproduced in a fresh worktree before any was believed.
Three of the five, and three earlier hand attempts, failed for one reason worth stating: pixel-lattice contour error is bounded and adversarial, not Gaussian. A traced boundary is off by at most half a pixel, and the sign is correlated along each staircase tread — so every estimator whose optimality rests on zero-mean independent noise is solving a problem the data does not pose. The winner minimises the worst boundary distance, not the sum of squares, and judges each region independently rather than per colour — which is what makes it fire on a real chart whose slice colours recur in a legend, the exact case that lets a fitter pass every synthetic test and never work in production.
Measured: centres within 0.1px and radii within 0.15px of ground truth, rendered back to a correct pie. Zero false arcs on photographs at five seeds, or on a disc, annulus, square, triangle, crescent, blob or elliptical wedge. Below ~0.6 rad sweep or ~15px radius it declines to a Bézier path — fails safe. Opt-in and off by default.
Honesty fix in the same change: the curved primitives are documented as a measured trade (~0.02 SSIM against the source), not "render-preserving". An ideal arc cannot follow a pixel staircase exactly. Only the <rect> is genuinely render-identical; the shipped <circle> always made this trade, and the docs now admit it.
Despeckle that adapts to the image
A real logo exposed this: antialiased artwork fragments along every edge into hundreds of one-to-forty-pixel slivers — 99% of components under 40px on a 405×384 logo — and the old fixed threshold (min(16, pixels/50000) = 3 for that image) removed almost none of them, so the trace was either enormous or, once budgeted, visibly wavy.
The threshold is now chosen by area, not count: components are removed only while everything removed still accounts for a negligible share of the picture. That separates the cases by itself — the logo's threshold climbs to 125 and clears 1431 slivers; a photograph's drops to 5 (from 8), more conservative, which is what protects fine detail. Logo SSIM 0.937 → 0.989, corpus problems: 0, benchmark unmoved.
523 tests · smoke clean · corpus problems: 0