carve 0.1.1

Implementation Plan

Living plan for building out carve. CARVE_DESIGN.md is the
architecture (the what and why); this document tracks status and the
ordered remaining work (the when and in what order). It supersedes the
month-by-month sketch in CARVE_DESIGN.md Β§11. Update it as milestones land; keep
it honest.

Last reviewed: 2026-06-24.

Status snapshot

Legend: βœ… done & tested Β· 🟑 partial Β· ⬜ not started.

Capability State Notes
io (atomic write, read) βœ…
process (subprocess capture) βœ… POSIX; Windows later
cdb (model + JSON + atomic write) βœ… deterministic output
command (de-Bazel argv) 🟑 M2 quirks landed; nvcc/emscripten/cross-host canonicalization left
aquery (proto parse, param-file expand, path resolve) βœ… vendored trimmed analysis_v2.proto
sidecar (schema, Load/Save, diff, project-scoped merge) βœ… HeaderIndex built & persisted; written_at stamped
refresh (in-process aquery, execroot, merge, multi-project) βœ… M1 done: scan-deps, incremental, staleness, header index, --jobs
scan_deps (clang DependencyScanningTool) βœ… wired into refresh; gated linux+macos
cli + //carve:carve βœ… all four subcommands wired: refresh + prune + aggregate + shard
e2e harness, CI, pre-commit, toolchains_llvm, proto matchers βœ… ASan/LSan/UBSan, TSan, and Linux MSan coverage for LLVM-free targets
Layer B (carve_refresh rule) βœ… bazel run //:refresh; run-based (nested-bazel resolved)
Layer C (aspect + shards) βœ… cc_carve_aspect + carve_aspect_refresh + shard + aggregate; per-action cacheable shards
Differential harness vs Hedron / clangd validation βœ… tools/cdb_diff.py + docs/differential-report.md (M3)
Distribution (.bcr/, prebuilt binaries, release) 🟑 release scaffolding landed (.bcr/ + release/publish workflows, source-only); not yet published
Windows ⬜

Bottom line: Layer A produces a correct-shaped CDB with header coverage and
incremental refresh.
scan-deps is wired into refresh; unchanged actions
reuse cached headers; editing a header re-scans only its owning actions;
unresolved (unbuilt generated) headers are not cached and are retried;
written_at and the persisted HeaderIndex are in place; scanning is
parallelized (--jobs). M1–M5 are complete, plus the prune, aggregate,
and shard subcommands - all four CLI subcommands are wired and tested. All three
layers work: refresh (A), carve_refresh (B, bazel run //:refresh), and the
Layer C aspect (cc_carve_aspect + carve_aspect_refresh) that emits one
cacheable shard per compile action and aggregates them. Next: M6 (release +
distribution) - the last milestone.

Milestones (dependency-ordered)

M1 - Wire scan-deps into refresh (the keystone)

Realizes incremental refresh and header coverage; everything downstream assumes it.

Acceptance: carve refresh on this repo populates headers; editing a header invalidates only owning actions; refresh stays idempotent; unit + e2e tests cover header population, reuse, and missing-header caching.

M2 - Complete the de-Bazel quirk inventory (CARVE_DESIGN Β§4.3)

Independent of M1; can run in parallel. One golden test per quirk (design Β§9.2).

Done (golden-tested in carve/command, wired through refresh):

Remaining (deferred - niche toolchains or a design-level property; best validated against M3's corpus):

Acceptance: golden test per quirk; platform-specific ones skipped where the toolchain is absent.

M3 - Differential harness + clangd validation βœ…

Correctness gate before building Layer B/C on top.

M4 - Layer B: carve_refresh rule βœ…

bazel run //:refresh as the CDB entry point (design Β§4.6).

(The design's literal bazel build //:compile_commands shape is not viable for the reason above; the README/usage now shows bazel run //:refresh.)

M5 - Layer C: aspect + shards

Per-action, individually-cacheable shards for huge repos (design Β§4.7).

Acceptance: aspect emits shards (done); carve aggregate merges them (done);
a compile-command change re-shards only the affected action (done - via Bazel's
action cache on command_file). M5 complete.

M6 - 0.1 release + distribution

.bcr/ metadata, release automation, prebuilt binaries for common platforms (design Β§7); decide Windows in-or-out.

Acceptance: a bzlmod consumer can bazel_dep(name = "mboworks_carve") and get a working CDB; tagged release.

Cross-cutting / parallelizable

Sequencing rationale

M1 first - it converts the working skeleton into the actual product (incrementality + headers). M2 runs alongside (independent). M3 validates correctness before B/C are layered on. M4 β†’ M5 (B before C, per the design's layering). Release (M6) last. Riskiest dependency (LLVM linkage) and toolchain are already done.