feat(bgcode): container-adapter + worker registration + metadata (DD-011 phase 4c) (#188) - #238
Merged
Merged
Conversation
…etadata (DD-011 phase 4c) (#188) .bgcode now flows through the existing parser pipeline: register it as a container adapter (DD-005 §4.4) beside .gcode.3mf, so `containers: 'auto'` sniffs + decodes it through GcodeParseSession — no consumer change, the whole downstream stack works unchanged. - gcode-bgcode: openBgcodeContainer(bytes) → the { id, sniff, open } shape (single plate; openPlate(0) streams the decoded gcode). openBgcode(bytes, {metadata:true}) now also decodes the metadata (INI) + thumbnail blocks, so the adapter surfaces machine geometry from bed_shape, a whitelist of slicer settings (feeds dialect detection + provenance), and thumbnails. - gcode-parser: batteries worker registers the bgcode adapter; new dep + vitest source alias. Verified end-to-end (real Prusa XL cube): parses through the session to 11,417 segments — the same count the golden-equivalence test pins against the plain .gcode — with a 360×360 bed + printer_model XL2IS metadata + 4 thumbnails. A worker without the adapter degrades honestly (binary noise → a few spurious moves, never a crash). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sobechestnut-dev
enabled auto-merge (squash)
July 28, 2026 02:13
…phase 4c) gcode-parser now depends on gcode-bgcode (the container adapter), so the consumer-vue reproducibility fixture must build + pack + install it too — otherwise `npm run build --workspace gcode-parser` fails with "Cannot find module '@chestnutlabs/gcode-bgcode'" (worker.ts). Add gcode-bgcode to the dependency-ordered PACKAGES list in run.mjs + run-registry.mjs (before gcode-parser) and as a file: tarball dep in the fixture app. Resolution shape now 10/10 @ChestnutLabs packages from local tarballs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Phase 4c — the integration that makes
.bgcode"just work." Does not close #188 — phase 5 (adversarial corpus + §7.3 review + benchmark) → phase 6 exit remain.What
.bgcodenow flows through the existing parser pipeline as a container adapter (DD-005 §4.4), beside.gcode.3mf:containers: 'auto'sniffs it, decodes it, and parses the result — no consumer change, the whole downstream stack (dialects/IR/renderer/progress) works unchanged.gcode-bgcode:openBgcodeContainer(bytes)implements the{ id, sniff, open }shape (single plate;openPlate(0)streams the decoded G-code).openBgcode(bytes, { metadata: true })now decodes the metadata (INI) + thumbnail blocks too, so the adapter surfaces machine geometry frombed_shape, a whitelist of slicer settings (feeds dialect detection + provenance), and thumbnails.gcode-parser: the batteries worker registers thebgcodeadapter.Verified end-to-end (real Prusa XL cube)
Through
GcodeParseSession: 11,417 segments — the exact count the golden-equivalence test pins against the plain.gcode— plusmachine.bed = 360×360,printerName XL2IS,printer_model/Producerin metadata.raw, and 4 thumbnails. A worker without the adapter degrades honestly (binary noise → a few spurious moves, never a crash).Notes
openBgcodeContainer(bytes).thumbnails; the parser worker's container-metadata contract has no thumbnail slot (neither does 3mf), so they aren't auto-attached to the IR — a small future contract extension, not a blocker.;TYPE:) detection for.bgcodeis a follow-up: PrusaSlicer moves thegenerated byheader into metadata blocks, so a dialect would need acontainerMetadetection path. Geometry + machine are correct regardless.Verification
typeCheck✓,lint✓ (0 errors),docs:build✓ (3/3), CI-liketest:packages✓ (bgcode 5 test files; parser container integration incl..bgcode),pack:check✓ (additiveadapter.*snapshot).🤖 Generated with Claude Code