Skip to content

feat(planning): developed-surface helical lowering + equivalence harness (S2) - #301

Merged
CameronBrooks11 merged 1 commit into
mainfrom
feat/296-s2-developed-surface-helical
Jun 29, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
feat/296-s2-developed-surface-helical

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Part of the Stage 2 epic #137 (slice S2, #296). Cuts helical planning over to a developed-surface primitive and stands up the equivalence harness.

What's here

  • fiberpath/planning/developed.py — a DevelopedPath of Waypoints on the unwrapped (z, θ) cylinder, plus a single PatternSpec → Motion IR lowering (build_developed_path + lower_developed_path). Geometry reuses compute_helical_kinematics verbatim (the Stage-1 single motion-math source) and accumulates θ in the legacy additive order, so the path owns the geometry while the bytes stay stable.
  • Helical cutover — plan_helical_layer's ~90-line imperative body becomes a 3-line delegation to the developed lowering. One helical implementation; dispatch_layer is unchanged.
  • Equivalence harness (tests/planning/_equivalence.py + test_pattern_equivalence.py) — asserts the lowered IR is a correct path: coverage (gcd tiling, no-gap), on-surface fiber angle (slope == α), delivery-head lean, and old-vs-new metric parity. Validated both ways: it passes on the byte-identical cutover and fails on deliberately broken inputs (wrong angle, wrong lean, non-coprime coverage, dropped moves).

Byte-clean result (and a deliberate deviation from the plan)

The mirror lowering is byte-identical to the prior emitter across every case tested (incl. the high-angle negative-tail-term path, skipInitialNearLock, pattern-4/skip-3, degenerate lead-in/out). So the existing byte-equal goldens still pass unchanged — there was nothing to regenerate.

Given that, I kept byte-equality rather than retiring it for the helical parts (the plan's S2-5/S2-6 assumed bytes would shift). Retiring a passing, strong gate buys nothing here; the equivalence harness is added as an additional, validated gate. Byte-equality for helical is retired in the first slice that actually changes bytes (the clean structural collapse, or cones).

Verification

  • Full backend suite 179 passed; goldens byte-equal; ruff format/ruff check/mypy clean.
  • New: test_developed.py (byte-identical to fixture, waypoints at α, no -0 tokens) + test_pattern_equivalence.py (per-part invariants + parity + 4 negative tests).

Not in this slice

The clean structural collapse (one move per vertex) and hoop/skip cutover stay on the legacy generators, deferred to later slices behind the now-validated harness.

Stage 2 / S2 (#296). Add fiberpath/planning/developed.py: a DevelopedPath of
Waypoints on the unwrapped (z, theta) cylinder plus a single
PatternSpec -> Motion IR lowering, and route plan_helical_layer through it
(build_developed_path + lower_developed_path). The geometry reuses
compute_helical_kinematics verbatim (the single motion-math source) and
accumulates theta in the legacy additive order, so output is byte-identical
to the committed helical goldens -- the existing byte-equal gate still passes.

Add the equivalence harness (tests/planning/_equivalence.py +
test_pattern_equivalence.py): coverage (gcd tiling, no-gap), on-surface fiber
angle (slope == alpha), delivery-head lean, and old-vs-new metric parity. It is
validated against the byte-identical cutover (passes) and against deliberately
broken inputs (fails), so it is trustworthy for the future slices that will
intentionally change the emitted bytes. Byte-equality is retained until then.

Refs #137.
@CameronBrooks11
CameronBrooks11 merged commit 69197d0 into main Jun 29, 2026
21 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/296-s2-developed-surface-helical branch June 29, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant