Repository navigation
Conversation
…n self-update A project pinned to 11.12.0 through `packageManager` or `devEngines.packageManager` still failed on every command with `Cannot use 'in' operator to search for 'integrity' in undefined`. That is the report in #12959, and it is the shape most people hit: the pin is committed, so one bad pin breaks everyone who clones the repo. #13076 refuses these releases, but only in `self-update`. The version switch is the other way in, and it reached the installer instead, where a release whose manifest declares dependencies crashes resolving them. Refuse the same releases there. The check sits after the "already this version" early return, deliberately: switching *to* a broken release is refused, but running one that is already installed is not — a developer whose pnpm is a broken release still needs it to work well enough to move off it. 11.13.0 is refused too, though it runs for the JS wrapper. The pin is shared and the wrapper is not, so pinning it works for whoever wrote the pin and breaks every teammate on `@pnpm/exe`, whose native is missing.
📝 WalkthroughWalkthroughVersion switching now rejects broken pnpm releases before installation in Rust and TypeScript flows, while allowing an already-running broken version. Tests cover these cases, and a patch changeset documents the behavior. ChangesBroken release switching
Estimated code review effort: 3 (Moderate) | ~20 minutes Assessment against linked issues
Out-of-scope changes
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for 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 |
PR Summary by QodoRefuse known-broken pnpm releases during version switch (not just self-update)
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Confidence Score: 5/5Safe to merge. The fix is narrow and targeted — one check added in the right place in both stacks — and the resource-cleanup (store close) on the new error path follows the identical pattern already present one block below. Both the TypeScript and Rust implementations are updated in lock-step, the "already running broken version" escape hatch is explicitly tested, and the broken-release check reuses the existing deny-list in a single place rather than duplicating it. No new failure paths are introduced for well-formed inputs. No files require special attention. Reviews (1): Last reviewed commit: "fix: refuse a broken pnpm release when s..." | Re-trigger Greptile |
Micro-Benchmark ResultsLinux |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pnpm/crates/cli/src/cli_args/switch_cli_version.rs (1)
52-94: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winAdd switch-level Rust regression coverage for broken-release refusal.
assert_release_is_installableis already covered, butpnpm/crates/cli/src/cli_args/switch_cli_version/tests.rsstill needsexecute_switchcases for refusing 11.12.0/11.13.0, allowing a valid target, and skipping the refusal when the broken version is already running.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/crates/cli/src/cli_args/switch_cli_version.rs` around lines 52 - 94, The switch flow lacks regression coverage for broken-release handling in execute_switch. Add tests in the switch CLI version tests covering refusal of versions 11.12.0 and 11.13.0, successful switching to a valid target, and returning the skip result when the broken version is already the running PNPM_VERSION; reuse existing test helpers and avoid duplicating assert_release_is_installable tests.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@pnpm/crates/cli/src/cli_args/switch_cli_version.rs`:
- Around line 52-94: The switch flow lacks regression coverage for
broken-release handling in execute_switch. Add tests in the switch CLI version
tests covering refusal of versions 11.12.0 and 11.13.0, successful switching to
a valid target, and returning the skip result when the broken version is already
the running PNPM_VERSION; reuse existing test helpers and avoid duplicating
assert_release_is_installable tests.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 13714691-1918-4c3f-adf2-693677fa1b8c
📒 Files selected for processing (5)
.changeset/refuse-broken-release-on-version-switch.mdpnpm/crates/cli/src/cli_args/self_update/install_pnpm.rspnpm/crates/cli/src/cli_args/switch_cli_version.rspnpm11/pnpm/src/switchCliVersion.test.tspnpm11/pnpm/src/switchCliVersion.ts
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13082 +/- ##
=======================================
Coverage 85.54% 85.54%
=======================================
Files 499 499
Lines 79884 79886 +2
=======================================
+ Hits 68339 68341 +2
Misses 11545 11545 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.78380104824,
"stddev": 0.21115977740228506,
"median": 2.73709482294,
"user": 2.3599142,
"system": 1.9545948,
"min": 2.5590624759400002,
"max": 3.19476480494,
"times": [
2.9262841189400004,
3.19476480494,
2.67381592494,
2.56982115494,
3.0084802979400003,
2.6561564629400003,
2.60284749194,
2.8464040289400003,
2.5590624759400002,
2.80037372094
]
},
{
"command": "pacquet@main",
"mean": 2.6884923542399997,
"stddev": 0.16820077175697265,
"median": 2.67199937994,
"user": 2.2562680999999998,
"system": 1.7433643999999997,
"min": 2.45557948194,
"max": 2.9315760669400004,
"times": [
2.85301519694,
2.47356550794,
2.67698796794,
2.6373081009400003,
2.66701079194,
2.9156977319400004,
2.9315760669400004,
2.57422626494,
2.69995643094,
2.45557948194
]
},
{
"command": "pnpr@HEAD",
"mean": 1.52080543884,
"stddev": 0.14710074795475656,
"median": 1.4845855389399998,
"user": 1.1517060000000001,
"system": 1.1639267,
"min": 1.35494512194,
"max": 1.78938077294,
"times": [
1.42985800594,
1.40241701794,
1.40228326594,
1.7252140119400001,
1.78938077294,
1.4801036299399999,
1.48906744794,
1.6380432299399998,
1.49674188394,
1.35494512194
]
},
{
"command": "pnpr@main",
"mean": 1.50250238124,
"stddev": 0.11849174094996905,
"median": 1.48294384394,
"user": 1.1201706000000002,
"system": 1.237468,
"min": 1.35933704694,
"max": 1.73105120894,
"times": [
1.3681565119399999,
1.45756446494,
1.48752171294,
1.73105120894,
1.53856821494,
1.57319145394,
1.62990082294,
1.40136639994,
1.35933704694,
1.47836597494
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.22179876828,
"stddev": 0.015301581847279217,
"median": 0.22320530988000004,
"user": 0.21068540000000002,
"system": 0.58982818,
"min": 0.20037775338000002,
"max": 0.24664160338000002,
"times": [
0.20037775338000002,
0.20430151538000002,
0.20617915338,
0.21739644638000002,
0.22284112438000003,
0.23044931838000002,
0.22516215738000003,
0.22356949538,
0.24106911538000003,
0.24664160338000002
]
},
{
"command": "pacquet@main",
"mean": 0.22273787038000004,
"stddev": 0.025641516855881584,
"median": 0.21016729138,
"user": 0.21511110000000003,
"system": 0.5724934799999999,
"min": 0.19889788538000003,
"max": 0.27458515837999997,
"times": [
0.20998635538000002,
0.20775884938000003,
0.20563735338000003,
0.21450774438000003,
0.21034822738000003,
0.19889788538000003,
0.20752322538,
0.24063084938,
0.27458515837999997,
0.25750305538
]
},
{
"command": "pnpr@HEAD",
"mean": 0.23739756618000002,
"stddev": 0.01245608268310927,
"median": 0.23482779738000004,
"user": 0.219935,
"system": 0.58456588,
"min": 0.22222037438000003,
"max": 0.26603980938,
"times": [
0.23851944138000003,
0.23325200838000001,
0.22563528838000002,
0.22222037438000003,
0.23270081938,
0.23287041938000003,
0.23689196538,
0.23640358638000003,
0.24944194938000003,
0.26603980938
]
},
{
"command": "pnpr@main",
"mean": 0.24635026308,
"stddev": 0.006214629113501139,
"median": 0.24621870638000004,
"user": 0.2221108,
"system": 0.61018808,
"min": 0.23624905438000002,
"max": 0.25526970838,
"times": [
0.25203163838,
0.24658126938000002,
0.23624905438000002,
0.24408842338000003,
0.24585614338000003,
0.23991492038,
0.25279089838,
0.25526970838,
0.25002165138,
0.24069892338
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.7241411352200005,
"stddev": 0.03633978371627034,
"median": 2.7209774269199998,
"user": 1.6890754600000002,
"system": 1.33218768,
"min": 2.6742013079199998,
"max": 2.7927658799199997,
"times": [
2.7148488609199997,
2.7548191359199996,
2.7363548079199997,
2.68837869992,
2.72710599292,
2.7927658799199997,
2.69021464792,
2.75329517492,
2.7094268439199998,
2.6742013079199998
]
},
{
"command": "pacquet@main",
"mean": 2.80107918872,
"stddev": 0.09450711898857689,
"median": 2.7790805809199997,
"user": 1.8774661599999998,
"system": 1.4793834799999999,
"min": 2.72943629292,
"max": 3.05768021392,
"times": [
2.72943629292,
2.77916212992,
2.75573505192,
2.7789990319199998,
2.7481121099199997,
2.75264951692,
2.7824264079199996,
2.83041627192,
3.05768021392,
2.79617485992
]
},
{
"command": "pnpr@HEAD",
"mean": 1.59677770922,
"stddev": 0.1382853569812909,
"median": 1.55016985742,
"user": 1.3177038600000002,
"system": 1.46461848,
"min": 1.4426205169200002,
"max": 1.83650658892,
"times": [
1.58149743492,
1.77589746992,
1.4971342839200001,
1.47572718092,
1.51884227992,
1.4426205169200002,
1.83650658892,
1.7233179479200003,
1.49142316192,
1.62481022692
]
},
{
"command": "pnpr@main",
"mean": 1.69400401722,
"stddev": 0.11088017175534078,
"median": 1.72647110692,
"user": 1.2167032599999998,
"system": 1.3056213799999998,
"min": 1.53225536092,
"max": 1.83674640092,
"times": [
1.81677169692,
1.83674640092,
1.64989018892,
1.77781754692,
1.53225536092,
1.54964865092,
1.7480431819200002,
1.7150812399200002,
1.73786097392,
1.57592493092
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6492720969600001,
"stddev": 0.03274517209889976,
"median": 0.63609682676,
"user": 0.8032477799999999,
"system": 0.7223137199999999,
"min": 0.6175925842600001,
"max": 0.7092858252600001,
"times": [
0.67469989426,
0.6175925842600001,
0.62416219326,
0.62397489126,
0.63401710326,
0.63858700426,
0.63378015726,
0.6381765502600001,
0.7092858252600001,
0.6984447662600001
]
},
{
"command": "pacquet@main",
"mean": 0.6137571320600002,
"stddev": 0.041166555185259926,
"median": 0.6190887792599999,
"user": 0.7446076799999999,
"system": 0.70923292,
"min": 0.55167767826,
"max": 0.6849371442600001,
"times": [
0.6849371442600001,
0.62097519926,
0.66203151226,
0.61720235926,
0.6309264292600001,
0.59367386326,
0.57027053326,
0.62653944326,
0.55167767826,
0.57933715826
]
},
{
"command": "pnpr@HEAD",
"mean": 0.26249553346,
"stddev": 0.007850569002021345,
"median": 0.26105678626,
"user": 0.19440158,
"system": 0.54581452,
"min": 0.24775003826,
"max": 0.27671245126,
"times": [
0.25892467426,
0.24775003826,
0.26007047126,
0.26170149626,
0.26925081226,
0.26216152326000003,
0.26041207626,
0.25844777526,
0.27671245126,
0.26952401626
]
},
{
"command": "pnpr@main",
"mean": 0.26242424806,
"stddev": 0.007570087801823597,
"median": 0.26206116426000003,
"user": 0.22304458,
"system": 0.5236886199999999,
"min": 0.25022956926,
"max": 0.27800996626,
"times": [
0.26272299126000004,
0.25850292926,
0.26120712426000003,
0.26166980726,
0.26245252126,
0.26785241626,
0.27800996626,
0.25480354826,
0.25022956926,
0.26679160726
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.0103309024200002,
"stddev": 0.03545803644823515,
"median": 2.01467581172,
"user": 1.1380963000000002,
"system": 0.82893,
"min": 1.9526312187200001,
"max": 2.06953683572,
"times": [
1.9526312187200001,
2.01856255472,
2.01519751772,
1.99055368972,
1.98133583172,
2.04932209672,
2.06953683572,
2.01415410572,
2.03416115272,
1.97785402072
]
},
{
"command": "pacquet@main",
"mean": 1.9886239648199997,
"stddev": 0.039302589929780106,
"median": 1.98115068322,
"user": 1.1109692,
"system": 0.8472666999999999,
"min": 1.94797299172,
"max": 2.05304856972,
"times": [
2.02873811372,
1.98142998972,
1.9912067007199998,
1.9510946437199999,
2.05304856972,
2.0405024897199997,
1.98087137672,
1.96283132672,
1.94854344572,
1.94797299172
]
},
{
"command": "pnpr@HEAD",
"mean": 0.27519673412,
"stddev": 0.012257741233434214,
"median": 0.27695657672000007,
"user": 0.2212701,
"system": 0.5542636,
"min": 0.25548533772000004,
"max": 0.29874238972000006,
"times": [
0.26479963672,
0.27845693872000005,
0.28015416672000004,
0.27821103572000005,
0.25548533772000004,
0.26598673272,
0.27570211772000003,
0.28626214372000003,
0.29874238972000006,
0.26816684172000005
]
},
{
"command": "pnpr@main",
"mean": 0.27536484612000006,
"stddev": 0.016884823490208124,
"median": 0.26723122322000004,
"user": 0.2161851,
"system": 0.5680555,
"min": 0.25637156772,
"max": 0.30387303672000004,
"times": [
0.26550615772,
0.28108690472000003,
0.26510368872,
0.30387303672000004,
0.26895628872000005,
0.25637156772,
0.28294696872,
0.26501989172,
0.30304203072,
0.26174192572000005
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.39548124912000004,
"stddev": 0.0205941005853737,
"median": 0.39284676742,
"user": 0.3769409199999999,
"system": 0.07823714000000001,
"min": 0.35577101742000006,
"max": 0.42689244942000004,
"times": [
0.37542017642000003,
0.39012125342000004,
0.4167071814200001,
0.39249261042000005,
0.35577101742000006,
0.39171468542000004,
0.42689244942000004,
0.39320092442000004,
0.3987732224200001,
0.41371897042000005
]
},
{
"command": "pacquet@main",
"mean": 0.40999535272000004,
"stddev": 0.018847217656525948,
"median": 0.41109088492,
"user": 0.4064742199999999,
"system": 0.06533444,
"min": 0.37670377442,
"max": 0.43692918842000006,
"times": [
0.43692918842000006,
0.42406005342,
0.40574624042000007,
0.42259996242000003,
0.41567667942000003,
0.40650509042000005,
0.37670377442,
0.40325754142000003,
0.42463710142000005,
0.38383789542
]
},
{
"command": "pnpr@HEAD",
"mean": 0.08842421674258062,
"stddev": 0.004025259872609025,
"median": 0.08711292542,
"user": 0.01796464903225806,
"system": 0.012779914193548387,
"min": 0.08122423042,
"max": 0.10231623942,
"times": [
0.09072660342,
0.09159815542,
0.08785559442,
0.08942954942,
0.08122423042,
0.08637781041999999,
0.08461240342,
0.08554203542,
0.08891792642,
0.10231623942,
0.09340955842,
0.08646395242,
0.08660964742,
0.08672367142,
0.08649640542,
0.08904390242,
0.08825695042,
0.08403136942,
0.09356139342,
0.08480624942,
0.08969462942,
0.09349705242,
0.08711292542,
0.08607591142,
0.08502007242,
0.09095529442,
0.09302619642,
0.09045832842,
0.08561488442,
0.08629842042,
0.08539335542
]
},
{
"command": "pnpr@main",
"mean": 0.08836200685333333,
"stddev": 0.0033754741974682174,
"median": 0.08800453042,
"user": 0.017864119999999997,
"system": 0.013365301999999997,
"min": 0.08229884642,
"max": 0.09824688142,
"times": [
0.09252255742,
0.08851884441999999,
0.09042700942,
0.08733988242,
0.08706985442,
0.09071735641999999,
0.08969582142,
0.08767853042,
0.08657016242,
0.09824688142,
0.08712217242,
0.08244284741999999,
0.08229884642,
0.08427969742,
0.08613659542,
0.08779084242,
0.09107693342,
0.09424116542,
0.08833947642,
0.08976366942,
0.09075949542,
0.08399952942,
0.08721362442,
0.09149409942,
0.08763549942,
0.08403405442,
0.08844827042,
0.08716118542,
0.08961708242,
0.08821821842
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.715739429540001,
"stddev": 0.19581422445519917,
"median": 4.6249651289400004,
"user": 2.27407452,
"system": 1.66461918,
"min": 4.507963381440001,
"max": 4.98825602344,
"times": [
4.98825602344,
4.53448239844,
4.6534054214400005,
4.89930322244,
4.551364968440001,
4.915748108440001,
4.507963381440001,
4.946056238440001,
4.59652483644,
4.56428969644
]
},
{
"command": "pacquet@main",
"mean": 4.61113615664,
"stddev": 0.12805470049932138,
"median": 4.57371139094,
"user": 2.08974802,
"system": 1.61528478,
"min": 4.44979215644,
"max": 4.916967141440001,
"times": [
4.55693052344,
4.67007359944,
4.57904684944,
4.62835957144,
4.51531990044,
4.68129655244,
4.54519933944,
4.916967141440001,
4.44979215644,
4.56837593244
]
},
{
"command": "pnpr@HEAD",
"mean": 3.5340824689400003,
"stddev": 0.12085649202115627,
"median": 3.4852336574400002,
"user": 1.2549674199999998,
"system": 1.29688178,
"min": 3.45136419644,
"max": 3.8239566944400005,
"times": [
3.48679514744,
3.52737428644,
3.4969720104400004,
3.46448144044,
3.4719646774400004,
3.6755231914400004,
3.4587208774400002,
3.8239566944400005,
3.45136419644,
3.4836721674400004
]
},
{
"command": "pnpr@main",
"mean": 3.5478341144400005,
"stddev": 0.07686233271892201,
"median": 3.53905368394,
"user": 1.2945531199999998,
"system": 1.2778107799999998,
"min": 3.4420191044400004,
"max": 3.6752606554400002,
"times": [
3.6752606554400002,
3.6319474854400005,
3.52432135044,
3.6077252624400002,
3.4420191044400004,
3.51401086144,
3.5850793694400003,
3.45657377844,
3.4876172594400003,
3.5537860174400002
]
}
]
} |
|
| Branch | pr/13082 |
| 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,596.78 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 275.20 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 262.50 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 88.42 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,520.81 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,534.08 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 237.40 ms |
Summary
Closes #12959.
#13076 stopped
pnpm self-updatefrom installing a broken release. It did not cover the version switch, which is the path most of the reports in #12959 actually describe — "every single pnpm add/install command failed". Measured on mergedmain(f15d67c, which includes #13076), a project pinned throughdevEngines.packageManager:Cannot use 'in' operator to search for 'integrity' in undefinedassertReleaseIsInstallable— the list #13076 introduced — now guards the switch too, so both ways of acquiring a pnpm agree on which releases are refusable.What a user sees instead of the TypeError:
Two decisions worth review
The check is placed after the "already this version" early return. Switching to a broken release is refused; running one that is already installed is not. Someone whose pnpm is 11.12.0 still needs it to work well enough to move off it — and
self-updateskips the switch entirely (skipPackageManagerCheck), so that escape stays open. A test covers this.11.13.0 is refused even though it runs. For the JS
pnpmwrapper 11.13.0 is fine — it is@pnpm/[email protected]whose platform packages shipped without a binary. But the pin is shared and the wrapper is not, so a developer on the JS wrapper would pin a version that works for them and breaks every teammate on@pnpm/exe. This is a deliberate behaviour change: a repo pinned to 11.13.0 that currently works for JS-wrapper users will start failing, with the message above telling them what to do. Both versions are deprecated on npm.Verification
switch_cli_version+ 30self_updatetests pass; clippy and fmt clean.switchCliVersiontests pass, including three new ones — the refusal, that a non-broken release still switches, and that a broken release already running is not refused.refuses to switch to a broken releasefails withReceived promise resolved instead of rejected. It spiesprocess.exitfor that reason: without the spy a regression runs the switch to completion and reachesexit(), ending the worker instead of failing the test.PNPM_HOME/store per case.The test file now spreads the real
@pnpm/engine.pm.commandsinto its mock rather than stubbingassertReleaseIsInstallable, so the list of broken releases stays in one place and these tests exercise it instead of a copy.Not in this PR
#12960 fixes the underlying
buildLockfileFromEnvLockfilepeer-suffix bug that made the bad manifest fatal. It is worth merging on its own merit — it is what stops a future release with peer-carrying dependencies from crashing the same way — but it is orthogonal to this, which is about refusing releases already known to be broken. It currently conflicts with #13076.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-4-8).
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
Bug Fixes
Tests