Files
faunosteo/.claude/tasks/plans/2026-11-04-v1-2-6-path-repair-core-proposal.md

3.7 KiB

Proposal: correcting a free path's points through the core (owner decision C45, not built)

Status: PROPOSAL for the owner, 2026-11-04. Nothing below is implemented. Until it is approved and built, the editor refuses an attachment that would leave a free path outside the new frame, keeps the document unchanged and never reshapes the path (contract C45, ruling R25).

Why the core is needed

A free path is {type:'path', d:<SVG path data>} (crates/core/src/domain/sheet/schema.rs:377). The core already reads path data strictly with the browser's grammar (crates/core/src/anatomy/path.rs: path_bounds, path_outline, 1 090 lines, bounded numbers, curves and arcs measured on their shape) but only internally, to judge frames. It exposes no operation that lists or moves points: the facade offers sheet.check, sheet.empty, sheet.edit, sheet.dependents. Listing or moving points in TypeScript would mean a second path parser and writer in the browser, which BDR-043 and the owner's clause exclude.

Minimal evolution

Two pure operations in the core, on top of the existing reader, reached through the wasm facade like the others:

  1. sheet.path_points (read): input { d, frame }; output the path's editable points in drawing order: for each command, its end point and its control points (cubic, quadratic, arc end point; an arc's radii and flags are not points and are not editable), each with a stable index, its absolute coordinates, kind (anchor | control) and outside (outside the frame). Unreadable d → the closed refusal the reader already has.
  2. sheet.path_move_points (transform): input { d, moves: [{ index, x, y }] }; output a new d where ONLY the numbers of the listed points change (converted back to the command's own absolute or relative form; every other command, number and separator kept as it was, so nothing is simplified or re-encoded); refused when an index is unknown, a coordinate is not finite or out of the existing bounds, or d is unreadable.

The editor then: lists the out-of-frame points of each free path in the repair dialog (values shown as stored, never pre-moved), lets the owner type new coordinates, and sends the attachment and every corrected annotation as one batch through the existing commitBatch + geometryAccept (the core judges the end state: out of frame, interior, too small). Cancel keeps everything; an invalid geometry is never kept, saved or submitted. Moving an anchor of a curve may leave its bulge outside: the control points are listed too, and the core's verdict says so.

Impact

  • crates/core: anatomy/path.rs (a writer for the moved numbers, sharing the reader), ops.rs / facade.rs (two operations), Rust unit tests and conformance cases (absolute/relative, H/V, S/T reflections, arcs, implicit repeats, numbers at the bounds, hostile inputs). No document schema change, no change to the archive or report readers, the N-1 reader untouched, no SQL, no seed, no golden or oracle regenerated.
  • packages/core-wasm: generated ts-rs types (PathPoint, PathMove) and a thin wrapper; the wasm stays within its 600 000 B gzip budget (583 126 B today: the writer must stay small; measured before merge).
  • apps/app: the repair dialog's free-path rows (fields per out-of-frame point), labels as proposals, unit and e2e tests (the complex path of C45 corrected point by point, saved, reloaded with every untouched number identical).
  • Gates: pnpm rust:check, pnpm wasm:build, the core-wasm proofs, check:all, a fresh verifier and security review. Scope: it reopens crates/**, excluded from V1-2.6 so far: it needs the owner's explicit approval (and could be scheduled as its own small step).