perf(cache): evict replaced dependency versions from the store first #1081
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.57) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 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
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #1081"
general
weight: 0.35
jdx
After
cargo update, the dependency versions you just replaced stayed protected from store eviction. The old lockfile's checkout claim lasts 30 days, and the manifest for the new lockfile starts from the previous one, so it keeps predicting the old versions beyond that. When the store went over budget, mbx evicted least recently used first among everything, which could remove long-unchanged dependencies you still build while keeping versions nothing asked for.mbx now reads the
Cargo.lockof every live checkout during a sweep that has to evict. Compilations of a registry package version that none of them names count as unreachable and are evicted before the rest.Cargo.lockis missing or unreadable keeps everything its builds recorded.target/), and a crate that only links a library a replaced package ships.Measurements
macOS on Apple silicon. I built this repository's last 20 lockfile commits in order, with
mbx buildin one checkout and an isolated cache, which left a 5.16 GiB store. Under the current rules 100% of its object bytes were protected, and the newest manifest still held 96 predictions (of 1183) for replaced versions. With this change 0.40 GiB (8%) becomes unprotected.I then collected a copy of that store with mbx 1.32.0 or with this branch, and rebuilt the newest lockfile from an empty target directory with mbx 1.32.0. Without any collection that rebuild gets 713 hits and 9 misses.
| Store budget | Evicted | 1.32.0: hits / misses | This change: hits / misses |
| --- | ---: | ---: | ---: |
| 5200 MiB | ~90 MiB | 603 / 119 | 713 / 9 |
| 5100 MiB | ~190 MiB | 145 / 578 | 713 / 9 |
| 5000 MiB | ~290 MiB | 136 / 587 | 713 / 9 |
| 4900 MiB | ~390 MiB | 136 / 587 | 713 / 9 |
| 4700 MiB | ~590 MiB | 136 / 587 | 136 / 587 |
| 4 GiB | | 106 / 617 | 136 / 587 |
| 3 GiB | | 106 / 617 | 106 / 617 |
| 2 GiB | | 69 / 654 | 68 / 655 |
The benefit lasts while the replaced versions cover what has to be evicted. Past that point the two behave about the same.
Limits of this measurement: it is one project with one trial per row, the 20 builds ran within minutes of each other rather than over weeks, and the sources were replayed without Git history. A project that updates its lockfile less will have less to reclaim.
mbx gc --dry-runon this store took 0.66–0.75 s with this change and 0.62–0.67 s with 1.32.0 over five alternating runs.Validation
New store tests cover replaced versions (including compacted and C include inputs), a version another live checkout still locks, missing or unparsable lockfiles, and compilations that only touch a replaced version.
mbx-cache-storegains a dependency ontoml.The lint, docs, link, Rust, end-to-end and release-diagnostics gates were run individually and pass locally.
test:prettydoes not pass on this machine: it times out atcargo test --test customand then hangs, as it also does on unrelated branches.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
Bug Fixes
Cache cleanup now identifies registry dependency versions no longer referenced by any live checkout’s lockfile and removes their cached compilations first.
If a live checkout’s lockfile is missing or unreadable, its recorded compilations are preserved.
Other compilations remain eligible for cleanup when needed to meet the cache budget or free disk space.
Documentation
Clarified cache cleanup order and noted that returning to an earlier lockfile can restore compilations that have not yet been evicted.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->