feat: record why compilations skip the cache and where incremental state comes from #911
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #911"
general
weight: 0.35
jbellis
When several checkouts of one project build in parallel, as agent worktrees do, much of the compiler time shows up as
unconsulted: the compiler ran without a cache lookup. The session history could not say why. It couldn't tell whether a crate was edited, whether it linked another crate's private incremental output, or whether its incremental state had been seeded from another checkout. As a result,mbx analyzereported many of these crates as a "first build", even when they were rebuilding after an edit to a crate they depend on.This PR records those facts and uses them in
mbx analyzeandmbx stats.What
mbx analyzeshows nowTake two checkouts of a workspace where
appdepends onmid, which depends oncore. Checkout A editscoreand builds, so all three keep private incremental state. Then checkout B editscoreand builds. Before,mbx analyzein checkout B said:Now the crates that rebuilt because they link
core's private output are charged tocore. A new section says where their incremental state came from:The other sources are
started from this checkout's earlier state,started empty, andseeding failed.started emptycomes with a reason: no other checkout had the state, a one-time discard of older state is pending, the state can't be shared between checkouts, or the checkout's state directory held no finished session. Bypassed workspace libraries that mbx gives private state are included too. Recordings from older versions don't have these fields, andmbx analyzereports them as before.Lifetime totals in
mbx statsmbx statsnow shows compilations by outcome, for example7 hits, 2 misses, 3 not looked up, 1 bypassed since 2026-11-05, addingN rebuilt to verifywhen verification sampling is on.mbx stats --jsonaddssavings.compilations, with raw counts and compiler time per outcome. No hit rate is computed, because which outcomes belong in the denominator depends on the question. Counting starts with the first build recorded by this version; earlier history isn't backfilled. While an older mbx shares the store, the totals for that period are low.Session event rows
Rows in
sessions/v1gain optional fields. They stay version 1, and older rows still parse. Session streams remain an implementation detail (seedocs/stability.md).| Field | On which rows | Meaning |
|---|---|---|
|
unit_kind| every row, when known |lib,bin,test,proc-macro,build-script||
incremental| rows where the compiler ran | whether the compilation kept private incremental state ||
skip_reason|unconsultedrows |private-dependency,eager,unshareable-key,hot-reuse,prediction-error,no-prediction,other||
private_dependencies| compilations that link private artifacts | up to four producing crates, thenprivate_dependencies_more||
incremental_state| private incremental compilations |existing(a finished session was there),seeded(donor, files, bytes, copy time),cold(reason),failed|To support this:
incremental::seednow reports what it copied instead of discarding it.Validation
miseisn't installed on the host where this was developed, so I ran the steps ofmise run ciby hand on Linux:cargo fmt --check, plus debug and release workspace clippy with-D warnings.mbx test --workspaceand the release diagnostics test.main-based binary on that host: three C-object and gdb tests, plus themise postinstalltest, which needsmise.An isolated end-to-end run, with its own store and two scratch checkouts, produced the rows and reports above. That run was where seeding from checkout A into checkout B was observed.
Two things this PR does not do:
main, and it is whycoreabove is reported as "no earlier recording".AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5-5; version: unavailable.
🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Compilation statistics now track cache hits, misses, bypasses, unconsulted compilations, verifications, incremental compilations, and compiler time, with a separate tracking start date.
Analysis reports can show private incremental-state sources, including reused, seeded, or empty state, and attribute dependent compilations to the crate whose changes made them necessary. This section is omitted when state details are unavailable.
Compilation records now include additional context, such as compiler unit type, incremental status, and incremental-state details.
Incremental-state seeding reports copied file and byte counts and elapsed time.
Documentation
* Updated the statistics and analysis guides to explain the new reporting and tracking behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->