Skip to content

feat(bgcode): container-adapter + worker registration + metadata (DD-011 phase 4c) (#188) - #238

Merged
sobechestnut-dev merged 2 commits into
devfrom
feat/188-bgcode-phase4c-adapter
Jul 28, 2026
Merged

feat(bgcode): container-adapter + worker registration + metadata (DD-011 phase 4c) (#188)#238
sobechestnut-dev merged 2 commits into
devfrom
feat/188-bgcode-phase4c-adapter

Conversation

@sobechestnut-dev

Copy link
Copy Markdown

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

.bgcode now 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 from bed_shape, a whitelist of slicer settings (feeds dialect detection + provenance), and thumbnails.
  • gcode-parser: the batteries worker registers the bgcode adapter.

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 — plus machine.bed = 360×360, printerName XL2IS, printer_model/Producer in metadata.raw, and 4 thumbnails. A worker without the adapter degrades honestly (binary noise → a few spurious moves, never a crash).

Notes

  • Thumbnails are decoded and available on 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.
  • Dialect feature-role (;TYPE:) detection for .bgcode is a follow-up: PrusaSlicer moves the generated by header into metadata blocks, so a dialect would need a containerMeta detection path. Geometry + machine are correct regardless.

Verification

typeCheck ✓, lint ✓ (0 errors), docs:build ✓ (3/3), CI-like test:packages ✓ (bgcode 5 test files; parser container integration incl. .bgcode), pack:check ✓ (additive adapter.* snapshot).

🤖 Generated with Claude Code

…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
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>
@sobechestnut-dev
sobechestnut-dev merged commit 75f9f2b 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.

epic: Binary G-code (.bgcode) decode support

1 participant