Repository navigation
fix: allow standalone pnpm downgrades - #12840
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds pnpm alias-replacement handling in both the pnpm11 TypeScript and pacquet Rust global install flows so Changespnpm alias replacement in global installers
Estimated code review effort: 3 (Moderate) | ~25 minutes 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 failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. 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 standalone pnpm downgrades by treating pnpm and @pnpm/exe as replacements
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
1.
|
Micro-Benchmark ResultsLinux |
Code Review by Qodo
Context used✅ Compliance rules (platform):
51 rules 1.
|
|
Code review by qodo was updated up to the latest commit e7456c8 |
PR Code Suggestions ✨Latest suggestions up to 13b86f5 Warning
Previous suggestionsSuggestions up to commit 92233bf
Suggestions
|
|||||||||||||||||||||||||||||||||
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12840 +/- ##
=======================================
Coverage 85.80% 85.81%
=======================================
Files 448 448
Lines 69402 69438 +36
=======================================
+ Hits 59552 59585 +33
- Misses 9850 9853 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Code review by qodo was updated up to the latest commit 2104f63 |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
pacquet/crates/cli/src/cli_args/global/tests.rs (1)
1-83: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAlias-equivalence tests only cover one direction.
Both tests seed
aliases = ["@pnpm/exe"]against an existing"pnpm"group. There's no test for the reverse direction (aliases = ["pnpm"]against an existing"@pnpm/exe"-only group), which is the actual downgrade scenario this PR targets (v12pnpm→ v11@pnpm/exe, or vice versa depending on packaging). Sincereplacement_aliasesis symmetric, this is likely covered implicitly, but an explicit reverse-direction test would pin down the exact regression this PR fixes and improve confidence given the Codecov coverage gap noted onglobal.rs.✅ Suggested additional test
#[test] fn pnpm_alias_equivalence_replaces_reverse_direction() { let aliases = vec!["pnpm".to_string()]; let aliases_to_replace = replacement_aliases(&aliases); assert!(should_replace_existing_package( &global_package(&["`@pnpm/exe`"]), &aliases, &aliases_to_replace, )); }🤖 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 `@pacquet/crates/cli/src/cli_args/global/tests.rs` around lines 1 - 83, Add an explicit reverse-direction alias-equivalence test in global tests to cover the downgrade case the PR targets. Extend the existing pnpm alias checks around replacement_aliases and should_replace_existing_package by adding a test that seeds aliases with "pnpm" and verifies it replaces an existing "`@pnpm/exe`"-only GlobalPackageInfo group, so both directions of the symmetric mapping are pinned down.pacquet/crates/cli/src/cli_args/global.rs (1)
417-441: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winCoverage gap on the destructive removal path.
The PR's Codecov comment flags 3 uncovered lines in this file, and
tests.rsonly exercises the pure predicate functions (replacement_aliases,should_replace_existing_package), not this loop or thehandle_global_addclosure (lines 117-119) that actually deletes global install directories. Given this path performs filesystem removal based on the new alias-equivalence rule, an integration-level test exercisingremove_existing_global_installsdirectly (or viahandle_global_add) would meaningfully reduce risk of a regression silently deleting the wrong global install.🤖 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 `@pacquet/crates/cli/src/cli_args/global.rs` around lines 417 - 441, The destructive global-removal path in remove_existing_global_installs is not covered, so add an integration-style test that exercises this function or the handle_global_add closure that calls it. Set up multiple global installs with overlapping aliases, verify the alias-equivalence replacement behavior, and assert that only the intended package directories/bins are removed while unrelated global installs remain untouched. Use the existing symbols remove_existing_global_installs, handle_global_add, find_global_package, and remove_group to locate the path to cover.
🤖 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.
Nitpick comments:
In `@pacquet/crates/cli/src/cli_args/global.rs`:
- Around line 417-441: The destructive global-removal path in
remove_existing_global_installs is not covered, so add an integration-style test
that exercises this function or the handle_global_add closure that calls it. Set
up multiple global installs with overlapping aliases, verify the
alias-equivalence replacement behavior, and assert that only the intended
package directories/bins are removed while unrelated global installs remain
untouched. Use the existing symbols remove_existing_global_installs,
handle_global_add, find_global_package, and remove_group to locate the path to
cover.
In `@pacquet/crates/cli/src/cli_args/global/tests.rs`:
- Around line 1-83: Add an explicit reverse-direction alias-equivalence test in
global tests to cover the downgrade case the PR targets. Extend the existing
pnpm alias checks around replacement_aliases and should_replace_existing_package
by adding a test that seeds aliases with "pnpm" and verifies it replaces an
existing "`@pnpm/exe`"-only GlobalPackageInfo group, so both directions of the
symmetric mapping are pinned down.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 83eea02d-5a4c-42ca-a4a1-83449a7da528
📒 Files selected for processing (4)
pacquet/crates/cli/src/cli_args/global.rspacquet/crates/cli/src/cli_args/global/tests.rspnpm11/global/commands/src/globalAdd.tspnpm11/global/commands/test/globalAdd.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- pnpm11/global/commands/src/globalAdd.ts
PR Code Suggestions ✨Warning
|
||||||||||||
|
Code review by qodo was updated up to the latest commit 2104f63 |
|
Code review by qodo was updated up to the latest commit 92233bf |
|
Code review by qodo was updated up to the latest commit 92233bf |
1 similar comment
|
Code review by qodo was updated up to the latest commit 92233bf |
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": 4.10333104284,
"stddev": 0.18071645970089742,
"median": 4.17415029914,
"user": 3.8717338,
"system": 3.3520686599999996,
"min": 3.84902835864,
"max": 4.33160989464,
"times": [
3.91636533964,
3.84902835864,
4.22269149164,
4.301207392639999,
4.33160989464,
3.88256397164,
4.21015745064,
3.97138593064,
4.19860935964,
4.14969123864
]
},
{
"command": "pacquet@main",
"mean": 4.1228810010400005,
"stddev": 0.16058635996717863,
"median": 4.18050909514,
"user": 3.8656294999999994,
"system": 3.3536332599999996,
"min": 3.89229826864,
"max": 4.36776982464,
"times": [
4.24388321164,
4.36776982464,
4.04473368464,
3.89229826864,
4.19247879264,
4.2518842576399996,
3.9610774046399997,
4.17258791864,
3.91366637564,
4.18843027164
]
},
{
"command": "pnpr@HEAD",
"mean": 2.10721949524,
"stddev": 0.12336471089935676,
"median": 2.07079023814,
"user": 2.7240209,
"system": 2.8582320599999993,
"min": 1.93819512564,
"max": 2.29044435564,
"times": [
2.29044435564,
2.04937324364,
2.13125473164,
2.04826468564,
1.93819512564,
2.2809248796399997,
1.99225433164,
2.01691912664,
2.2323572396399998,
2.09220723264
]
},
{
"command": "pnpr@main",
"mean": 2.13029700874,
"stddev": 0.11088794745449569,
"median": 2.12410481514,
"user": 2.7096764999999996,
"system": 2.8715024599999994,
"min": 2.00476043764,
"max": 2.33125673564,
"times": [
2.26838143164,
2.17378687064,
2.1807250316399998,
2.14431904464,
2.0549327686399996,
2.00787513864,
2.00476043764,
2.03304204264,
2.10389058564,
2.33125673564
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.63915098594,
"stddev": 0.013703113152152705,
"median": 0.6366680979400001,
"user": 0.36353716,
"system": 1.3169059199999997,
"min": 0.6216754079400001,
"max": 0.66609578694,
"times": [
0.64492625894,
0.6555043219400001,
0.6325241379400001,
0.62867085394,
0.62621507994,
0.6341456869400001,
0.66609578694,
0.6216754079400001,
0.6425618159400001,
0.6391905089400001
]
},
{
"command": "pacquet@main",
"mean": 0.68109158274,
"stddev": 0.13262462433050284,
"median": 0.6432113019400001,
"user": 0.36548976,
"system": 1.31622402,
"min": 0.61337555994,
"max": 1.05405480694,
"times": [
0.6580140549400001,
0.66367585494,
0.62511153894,
0.61337555994,
0.6402274759400001,
0.6200280369400001,
0.61826369294,
0.64619512794,
1.05405480694,
0.6719696779400001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.72143137084,
"stddev": 0.07712649781147377,
"median": 0.69994723244,
"user": 0.38935395999999994,
"system": 1.3661896199999999,
"min": 0.67943375594,
"max": 0.93917388294,
"times": [
0.7001910449400001,
0.6859347949400001,
0.70253122694,
0.7062120809400001,
0.69296463194,
0.69468824594,
0.67943375594,
0.93917388294,
0.6997034199400001,
0.71348062394
]
},
{
"command": "pnpr@main",
"mean": 0.69431951654,
"stddev": 0.027337816824800153,
"median": 0.6856030314400001,
"user": 0.38538986,
"system": 1.3465444199999999,
"min": 0.66495951694,
"max": 0.74311546094,
"times": [
0.7348315539400001,
0.7063543679400001,
0.68868445594,
0.66495951694,
0.67003028294,
0.6825216069400001,
0.74311546094,
0.70424906594,
0.67809462194,
0.6703542319400001
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.27295539074,
"stddev": 0.053657088092261676,
"median": 4.26383043204,
"user": 3.849369399999999,
"system": 3.32190576,
"min": 4.21679242954,
"max": 4.34551353154,
"times": [
4.24528226154,
4.34551353154,
4.328444215539999,
4.30323801254,
4.28237860254,
4.341992633539999,
4.21679242954,
4.2289988335399995,
4.21711426154,
4.21979912554
]
},
{
"command": "pacquet@main",
"mean": 4.24940951674,
"stddev": 0.03870110998110847,
"median": 4.25299379554,
"user": 3.8351555,
"system": 3.2784833600000005,
"min": 4.204317544539999,
"max": 4.33112529954,
"times": [
4.33112529954,
4.251498070539999,
4.25448952054,
4.261134441539999,
4.208366615539999,
4.282192568539999,
4.204317544539999,
4.259928576539999,
4.226117010539999,
4.2149255195399995
]
},
{
"command": "pnpr@HEAD",
"mean": 2.23150401624,
"stddev": 0.1263379673800546,
"median": 2.2284994730400003,
"user": 2.5791582999999996,
"system": 2.79452136,
"min": 2.05383742954,
"max": 2.46770931954,
"times": [
2.46770931954,
2.13106519254,
2.20963709454,
2.24736185154,
2.05383742954,
2.10901551054,
2.32051202654,
2.2934692715400002,
2.1449837565400003,
2.3374487095400003
]
},
{
"command": "pnpr@main",
"mean": 2.1959389228400004,
"stddev": 0.1394277754335978,
"median": 2.12894105254,
"user": 2.5441487999999994,
"system": 2.7937696599999997,
"min": 2.04170807254,
"max": 2.38687238154,
"times": [
2.37277995254,
2.2554341835400002,
2.13741515354,
2.04170807254,
2.12046695154,
2.07683716154,
2.08465149754,
2.38310848354,
2.38687238154,
2.10011539054
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.36865345304,
"stddev": 0.009063654016650923,
"median": 1.3696434591400002,
"user": 1.3153181999999997,
"system": 1.6919068199999998,
"min": 1.35680014014,
"max": 1.3843122811400002,
"times": [
1.3797252821400001,
1.3714285451400001,
1.3602916911400003,
1.3721682081400002,
1.35680014014,
1.36313386814,
1.35873999714,
1.3843122811400002,
1.37207614414,
1.36785837314
]
},
{
"command": "pacquet@main",
"mean": 1.3695039343400002,
"stddev": 0.036807044928156986,
"median": 1.3573701981400002,
"user": 1.3131155999999997,
"system": 1.69373932,
"min": 1.33905068114,
"max": 1.46914081814,
"times": [
1.3814429681400002,
1.3598064091400002,
1.46914081814,
1.3710176901400002,
1.35268015514,
1.3569550511400001,
1.3577853451400002,
1.33905068114,
1.3562323041400002,
1.35092792114
]
},
{
"command": "pnpr@HEAD",
"mean": 0.66667755764,
"stddev": 0.06388557734190364,
"median": 0.64653712614,
"user": 0.3379942,
"system": 1.26582822,
"min": 0.63975629814,
"max": 0.84749999714,
"times": [
0.64163050314,
0.6480609231400001,
0.64324252114,
0.64657245614,
0.63975629814,
0.84749999714,
0.64751096214,
0.64650179614,
0.66383695014,
0.64216316914
]
},
{
"command": "pnpr@main",
"mean": 0.6813457199400001,
"stddev": 0.10494337504302258,
"median": 0.6493346496400001,
"user": 0.3422843,
"system": 1.26448042,
"min": 0.6310128381400001,
"max": 0.9782507661400001,
"times": [
0.6605412741400001,
0.65747749714,
0.64859572814,
0.6319171331400001,
0.6491727031400001,
0.6310128381400001,
0.64098450714,
0.6660081561400001,
0.9782507661400001,
0.64949659614
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.0291496948,
"stddev": 0.0294714063564525,
"median": 3.0276070826000003,
"user": 1.74944876,
"system": 1.9740157800000002,
"min": 2.9886674556000004,
"max": 3.0962884726,
"times": [
3.0962884726,
3.0335772816,
3.0473300466,
3.0163136696,
3.0146512986,
3.0282244046,
3.0002020916,
2.9886674556000004,
3.0392524666000003,
3.0269897606000002
]
},
{
"command": "pacquet@main",
"mean": 3.0126478452999996,
"stddev": 0.028068842347811276,
"median": 3.0110214671,
"user": 1.7261979599999997,
"system": 1.9693018800000002,
"min": 2.9678919416,
"max": 3.0568685836,
"times": [
3.0089944946,
2.9990731676,
3.0043984896,
2.9678919416,
3.0390473796,
3.0130484396,
3.0422992096,
2.9770944126,
3.0568685836,
3.0177623346
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6686203848,
"stddev": 0.008108320898323845,
"median": 0.6669234326000001,
"user": 0.33423295999999997,
"system": 1.3121199799999999,
"min": 0.6586744996000001,
"max": 0.6859997296000001,
"times": [
0.6648001146000001,
0.6665931216000001,
0.6586836826000001,
0.6661021566,
0.6586744996000001,
0.6672537436000001,
0.6704580816000001,
0.6718630536000001,
0.6757756646,
0.6859997296000001
]
},
{
"command": "pnpr@main",
"mean": 0.6536582597,
"stddev": 0.006862187221975888,
"median": 0.6539750636000001,
"user": 0.33448506000000006,
"system": 1.26955118,
"min": 0.6390444306,
"max": 0.6632350006000001,
"times": [
0.6571351376000001,
0.6390444306,
0.6576457866000001,
0.6502141986000001,
0.6632350006000001,
0.6517992186000001,
0.6489488486000001,
0.6554780676,
0.6524720596000001,
0.6606098486
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6445235756,
"stddev": 0.0069782118619080655,
"median": 0.6436222995,
"user": 0.60111862,
"system": 0.15238727999999999,
"min": 0.632458528,
"max": 0.656445667,
"times": [
0.64120499,
0.64080717,
0.645013364,
0.64231867,
0.632458528,
0.644925929,
0.645129812,
0.656445667,
0.641794259,
0.655137367
]
},
{
"command": "pacquet@main",
"mean": 0.6478952597000001,
"stddev": 0.00472829409294992,
"median": 0.647757531,
"user": 0.60765822,
"system": 0.14983108,
"min": 0.641905168,
"max": 0.654325946,
"times": [
0.653001964,
0.646976003,
0.65198086,
0.642780746,
0.6429054200000001,
0.641905168,
0.648539059,
0.652050924,
0.654325946,
0.644486507
]
},
{
"command": "pnpr@HEAD",
"mean": 0.10780365264,
"stddev": 0.0013567734657886558,
"median": 0.107293761,
"user": 0.027325779999999997,
"system": 0.020991500000000003,
"min": 0.10676300500000001,
"max": 0.11194874,
"times": [
0.10699776300000001,
0.107176993,
0.107293761,
0.107769817,
0.10722558,
0.106853929,
0.107601878,
0.107206462,
0.107339394,
0.107009305,
0.10791964400000001,
0.106831886,
0.107291197,
0.10766025500000001,
0.107444469,
0.10676300500000001,
0.107482741,
0.107256266,
0.107072623,
0.10719795900000001,
0.107586575,
0.10924574000000001,
0.11173121200000001,
0.10918412200000001,
0.11194874
]
},
{
"command": "pnpr@main",
"mean": 0.10860303958333332,
"stddev": 0.002850987317674274,
"median": 0.10745437199999999,
"user": 0.026688186666666665,
"system": 0.022187163333333332,
"min": 0.106572148,
"max": 0.118963185,
"times": [
0.111830499,
0.106572148,
0.107452437,
0.107652653,
0.107484534,
0.106980343,
0.107456307,
0.107354406,
0.107155231,
0.107565905,
0.112012885,
0.107165931,
0.10732965500000001,
0.10745104500000001,
0.10754693700000001,
0.11192724300000001,
0.107524593,
0.10737189700000001,
0.10727049200000001,
0.112423984,
0.107338573,
0.10702990500000001,
0.107612162,
0.118963185
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 6.8944978816399995,
"stddev": 0.1924595405128218,
"median": 6.888990997840001,
"user": 4.05748322,
"system": 3.6084119800000005,
"min": 6.574456507840001,
"max": 7.19957789584,
"times": [
7.03705447984,
7.08170192584,
6.89803738484,
7.19957789584,
6.794710863840001,
6.87994461084,
6.574456507840001,
6.78849139584,
6.677755531840001,
7.01324821984
]
},
{
"command": "pacquet@main",
"mean": 6.784662545640001,
"stddev": 0.11508957383954949,
"median": 6.788013411340001,
"user": 4.03871542,
"system": 3.6166685800000002,
"min": 6.64951713984,
"max": 7.032282282840001,
"times": [
7.032282282840001,
6.83963646084,
6.73035546884,
6.81658558584,
6.64951713984,
6.68436358684,
6.65759534084,
6.84138294284,
6.759441236840001,
6.83546541084
]
},
{
"command": "pnpr@HEAD",
"mean": 4.85018597424,
"stddev": 0.09059819504339635,
"median": 4.81523101734,
"user": 2.8197857199999996,
"system": 3.1034021799999993,
"min": 4.7373466548400005,
"max": 5.03220565584,
"times": [
4.916627113840001,
4.77089364784,
4.7373466548400005,
4.804901640840001,
5.03220565584,
4.80208860584,
4.7975008928400005,
4.82556039384,
4.8685018518400005,
4.94623328484
]
},
{
"command": "pnpr@main",
"mean": 4.908559134740001,
"stddev": 0.09517510011163648,
"median": 4.91463374534,
"user": 2.8291432199999997,
"system": 3.0935365799999994,
"min": 4.758803670840001,
"max": 5.10352719684,
"times": [
4.85133467484,
4.90727334684,
4.87657682684,
4.80664520284,
4.92199414384,
4.957795922840001,
4.758803670840001,
4.9402586818400005,
5.10352719684,
4.961381679840001
]
}
]
} |
|
| Branch | pr/12840 |
| 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 | 2,231.50 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 668.62 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 666.68 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 107.80 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,107.22 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 4,850.19 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 721.43 ms |
|
Code review by qodo was updated up to the latest commit 13b86f5 |
|
Code review by qodo was updated up to the latest commit 13b86f5 |
1 similar comment
|
Code review by qodo was updated up to the latest commit 13b86f5 |
Summary
Allows standalone installs to replace an existing global pnpm entry when the package identity changes between
pnpmand@pnpm/exe. This fixes downgrading from pnpm v12 to pnpm v11 through the standalone installer without weakening bin-conflict checks for unrelated global packages.The same replacement alias handling is mirrored in pacquet.
Squash Commit Body
Checklist
pacquet/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 (Codex, GPT-5).
Summary by CodeRabbit
pnpmand@pnpm/exereplaces the correct existing global install.