Repository navigation
Conversation
…rtual-store slot
Installing a `file:` directory dependency with the global virtual store
enabled crashed the headless install:
TypeError: Cannot read properties of undefined (reading 'split')
at assertNoPathTraversal
at formatGlobalVirtualStorePath
at calcGraphNodeHash
pnpm omits `version` from a directory snapshot, so `nameVerFromPkgSnapshot`
hands the hasher `undefined` and the traversal guard added in
#12872 dereferences it. Directory snapshots now use a fixed
`directory` segment in place of the version. That also settles a
disagreement between the two install paths: the resolver reads the version
off the manifest and the headless install off the lockfile, where there is
none, so the same package landed on two different slots.
The crash hid a worse defect. A directory resolution is the one resolution
with no integrity — it is a path relative to the lockfile — so `file:dep`
hashed identically in every project that depended on a directory of that
name, and all of them linked to whichever project installed first. Since
the source directory is mutable, pnpm re-imports it on every install, so
the projects went on overwriting each other's copy. The lockfile directory
now joins the hash payload for directory resolutions, giving each project
its own slot; every other resolution hashes exactly as before.
`iterateHashedGraphNodes` takes an options object now — it was up to five
positional parameters before this change added a sixth.
Fixes #13335
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Warning Review limit reached
Next review available in: 12 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughGlobal virtual store hashing now scopes local directory dependencies by lockfile directory, uses a stable ChangesGlobal virtual store local directory dependencies
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ProjectInstall
participant DependencyResolver
participant GraphHasher
participant GlobalVirtualStore
ProjectInstall->>DependencyResolver: resolve local file: directory dependency
DependencyResolver->>GraphHasher: pass lockfileDir and dependency resolution
GraphHasher->>GraphHasher: include project scope and directory segment
GraphHasher-->>GlobalVirtualStore: compute project-scoped slot
GlobalVirtualStore-->>ProjectInstall: materialize dependency in GVS slot
Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
PR Summary by QodoFix global virtual store hashing for local directory dependencies
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
Confidence Score: 5/5The PR appears safe to merge. The previously reported pacquet parity defect is fixed: production install and inspection paths now supply the lockfile directory, directory resolutions use the stable directory segment, and the project identity participates in the Rust hash as it does in TypeScript. No blocking failure remains. Reviews (6): Last reviewed commit: "perf(virtual-store-layout): convert the ..." | Re-trigger Greptile |
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
…quet Mirrors the TypeScript change on the Rust side, so both stacks derive the same global-virtual-store slot for a package resolved from a local directory. `gvs_version_segment` rendered the literal `undefined` for every `file:` dependency, which is what the TypeScript side produced before its traversal guard turned the missing version into a crash. It now anchors a directory resolution to the `directory` segment and prefers the metadata's own version, so a local tarball — content-addressed, and carrying a version in the lockfile — no longer shares the directory dep's fallback. `VirtualStoreLayout::new` inserted a suffix for every snapshot with no resolution check, so directory deps collided across projects exactly as they did in the TypeScript CLI. It takes the lockfile directory now and folds it into the hash payload for directory resolutions. Also applies two review findings to the TypeScript side: the slot's version segment is chosen from the resolution alone, so a caller that leaves `lockfileDir` out still produces a well-formed path instead of dereferencing the missing version. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Micro-Benchmark ResultsLinux |
|
Code review by qodo was updated up to the latest commit 901d9ea |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
…ath string `to_string_lossy` is what keeps the Rust and TypeScript stacks on one slot: Node decodes a path as UTF-8 with replacement, so the JS string the TypeScript CLI hashes is already the lossy form. Hashing the raw bytes here instead would give the two stacks different slots for the same project. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ath component The assertion matched the `dep/directory/` substring, which only holds where `/` is the native separator — it failed on Windows against the correct `@\dep\directory\<hash>` slot. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit 6ae27c8 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
Notes on the outstanding automated findings. "GVS hashing not synced" — already addressedThe pacquet port landed in 901d9ea, one commit after the finding was first raised. "Lossy lockfileDir hashing" — intentional, and the alternative would break parityThe concern is that
$ ls -b utf8/ # two directories differing only in invalid UTF-8 bytes
p\377 p\376
$ node -e 'for (const e of require("fs").readdirSync("utf8")) console.log([...e].map(c => c.codePointAt(0).toString(16)).join(","))'
70,fffd
70,fffdHashing the raw bytes on the Rust side would give the two stacks different slots for the same project — a divergence reachable by every user, traded for one that no user can reach. A project rooted at such a path cannot be installed by the TypeScript CLI at all, because Node cannot address it through its string path APIs: $ node -e 'const fs=require("fs"),path=require("path");
const p = path.join("utf8", fs.readdirSync("utf8")[0]);
console.log(fs.existsSync(p));'
falseThe rationale is recorded at the conversion site in 6ae27c8. Trailing commas in multi-line parameter lists (rule 713434)Not applicable to this repository: the shared config ( Written by an agent (Claude Code, claude-opus-5). |
|
Code review by qodo was updated up to the latest commit 801bbf6 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
`local_directory_scope` turned the same `lockfile_dir` into a fresh `String` for every local directory snapshot, though the value is constant for the whole `VirtualStoreLayout::new` run. The conversion moves to the caller and the scope is borrowed from there. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit d474e4f |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
On the new finding, "Project scope path not normalized" — not fixing this, deliberately. The TypeScript CLI does not normalize It is also the safe direction of error. An unnormalized spelling produces an extra slot, each holding the correct content for the project that created it. The failure this PR fixes is the opposite — two projects collapsing onto one slot and overwriting each other. Over-scoping wastes a little store space; under-scoping corrupts an install. If normalization is wanted, it belongs in both stacks at once, with a decision about whether to resolve symlinks ( The Written by an agent (Claude Code, claude-opus-5). |
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time). Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.54767331138,
"stddev": 0.13488259785714346,
"median": 2.5352290058799998,
"user": 1.6326796799999996,
"system": 1.30752092,
"min": 2.33530746038,
"max": 2.75318410238,
"times": [
2.5294442253800002,
2.53660595338,
2.6769163863800003,
2.3551819643800003,
2.75318410238,
2.33530746038,
2.48096217938,
2.66376625938,
2.53385205838,
2.61151252438
]
},
{
"command": "pacquet@main",
"mean": 2.50008859858,
"stddev": 0.12197056467687066,
"median": 2.5054928383800004,
"user": 1.60843508,
"system": 1.3190633199999997,
"min": 2.34784055338,
"max": 2.67856956638,
"times": [
2.53986881238,
2.3667317053800003,
2.67856956638,
2.3604264173800003,
2.65904304738,
2.43884844638,
2.58609894938,
2.5523416233800003,
2.34784055338,
2.4711168643800003
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5627635153800001,
"stddev": 0.1603861046063119,
"median": 1.6015731718800001,
"user": 1.2025164799999999,
"system": 1.1404911199999999,
"min": 1.34617481838,
"max": 1.7681876643799999,
"times": [
1.48942261838,
1.60443687638,
1.71282355938,
1.7681876643799999,
1.34617481838,
1.68678451638,
1.59870946738,
1.6929719453799998,
1.3734889693799999,
1.35463471838
]
},
{
"command": "pnpr@main",
"mean": 1.57720289718,
"stddev": 0.18068210182028077,
"median": 1.61600659088,
"user": 1.19115608,
"system": 1.1635867199999999,
"min": 1.34580037638,
"max": 1.79454320738,
"times": [
1.36555066738,
1.34580037638,
1.59652142538,
1.71513161938,
1.74051166838,
1.37532829638,
1.4330114003799999,
1.7701385543800001,
1.63549175638,
1.79454320738
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2526490681600001,
"stddev": 0.005646801542682622,
"median": 0.25257945715999996,
"user": 0.19414896,
"system": 0.5209980599999999,
"min": 0.24545854516,
"max": 0.26004000016,
"times": [
0.25340877316,
0.25970655316,
0.24637218716000003,
0.25967233216,
0.25175014116,
0.25359987916,
0.24893584216000003,
0.24545854516,
0.24754642816000003,
0.26004000016
]
},
{
"command": "pacquet@main",
"mean": 0.25380021726,
"stddev": 0.006773772737646805,
"median": 0.25232791716,
"user": 0.19561426,
"system": 0.51048776,
"min": 0.24573473416000002,
"max": 0.26565156216,
"times": [
0.24605465316000003,
0.24573473416000002,
0.25138197016,
0.25815410616,
0.24766178016000004,
0.26565156216,
0.25043284416,
0.26041083416,
0.25924582415999997,
0.25327386416
]
},
{
"command": "pnpr@HEAD",
"mean": 0.26820293776,
"stddev": 0.004374577404407154,
"median": 0.26742023116,
"user": 0.21095026,
"system": 0.5163206600000001,
"min": 0.26317076816,
"max": 0.27766702316,
"times": [
0.26731559016,
0.27064537916,
0.26960262116,
0.26317076816,
0.26752487216,
0.26350048216,
0.27766702316,
0.27122298516,
0.26715674616,
0.26422291016
]
},
{
"command": "pnpr@main",
"mean": 0.26615116826,
"stddev": 0.007940756458555328,
"median": 0.26762225916,
"user": 0.20896966,
"system": 0.51221256,
"min": 0.25087938516,
"max": 0.27639796816,
"times": [
0.26857311316,
0.26336839516,
0.27639796816,
0.27058163716,
0.26330700616,
0.27173953416,
0.27376536616,
0.25622787216,
0.25087938516,
0.26667140516
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.76585598244,
"stddev": 0.011786212757515149,
"median": 2.76236952954,
"user": 1.8226094,
"system": 1.36115918,
"min": 2.74589095904,
"max": 2.78269707104,
"times": [
2.78269707104,
2.77706928104,
2.78090675804,
2.76210931004,
2.75721774404,
2.76262974904,
2.77124550104,
2.75794952904,
2.76084392204,
2.74589095904
]
},
{
"command": "pacquet@main",
"mean": 2.7413376894399994,
"stddev": 0.01962844045402973,
"median": 2.73812043354,
"user": 1.8304372999999998,
"system": 1.32462788,
"min": 2.71525893504,
"max": 2.77861744304,
"times": [
2.74516045104,
2.74051286304,
2.77861744304,
2.71525893504,
2.76527154604,
2.72400266604,
2.7349024690399997,
2.73572800404,
2.7510642070399998,
2.72285831004
]
},
{
"command": "pnpr@HEAD",
"mean": 1.6308469301400002,
"stddev": 0.10627234390530138,
"median": 1.6258821435400002,
"user": 1.194411,
"system": 1.13729208,
"min": 1.48467060504,
"max": 1.7753235420400002,
"times": [
1.7753235420400002,
1.7502041290400001,
1.51537791904,
1.6894263360400001,
1.5070038590400001,
1.73839443804,
1.48467060504,
1.63698254804,
1.59630418604,
1.61478173904
]
},
{
"command": "pnpr@main",
"mean": 1.6537744588399999,
"stddev": 0.15709222029483666,
"median": 1.6279898730400002,
"user": 1.1765323999999997,
"system": 1.18157668,
"min": 1.4385699900400002,
"max": 1.87373594304,
"times": [
1.7814440820400002,
1.5366520040400002,
1.8125063590400001,
1.8099693760400002,
1.56680448304,
1.5231785740400001,
1.4385699900400002,
1.87373594304,
1.5057085140400002,
1.68917526304
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.5870113399200001,
"stddev": 0.010119567172710559,
"median": 0.58476717962,
"user": 0.7142541399999999,
"system": 0.6773213799999999,
"min": 0.5722492171200001,
"max": 0.6090216881200001,
"times": [
0.5800671151200001,
0.5914040441200001,
0.5812802621200001,
0.5722492171200001,
0.5865782071200001,
0.6090216881200001,
0.5901851691200001,
0.5948733641200001,
0.5829561521200001,
0.5814981801200001
]
},
{
"command": "pacquet@main",
"mean": 0.5743751946200002,
"stddev": 0.008685939797466577,
"median": 0.5742832631200001,
"user": 0.6845271399999999,
"system": 0.68341048,
"min": 0.5614812811200001,
"max": 0.5853159001200001,
"times": [
0.5614812811200001,
0.5660926731200001,
0.5738980611200001,
0.5851214971200001,
0.56301201712,
0.5816785291200001,
0.5853159001200001,
0.5731407591200001,
0.5793427631200001,
0.5746684651200001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29838494781999997,
"stddev": 0.007613417380181638,
"median": 0.29934259411999997,
"user": 0.19287263999999998,
"system": 0.50034308,
"min": 0.28678762812,
"max": 0.31324892912,
"times": [
0.29965769912,
0.28818249512,
0.30166965012,
0.29336970312,
0.30160868512,
0.28678762812,
0.29902748912,
0.30209323212,
0.31324892912,
0.29820396712
]
},
{
"command": "pnpr@main",
"mean": 0.30304337582000007,
"stddev": 0.009987449033819549,
"median": 0.30164757412,
"user": 0.19202483999999997,
"system": 0.51452688,
"min": 0.28846420012,
"max": 0.31897848012,
"times": [
0.30140072912,
0.30578469112,
0.28846420012,
0.30064778212000004,
0.30657786412000004,
0.30189441912000003,
0.28915533412,
0.31722512412000003,
0.31897848012,
0.30030513412000004
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.9092378022599998,
"stddev": 0.01576049353083383,
"median": 1.9055740665599998,
"user": 0.9497885399999998,
"system": 0.77113854,
"min": 1.89145574456,
"max": 1.94268765956,
"times": [
1.94268765956,
1.89325059656,
1.91294526056,
1.89861791756,
1.90883077156,
1.90231736156,
1.89145574456,
1.92401397656,
1.9178445525599999,
1.90041418156
]
},
{
"command": "pacquet@main",
"mean": 1.89387511426,
"stddev": 0.008754498318316135,
"median": 1.89329050806,
"user": 0.9424783400000001,
"system": 0.7515350399999999,
"min": 1.87934219656,
"max": 1.91091287656,
"times": [
1.87934219656,
1.89053530156,
1.89485677656,
1.8999770565599998,
1.8967495935599998,
1.89896283056,
1.88414153056,
1.91091287656,
1.89172423956,
1.89154874056
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29986367756,
"stddev": 0.0075037510945715575,
"median": 0.30111675106,
"user": 0.18788584000000003,
"system": 0.50523924,
"min": 0.28915861756000005,
"max": 0.30953320456000005,
"times": [
0.29470115456,
0.30953320456000005,
0.29086283656,
0.30935622556000003,
0.30140036856,
0.28915861756000005,
0.30469847056000005,
0.29301020856000004,
0.30083313356,
0.30508255556
]
},
{
"command": "pnpr@main",
"mean": 0.29677732586,
"stddev": 0.006520152752544529,
"median": 0.29638499956000003,
"user": 0.19399033999999996,
"system": 0.50595064,
"min": 0.28807792856000003,
"max": 0.30731216756,
"times": [
0.30731216756,
0.29771006556,
0.28932790256,
0.29249286856,
0.28807792856000003,
0.29260873656,
0.29774772656000004,
0.29505993356000004,
0.30506248256,
0.30237344656000004
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.36203441136000003,
"stddev": 0.006388904365973551,
"median": 0.36154279886000007,
"user": 0.3531151999999999,
"system": 0.07132051999999998,
"min": 0.35170222586000005,
"max": 0.37467050386000006,
"times": [
0.36710699786000006,
0.35760565786000004,
0.36057472586000006,
0.36222492386000005,
0.35170222586000005,
0.36575617986000003,
0.36374634086,
0.36086067386000004,
0.35609588386,
0.37467050386000006
]
},
{
"command": "pacquet@main",
"mean": 0.36708023016000013,
"stddev": 0.00512571573260837,
"median": 0.36558856186,
"user": 0.35905489999999995,
"system": 0.06633911999999999,
"min": 0.36070657786000004,
"max": 0.37572987586000006,
"times": [
0.36332501986000004,
0.36562502186,
0.37572987586000006,
0.36722271786000005,
0.37208903486000006,
0.36555210186000003,
0.36290750786000003,
0.36363216786,
0.37401227586,
0.36070657786000004
]
},
{
"command": "pnpr@HEAD",
"mean": 0.09009923273500002,
"stddev": 0.003805879785554764,
"median": 0.09005455886,
"user": 0.020177737500000004,
"system": 0.012818101250000002,
"min": 0.08544509186,
"max": 0.10295055486,
"times": [
0.08889482386,
0.09378295686,
0.09062800686,
0.08673102086000001,
0.09230796486000001,
0.09385390786,
0.08699175186000001,
0.09059843386000001,
0.09254256886000001,
0.08957111586000001,
0.09150383186000001,
0.09468821486000001,
0.09134695186000001,
0.09138905486,
0.09191510886000001,
0.08544509186,
0.08707402086,
0.09116109486,
0.09182589586,
0.08723045486,
0.08978955186000001,
0.09009955686,
0.08644617686,
0.08569909786,
0.10295055486,
0.09000956086,
0.08633362286,
0.08638161386,
0.08584981386,
0.08596868586,
0.09685726486,
0.08730767486
]
},
{
"command": "pnpr@main",
"mean": 0.08933200402666666,
"stddev": 0.0026789233702815703,
"median": 0.08982901986,
"user": 0.0215919,
"system": 0.010732186666666664,
"min": 0.08513306486000001,
"max": 0.09404218886,
"times": [
0.09179093786,
0.08699604886000001,
0.08659491186,
0.09160426886,
0.08701997486,
0.08652227386,
0.09197318286,
0.09080009786,
0.09073202886000001,
0.09404218886,
0.08979022286,
0.09309314686,
0.08996022286000001,
0.08670349586000001,
0.09223253186000001,
0.09239048686000001,
0.08761066686,
0.09247939586000001,
0.09081758386000001,
0.08666432486,
0.09191086086,
0.08986781686,
0.09257689486000001,
0.08513306486000001,
0.08615815186,
0.08746582186,
0.08611438186,
0.08708791686,
0.08670477486,
0.08712244286000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.658732967900001,
"stddev": 0.15163363587336956,
"median": 4.7274065205,
"user": 1.76886954,
"system": 1.42263466,
"min": 4.4094161995,
"max": 4.799260836499999,
"times": [
4.4094161995,
4.799260836499999,
4.4885870274999995,
4.4398939455,
4.7588922915,
4.7526636105,
4.7160953605,
4.7387176805,
4.7958037104999995,
4.6879990165
]
},
{
"command": "pacquet@main",
"mean": 4.546756309499999,
"stddev": 0.1375346489645903,
"median": 4.523932697999999,
"user": 1.78351084,
"system": 1.39087646,
"min": 4.4160859565,
"max": 4.849406710499999,
"times": [
4.4160859565,
4.5984005004999995,
4.4530423515,
4.452447610499999,
4.849406710499999,
4.5948230445,
4.5953032735,
4.438040465499999,
4.4244082495,
4.6456049324999995
]
},
{
"command": "pnpr@HEAD",
"mean": 3.5474082673,
"stddev": 0.0981746316782055,
"median": 3.5007864675,
"user": 1.31451904,
"system": 1.2069657599999997,
"min": 3.4507094895,
"max": 3.7259883095000004,
"times": [
3.4563672215000003,
3.7259883095000004,
3.5018396545,
3.6438134205000003,
3.4507094895,
3.4997332805,
3.4873920365,
3.6077444425,
3.6405593345000002,
3.4599354835000002
]
},
{
"command": "pnpr@main",
"mean": 3.570959966,
"stddev": 0.16345863272059372,
"median": 3.4850472220000004,
"user": 1.32446494,
"system": 1.21174506,
"min": 3.4408611535,
"max": 3.8973345825,
"times": [
3.4814479705,
3.5757980025,
3.8195929915,
3.8973345825,
3.4624713425,
3.4408611535,
3.4480568205,
3.6265471335000004,
3.4688431895000003,
3.4886464735000002
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13383 |
| Testbed | pnpr |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,484.67 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 289.16 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 286.79 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 85.45 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,346.17 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,450.71 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 263.17 ms |
…rtual-store slot (pnpm#13383) Installing a `file:` directory dependency with the global virtual store enabled crashed the headless install: TypeError: Cannot read properties of undefined (reading 'split') at assertNoPathTraversal at formatGlobalVirtualStorePath at calcGraphNodeHash pnpm omits `version` from a directory snapshot, so `nameVerFromPkgSnapshot` hands the hasher `undefined` and the traversal guard added in pnpm#12872 dereferences it. Directory snapshots now use a fixed `directory` segment in place of the version. That also settles a disagreement between the two install paths: the resolver reads the version off the manifest and the headless install off the lockfile, where there is none, so the same package landed on two different slots. The crash hid a worse defect. A directory resolution is the one resolution with no integrity — it is a path relative to the lockfile — so `file:dep` hashed identically in every project that depended on a directory of that name, and all of them linked to whichever project installed first. Since the source directory is mutable, pnpm re-imports it on every install, so the projects went on overwriting each other's copy. The lockfile directory now joins the hash payload for directory resolutions, giving each project its own slot; every other resolution hashes exactly as before. `iterateHashedGraphNodes` takes an options object now — it was up to five positional parameters before this change added a sixth. Closes pnpm#13335
Summary
Fixes #13335.
Installing a
file:directory dependency with the global virtual store enabled crashed the headless install:pnpm deliberately omits
versionfrom a directory snapshot (toLockfileDependencyskips it fortype: 'directory'), sonameVerFromPkgSnapshothands the hasherundefined, and the traversal guard added in #12872 dereferences it. Directory snapshots now use a fixeddirectorysegment in place of the version.While reproducing that, I found a second, quieter defect underneath it. A directory resolution is the one resolution with no integrity — it is a path relative to the lockfile — so
file:dephashed identically in every project depending on a directory of that name, and they all shared one global-virtual-store slot:Both resolved to
<store>/v11/links/@/dep/1.0.0/28c8453e…. Because the source directory is mutable, pnpm re-imports directory deps on every install, so the two projects went on overwriting each other's copy. The lockfile directory now joins the hash payload for directory resolutions, giving each project its own slot; every other resolution hashes exactly as before.Fixing the version segment also settles a disagreement between the two install paths: the resolver reads the version off the manifest and the headless install reads it off the lockfile, where there is none, so the same package used to land on two different slots depending on which path ran.
Notes for reviewers
virtualStoreDiris the global store (extendInstallOptions), so there is no project-local virtual store left to fall back to. Scoping the slot achieves the same isolation without introducing a second virtual-store root. Directory deps take the cold re-import path on every install anyway, so they never benefited from a shared slot..../undefined/<hash>slots left by earlier pnpm 11 versions become unreachable and are collected by the existing mark-and-sweeppruneGlobalVirtualStore.iterateHashedGraphNodestakes an options object now — it was already up to five positional parameters, and this change would have added a sixth.pacquet
The Rust port had both defects and is fixed in the same PR, so the two stacks derive the same slot:
gvs_version_segmentrendered the literalundefinedfor everyfile:dep — what the TypeScript side produced before its traversal guard turned the missing version into a crash. It now anchors a directory resolution to thedirectorysegment, and prefersPackageMetadata::version, so a local tarball (content-addressed, and carrying a version in the lockfile) no longer shares the directory dep's fallback. That last part was an existing divergence from the TypeScript CLI.VirtualStoreLayout::newtook no resolution into account when inserting a slot suffix, so directory deps collided across projects the same way. It takes the lockfile directory now and folds it into the hash payload for directory resolutions, via a newprojectargument oncalc_graph_node_hash.local_directory_dependency_works_with_global_virtual_store(pnpm/crates/cli/tests/global_virtual_store.rs) anddirectory_deps_get_a_slot_per_project(virtual_store_layout/tests.rs) — there was no coverage for a plain, non-injectedfile:directory dependency under GVS.Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-opus-5).
Summary by CodeRabbit
file:directory dependencies when Global Virtual Store is enabled.file:directory dependencies get deterministic, project-specific slots and don’t collide across projects with the same dependency name.