Skip to content

test(planning): byte-equal .wind→.gcode golden harness + regenerator - #277

Merged
CameronBrooks11 merged 1 commit into
mainfrom
test/byte-equal-golden-harness
Jun 28, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
test/byte-equal-golden-harness

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Part of #136 (Motion IR epic). Closes #271. Prework slice P1 — turn the goldens frozen in #270 into the regression gate the IR refactor (#274) runs against.

What it does

tests/planning/test_example_goldens.py parametrizes over the 7 example .wind → .gcode pairs, plans each, and compares the result byte-for-byte against its committed golden — serialized exactly as write_gcode writes the file ("\n".join(commands) + "\n").

Until serialize() exists (#274) the harness exercises the current emit path (plan_wind().commands); #274 swaps the producer and the empty diff is its acceptance.

Design notes

  • Exact-text compare (not splitlines()), so trailing-newline / length drift is caught, not just per-line content.
  • Concise failure: on mismatch it reports the first differing line + line counts (pytrace=False) instead of letting pytest diff multi-MB strings.
  • Deliberate regenerator: FIBERPATH_UPDATE_GOLDENS=1 pytest tests/planning/test_example_goldens.py rewrites the goldens (and skips), so baselines are never hand-edited. Verified idempotent against build(planning): freeze byte-exact G-code goldens before the Motion IR refactor #270's freeze (0 files changed).
  • Smallest-first ordering so a structural break surfaces before grinding through the multi-MB rocketry parts.
  • The four strategy-level fixtures in tests/planning/fixtures/ stay on their own path (test_layer_strategies.py covers the layer-only path; this covers the full-program path).

Verification

  • ruff + ruff format + mypy clean.
  • Normal run: 7 passed (~5.8s); regenerator: 7 skipped, 0 goldens changed; a deliberately corrupted golden yields the concise first-diff message and restores cleanly.
  • Full backend suite: 131 passed (+7), 7.5s.

No marker needed — the large parts plan fast enough (~6s total) to stay in the default suite, where they belong as the gate.

Prework slice P1 for the Motion IR epic (#136): gate the goldens frozen in #270
so the IR refactor (#274) can prove an empty diff at every step.

A parametrized test plans each example .wind and compares the result, byte for
byte, against its committed .gcode — serialized exactly as write_gcode writes the
file (`"\n".join(commands) + "\n"`). Until serialize() exists (#274) the harness
exercises the current emit path (plan_wind().commands); #274 swaps the producer
and the empty diff is its acceptance.

- Exact-text compare catches trailing-newline / length drift, not just per-line.
- On mismatch it reports the first differing line (not a multi-MB pytest diff).
- FIBERPATH_UPDATE_GOLDENS=1 pytest regenerates the goldens deliberately, so
  baselines are never hand-edited (verified idempotent against #270's freeze).

The four strategy-level fixtures in tests/planning/fixtures/ stay on their own
path (test_layer_strategies.py covers the layer-only path; this covers the
full-program path).

Part of #136. Closes #271.
@CameronBrooks11
CameronBrooks11 merged commit 58a31be into main Jun 28, 2026
12 checks passed
@CameronBrooks11
CameronBrooks11 deleted the test/byte-equal-golden-harness branch June 28, 2026 05:13
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.

test(planning): byte-equal .wind→.gcode golden harness + regenerator

1 participant