Skip to content

build(planning): freeze byte-exact G-code goldens from the current planner - #276

Merged
CameronBrooks11 merged 1 commit into
mainfrom
build/freeze-motion-ir-goldens
Jun 28, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
build/freeze-motion-ir-goldens

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Part of #136 (Motion IR epic). Closes #270. Prework slice P0 — establish a trustworthy byte baseline before the IR refactor.

Why this was needed (critical finding)

The committed examples/rocketry/*.gcode were stale — they reproduce from no current code path:

  1. A-axis sign flip. Old goldens emit negative/decreasing mandrel rotation (A-540, A-0.75…); the planner has produced positive/increasing A since the initial commit (far_mandrel/mandrel_position only ever increment). X and B were byte-identical.
  2. Accumulating pattern-advance divergence. On top of the sign, negating A still left a 120°-per-circuit (360/patternNumber) growing offset — from intentional coverage fixes made after the goldens were last cut: f73386a ("mvp of working tests on cyclone", introduced start_position_increment/pattern_step_degrees) and f4c1204 ("validate lockDegrees coverage compatibility"). So the current planner is the corrected, cyclone-validated engine; the old goldens encode pre-fix output.
  3. Edited input / missing file. AvBay(470mm)triple.wind was edited after its gcode was cut (different line count); AvBay(470mm)single had no committed gcode.

What this does

Regenerates every example golden from its .wind with the current planner (verbose=False) and adds the four missing ones:

Golden
examples/rocketry/CarbonMotorTube(1295mm).gcode refreshed (sign + pattern fix)
examples/rocketry/MainChute(585mm).gcode refreshed (sign + pattern fix)
examples/rocketry/AvBay(470mm)triple.gcode refreshed (edited input)
examples/rocketry/AvBay(470mm)single.gcode new
examples/{multi_layer,simple_cylinder,sized_simple_cylinder}/expected.gcode new (expected.gcode matches the existing docs/guides/visualization.md reference)

A-axis sign decision (recorded per #270)

Frozen at the planner's current positive-A direction. Rationale: the byte-equal gate must capture what the planner actually emits today (the IR refactor in #274 must reproduce it); positive-A is the long-standing structural behavior since the first commit; and the divergence traces to deliberate, cyclone-validated coverage fixes. If the physical machine ever needs the opposite mandrel spin, that is a separate, deliberate sign-convention change with its own golden refresh — not a reason to freeze a non-reproducible artifact. (Confirmed with the maintainer.)

Verification

  • All 7 validate cleanly (no warnings/errors); headers match their .wind; output layer counts match; opcodes are only {G0, G92, comment}; no NaN/inf; X spans 0→windLength.
  • Deterministic — regenerating is byte-identical.
  • All 7 reproduce byte-for-byte from their .wind via fiberpath plan <wind> -o <gcode>.
  • .gitattributes already marks *.gcode linguist-generated + eol=lf, so GitHub collapses these large generated diffs.

Only non-verbose goldens are frozen (verbose is a debug overlay, not a regression target). The parametrized byte-equal harness + regenerator lands next in #271.

…anner

Prework for the Motion IR epic (#136): establish a trustworthy byte baseline
before the IR refactor, since the committed examples/rocketry goldens were stale
and reproduced from no current code path.

The old goldens did NOT reproduce from their .wind under the current planner:
- the mandrel A-axis sign was flipped (negative/decreasing) vs the planner's
  long-standing positive/increasing convention (`far_mandrel`/`mandrel_position`
  have been positive since the initial commit); and
- on top of the sign, an accumulating 120deg-per-circuit (360/patternNumber)
  divergence from intentional pattern-coverage fixes made AFTER the goldens were
  last cut (f73386a "mvp of working tests on cyclone"; f4c1204 "validate
  lockDegrees coverage compatibility"); and
- AvBay(470mm)triple.wind had been edited after its gcode was cut (different line
  count); AvBay(470mm)single had no committed gcode at all.

Regenerate every example golden from its .wind with the current (cyclone-validated)
planner at verbose=False, and add the four missing ones. The A-axis sign is frozen
as the planner's current positive direction (confirmed). Output is deterministic
and every .wind reproduces its .gcode byte-for-byte.

Frozen (regenerable via `fiberpath plan <wind> -o <gcode>`):
  examples/rocketry/{CarbonMotorTube(1295mm),MainChute(585mm),
    AvBay(470mm)triple,AvBay(470mm)single}.gcode
  examples/{multi_layer,simple_cylinder,sized_simple_cylinder}/expected.gcode

Part of #136. Closes #270.
@CameronBrooks11
CameronBrooks11 merged commit f7591df into main Jun 28, 2026
9 checks passed
@CameronBrooks11
CameronBrooks11 deleted the build/freeze-motion-ir-goldens branch June 28, 2026 05:01
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.

build(planning): freeze byte-exact G-code goldens before the Motion IR refactor

1 participant