Repository navigation
feat(planning): developed-surface helical lowering + equivalence harness (S2) - #301
Merged
Merged
Conversation
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.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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— aDevelopedPathofWaypoints on the unwrapped(z, θ)cylinder, plus a singlePatternSpec → Motion IRlowering (build_developed_path+lower_developed_path). Geometry reusescompute_helical_kinematicsverbatim (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.plan_helical_layer's ~90-line imperative body becomes a 3-line delegation to the developed lowering. One helical implementation;dispatch_layeris unchanged.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
ruff format/ruff check/mypyclean.test_developed.py(byte-identical to fixture, waypoints at α, no-0tokens) +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.