feat(targets): remove build units of replaced dependency versions sooner #1079
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
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 #1079"
general
weight: 0.35
jdx
Updating dependencies leaves the old versions' build units in a managed target directory, along with the units of everything built against them. Until now they stayed for
target.max_age(30 days), and on filesystems that do not record access times, such as APFS on macOS, unit cleanup never ran at all. mbx now usesCargo.lockto remove them a few days after the checkout moves on.On by default. A unit built from a registry version that the lockfile now lists only at other versions, and every unit built against it, is removed once:
build,check,test,run,bench,clippy,doc,rustc, ornextestthrough mbx used the lockfile as it is, withoutCargo.lockchanging during the run (aliases of those commands count, unless they add their own target directory, manifest, or configuration;nextestruns that reuse an archive or prebuilt binaries, andnextestsubcommands that build nothing, do not);Removal happens in the usual target collection, including
mbx gc(--dry-runpreviews it). It needs Cargo 1.100 or later. To keep every unit until it ages out:or set
MBX_TARGET_PRUNE_OUTDATED_DEPENDENCIES=false.Left alone: git and path packages, packages the lockfile no longer names at all, targets mbx does not manage, kept targets (
target.keep), and targets no mbx build has succeeded in since upgrading or since the lockfile last changed.Measured
On macOS (APFS, Cargo 1.101.0-beta.4), I built this repository's workspace (dev profile) into one managed target at six commits spanning 2026-10-22 to 2026-12-03, with an isolated cache, then moved file times back three days to stand in for the wait and ran
mbx gc.| | without removal | with removal |
| --- | --- | --- |
| Target size (
du) | 4272 MiB, 771 units | 1280 MiB, 316 units || Next build at the current lockfile | 5.6–7.5 s, 26 hits, 1 miss | 5.7–6.2 s, 26 hits, 1 miss |
| Switch back to the previous lockfile commit measured (
affef4f7) | 1.8 s, 19 hits, 0 misses | 2.7 s, 76 hits, 0 misses || Switch back to the oldest (
25e20153) | 1.4 s, 26 hits, 0 misses | 2.7 s, 188 hits, 0 misses |mbx gcreported 455 units and 3.1 GB of logical bytes removed. Sizes are logical; blocks shared with the cache by reflink free less physical space. Each timing is a single run on one machine. The switch-back cost is small here because the local cache still held everything; if the cache has since evicted those results, they compile again.Limitations
Validation
On macOS, the lint, build, Rust test, end-to-end, release-diagnostics, and docs tasks of
mise run cipassed, including new unit tests for the lockfile judgement and a collection test covering the unrecorded, just-recorded, and settled states.test:prettydid not pass locally: it timed out at itscargo test --test customstep and then hung, which also happens on unrelated branches on this machine.AI-assisted — Tool: Claude Code; model: anthropic/claude-sonnet-5-5; version: unavailable.
🤖 Generated with Claude Code
<!-- CURSOR_SUMMARY -->
---
<!-- /CURSOR_SUMMARY -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Managed target cleanup can remove cached build units for registry dependency versions no longer present in the lockfile, along with units built against them. This is enabled by default and can be disabled with
target.prune_outdated_dependencies.Cleanup waits until a successful mbx build uses an unchanged lockfile for a day and affected units have been untouched for the required retention period. Cargo 1.100 or later is required.
Bug Fixes
Builds invoked through Cargo aliases update lockfile tracking only when they succeed and use the managed target.
Documentation
* Added configuration and managed-target cleanup details, including eligibility and retention behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->