Repository navigation
fix(global): skip absent package directories when scanning bin ownership - #15381
Conversation
Enumerating a global group's bins failed closed on every declared dependency whose manifest could not be read. A group whose package directory is a link into the global virtual store that no longer holds the package therefore aborted every `pnpm add -g`, `pnpm update -g`, and `pnpm remove -g` that had to scan the other groups, with ERR_PNPM_PACKAGE_MANIFEST_IO_ERROR naming the dangling manifest path. The pnpm install script hit this while replacing the existing pnpm CLI group on a machine whose store had been pruned, so pnpm could not be updated at all. A dependency whose directory under `node_modules` is absent is definitively not installed, the same way a group without `node_modules` is: no bin can resolve through a directory that is not there. Such a dependency now reads as owning no bins. A directory that exists but lacks a readable, valid manifest still fails closed, so unknown ownership is never treated as unowned, and every non-ENOENT probe error still surfaces. Both stacks probe the dependency directory before reading its manifest. The Rust probe goes through the FsReadDir capability so the fake-filesystem unit tests keep exercising the per-manifest error paths. The unit test that models one missing manifest now creates the dependency directory first, since an absent directory is the case being relaxed. New unit and e2e tests cover an absent directory and a dangling link in each stack.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pnpm/pnpm/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughRust and TypeScript scanners now skip absent dependency directories when collecting global bins. Tests cover missing manifests and global add or remove when a surviving package link dangles. A changeset marks three packages for patch releases. ChangesGlobal package bin ownership
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change appears ready to merge after normal checks; no actionable risk is established for global add or remove with dangling package links. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
pnpm11/global/packages/src/scanGlobalPackages.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15381 +/- ##
==========================================
+ Coverage 91.58% 91.60% +0.02%
==========================================
Files 1400 1402 +2
Lines 188543 188937 +394
==========================================
+ Hits 172676 173075 +399
+ Misses 15867 15862 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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-workspace scenario compares 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": 2.8081086445400008,
"stddev": 0.1497188929135133,
"median": 2.7486767752400003,
"user": 2.3609424799999994,
"system": 2.11297924,
"min": 2.6536572032400003,
"max": 3.0730889182400003
},
{
"command": "pacquet@main",
"mean": 2.8582785199400003,
"stddev": 0.11940591148920003,
"median": 2.86062138724,
"user": 2.49308248,
"system": 2.12369494,
"min": 2.65266215224,
"max": 3.0117329182400003
},
{
"command": "pnpr@HEAD",
"mean": 1.5351694098400002,
"stddev": 0.10700999261639421,
"median": 1.53580198724,
"user": 1.5268304799999999,
"system": 1.5593648400000002,
"min": 1.3843232082399999,
"max": 1.71122503824
},
{
"command": "pnpr@main",
"mean": 1.47169401284,
"stddev": 0.09594441742825505,
"median": 1.46014767324,
"user": 1.29611898,
"system": 1.42314564,
"min": 1.32974993524,
"max": 1.63004306224
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.32302971646,
"stddev": 0.060919813048736865,
"median": 0.30982804666,
"user": 0.35853539999999995,
"system": 0.7015615199999999,
"min": 0.25376069466,
"max": 0.41094230266000004
},
{
"command": "pacquet@main",
"mean": 0.26890668756,
"stddev": 0.02183794481305346,
"median": 0.26940730615999997,
"user": 0.29668190000000005,
"system": 0.5971651199999999,
"min": 0.23003950666,
"max": 0.29430294966
},
{
"command": "pnpr@HEAD",
"mean": 0.27800053826,
"stddev": 0.01310998646207333,
"median": 0.27980290066,
"user": 0.2900723,
"system": 0.59095292,
"min": 0.25471266266,
"max": 0.29580381366
},
{
"command": "pnpr@main",
"mean": 0.35078405426000003,
"stddev": 0.04032013160053613,
"median": 0.34937306766,
"user": 0.3705615,
"system": 0.6942343199999998,
"min": 0.28466877966,
"max": 0.40855745466000004
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.011848508121717798,
"stddev": 0.002808032631321737,
"median": 0.012239813680000001,
"user": 0.006988886871165643,
"system": 0.005693479141104293,
"min": 0.007290826680000001,
"max": 0.01991933268
},
{
"command": "pacquet@main",
"mean": 0.0114698315384475,
"stddev": 0.0022779382353537735,
"median": 0.01074741868,
"user": 0.006680170228310505,
"system": 0.005567982648401828,
"min": 0.007242495680000001,
"max": 0.01843813768
},
{
"command": "pnpr@HEAD",
"mean": 0.01046689451181818,
"stddev": 0.0015547311816927717,
"median": 0.010090298180000002,
"user": 0.006153279090909094,
"system": 0.005058948181818185,
"min": 0.007481075680000001,
"max": 0.01831030668
},
{
"command": "pnpr@main",
"mean": 0.011742767622307696,
"stddev": 0.002215952967772367,
"median": 0.01133800218,
"user": 0.007025200769230772,
"system": 0.00550388923076923,
"min": 0.00778103168,
"max": 0.02212417168
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.01053797140288288,
"stddev": 0.0010648741813194945,
"median": 0.01041250502,
"user": 0.006006241081081084,
"system": 0.005278886846846846,
"min": 0.008147416519999999,
"max": 0.014164598520000002
},
{
"command": "pacquet@main",
"mean": 0.010190351680305345,
"stddev": 0.0016249251851803235,
"median": 0.01009251702,
"user": 0.005647908091603057,
"system": 0.005268318320610683,
"min": 0.00708133452,
"max": 0.01628016152
},
{
"command": "pnpr@HEAD",
"mean": 0.009111550664680848,
"stddev": 0.0007425913551583473,
"median": 0.00911343652,
"user": 0.005023427404255316,
"system": 0.004769996765957446,
"min": 0.00735821852,
"max": 0.01148558152
},
{
"command": "pnpr@main",
"mean": 0.009221138015999995,
"stddev": 0.0009136354010085261,
"median": 0.00913629652,
"user": 0.004864520000000001,
"system": 0.004990934239999998,
"min": 0.00708370652,
"max": 0.012773375520000001
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.6753769918600003,
"stddev": 0.03177461659373848,
"median": 2.6814539167600002,
"user": 2.42654636,
"system": 2.0092832600000006,
"min": 2.6235612497600003,
"max": 2.72521064476
},
{
"command": "pacquet@main",
"mean": 2.68568463106,
"stddev": 0.04575366721503653,
"median": 2.68949694326,
"user": 2.4062817599999997,
"system": 2.02480416,
"min": 2.62119327576,
"max": 2.7508579487600002
},
{
"command": "pnpr@HEAD",
"mean": 1.65483493956,
"stddev": 0.14219965797701928,
"median": 1.65281679276,
"user": 1.43726366,
"system": 1.6602689599999998,
"min": 1.46519213176,
"max": 1.8183989727600003
},
{
"command": "pnpr@main",
"mean": 1.5573520435600003,
"stddev": 0.1200696074749955,
"median": 1.54840920576,
"user": 1.28480266,
"system": 1.5029396599999998,
"min": 1.4120751667600002,
"max": 1.7456330107600002
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.5418216624800001,
"stddev": 0.03960721408682463,
"median": 0.53174773358,
"user": 0.7948208999999999,
"system": 0.95544418,
"min": 0.49386990208000003,
"max": 0.6198232550800001
},
{
"command": "pacquet@main",
"mean": 0.6702625392800001,
"stddev": 0.08971201061797476,
"median": 0.7027742995800002,
"user": 1.0184756999999998,
"system": 1.1114381799999997,
"min": 0.5175704120800001,
"max": 0.7670967180800001
},
{
"command": "pnpr@HEAD",
"mean": 0.36338319548,
"stddev": 0.0232593648951956,
"median": 0.36023557658,
"user": 0.318597,
"system": 0.64131328,
"min": 0.33573899208,
"max": 0.40686219008
},
{
"command": "pnpr@main",
"mean": 0.34773722657999995,
"stddev": 0.023576982480802706,
"median": 0.34492708758,
"user": 0.2927202,
"system": 0.6575983799999999,
"min": 0.31117310208,
"max": 0.38884695908
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.66081757548,
"stddev": 0.03409940862580703,
"median": 1.65331849798,
"user": 0.9594326599999998,
"system": 1.01386868,
"min": 1.62387161398,
"max": 1.72027338198
},
{
"command": "pacquet@main",
"mean": 1.6561549866800003,
"stddev": 0.038309190478767734,
"median": 1.65337581248,
"user": 0.94226386,
"system": 0.99205518,
"min": 1.60011409398,
"max": 1.70449672498
},
{
"command": "pnpr@HEAD",
"mean": 0.30062495798000005,
"stddev": 0.008296353543815888,
"median": 0.29993332798000005,
"user": 0.25621955999999996,
"system": 0.53572698,
"min": 0.28470813698,
"max": 0.31070530198
},
{
"command": "pnpr@main",
"mean": 0.29605142008,
"stddev": 0.013564039946813261,
"median": 0.29506456598,
"user": 0.23659835999999998,
"system": 0.54755208,
"min": 0.27631398298000004,
"max": 0.31508024998
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.24215506316727273,
"stddev": 0.014504669650105044,
"median": 0.24101928044,
"user": 0.2463179618181818,
"system": 0.09899526,
"min": 0.21953056744000002,
"max": 0.26917740844
},
{
"command": "pacquet@main",
"mean": 0.26164599034,
"stddev": 0.025758671627000133,
"median": 0.25775372143999997,
"user": 0.2768706799999999,
"system": 0.09490546000000001,
"min": 0.22027858144,
"max": 0.29927938244
},
{
"command": "pnpr@HEAD",
"mean": 0.09931484716000001,
"stddev": 0.0065624155118943405,
"median": 0.09891924344,
"user": 0.03857274,
"system": 0.018414780000000006,
"min": 0.08845998844,
"max": 0.11473024344
},
{
"command": "pnpr@main",
"mean": 0.09722752744,
"stddev": 0.0057308880382535045,
"median": 0.09559146544,
"user": 0.03680858769230769,
"system": 0.017390259999999998,
"min": 0.08916649444000001,
"max": 0.11013210444
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.7023204052511113,
"stddev": 0.13448207048829888,
"median": 0.71079965314,
"user": 0.7259390844444442,
"system": 0.165706,
"min": 0.49335661414000004,
"max": 0.9350285391400001
},
{
"command": "pacquet@main",
"mean": 0.7811999785844443,
"stddev": 0.10849441164647314,
"median": 0.77548327114,
"user": 0.822784751111111,
"system": 0.16430977777777775,
"min": 0.58723071014,
"max": 0.94224933114
},
{
"command": "pnpm@HEAD",
"mean": 3.253921837251111,
"stddev": 0.3567241589048285,
"median": 3.1540358771399997,
"user": 4.997788306666667,
"system": 0.25908444444444445,
"min": 2.85241206814,
"max": 4.0026082691400005
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.24425452391384614,
"stddev": 0.05475752278346776,
"median": 0.21550188476,
"user": 0.18075147230769228,
"system": 0.1214849323076923,
"min": 0.19446379076,
"max": 0.32369475176
},
{
"command": "pacquet@main",
"mean": 0.2457149249138462,
"stddev": 0.04929778428896532,
"median": 0.21895989176,
"user": 0.17394916461538462,
"system": 0.12898124,
"min": 0.19540820076,
"max": 0.32760369976000003
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.83607662192,
"stddev": 0.2532439998161651,
"median": 4.73403565692,
"user": 2.4361567400000004,
"system": 2.08263904,
"min": 4.54505161542,
"max": 5.422736195420001
},
{
"command": "pacquet@main",
"mean": 4.59244399182,
"stddev": 0.17085226524504393,
"median": 4.529200233420001,
"user": 1.9018255400000001,
"system": 1.6551440399999997,
"min": 4.41316137142,
"max": 4.84150552342
},
{
"command": "pnpr@HEAD",
"mean": 3.5614021774200006,
"stddev": 0.14540114858797412,
"median": 3.51640695342,
"user": 1.5419875399999996,
"system": 1.7060377399999997,
"min": 3.3938312074200003,
"max": 3.8046621054200003
},
{
"command": "pnpr@main",
"mean": 3.5892013059199996,
"stddev": 0.13979937916446233,
"median": 3.57132554092,
"user": 1.84552814,
"system": 1.9786375399999998,
"min": 3.4155420114200004,
"max": 3.9005153704200004
}
]
}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.14365760930000002,
"stddev": 0.006909383832505652,
"median": 0.1424753313,
"user": 0.17585328888888888,
"system": 0.14770432,
"min": 0.1364784088,
"max": 0.1582132388
},
{
"command": "pacquet@main",
"mean": 0.1565014959764706,
"stddev": 0.010829733030000677,
"median": 0.1587988888,
"user": 0.19148181176470588,
"system": 0.1573882611764706,
"min": 0.1393943158,
"max": 0.1771679458
},
{
"command": "pnpr@HEAD",
"mean": 0.15839561868888888,
"stddev": 0.007766444996769564,
"median": 0.1581016593,
"user": 0.1747477333333333,
"system": 0.1578714311111111,
"min": 0.1468455488,
"max": 0.1698613838
},
{
"command": "pnpr@main",
"mean": 0.25855258836249995,
"stddev": 0.04814491417477378,
"median": 0.2629269463,
"user": 0.2988474,
"system": 0.225557445,
"min": 0.1617280698,
"max": 0.3305596448
}
]
} |
PR Summary by QodoSkip absent global package directories during bin ownership scans
AI Description
Diagram
High-Level Assessment
Files changed (8)
|
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
…d fails Read each declared dependency's manifest first and probe its directory only when the read fails with NotFound. The happy path costs no extra filesystem call per dependency, and a link pruned between the two reads is skipped as absent instead of surfacing the manifest error. The dangling-link unit test now creates the link through pnpm_fs::symlink_dir so it also runs on Windows, where global groups link packages with junctions. The changeset keeps only the user-visible behavior.
|
Review round on cd6757d, addressed in 88634a3:
Written by an agent (Claude Code, claude-fable-5-1). |
|
Code review by qodo was updated up to the latest commit 88634a3 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
The API docs state what the scan guarantees. The reason the directory is probed after the manifest read rather than before, a link pruned while the scan runs, stays as an inline comment at the probe.
|
Review round on 88634a3, addressed in 0f5a305:
CodeRabbit reports it has used its free OSS review quota, so it has not re-reviewed past cd6757d. Written by an agent (Claude Code, claude-fable-5-1). |
|
Code review by qodo was updated up to the latest commit 0f5a305 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
…hip (pnpm#15381) Enumerating a global group's bins failed closed on every declared dependency whose manifest could not be read. A group whose package directory is a link into the global virtual store that no longer holds the package therefore aborted every `pnpm add -g`, `pnpm update -g`, and `pnpm remove -g` that had to scan the other groups, with ERR_PNPM_PACKAGE_MANIFEST_IO_ERROR naming the dangling manifest path. The pnpm install script hit this while replacing the existing pnpm CLI group on a machine whose store had been pruned, so pnpm could not be updated at all. A dependency whose directory under `node_modules` is absent is definitively not installed, the same way a group without `node_modules` is: no bin can resolve through a directory that is not there. Such a dependency now reads as owning no bins. A directory that exists but lacks a readable, valid manifest still fails closed, so unknown ownership is never treated as unowned, and every non-ENOENT probe error still surfaces. Both stacks probe the dependency directory before reading its manifest. The Rust probe goes through the FsReadDir capability so the fake-filesystem unit tests keep exercising the per-manifest error paths. The unit test that models one missing manifest now creates the dependency directory first, since an absent directory is the case being relaxed. New unit and e2e tests cover an absent directory and a dangling link in each stack.
Summary
pnpm add -g,pnpm update -g, andpnpm remove -gscan every other global group's bin ownership before mutating anything. That scan failed closed on any dependency manifest it could not read, so a group whose package directory is a link into a global virtual store that no longer holds the package aborted the whole command:The pnpm install script (
curl -fsSL https://get.pnpm.io/install.sh | sh -) runspnpm add -gfor@pnpm/exe, so on a machine whose store had been pruned pnpm could not be updated at all.A dependency whose directory under
node_modulesis absent is definitively not installed, the same way a group withoutnode_modulesis (#15151): no bin can resolve through a directory that is not there. Such a dependency now reads as owning no bins. A directory that exists but lacks a readable, valid manifest still fails closed, and every non-ENOENT probe error still surfaces, so the preflight property from #13985 is kept.The bug is in both stacks, so both are fixed: the Rust
pnpm-globalcrate and the TypeScript@pnpm/global.packagespackage.Verification:
PNPM_HOME. The patched binary completes the sameadd -g.pnpm-globalunit tests (18) and thepnpm-cliglobal ownership e2e tests (18), including the new absent-directory and dangling-link cases.@pnpm/global.commandsgetInstalledBinNamesandglobalRemovesuites (14).Squash Commit Body
Checklist
are implemented in every affected version.
pnpm,pacquet,@pnpm/global.packages).Written by an agent (Claude Code, claude-fable-5-1).
Summary by CodeRabbit