Repository navigation
fix(install): refuse a modules dir linked from another store on add - #17264
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": 2.8146112603,
"stddev": 0.0984882558270576,
"median": 2.8124420692000003,
"user": 3.1464420800000004,
"system": 2.39971254,
"min": 2.7001730867,
"max": 3.0481086907
},
{
"command": "pacquet@main",
"mean": 2.7690322346,
"stddev": 0.08205025329492605,
"median": 2.7768492082,
"user": 3.1117203799999995,
"system": 2.29258304,
"min": 2.6242817397,
"max": 2.8700666527
},
{
"command": "pnpr@HEAD",
"mean": 1.6014941389999997,
"stddev": 0.15232509402756875,
"median": 1.5570950686999998,
"user": 2.6311308799999997,
"system": 2.18024784,
"min": 1.4370048656999999,
"max": 1.8733027127
},
{
"command": "pnpr@main",
"mean": 1.5578760055,
"stddev": 0.1225181791186895,
"median": 1.5233495261999999,
"user": 2.4301569799999996,
"system": 1.9755530399999999,
"min": 1.4116170487,
"max": 1.7590586727
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.4464840531400001,
"stddev": 0.05040446373993394,
"median": 0.45087370224,
"user": 0.52407596,
"system": 0.8946517799999999,
"min": 0.37201234524000004,
"max": 0.5349579552400001
},
{
"command": "pacquet@main",
"mean": 0.60471646934,
"stddev": 0.07799708362745214,
"median": 0.6145423612400001,
"user": 0.67236186,
"system": 1.0441342800000002,
"min": 0.5106452792400001,
"max": 0.7287717632400001
},
{
"command": "pnpr@HEAD",
"mean": 0.5122044020400001,
"stddev": 0.0427463443671565,
"median": 0.5267347467400001,
"user": 0.5787815599999999,
"system": 0.9208412800000001,
"min": 0.45578989824000005,
"max": 0.56944575224
},
{
"command": "pnpr@main",
"mean": 0.5518910576400001,
"stddev": 0.10739402160300948,
"median": 0.5199967192400001,
"user": 0.6108612599999999,
"system": 1.0050585799999996,
"min": 0.43689938524000005,
"max": 0.7773168502400001
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.016667408797777776,
"stddev": 0.0027837462131216767,
"median": 0.01619858502,
"user": 0.008800483456790123,
"system": 0.009139434567901235,
"min": 0.01172655602,
"max": 0.02418998202
},
{
"command": "pacquet@main",
"mean": 0.01585678041735099,
"stddev": 0.0026330534386611723,
"median": 0.015407563020000003,
"user": 0.0089350140397351,
"system": 0.0082837761589404,
"min": 0.011107404020000001,
"max": 0.02667542702
},
{
"command": "pnpr@HEAD",
"mean": 0.013540997332138741,
"stddev": 0.0015963317729836206,
"median": 0.01363161602,
"user": 0.007701703815028903,
"system": 0.0070377722543352615,
"min": 0.010159351020000002,
"max": 0.01845771002
},
{
"command": "pnpr@main",
"mean": 0.013084526651067963,
"stddev": 0.0013541063980308443,
"median": 0.01293791402,
"user": 0.007336411262135924,
"system": 0.0068671368932038835,
"min": 0.010570908020000002,
"max": 0.01866981002
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.011385713581581927,
"stddev": 0.0012498575261532792,
"median": 0.011175983220000001,
"user": 0.006712874463276838,
"system": 0.005669315254237289,
"min": 0.00897309022,
"max": 0.01876638422
},
{
"command": "pacquet@main",
"mean": 0.011271546641800946,
"stddev": 0.001241217930022397,
"median": 0.01108454122,
"user": 0.006703220568720377,
"system": 0.005536115639810425,
"min": 0.009170410220000001,
"max": 0.01607371822
},
{
"command": "pnpr@HEAD",
"mean": 0.011226921566733663,
"stddev": 0.0011873583300371512,
"median": 0.011013468220000001,
"user": 0.006881853567839199,
"system": 0.005308381909547733,
"min": 0.00909266522,
"max": 0.016547529220000003
},
{
"command": "pnpr@main",
"mean": 0.010569647536513767,
"stddev": 0.0011026414082725108,
"median": 0.010332212220000001,
"user": 0.005517401467889905,
"system": 0.00598179449541284,
"min": 0.008745061220000001,
"max": 0.016005880220000004
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.20414830272,
"stddev": 0.20704521603575227,
"median": 3.15672882912,
"user": 3.9428987799999993,
"system": 2.65555822,
"min": 2.94678151112,
"max": 3.54010405912
},
{
"command": "pacquet@main",
"mean": 3.1806532060199997,
"stddev": 0.2915899091059277,
"median": 3.13646654212,
"user": 3.8244847799999997,
"system": 2.69200872,
"min": 2.86629417412,
"max": 3.80908873512
},
{
"command": "pnpr@HEAD",
"mean": 1.6713506558200002,
"stddev": 0.14011583084125148,
"median": 1.64016205162,
"user": 2.21673208,
"system": 1.80494142,
"min": 1.4699959401200002,
"max": 1.86143347712
},
{
"command": "pnpr@main",
"mean": 1.6574313338200004,
"stddev": 0.1451200959801197,
"median": 1.58316102412,
"user": 2.3388406799999997,
"system": 1.9927518199999998,
"min": 1.4609971291200001,
"max": 1.88809170212
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
Confirmation (reversed target order)
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.7699806845399999,
"stddev": 0.11477079688781955,
"median": 0.7687556524400001,
"user": 1.11110726,
"system": 1.11464694,
"min": 0.56045621944,
"max": 0.92238093844
},
{
"command": "pacquet@main",
"mean": 0.54932081564,
"stddev": 0.03357978799867797,
"median": 0.54814787044,
"user": 0.7776512600000001,
"system": 0.9272416399999999,
"min": 0.48364376944000004,
"max": 0.59974432244
},
{
"command": "pnpr@HEAD",
"mean": 0.48022276754000004,
"stddev": 0.10403002519957247,
"median": 0.45701318794,
"user": 0.47610746,
"system": 0.84619614,
"min": 0.32730354544,
"max": 0.6343604124400001
},
{
"command": "pnpr@main",
"mean": 0.3998342998400001,
"stddev": 0.05006961312019995,
"median": 0.39041738544000004,
"user": 0.37920126,
"system": 0.75245604,
"min": 0.33683097044,
"max": 0.50506356544
}
],
"confirmation": {
"results": [
{
"command": "pnpr@main",
"mean": 0.6482777186,
"stddev": 0.10878485048321171,
"median": 0.6527900269000001,
"user": 0.57512202,
"system": 0.9469101600000001,
"min": 0.4641301519,
"max": 0.8710237509000001
},
{
"command": "pnpr@HEAD",
"mean": 0.6017470892000001,
"stddev": 0.07517233974173845,
"median": 0.5839819239,
"user": 0.54113672,
"system": 0.9024430599999999,
"min": 0.4651359829,
"max": 0.7034585309000001
},
{
"command": "pacquet@main",
"mean": 0.9596636096000001,
"stddev": 0.13342936738430014,
"median": 0.9829061089000001,
"user": 1.2828645200000002,
"system": 1.23057186,
"min": 0.7620147929000001,
"max": 1.1646044389
},
{
"command": "pacquet@HEAD",
"mean": 0.7871892412,
"stddev": 0.04719712032767096,
"median": 0.7888106699000001,
"user": 1.15850802,
"system": 1.12013586,
"min": 0.6980349679000001,
"max": 0.8524313149000001
}
]
}
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.4223062946800002,
"stddev": 0.2694430004820813,
"median": 2.41716097558,
"user": 1.96933992,
"system": 1.6284842400000001,
"min": 2.1581295975800003,
"max": 3.08796754358
},
{
"command": "pacquet@main",
"mean": 2.0860114232799996,
"stddev": 0.058365288614862745,
"median": 2.07435032308,
"user": 1.65741922,
"system": 1.3711042399999998,
"min": 2.01266789758,
"max": 2.22047638458
},
{
"command": "pnpr@HEAD",
"mean": 0.56338688358,
"stddev": 0.11450410493208053,
"median": 0.5173218850800001,
"user": 0.5350088199999999,
"system": 0.9139873399999999,
"min": 0.47552705558,
"max": 0.8636399075800001
},
{
"command": "pnpr@main",
"mean": 0.45888324238000006,
"stddev": 0.041609462445583216,
"median": 0.44998969358000007,
"user": 0.44335201999999985,
"system": 0.8359818400000002,
"min": 0.41173611558000006,
"max": 0.5394391215800001
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.31383766418,
"stddev": 0.025143298076238885,
"median": 0.30661257288,
"user": 0.31243402,
"system": 0.13251398,
"min": 0.28361232888,
"max": 0.35786253488
},
{
"command": "pacquet@main",
"mean": 0.29378138128,
"stddev": 0.013198880249112623,
"median": 0.29040749438,
"user": 0.29488472,
"system": 0.11544147999999999,
"min": 0.27563613888,
"max": 0.31788406088
},
{
"command": "pnpr@HEAD",
"mean": 0.10639985491703705,
"stddev": 0.005030891970135189,
"median": 0.10668373188000001,
"user": 0.04655689777777777,
"system": 0.01836329111111111,
"min": 0.09678492088000001,
"max": 0.11583122588000001
},
{
"command": "pnpr@main",
"mean": 0.12549932345692308,
"stddev": 0.022634961902252046,
"median": 0.12805912687999998,
"user": 0.059925812307692304,
"system": 0.02296640384615384,
"min": 0.09751622988000001,
"max": 0.17875020688
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.35635857622444445,
"stddev": 0.015289598870288546,
"median": 0.34902588178000005,
"user": 0.3756875022222222,
"system": 0.08839497777777779,
"min": 0.34026578478,
"max": 0.38197759078000004
},
{
"command": "pacquet@main",
"mean": 0.39815231333555556,
"stddev": 0.034884669692264655,
"median": 0.41352213578,
"user": 0.42945716888888885,
"system": 0.08563764444444445,
"min": 0.34766533178000003,
"max": 0.43712000778000004
},
{
"command": "pnpm@HEAD",
"mean": 6.232274441113335,
"stddev": 0.69214755867207,
"median": 6.04051618478,
"user": 9.781182057777777,
"system": 0.6118103111111111,
"min": 5.60695800878,
"max": 7.622009070780001
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.16878104375578948,
"stddev": 0.013853000601858883,
"median": 0.16705826744000002,
"user": 0.1555840536842105,
"system": 0.0795135094736842,
"min": 0.14067667444,
"max": 0.18966636844
},
{
"command": "pacquet@main",
"mean": 0.167989304065,
"stddev": 0.014967904156628995,
"median": 0.16292459594000003,
"user": 0.15483658,
"system": 0.08241203250000001,
"min": 0.14895978844000002,
"max": 0.19319813844
}
]
}Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.09614968432625003,
"stddev": 0.005581427992531691,
"median": 0.09372257692,
"user": 0.03702958,
"system": 0.06662121625,
"min": 0.08655399842,
"max": 0.11307751542000001
},
{
"command": "pacquet@main",
"mean": 0.09863553372000002,
"stddev": 0.005681184265164791,
"median": 0.09736811892,
"user": 0.038372046666666666,
"system": 0.06804959333333334,
"min": 0.09196994242,
"max": 0.11777584342
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 5.09124346606,
"stddev": 0.20244054892606747,
"median": 5.11249524516,
"user": 3.3604824199999994,
"system": 2.5306881399999996,
"min": 4.71875626716,
"max": 5.36372798616
},
{
"command": "pacquet@main",
"mean": 5.14971338496,
"stddev": 0.29327055584430484,
"median": 5.15739144166,
"user": 3.32525032,
"system": 2.44703084,
"min": 4.72245090916,
"max": 5.78886987116
},
{
"command": "pnpr@HEAD",
"mean": 5.42295431576,
"stddev": 1.0523081813232258,
"median": 5.36935750966,
"user": 3.7221869199999995,
"system": 3.1048806399999997,
"min": 4.15648130716,
"max": 7.1097685871600005
},
{
"command": "pnpr@main",
"mean": 5.640153401159999,
"stddev": 0.6656365042213673,
"median": 5.585448469659999,
"user": 3.6704732199999994,
"system": 2.98759944,
"min": 4.79824821216,
"max": 6.61427404816
}
]
}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.16083083305999998,
"stddev": 0.008681201385152555,
"median": 0.15949675306,
"user": 0.19178466857142856,
"system": 0.15382892,
"min": 0.15120666706,
"max": 0.17520058406
},
{
"command": "pacquet@main",
"mean": 0.16897107817764703,
"stddev": 0.01577802992914314,
"median": 0.16184612806,
"user": 0.21786247529411767,
"system": 0.14173324352941177,
"min": 0.14589244506,
"max": 0.19406903506
},
{
"command": "pnpr@HEAD",
"mean": 0.19750483464333335,
"stddev": 0.010621359890315391,
"median": 0.19616804856,
"user": 0.23817774,
"system": 0.15604483666666666,
"min": 0.17930829306,
"max": 0.21462512606
},
{
"command": "pnpr@main",
"mean": 0.19981064821384617,
"stddev": 0.010276518794455972,
"median": 0.19867434106,
"user": 0.2449905476923077,
"system": 0.16194395846153847,
"min": 0.18797627706,
"max": 0.22321520906
}
]
}Scenario: Store only: unlocked direct deps, cold cache + hot storeStore-only install (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.4988464561400003,
"stddev": 0.1353359526807103,
"median": 1.48345801414,
"user": 0.9939010400000001,
"system": 0.33667625999999995,
"min": 1.3590050456400002,
"max": 1.8129230946400001
},
{
"command": "pacquet@main",
"mean": 1.3761483821400002,
"stddev": 0.043945006485067356,
"median": 1.3741380001400003,
"user": 0.8192457400000001,
"system": 0.30999726,
"min": 1.32048880464,
"max": 1.4361226256400001
}
]
}Scenario: Cargo: repeat install, hot cache + hot storeFrozen repeat install of a Cargo workspace (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.06694644990000002,
"stddev": 0.014191607702068648,
"median": 0.06221216586000001,
"user": 0.0440427,
"system": 0.037431519999999996,
"min": 0.045611441860000004,
"max": 0.11055084686000001
},
{
"command": "pacquet@main",
"mean": 0.0918053043957143,
"stddev": 0.013847144458005587,
"median": 0.08872581436000002,
"user": 0.05088506857142857,
"system": 0.052436878571428584,
"min": 0.06614578286,
"max": 0.13404880886
}
]
} |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17264 +/- ##
========================================
Coverage 92.55% 92.56%
========================================
Files 1872 1874 +2
Lines 242307 242435 +128
========================================
+ Hits 224278 224417 +139
+ Misses 18029 18018 -11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Execution Profiles recorded for 1 job, triggered by
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
PR Summary by QodoReject incompatible modules directories on add, remove, and update
AI Description
Diagram
High-Level Assessment
Files changed (36)
|
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
pnpm v12 let `pnpm add`, `pnpm remove`, and `pnpm update` silently purge and reinstall `node_modules` when `.modules.yaml` recorded a different store, virtual store directory, or layout version. Its port of `validateModules` carried only the hoist-pattern and `virtualStoreDirMaxLength` checks, and `pnpm update` ran as a plain install, so it skipped even those. pnpm v11 (`validateModules` and `checkCompatibility` in pnpm11/installing/deps-installer/src/install/) fails every mutation other than a plain install with ERR_PNPM_MODULES_BREAKING_CHANGE, ERR_PNPM_UNEXPECTED_STORE, or ERR_PNPM_UNEXPECTED_VIRTUAL_STORE, and only `pnpm install` takes the purge path. `installsOnly` is false for an install with `update` set, so `pnpm update` errors too. `check_modules_settings_diff` now runs the `checkCompatibility` checks after the `*_DIFF` ones, in v11's order, and moves to its own module to keep `modules_state.rs` under the file-length limit. Paths compare lexically, case-insensitively on Windows, like `path.relative`, and the neighbouring `v3` store is accepted as v11 does. The hoist-pattern checks skip a `virtualStoreOnly` manifest, as v11 does. The error text and help match the v11 error message and the default reporter's body. `pnpm update` now passes `installs_only: false`. The confirmModulesPurge prompt stays out: v12 lists it as a pnpm v11 setting and purges without asking. The new modules_dir_compatibility e2e module covers add, remove, and update against a changed `storeDir`, add against a changed `virtualStoreDir` and layout version, and that `pnpm install` then recreates the tree. All three tests fail with the check disabled, and the update case fails with `installs_only: true` restored. Part of pnpm/tasks#191. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ERR_PNPM_UNEXPECTED_STORE and ERR_PNPM_UNEXPECTED_VIRTUAL_STORE tell the user to run `pnpm install`, but in both CLIs the optimistic repeat install reported "Already up to date": the workspace state recorded neither setting, so nothing invalidated the fast path. Both stacks now record the configured `storeDir` and `virtualStoreDir` in the workspace state and compare them like the other settings, so the next `pnpm install` takes the full install, which purges and recreates `node_modules`. The fast path reads no extra file. The recorded values are the raw configured ones, the same in both stacks, so either CLI accepts the state the other wrote: - v11 records `opts.storeDir` as configured (`~/` expanded). Its store controller writes the resolved store into the options it is given, so `installDeps` now passes it a copy, and the recursive install, whose context does the same, snapshots the value before it runs. - v12 reads both from `explicit_settings` and expands a leading `~/` in `storeDir` as v11 does. A deploy records the store location its deployed `pnpm-workspace.yaml` carries (no `storeDir`, and only a relative `virtualStoreDir`), so `pnpm run` in the deploy directory still passes dependency verification. The layout version is not recorded: it has been 5 since before the workspace state existed, so only a hand-edited `.modules.yaml` can disagree with it. ERR_PNPM_MODULES_BREAKING_CHANGE now uses the default reporter's title and help, as the other two errors do. Tests: the v12 e2e module drops its optimistic-repeat-install workaround, checks the reinstall after both changes, and checks that the state records `storeDir` as configured. A new v11 test (installing/commands/test/storeLocationChange.ts) checks that an unchanged repeat install stays on the fast path, that `pnpm add` fails and `pnpm install` reinstalls after each change, and that single-project and recursive installs record the configured `storeDir`. Each fails with the new setting keys removed, and the v11 recording tests fail without the copy and the snapshot. Part of pnpm/tasks#191. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first version recorded `storeDir` and `virtualStoreDir` as spelled. TS CI showed two ways that breaks: a verification-triggered install passes the store as an absolute path while the user spells it relative, and a shared-lockfile deploy installs with an absolute `virtualStoreDir` that the deployed directory's own config does not name. Rust CI on Windows failed on separator-sensitive assertions in the new e2e test. Both stacks now record each configured setting as the directory it resolves to, against the directory of the workspace state, with the store version appended to `storeDir` as the store resolution does. A setting that is not configured stays unset, so a project that sets neither records nothing. `pnpm run` and `pnpm exec` dependency verification ignore both settings and carry the recorded ones forward, as they do for the dependency groups: a script runs the same from whichever store `node_modules` was linked from, and only an install has to act on the change. This also keeps a deployed project passing verification without deploy-specific handling, so the v12 deploy change is reverted. The e2e test now compares recorded paths by component, so it holds on Windows. A unit test covers the v11 path resolution. Part of pnpm/tasks#191. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tual store Review follow-ups. `pnpm add`, `pnpm remove`, and `pnpm update` could still purge `node_modules`: `purge_inconsistent_modules_dir` ran the `validateModules` checks and then purged anyway for any drift they do not report, such as a `nodeLinker` change. pnpm v11 never purges for a mutation other than a plain install (`forceNewModules = installsOnly`), so a non-install mutation now either fails on the reported drift or keeps the directory. The layout-drift check also compares the recorded store and virtual store with `same_path`, the comparison the errors use, rather than as exact strings, so a spelling difference (case on Windows, `..` segments) no longer reads as drift. Under a global virtual store, v12 recorded the global virtual store as `virtualStoreDir` in the workspace state. It now records the configured `virtualStoreDir` anchored at the lockfile directory, as v11 does. Tests: an e2e case where `add` after a `nodeLinker` change keeps a file in `node_modules` (fails against the previous commit), a case where `pnpm run` passes verification after a `storeDir` change and keeps the recorded store until `pnpm install` recreates the tree (in both stacks; the v12 one fails without the ignore list), and a case for the recorded `virtualStoreDir` under a global virtual store (fails with the previous recording). The v11 changeset now names `@pnpm/deps.status` and `@pnpm/exec.commands`, which the change also touches. Part of pnpm/tasks#191. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… base v11's store controller resolves a relative `storeDir` against the workspace directory, else the project. The workspace state resolved it against its own directory, the lockfile directory. With a project lockfile inside a workspace, the state recorded a store the installer never used, so switching to that path's absolute spelling looked unchanged. `virtualStoreDir` keeps resolving against the lockfile directory, as the install context does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
dbf6558 to
5258adb
Compare
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Code review by qodo was updated up to the latest commit 5258adb |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Code review by qodo was updated up to the latest commit 96d3785 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
@coderabbitai resume |
✅ Action performed
|
|
@coderabbitai review |
|
Summary
Before this PR, pnpm v12's
pnpm add,pnpm remove, andpnpm updatesilently purged and reinstallednode_moduleswhen.modules.yamlrecorded a different store, virtual store directory, or layout version. pnpm v11 fails these commands withERR_PNPM_UNEXPECTED_STORE,ERR_PNPM_UNEXPECTED_VIRTUAL_STORE, orERR_PNPM_MODULES_BREAKING_CHANGE(validateModulesandcheckCompatibilityinpnpm11/installing/deps-installer/src/install/), and only a plainpnpm installpurges. This PR ports those checks to v12 and makespnpm updatea non-plain install, asinstallsOnlyis in v11.The errors tell the user to run
pnpm install, but in both CLIs the optimistic repeat install answered "Already up to date": the workspace state recorded neitherstoreDirnorvirtualStoreDir. This PR fixes that in both stacks, so the documented recovery works.This changes behavior for v12 users who relied on the silent reinstall. It restores v11 behavior, so it ships as a fix, and the v12 changeset says so. The v11 half has its own changeset because its release note differs.
Part of pnpm/tasks#191
Notes for review:
storeDir. In v11 that isstoreDiragainst the workspace directory (else the project), ascreateStoreControllerdoes, andvirtualStoreDiragainst the lockfile directory. Relative and absolute spellings therefore compare equal. A verification-triggered install passes the store as an absolute path, and TS CI caught the first, as-spelled version on that. A setting that is not configured stays unset, so the check needs no store placement and reads no extra file.pnpm run/pnpm execverification ignores both settings and carries the recorded values forward, as it does fordev/optional/production. A script runs the same from whichever storenode_moduleswas linked from. This also keeps a deployed project passing verification (deploy.tsin v11,deploy::deployed_project_passes_dependency_verificationin v12) without deploy-specific code. Apnpm installinside a deploy directory whose config names another store now reinstalls.forceNewModules = installsOnly), so itsaddafter anodeLinkerchange keepsnode_modulesand writes a.modules.yamlwith the new linker. The old layout's packages then stay forever (v11: pnpm add after a nodeLinker change leaves the old layout's packages in node_modules tasks#203). Purging there is no better: a filteredaddrelinks only the selected projects, and an unreadable.modules.yamlgives no record of what pnpm owns. v12add,remove, andupdatetherefore fail on that drift too, with a newERR_PNPM_NODE_LINKER_DIFF(documented inpnpm/docs/errors.md) orERR_PNPM_MODULES_BREAKING_CHANGEfor an unreadable.modules.yaml. The layout-drift check compares the recorded store and virtual store with the same lexical comparison the errors use, case-insensitive on Windows with full Unicode folding, aspath.relativedoes.virtualStoreDiranchored at the lockfile directory, as v11 does, not the global virtual store.storeDirorvirtualStoreDirrun one full install (no purge) after upgrading, because older states lack the keys.createStoreControllerwrites the resolved store into the options it gets, and so does the recursive install context.installDepsnow passes a copy, and the recursive state write snapshots the configured value. Otherwise an unconfigured store would be recorded as the default store's path..modules.yamlcan disagree with it.confirmModulesPurgestays v11-only, as v12 lists it.ERR_PNPM_MODULES_BREAKING_CHANGEnow uses the default reporter's title and help, like the other two errors.@pnpm/workspace.stategains a dependency on@pnpm/constantsfor the store version.Squash Commit Body
Checklist
are implemented in every affected version. (The new error is v12 only, since v11 already has it. The reinstall fix is in both.)
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note. (Two:
pacquet, and@pnpm/workspace.state+@pnpm/deps.status+@pnpm/exec.commands+@pnpm/installing.commands+pnpm.)nodeLinkerrefusal,add_refuses_a_modules_dir_installed_with_another_node_linkerfails.storeDiragainst the lockfile directory makes the v11 project-lockfile test recordproject-1/store/v11and fail.installs_only: truerestored for update, the update case fails.storeDir/virtualStoreDirremoved from the run ignore list, the new run-after-store-change test fails in both stacks.$HOME, and they pass with this one.ERR_PNPM_UNEXPECTED_STOREin both docs trees already sayspnpm installreinstalls, which is now true.)Local runs:
pnpm-cli,pnpm-package-manager, andpnpm-workspace-statesuites, plus clippy and dylint on the touched crates.@pnpm/installing.commands(all 43 suites),@pnpm/deps.status, and@pnpm/workspace.state.$HOME:test/verifyDepsBeforeRun,test/deploy.ts,test/install/misc.ts, andtest/install/global.tspass.test/install/pacquet.tsfails locally only, on a warning about a v12 setting in my globalconfig.yaml.Written by an agent (Claude Code, claude-opus-5-5).
🤖 Generated with Claude Code
Summary by CodeRabbit
pnpm installnow recreatesnode_moduleswhen the configured store or virtual store location changes, rather than reporting that everything is up to date.pnpm add,pnpm remove, andpnpm updatenow report errors whennode_modulesis incompatible with the configured store, virtual store, layout version, ornodeLinker. Existing dependencies are preserved; runpnpm installto recreate the modules directory.pnpm updatealso reports errors when hoist patterns or the virtual store maximum path length differ.