Repository navigation
fix(resolver): preserve exact version pins during update - #13027
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
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 (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR updates Rust and TypeScript pin detection to recognize bare ChangesExact pin preservation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PackageJson as package.json
participant UpdateLatest as update_latest
participant PinResolver as which_version_is_pinned
participant UpdatedPackageJson as updated_package.json
PackageJson->>UpdateLatest: dependency =100.0.0
UpdateLatest->>PinResolver: classify existing specifier
PinResolver-->>UpdateLatest: exact pin
UpdateLatest->>UpdatedPackageJson: write 101.0.0
Assessment against linked issues
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 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 |
Confidence Score: 5/5Targeted, well-tested fix that correctly handles the The change is narrow: one No files require special attention. Reviews (3): Last reviewed commit: "test(npm-resolver): keep the non-registr..." | Re-trigger Greptile |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13027 +/- ##
==========================================
+ Coverage 85.47% 85.48% +0.01%
==========================================
Files 502 502
Lines 80771 80825 +54
==========================================
+ Hits 69039 69095 +56
+ Misses 11732 11730 -2 ☔ 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.50514813606,
"stddev": 0.1442762043148726,
"median": 2.4681062026599996,
"user": 1.7096100200000002,
"system": 1.34708928,
"min": 2.3721607371599998,
"max": 2.80069873116,
"times": [
2.50749967316,
2.80069873116,
2.40911729716,
2.5764082621599997,
2.5172023371599996,
2.3721607371599998,
2.3849422801599998,
2.67997148016,
2.3747678301599997,
2.4287127321599997
]
},
{
"command": "pacquet@main",
"mean": 2.65662277136,
"stddev": 0.2508704781504169,
"median": 2.55202598366,
"user": 2.174778619999999,
"system": 1.72368268,
"min": 2.36506919016,
"max": 3.1324110081599996,
"times": [
2.5199495221599997,
2.52666777516,
2.8880238981599997,
2.50411351616,
3.1324110081599996,
2.61921204016,
2.96945919216,
2.46393737916,
2.57738419216,
2.36506919016
]
},
{
"command": "pnpr@HEAD",
"mean": 1.51142031436,
"stddev": 0.12840566314941906,
"median": 1.5168781636600002,
"user": 1.24511212,
"system": 1.3281196800000001,
"min": 1.34804835616,
"max": 1.71587410116,
"times": [
1.3944942471600001,
1.4931594351600002,
1.55319207416,
1.58289982316,
1.42131038916,
1.37547504616,
1.71587410116,
1.68915277916,
1.5405968921600002,
1.34804835616
]
},
{
"command": "pnpr@main",
"mean": 1.51332473616,
"stddev": 0.10703142142654504,
"median": 1.49211931516,
"user": 1.1919198199999999,
"system": 1.23399788,
"min": 1.40128437416,
"max": 1.69352985816,
"times": [
1.67218050616,
1.42462234716,
1.40822637816,
1.5396972801600002,
1.49969521516,
1.48454341516,
1.40128437416,
1.69352985816,
1.42705380816,
1.58241417916
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.25704921086000004,
"stddev": 0.0070329387461761554,
"median": 0.25570012506000006,
"user": 0.20531213999999998,
"system": 0.5404306600000002,
"min": 0.24560468356,
"max": 0.26613699956000003,
"times": [
0.25610780156,
0.25529244856000005,
0.26613699956000003,
0.25079748656000006,
0.25485005656000004,
0.24560468356,
0.25059316256,
0.26123566356000005,
0.26511552856000004,
0.26475827756000003
]
},
{
"command": "pacquet@main",
"mean": 0.26176003966000005,
"stddev": 0.010428442514692098,
"median": 0.25794185606000003,
"user": 0.21567593999999998,
"system": 0.53195596,
"min": 0.25147900856000005,
"max": 0.27851118656000007,
"times": [
0.26666832856000006,
0.25574188356000005,
0.25147900856000005,
0.25619973556000003,
0.25968397656000003,
0.25199155156,
0.26780279156000003,
0.27793262856000006,
0.27851118656000007,
0.25158930556000003
]
},
{
"command": "pnpr@HEAD",
"mean": 0.25477488846,
"stddev": 0.008551616203158358,
"median": 0.25566999356000003,
"user": 0.19737613999999998,
"system": 0.50919636,
"min": 0.24119354956000003,
"max": 0.26892398956,
"times": [
0.24492554556,
0.26892398956,
0.25924599256,
0.25863799856,
0.24654017256000002,
0.26308985956000003,
0.25385178956000004,
0.25462269856,
0.24119354956000003,
0.25671728856000003
]
},
{
"command": "pnpr@main",
"mean": 0.27056606835999997,
"stddev": 0.011767437161134328,
"median": 0.27021026306000007,
"user": 0.22977714000000002,
"system": 0.52997716,
"min": 0.25156858656000003,
"max": 0.28938800656,
"times": [
0.27144543056000003,
0.27081679856,
0.25992134256000005,
0.25156858656000003,
0.26960372756000006,
0.28395727656,
0.26231935156,
0.26455911356000006,
0.28938800656,
0.28208104956
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.7869980168799997,
"stddev": 0.08259069593107835,
"median": 2.75176735678,
"user": 1.8677447600000001,
"system": 1.40198262,
"min": 2.72012012578,
"max": 2.96638790078,
"times": [
2.72015624378,
2.72355157778,
2.7434595697799997,
2.74856562078,
2.7549690927799997,
2.72012012578,
2.8931391077799997,
2.96638790078,
2.8110259267799997,
2.78860500278
]
},
{
"command": "pacquet@main",
"mean": 2.93919306448,
"stddev": 0.05975384661479262,
"median": 2.92870979828,
"user": 2.2878991599999994,
"system": 1.5694548200000003,
"min": 2.86444025078,
"max": 3.0206176377799996,
"times": [
2.88263429678,
2.90856721278,
2.86444025078,
2.9951543347799996,
2.87028268478,
2.91662781878,
3.0169125217799997,
3.0206176377799996,
2.94079177778,
2.9759021087799997
]
},
{
"command": "pnpr@HEAD",
"mean": 1.75477536468,
"stddev": 0.16503639901348363,
"median": 1.75784218128,
"user": 1.5736559599999995,
"system": 1.7718041199999999,
"min": 1.4780973697800002,
"max": 2.0076662487799997,
"times": [
1.7633915847800001,
1.4780973697800002,
1.75229277778,
1.81801298878,
1.92517141878,
2.0076662487799997,
1.6335412017800002,
1.5788223357800002,
1.90158599678,
1.6891717237800001
]
},
{
"command": "pnpr@main",
"mean": 1.6489116118800002,
"stddev": 0.14464147115477585,
"median": 1.6649060257800001,
"user": 1.38200326,
"system": 1.43813282,
"min": 1.46063376678,
"max": 1.84288617478,
"times": [
1.6496109437800002,
1.68020110778,
1.84288617478,
1.49533108078,
1.84076451478,
1.69662333278,
1.78237496578,
1.50171559478,
1.46063376678,
1.5389746367800001
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6557028608600001,
"stddev": 0.03441596862054313,
"median": 0.65838601746,
"user": 0.8406257199999999,
"system": 0.7300351799999999,
"min": 0.59876150796,
"max": 0.70859748996,
"times": [
0.6346214869600001,
0.6173163409600001,
0.7029334919600001,
0.59876150796,
0.6689882209600001,
0.6639140709600001,
0.6441154679600001,
0.70859748996,
0.6649225669600001,
0.6528579639600001
]
},
{
"command": "pacquet@main",
"mean": 0.8297812508600002,
"stddev": 0.10610408805179257,
"median": 0.7924013164600001,
"user": 1.0690717199999997,
"system": 0.8363919799999999,
"min": 0.7258425839600001,
"max": 1.01989106796,
"times": [
0.7332846559600001,
0.7748595609600001,
0.7416826239600001,
0.7258425839600001,
0.8099430719600001,
0.7672372689600001,
0.8504979389600001,
0.88054642396,
0.9940273119600002,
1.01989106796
]
},
{
"command": "pnpr@HEAD",
"mean": 0.35952911156,
"stddev": 0.02657003674088712,
"median": 0.35375854346,
"user": 0.26408382,
"system": 0.6158811799999999,
"min": 0.32186799496,
"max": 0.40964911396000003,
"times": [
0.38662968496,
0.34552839996,
0.34818603596000003,
0.35535369296,
0.33466081696,
0.35216339396,
0.38525130296000004,
0.35600067896000004,
0.32186799496,
0.40964911396000003
]
},
{
"command": "pnpr@main",
"mean": 0.33771611566,
"stddev": 0.013868061946153955,
"median": 0.33785207695999997,
"user": 0.23544782,
"system": 0.55743258,
"min": 0.31983887096,
"max": 0.35781365696,
"times": [
0.34326992296000003,
0.35176305196,
0.32335411896,
0.33331508696,
0.34238906696,
0.31983887096,
0.35781365696,
0.32358069596,
0.32843938096,
0.35339730396
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.2115728690000003,
"stddev": 0.0443291337489704,
"median": 2.2001436531999996,
"user": 1.5304425799999999,
"system": 1.0387733399999999,
"min": 2.1336094422,
"max": 2.2749111922,
"times": [
2.1858995632,
2.2473895212,
2.1985388061999998,
2.2017485002,
2.1960891102,
2.1336094422,
2.2526061012,
2.2749111922,
2.2540745801999997,
2.1708618732
]
},
{
"command": "pacquet@main",
"mean": 2.107014285,
"stddev": 0.06295595547530898,
"median": 2.0969660827,
"user": 1.33637798,
"system": 0.97038034,
"min": 2.0400033152,
"max": 2.2389222142,
"times": [
2.2389222142,
2.1804198022,
2.0400033152,
2.0889661332,
2.0622998822,
2.1270315332,
2.1172243382,
2.1049660322,
2.0646277182,
2.0456818811999997
]
},
{
"command": "pnpr@HEAD",
"mean": 0.3154844546000001,
"stddev": 0.016157067102210834,
"median": 0.31629427270000005,
"user": 0.18320387999999999,
"system": 0.5745290399999998,
"min": 0.2903707682,
"max": 0.34863032320000004,
"times": [
0.34863032320000004,
0.3109281152,
0.31583918720000004,
0.2958252522,
0.2903707682,
0.3102052262,
0.3171180422,
0.3218677502,
0.32731052320000004,
0.31674935820000005
]
},
{
"command": "pnpr@main",
"mean": 0.32943023740000005,
"stddev": 0.015844661779207677,
"median": 0.3305595267,
"user": 0.22669928,
"system": 0.5674035399999999,
"min": 0.3050951692,
"max": 0.3583807652,
"times": [
0.33217170220000003,
0.3050951692,
0.30739970120000004,
0.33976974620000006,
0.3289473512,
0.3217990322,
0.33257520020000003,
0.3264088082,
0.3583807652,
0.34175489820000005
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.36498319474000007,
"stddev": 0.026595337464704976,
"median": 0.35581078524,
"user": 0.36463073999999995,
"system": 0.05594308,
"min": 0.33154833324,
"max": 0.41760351424000003,
"times": [
0.38472552524000003,
0.35665336924,
0.34535715424,
0.34240943124,
0.41760351424000003,
0.39419130024,
0.36964009424,
0.35496820124,
0.35273502424000003,
0.33154833324
]
},
{
"command": "pacquet@main",
"mean": 0.37771686674000005,
"stddev": 0.01888946504733287,
"median": 0.37630838574000003,
"user": 0.36784764,
"system": 0.06408768,
"min": 0.33295344524,
"max": 0.40018345524,
"times": [
0.33295344524,
0.39078290224,
0.37633961924,
0.37627715224,
0.39413717824,
0.37014639624,
0.37571169924000003,
0.37073693724,
0.40018345524,
0.38989988224
]
},
{
"command": "pnpr@HEAD",
"mean": 0.08489380986499998,
"stddev": 0.004226161492899068,
"median": 0.08561507924,
"user": 0.01773778375,
"system": 0.00990479125,
"min": 0.07681168924,
"max": 0.09218529124000001,
"times": [
0.08780934524,
0.09066207824,
0.08547137924,
0.08671096824,
0.08540076624,
0.09191864024,
0.08838889424,
0.09218529124000001,
0.08575877924,
0.09091482324,
0.08196707124,
0.07876291824000001,
0.08184093424,
0.08636209324,
0.08583119624,
0.09068130224,
0.08682277924,
0.08593599224,
0.08832754924,
0.08711682224,
0.08467372924,
0.08650438124,
0.08264087724000001,
0.08281835124,
0.08442782724,
0.07994988924,
0.08152688324,
0.08137730224,
0.08189468524,
0.07681168924,
0.07718788624,
0.07791879024000001
]
},
{
"command": "pnpr@main",
"mean": 0.08285851261142857,
"stddev": 0.004347675251213235,
"median": 0.08167449124000001,
"user": 0.016394154285714287,
"system": 0.009310303999999998,
"min": 0.07667207624,
"max": 0.09078612124,
"times": [
0.07963165024,
0.07732729824,
0.07696323424,
0.07770320524,
0.07667207624,
0.07880943424,
0.08139539624,
0.08163283324000001,
0.07771640024,
0.08122068824,
0.07727608224,
0.07828416724000001,
0.08821590924,
0.08080016824,
0.08309847824,
0.08293715524,
0.07949752924,
0.08115168924,
0.09077043124,
0.09078612124,
0.08479866524,
0.08158847924,
0.08411026024,
0.08626091324,
0.08771116024,
0.09014443524,
0.08772660924,
0.08902956724,
0.08586050024,
0.08503096124000001,
0.08989437524,
0.08167449124000001,
0.08169343724,
0.08082707824,
0.08180706024
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.5772668408,
"stddev": 0.08496796833495027,
"median": 4.5429353376999995,
"user": 2.0978298799999995,
"system": 1.59878672,
"min": 4.5018579607,
"max": 4.7796669417,
"times": [
4.5530800997,
4.5742343577,
4.5250309597000005,
4.5289866557,
4.5327905757,
4.5765669847,
4.5018579607,
4.5308115817,
4.6696422907,
4.7796669417
]
},
{
"command": "pacquet@main",
"mean": 4.7149803329,
"stddev": 0.15728556504943186,
"median": 4.6838150772,
"user": 2.3353614799999995,
"system": 1.7156379199999996,
"min": 4.4951883127,
"max": 5.0045593597,
"times": [
4.5753221257000005,
4.4951883127,
4.9336277377,
4.6396065797,
4.6301198937,
4.7011504397,
5.0045593597,
4.6683263467,
4.8025987257,
4.6993038077
]
},
{
"command": "pnpr@HEAD",
"mean": 3.6929517371000005,
"stddev": 0.11898581436871188,
"median": 3.6523355497,
"user": 1.57857118,
"system": 1.5467649199999998,
"min": 3.5796328877,
"max": 3.9857265357,
"times": [
3.6830327337,
3.5796328877,
3.8052304527,
3.6840523817,
3.6352131177,
3.6310818307000003,
3.6208763317,
3.6668343397000003,
3.6378367597,
3.9857265357
]
},
{
"command": "pnpr@main",
"mean": 3.672558557,
"stddev": 0.14100667667970648,
"median": 3.6290687527000003,
"user": 1.7190589799999998,
"system": 1.64971032,
"min": 3.5194585087,
"max": 3.9443802037,
"times": [
3.6183598717,
3.6376249057,
3.9015598807000003,
3.5613316227,
3.6205125997,
3.5800909457000003,
3.6974519167000004,
3.5194585087,
3.6448151147,
3.9443802037
]
}
]
} |
|
| Branch | pr/13027 |
| 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,754.78 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 315.48 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 359.53 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 84.89 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,511.42 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,692.95 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 254.77 ms |
bfbc408 to
4f7f374
Compare
Code Review by Qodo
Context used✅ Tickets:
🎫 `pnpm update` updates some version ranges inaccurately 🎫 pnpm update -S to write actual version to every dependencies✅ Compliance rules (platform):
18 rules 1. = pins drop operator
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
The `=` classification change also treats a `file:` path whose only range-like element is a bare `x.y.z` as an exact pin, so the fixture `file:../dep-of-pkg-with-1-dep-100.0.0.tgz` (dashes now count as range elements) classifies as no-pin and let `add_explicit_range_ignores_pin_from_non_registry_prev` pass even with the `is_registry_style_specifier` gate removed. Switch it to `file:../deps/100.0.0.tgz`, which still classifies as a patch pin in both stacks, so the test fails without the gate again. Refresh the now-stale rationale comments in the test and in add.rs. Add a `1.0.0||` row to the TypeScript whichVersionIsPinned table so both stacks document that a dangling `||` separator is not a single pin.
|
Code review by qodo was updated up to the latest commit 52db503 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
Summary
pnpm updaterewrites an exact version pin that uses the=operator (=3.5.1) to a caret range (^3.5.1):whichVersionIsPinnedhas no case for the=operator, so the spec falls through to the default pinning. A bare=now classifies the same way as the plain version it prefixes (=3.5.1→ exact pin, written back as the bare3.5.2;=x.y.zandx.y.zare the same range, and the bare form is node-semver's canonical spelling — npm's--save-exactwrites it the same way).The
*→^x.y.zhalf of the issue report is intentional behavior (#5436) and is not changed here.The Rust port gets the same fix, plus its comparator scan now counts dangling
||/-separators as range elements the way semver-utils does — otherwise=1.2.3||(a valid range) would classify as a pin in Rust but not in TypeScript.Side effects of the classification change:
pnpm add foo@=1.2.3now records1.2.3instead of^1.2.3(matchingpnpm add [email protected]), and withsave-workspace-protocol: rollingaworkspace:=x.y.zdependency updates toworkspace:*instead ofworkspace:^.Closes #12745
Testing
whichVersionIsPinnedtable rows (=1.0.0→patch,=1.0→minor,=1→major,npm:foo@=1.0.0→patch, and>=/^=/~=/dangling-||staying unpinned). They fail onmainwithundefinedinstead of the pin.("=1.2.3", None)row flips toSome(Patch)plus the same new rows, and a CLI e2e (update_latest_preserves_equals_pin_as_exact) provesupdate --lateston=100.0.0writes101.0.0instead of^101.0.0.cargo fmt/clippy/eslint/typecheck clean.Squash Commit Body
Checklist
pnpm/port.pnpm changeset) if this PR changes any published package. Keep it short and written for pnpm users — it becomes a release note.Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
=operator during updates, instead of rewriting them into caret ranges.npm:-scoped=...specs as exact pins and updates them to the latest matching exact version.=and malformed range edge cases, ensuring correct “pinned vs not pinned” classification.pacquet update --latestcovering=100.0.0behavior.=cases and updated expectations for edge inputs.