Repository navigation
fix(store): remove the metadata cache on store prune - #17253
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Micro-Benchmark ResultsLinux |
Same-run regression checkHEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval. Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.
Integrated-Benchmark Report (Linux)Commit: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked, injected, and Cargo workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.0293298080200004,
"stddev": 0.1299144917602499,
"median": 3.06788970632,
"user": 3.08303908,
"system": 2.31800026,
"min": 2.80692136732,
"max": 3.19101561832
},
{
"command": "pacquet@main",
"mean": 2.9315546185200003,
"stddev": 0.10630069414593406,
"median": 2.94956541132,
"user": 2.99551308,
"system": 2.17347786,
"min": 2.72649647732,
"max": 3.08110114432
},
{
"command": "pnpr@HEAD",
"mean": 1.51642810952,
"stddev": 0.11222360579836917,
"median": 1.47981026232,
"user": 2.09624498,
"system": 1.6752619599999996,
"min": 1.40171443932,
"max": 1.72400192232
},
{
"command": "pnpr@main",
"mean": 1.52490277132,
"stddev": 0.062157109583546984,
"median": 1.51133798332,
"user": 2.23588868,
"system": 1.7754386600000003,
"min": 1.42322777532,
"max": 1.62232125332
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.50542029686,
"stddev": 0.03520247933584032,
"median": 0.5109998197600001,
"user": 0.5752364600000001,
"system": 0.9756714399999998,
"min": 0.41514255876000006,
"max": 0.53798750976
},
{
"command": "pacquet@main",
"mean": 0.46166768786000006,
"stddev": 0.041762255146050996,
"median": 0.47287191326000005,
"user": 0.5492056599999999,
"system": 0.9199839400000001,
"min": 0.38905394276000005,
"max": 0.5138372047599999
},
{
"command": "pnpr@HEAD",
"mean": 0.57195856766,
"stddev": 0.09460702536414217,
"median": 0.55828581576,
"user": 0.6583496600000002,
"system": 1.07113604,
"min": 0.45480672976000003,
"max": 0.7517068207600001
},
{
"command": "pnpr@main",
"mean": 0.4366705207599999,
"stddev": 0.046010541673207006,
"median": 0.41488634226000004,
"user": 0.49656986,
"system": 0.8682637400000001,
"min": 0.37414335776,
"max": 0.49702582976000004
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.01945977086675676,
"stddev": 0.0035006386881920953,
"median": 0.018999698860000004,
"user": 0.010359098378378378,
"system": 0.010293298108108107,
"min": 0.014113843360000001,
"max": 0.034032655360000004
},
{
"command": "pacquet@main",
"mean": 0.01675899310375001,
"stddev": 0.0020505868432995657,
"median": 0.01658402436,
"user": 0.0099932075,
"system": 0.008141125,
"min": 0.01214079136,
"max": 0.024651289360000002
},
{
"command": "pnpr@HEAD",
"mean": 0.023263722882727256,
"stddev": 0.006671399774051921,
"median": 0.021152160860000005,
"user": 0.012548685909090902,
"system": 0.011657059772727274,
"min": 0.01335414836,
"max": 0.041397316360000005
},
{
"command": "pnpr@main",
"mean": 0.01867649124068182,
"stddev": 0.002501439934035699,
"median": 0.018357054360000003,
"user": 0.010140401818181813,
"system": 0.01010905511363636,
"min": 0.013765129360000001,
"max": 0.02812237236
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.013366339901086969,
"stddev": 0.0032040556781351625,
"median": 0.0124695942,
"user": 0.007720194347826084,
"system": 0.006809384239130434,
"min": 0.009724089200000001,
"max": 0.0272139072
},
{
"command": "pacquet@main",
"mean": 0.012685317341509432,
"stddev": 0.0023675271996220965,
"median": 0.012258216200000002,
"user": 0.00761217773584906,
"system": 0.0062409126415094345,
"min": 0.009288239200000001,
"max": 0.0239920952
},
{
"command": "pnpr@HEAD",
"mean": 0.013534903786956516,
"stddev": 0.003249963545089688,
"median": 0.0127101422,
"user": 0.007356883804347825,
"system": 0.007449598586956519,
"min": 0.008573663200000001,
"max": 0.0264127402
},
{
"command": "pnpr@main",
"mean": 0.012618076022335025,
"stddev": 0.0020346881246050916,
"median": 0.0120327612,
"user": 0.007093713604060909,
"system": 0.0066740264974619315,
"min": 0.0096088622,
"max": 0.0205073172
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.85026136364,
"stddev": 0.2501089489420422,
"median": 2.7651756072399998,
"user": 3.1647260399999997,
"system": 2.22037842,
"min": 2.67084599174,
"max": 3.50717209474
},
{
"command": "pacquet@main",
"mean": 2.63732796584,
"stddev": 0.06076445792969171,
"median": 2.63750952474,
"user": 2.7316967400000003,
"system": 1.8228552199999999,
"min": 2.5542216287399997,
"max": 2.74949168374
},
{
"command": "pnpr@HEAD",
"mean": 1.5725088004399999,
"stddev": 0.10622770452508204,
"median": 1.57827732174,
"user": 1.76136144,
"system": 1.4683592199999995,
"min": 1.4426481467399999,
"max": 1.74776912874
},
{
"command": "pnpr@main",
"mean": 1.55357557234,
"stddev": 0.13262035895208357,
"median": 1.49791069174,
"user": 1.7831385400000002,
"system": 1.37279712,
"min": 1.45399705274,
"max": 1.83594153774
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.9307658013600001,
"stddev": 0.055051567402239314,
"median": 0.9307408321600001,
"user": 1.37030444,
"system": 1.3260769199999998,
"min": 0.84832350916,
"max": 1.02288162016
},
{
"command": "pacquet@main",
"mean": 0.9764677702600002,
"stddev": 0.10535302654126079,
"median": 0.9755737961600001,
"user": 1.41010954,
"system": 1.3829617200000002,
"min": 0.83074008716,
"max": 1.21136084316
},
{
"command": "pnpr@HEAD",
"mean": 0.5644215911599999,
"stddev": 0.06009993536085395,
"median": 0.5627704061600001,
"user": 0.53517334,
"system": 0.9870534199999998,
"min": 0.49117729016,
"max": 0.70268328416
},
{
"command": "pnpr@main",
"mean": 0.53294492506,
"stddev": 0.03537300080584809,
"median": 0.5332472446600001,
"user": 0.53047144,
"system": 0.99902132,
"min": 0.46984104216,
"max": 0.6055216611600001
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.92092838642,
"stddev": 0.07772700121167013,
"median": 1.92325827862,
"user": 1.43777482,
"system": 1.2157185399999997,
"min": 1.7947952441200001,
"max": 2.02112969112
},
{
"command": "pacquet@main",
"mean": 1.7924380092200003,
"stddev": 0.0757745469005123,
"median": 1.76056478962,
"user": 1.21850142,
"system": 1.14944824,
"min": 1.68904682312,
"max": 1.8838086041200002
},
{
"command": "pnpr@HEAD",
"mean": 0.3509092376200001,
"stddev": 0.008978626370839491,
"median": 0.35291513712000006,
"user": 0.31925351999999996,
"system": 0.66367754,
"min": 0.33390655812000003,
"max": 0.36095482412
},
{
"command": "pnpr@main",
"mean": 0.37520579072000004,
"stddev": 0.0227006269273845,
"median": 0.37995533512,
"user": 0.34688532000000005,
"system": 0.71424234,
"min": 0.34482953012000006,
"max": 0.41774823012000006
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.45993975396,
"stddev": 0.05568899225731956,
"median": 0.46093319266,
"user": 0.48402938000000006,
"system": 0.18208400000000002,
"min": 0.38860219216,
"max": 0.5429037281600001
},
{
"command": "pacquet@main",
"mean": 0.40462388996000004,
"stddev": 0.028342063640944645,
"median": 0.4043659176600001,
"user": 0.42432818,
"system": 0.1614329,
"min": 0.36875493216000005,
"max": 0.44835300016000007
},
{
"command": "pnpr@HEAD",
"mean": 0.12296111940999999,
"stddev": 0.006247037153796726,
"median": 0.12483485166,
"user": 0.05265363000000001,
"system": 0.029207300000000002,
"min": 0.11344584016,
"max": 0.13633044216
},
{
"command": "pnpr@main",
"mean": 0.11359513564,
"stddev": 0.007353572066836607,
"median": 0.11198337916000001,
"user": 0.05132156000000001,
"system": 0.020767839999999996,
"min": 0.10182236316000001,
"max": 0.12737647816
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.3233105391466667,
"stddev": 0.018424971507684143,
"median": 0.32634599048,
"user": 0.34728140888888887,
"system": 0.06845962222222221,
"min": 0.29571873348000005,
"max": 0.35221640648
},
{
"command": "pacquet@main",
"mean": 0.32593961025777785,
"stddev": 0.013175417702341293,
"median": 0.32863993048,
"user": 0.3452846311111111,
"system": 0.06910662222222222,
"min": 0.30204900348,
"max": 0.34346560648
},
{
"command": "pnpm@HEAD",
"mean": 5.019157826146666,
"stddev": 0.09653686931328247,
"median": 5.08152610148,
"user": 8.021426853333331,
"system": 0.5679474,
"min": 4.8482840954799995,
"max": 5.12078076548
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.12809899965333335,
"stddev": 0.00997620935183826,
"median": 0.12648985832,
"user": 0.11918090833333332,
"system": 0.06427482333333333,
"min": 0.11365152832,
"max": 0.15277984032
},
{
"command": "pacquet@main",
"mean": 0.12741097414608699,
"stddev": 0.00996940867881025,
"median": 0.12705299732,
"user": 0.11809337391304349,
"system": 0.06313369652173913,
"min": 0.11314598932,
"max": 0.14670519932
}
]
}Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.10997300689407412,
"stddev": 0.005703235718751532,
"median": 0.11016692482000001,
"user": 0.04457859407407407,
"system": 0.07426531333333333,
"min": 0.10033061582000001,
"max": 0.12252396182000001
},
{
"command": "pacquet@main",
"mean": 0.11387411744962964,
"stddev": 0.0054168044748467,
"median": 0.11486177182000001,
"user": 0.046580001481481496,
"system": 0.07719879481481484,
"min": 0.10435769882000001,
"max": 0.12332892182
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.8904500697,
"stddev": 0.1567411252492298,
"median": 4.8648944676,
"user": 2.83717316,
"system": 2.09191908,
"min": 4.6817008871,
"max": 5.1752561171
},
{
"command": "pacquet@main",
"mean": 4.8583883799,
"stddev": 0.118096885007434,
"median": 4.8992658226,
"user": 2.9758890599999996,
"system": 2.1138308799999996,
"min": 4.6830342721,
"max": 4.984630335099999
},
{
"command": "pnpr@HEAD",
"mean": 3.7288975671999998,
"stddev": 0.1130230717196873,
"median": 3.6913312716,
"user": 2.3302657599999996,
"system": 1.82180468,
"min": 3.6165281321,
"max": 3.9623729651
},
{
"command": "pnpr@main",
"mean": 3.866333832299999,
"stddev": 0.14173084420720866,
"median": 3.8469731901,
"user": 2.65262956,
"system": 2.02353168,
"min": 3.6320274121000002,
"max": 4.186871271099999
}
]
}Scenario: GVS linker: fresh restore, hot cache + hot storeSame install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.21898282936000002,
"stddev": 0.051178092138463714,
"median": 0.19051773655999998,
"user": 0.26963796,
"system": 0.21878946,
"min": 0.18013855456,
"max": 0.30486901956
},
{
"command": "pacquet@main",
"mean": 0.19142245706,
"stddev": 0.02196312942139885,
"median": 0.18569254556,
"user": 0.2363494028571429,
"system": 0.1858917457142857,
"min": 0.17527395556,
"max": 0.26079250556000005
},
{
"command": "pnpr@HEAD",
"mean": 0.21694205601454541,
"stddev": 0.012167009055484691,
"median": 0.21777976156,
"user": 0.2392070781818182,
"system": 0.2022154145454545,
"min": 0.20078146856,
"max": 0.23222810056
},
{
"command": "pnpr@main",
"mean": 0.19027268840615383,
"stddev": 0.012996381875525521,
"median": 0.19313058455999998,
"user": 0.21586187538461535,
"system": 0.18520211384615384,
"min": 0.16747281156,
"max": 0.20955608656
}
]
}Scenario: Store only: unlocked direct deps, cold cache + hot storeStore-only install (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.4098280752399999,
"stddev": 0.036177119381696474,
"median": 1.41775892304,
"user": 0.90467944,
"system": 0.38830909999999996,
"min": 1.36184555604,
"max": 1.47947083804
},
{
"command": "pacquet@main",
"mean": 1.39333343234,
"stddev": 0.040247558151203684,
"median": 1.3983008855399999,
"user": 0.89474924,
"system": 0.36865629999999994,
"min": 1.32581774504,
"max": 1.44290312504
}
]
}Scenario: Cargo: repeat install, hot cache + hot storeFrozen repeat install of a Cargo workspace (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.04385842099246377,
"stddev": 0.004206298098768946,
"median": 0.04355429192,
"user": 0.03140666318840579,
"system": 0.023000888695652165,
"min": 0.03497183392000001,
"max": 0.05954968092000001
},
{
"command": "pacquet@main",
"mean": 0.037519736999365075,
"stddev": 0.005205106024568882,
"median": 0.036238886920000005,
"user": 0.028267230476190463,
"system": 0.01855316888888889,
"min": 0.031198148919999998,
"max": 0.05952875992000001
}
]
} |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17253 +/- ##
==========================================
- Coverage 92.54% 92.54% -0.01%
==========================================
Files 1864 1865 +1
Lines 241552 241634 +82
==========================================
+ Hits 223550 223618 +68
- Misses 18002 18016 +14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
`pnpm store prune` pruned the dlx cache, the global virtual store, and the
content-addressable store, but left the registry metadata cache in place.
The `ERR_PNPM_TARBALL_INTEGRITY` advice in the errors docs ("run pnpm store
prune") relies on prune clearing that cache, so a stale integrity
checksum stayed after following it.
pnpm v11 removes every directory directly under cacheDir whose name starts
with `metadata` or is a layout version (`vN`), plus `<storeDir>/tmp`, and
logs "Removed all cached metadata files"
(pnpm11/store/controller/src/storeController/prune.ts). The store's tmp dir
was already cleared by the v12 CAS prune.
`StoreDir::prune` now takes the cache directory and removes the same
directories between the global virtual store and CAS passes, in v11's
order, and prints the same message. It runs under the exclusive store
prune lock, which every install holds shared for its whole run, so no
concurrent install reads the cache while it goes. Symbolic links are kept,
as v11's directory filter keeps them, and a `vN` directory that holds the
store itself is kept for a cacheDir that encloses the store.
Tested by unit tests for the name filter, symlinks, and an enclosing
store, and by a CLI e2e test that installs a package, prunes, and checks
the `v12` metadata directory and the log line.
Part of pnpm/tasks#191.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first version matched v11's filter and removed every `vN` directory under cacheDir whole. In v12 that also removed the cargo index, the tarball-resolution cache, and the runtime shasums cache under `v11/`, and with a cacheDir pointing at a broad directory (a project's pnpm-workspace.yaml can set it) it could delete global packages or other pnpm versions' stores. Prune now removes only `<cacheDir>/metadata*` and `<cacheDir>/vN/metadata*`, which covers every mirror root v12 writes (`v12/metadata`, `metadata-full`, `metadata-full-filtered`, `metadata-private`), the `v11/` legacy roots, and older top-level ones. It also keeps any of those directories that is or holds the store, globalDir, the global packages and bin dirs, the pnpm home, or the state dir. Tested by unit tests for cacheDir == globalDir and a home-like cacheDir, and a CLI e2e test with the pnpm home inside cacheDir. Part of pnpm/tasks#191. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2acb471 to
cebbe95
Compare
|
@coderabbitai review |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
PR Summary by QodoClear registry metadata cache during store prune
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
Code Review by Qodo
1. Prune can erase files outside the cache
|
| if name.starts_with("metadata") { | ||
| metadata_dirs.push(path); | ||
| } else if is_layout_version(&name) { | ||
| let nested = child_dirs(&path)? |
There was a problem hiding this comment.
1. Prune can erase files outside the cache 🐞 Bug ⛨ Security
cached_metadata_dirs checks that a versioned child is a directory, then reopens its pathname and later passes a discovered child to recursive removal without holding that parent directory stable. If a process able to modify the cache replaces the versioned child with a symlink between those steps, prune can follow it and remove a metadata* directory outside the configured cache.
Agent Prompt
## Issue description
A versioned cache directory can be replaced with a symlink after enumeration, redirecting metadata discovery and recursive deletion outside the cache.
## Fix Focus Areas
- pnpm/crates/store-dir/src/prune_cached_metadata.rs[54-96]
- pnpm/crates/store-dir/src/prune_cached_metadata.rs[30-38]
## Recommended Fix
Traverse and delete relative to stable opened directory handles without following substituted parent symlinks. Do not rely on a one-time canonicalization check before pathname-based recursive removal; add a test that swaps a versioned parent during prune.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
The finding holds: a process that can write to cacheDir could replace a vN directory with a symbolic link between the directory check and the removal and redirect the recursive removal at any metadata* directory the pruning user can delete.
Fixed in #17272: the prune now holds cacheDir and each vN open, checks and renames each metadata* child through the open descriptor on Unix, and removes it under a name a substituted directory cannot hold. The protected-directory check is verified against the open descriptor before any removal. The helper's tests include the swap itself.
Written by an agent (Claude Code, claude-fable-5-1).
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Rate Limit Exceeded
|
`pnpm store prune` removed `<cacheDir>/vN/metadata*` by path after checking that `vN` was a real directory. A process that can write to `cacheDir` could replace `vN` with a symbolic link between the check and the removal and redirect the recursive removal at any `metadata*` directory the pruning user can delete. `pnpm_fs::OpenDir` holds a directory open while its children are removed. On Unix it checks the child through the open descriptor (`openat` with `O_NOFOLLOW | O_DIRECTORY`), renames it through the descriptor (`renameat`) to a name only this process knows, and only then removes it by path: a directory substituted for the opened one cannot hold that name, so the renamed directory stays behind in the real one, where the next prune removes it by its `metadata` prefix. The canonical path used for the protected-directory check is verified against the open descriptor's device and inode before any removal; a replaced directory is skipped with a warning. On Windows and WASI every operation resolves the path again, as the other symlink-safe helpers do there. The prune opens `cacheDir` and each `vN` this way. The held-file id generator of `dir_lock` moves to a shared `random_hex` helper so the removal name and the held-file id use one implementation. Follow-up to #17253. Part of pnpm/tasks#191.
…ata (#17272) `pnpm store prune` removed `<cacheDir>/vN/metadata*` by path after checking that `vN` was a real directory. A process that can write to `cacheDir` could replace `vN` with a symbolic link between the check and the removal and redirect the recursive removal at any `metadata*` directory the pruning user can delete. `pnpm_fs::OpenDir` holds a directory open while its children are opened or removed. On Unix a child is opened through the parent's descriptor (`openat` with `O_NOFOLLOW | O_DIRECTORY`) and removed through it: the removal walks the directory with `fdopendir` and `readdir` and unlinks every entry with `unlinkat` relative to its parent descriptor, so no step after the open resolves a path. The canonical path used for the protected-directory check is verified against the open descriptor's device and inode before any removal; a replaced directory is skipped with a warning. On Windows and WASI every operation resolves the path again, as the other symlink-safe helpers do there. The prune opens `cacheDir` this way and each `vN` through it. The `OpenDir` tests cover the race at both levels: the directory is replaced by a link after the open, and a removal and a child open through the handle must leave the link's target intact. The store-dir tests gain a case for a `vN` that is a symbolic link. Follow-up to #17253. Part of pnpm/tasks#191.
Summary
In v12,
pnpm store prunepruned the dlx cache, the global virtual store, and the content-addressable store, but it left the registry metadata cache in place. v11 removes that cache (pnpm11/store/controller/src/storeController/prune.ts), and theERR_PNPM_TARBALL_INTEGRITYadvice inpnpm/docs/errors.mdrelies on it.With this PR, v12 removes
<cacheDir>/metadata*and<cacheDir>/vN/metadata*. That covers every mirror root v12 writes (v12/metadata,v12/metadata-full,v12/metadata-full-filtered,v12/metadata-private), thev11/legacy roots, and older top-levelmetadata*dirs. It runs between the GVS and CAS passes, under the exclusive store prune lock, which every install holds shared for its whole run. It prints v11's "Removed all cached metadata files". The v12 CAS prune already cleared<storeDir>/tmp(remove_tmp, which keeps private installs that are still held).Deliberate differences from v11:
vNdirectory undercacheDirwhole. In v12 that would also removev11/cargo-index,v11/tarball-resolutions, andv11/runtime-shasums, so only themetadata*children ofvNare removed.cacheDircan come from a project'spnpm-workspace.yaml. v11 has no such guard: withcacheDirset to the store's parent, v11 wouldrimrafthe store'sv11dir. That v11 hazard should be fixed separately. The coordinator is tracking it.Dirent.isDirectory()filter also keeps them.Out of scope: v11 also prunes stale
download-*/tarball-*spill directories (#16620). Only v11 creates those directories.Part of pnpm/tasks#191
Squash Commit Body
Checklist
are implemented in every affected version. (v12-only bug, v11 already clears the cache.)
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
pnpm-store-dirprune_cached_metadata::tests,pnpm-clistore::store_prune_removes_the_metadata_cacheandstore::store_prune_keeps_the_pnpm_home_inside_the_cache_dir. Each failed with its fix or guard disabled.)Written by an agent (Claude Code, claude-opus-5-5).
🤖 Generated with Claude Code
Summary by CodeRabbit
pnpm store prunenow removes cached metadata directories, including those in versioned cache folders, while retaining unrelated caches and protected global packages.ERR_PNPM_TARBALL_INTEGRITYerrors after a registry republishes a package version.