test(bgcode): golden-equivalence killer test — decoded .bgcode IR == plain .gcode IR (#188) - #237
Merged
Merged
Conversation
…plain .gcode IR (#188) The DD-011 §D6 acceptance criterion, now committed. A PrusaSlicer 2.9.6 primitive cube (a generic redistributable shape) is committed in BOTH formats; the test decodes the .bgcode, parses both, and asserts the IR is byte-identical across every geometry channel (x0/y0/z0/x1/y1/z1/e/kind/tool/layer) — 11,417 segments, identical digests. srcByte is excluded (MeatPack no-spaces makes the decoded text shorter, so source offsets differ; the geometry is what equivalence means). The fixture exercises the real Prusa codec stack end-to-end: heatshrink-12 + MeatPack (comments + no-spaces) + DEFLATE metadata + thumbnails + per-block CRC32. Test + fixtures only; no code change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sobechestnut-dev
enabled auto-merge (squash)
July 28, 2026 01:38
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.
The DD-011 §D6 acceptance criterion — the "killer test" — now committed, using a redistributable PrusaSlicer cube exported in both formats (thanks for the pair!). Part of #188 phase 4.
What it proves
Decode the
.bgcode→ parse it → parse the plain.gcode→ assert the two IRs are byte-identical across every geometry channel (x0/y0/z0/x1/y1/z1/e/kind/tool/layer). Result: 11,417 segments each, all 10 channel digests identical. Decode correctness is pinned against the already-trusted plain-G-code path.srcByteis excluded on purpose — MeatPack no-spaces makes the decoded text shorter than the plain.gcode(G1X10vsG1 X10), so source offsets differ while the geometry is identical, which is exactly what equivalence means here.The fixture exercises the real Prusa codec stack
The committed
prim-cube.bgcode(PrusaSlicer 2.9.6) is not synthetic — it uses heatshrink-12 compression + MeatPack (comments, no-spaces) encoding, DEFLATE metadata, thumbnails, and per-block CRC32. So this single test end-to-end validates every codec (phases 1–3) + the DEFLATE-flavor fix (#236) against genuine Prusa output.Verification
Test + fixtures only (no shipped-code change).
typeCheck✓,lint✓ (0 errors), CI-liketest:packages✓ (bgcode = 4 test files),pack:check✓ (no snapshot change).Epic status after this
Phases 1–3 (all codecs) + the deflate fix + this killer test are done. Remaining for #188: the container-adapter/worker registration (so
containers: 'auto'decodes.bgcodethroughGcodeParseSession) + metadata/thumbnail surfacing + the §7.3 security review.🤖 Generated with Claude Code