Skip to content

feat: pluggable materializer backends — --out --format#133

Merged
jamestexas merged 2 commits intomainfrom
feat/materializer-backends
Mar 25, 2026
Merged

feat: pluggable materializer backends — --out --format#133
jamestexas merged 2 commits intomainfrom
feat/materializer-backends

Conversation

@jamestexas
Copy link
Copy Markdown
Contributor

Summary

  • Adds Materializer interface + ForFormat factory in new internal/materialize/ package
  • Three backends: SQLite (file copy), ZIP (nodes → archive entries), BoltDB (dirs → nested bbolt buckets, //go:build boltdb)
  • New --format flag on root command (sqlite|zip|boltdb, default sqlite)
  • Replaces copyFile() in --out path with materializer dispatch

Test plan

  • 12 core tests (SQLite + ZIP + factory)
  • 6 BoltDB tests behind boltdb build tag
  • task lint — 0 issues
  • task test — full suite green
  • task build — builds and codesigns

Bead: mache-65d237

🤖 Generated with Claude Code

Add Materializer interface with three backends so --out can write
projected trees to formats other than SQLite:

- SQLiteMaterializer: file copy (refactored from copyFile)
- ZIPMaterializer: nodes → zip archive entries
- BoltDBMaterializer: dirs → nested bbolt buckets (//go:build boltdb)

New --format flag on root command (default: sqlite).
18 tests total, all TDD.

[mache-65d237]
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new internal/materialize package to make --out support multiple output backends, selected via a new --format CLI flag, while keeping SQLite as the default.

Changes:

  • Introduces a Materializer interface plus a ForFormat factory (with build-tag gated registration for optional formats).
  • Implements SQLite (DB file copy), ZIP (file nodes → ZIP entries), and BoltDB (dirs → nested bbolt buckets; //go:build boltdb) backends.
  • Updates mache root command --out flow to dispatch through the selected materializer and adds tests for SQLite/ZIP/factory + BoltDB behind the build tag.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/materialize/materialize.go Defines the Materializer interface, format factory, and SQLite/ZIP implementations.
internal/materialize/materialize_test.go Adds core tests for SQLite/ZIP materializers and the ForFormat factory.
internal/materialize/boltdb.go Adds build-tagged BoltDB materializer implementation and registration.
internal/materialize/boltdb_test.go Adds build-tagged tests covering BoltDB output structure and content.
cmd/mount.go Adds --format flag and replaces direct DB copy in the --out flow with materializer dispatch.
go.mod Adds go.etcd.io/bbolt dependency for the optional BoltDB backend.
go.sum Adds checksums for the new bbolt dependency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/mount.go Outdated
Comment thread internal/materialize/materialize.go Outdated
Comment thread internal/materialize/boltdb.go Outdated
Comment thread internal/materialize/boltdb.go Outdated
Comment thread internal/materialize/materialize_test.go Outdated
- Flag help text: note boltdb requires -tags boltdb
- ForFormat error: build supported-format list dynamically
- BoltDB: check os.Remove error (tolerate IsNotExist), use 0600 perms
- Test comment: clarify node count breakdown

[mache-65d237]
@jamestexas jamestexas merged commit 26fc496 into main Mar 25, 2026
14 checks passed
@jamestexas jamestexas deleted the feat/materializer-backends branch March 25, 2026 19:51
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.

2 participants