Skip to content

test(bgcode): golden-equivalence killer test — decoded .bgcode IR == plain .gcode IR (#188) - #237

Merged
sobechestnut-dev merged 1 commit into
devfrom
feat/188-bgcode-phase4-golden
Jul 28, 2026
Merged

test(bgcode): golden-equivalence killer test — decoded .bgcode IR == plain .gcode IR (#188)#237
sobechestnut-dev merged 1 commit into
devfrom
feat/188-bgcode-phase4-golden

Conversation

@sobechestnut-dev

Copy link
Copy Markdown

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.

srcByte is excluded on purpose — MeatPack no-spaces makes the decoded text shorter than the plain .gcode (G1X10 vs G1 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-like test: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 .bgcode through GcodeParseSession) + metadata/thumbnail surfacing + the §7.3 security review.

🤖 Generated with Claude Code

…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
sobechestnut-dev enabled auto-merge (squash) July 28, 2026 01:38
@sobechestnut-dev
sobechestnut-dev merged commit f2e79e4 into dev Jul 28, 2026
4 checks passed
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