Repository navigation
Conversation
Seed optional peers from workspace package versions and omit empty deprecation metadata. Preserve valid lockfile pins while dedupe re-resolves dependency edges. Closes #13430.
📝 WalkthroughWalkthroughPacquet now resolves optional peers from local workspace versions, preserves valid lockfile pins during ChangesPacquet parity fixes
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant WorkspaceResolver
participant WorkspaceTreeCtx
participant ImporterHoistState
participant OptionalPeer
WorkspaceResolver->>WorkspaceTreeCtx: record workspace package version
ImporterHoistState->>WorkspaceTreeCtx: collect newly seen versions
WorkspaceTreeCtx-->>ImporterHoistState: update preferred versions
ImporterHoistState->>OptionalPeer: resolve optional peer from workspace version
Assessment against linked issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoFix pacquet resolution parity for optional peers and dedupe lockfile pin reuse
AI Description
Diagram
High-Level Assessment
Files changed (9)
|
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains within the scope of an eligible previous review thread. Reviews (2): Last reviewed commit: "perf(resolving-deps-resolver): avoid rep..." | Re-trigger Greptile |
Micro-Benchmark ResultsLinux |
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1. Changeset missing pnpm entry
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13431 +/- ##
==========================================
+ Coverage 87.60% 87.62% +0.01%
==========================================
Files 545 545
Lines 93698 93794 +96
==========================================
+ Hits 82085 82184 +99
+ Misses 11613 11610 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In @.changeset/mui-optional-peer-parity.md:
- Line 5: Update the release note in mui-optional-peer-parity.md to document
that pnpm dedupe --check now retains valid lockfile pins, alongside the existing
behavior changes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 99c1b741-ace9-41ec-849b-3b6eae076e4b
📒 Files selected for processing (9)
.changeset/mui-optional-peer-parity.mdpnpm/crates/cli/src/cli_args/dedupe.rspnpm/crates/cli/tests/dedupe.rspnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rspnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rspnpm/crates/package-manager/src/install_with_fresh_lockfile.rspnpm/crates/package-manager/src/update.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rspnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time). Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.51008632826,
"stddev": 0.1299573940721753,
"median": 2.46961713636,
"user": 1.7827052399999996,
"system": 1.40412106,
"min": 2.37811785386,
"max": 2.7424002398600003,
"times": [
2.6236229138600002,
2.42611605286,
2.37811785386,
2.40628012586,
2.47394925186,
2.47878137786,
2.46528502086,
2.7424002398600003,
2.69788720086,
2.40842324486
]
},
{
"command": "pacquet@main",
"mean": 2.6252730274600005,
"stddev": 0.15107276778364712,
"median": 2.63515783936,
"user": 2.14898614,
"system": 1.69929286,
"min": 2.41568893086,
"max": 2.90321572286,
"times": [
2.6287463298600002,
2.65678703186,
2.64156934886,
2.61875656086,
2.90321572286,
2.77997260886,
2.45663930486,
2.46248008286,
2.68887435286,
2.41568893086
]
},
{
"command": "pnpr@HEAD",
"mean": 1.54562810676,
"stddev": 0.1438051614416517,
"median": 1.51936477986,
"user": 1.10252844,
"system": 1.2121102599999998,
"min": 1.36016506286,
"max": 1.75445795086,
"times": [
1.47052004186,
1.37862373086,
1.75445795086,
1.49117284886,
1.41472615286,
1.6926344548599999,
1.54755671086,
1.66075048586,
1.68567362786,
1.36016506286
]
},
{
"command": "pnpr@main",
"mean": 1.65843906086,
"stddev": 0.12018436274549064,
"median": 1.67645493236,
"user": 1.1924650399999996,
"system": 1.2289883599999998,
"min": 1.37607353386,
"max": 1.8189097898600002,
"times": [
1.7301848288600001,
1.58111740086,
1.6509997088600001,
1.73791140886,
1.6546102868600001,
1.61701339686,
1.8189097898600002,
1.71927067586,
1.37607353386,
1.6982995778599999
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.27715125378000005,
"stddev": 0.009549729264705464,
"median": 0.27539304848,
"user": 0.20921868000000005,
"system": 0.55338772,
"min": 0.26442799948000006,
"max": 0.29465820748000005,
"times": [
0.28684824148000004,
0.27170307848,
0.26884109248000004,
0.26442799948000006,
0.27367730248000005,
0.27710879448000003,
0.29465820748000005,
0.28663158248000004,
0.27801100548,
0.26960523348000004
]
},
{
"command": "pacquet@main",
"mean": 0.27393491518,
"stddev": 0.009900816908080513,
"median": 0.27439534648,
"user": 0.23933717999999998,
"system": 0.54659892,
"min": 0.25558345048000003,
"max": 0.28898566148000004,
"times": [
0.27678289048000004,
0.28276746448000006,
0.28898566148000004,
0.26145185648,
0.27016169248000005,
0.27534605948,
0.25558345048000003,
0.27315105948,
0.27344463348000003,
0.28167438348
]
},
{
"command": "pnpr@HEAD",
"mean": 0.28229201148,
"stddev": 0.01616313028487377,
"median": 0.28419096498000007,
"user": 0.22817378000000002,
"system": 0.55551062,
"min": 0.26042730348000004,
"max": 0.31177876448,
"times": [
0.28580501348000004,
0.31177876448,
0.28257691648000005,
0.29534687648,
0.29091140248,
0.26042730348000004,
0.26147271548000006,
0.27488112348000004,
0.26876163248,
0.29095836648000006
]
},
{
"command": "pnpr@main",
"mean": 0.31301944938000004,
"stddev": 0.023455154203379625,
"median": 0.30626695998000003,
"user": 0.26821158000000006,
"system": 0.56653062,
"min": 0.28711863448,
"max": 0.36695810648000005,
"times": [
0.30396253248000005,
0.32238370648000003,
0.28711863448,
0.30299310548,
0.30857138748,
0.33368780748000004,
0.29454088448000004,
0.29541241748,
0.36695810648000005,
0.31456591148
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.9147250008600003,
"stddev": 0.07056874808784025,
"median": 2.91689216576,
"user": 2.0549454999999996,
"system": 1.4671533799999996,
"min": 2.82515490976,
"max": 3.07199019476,
"times": [
2.85820442276,
2.8706743717600003,
3.07199019476,
2.9599075207600003,
2.94676332076,
2.9258634217600004,
2.92554821676,
2.82515490976,
2.8549075147600003,
2.90823611476
]
},
{
"command": "pacquet@main",
"mean": 2.86871772696,
"stddev": 0.05518220414124926,
"median": 2.85922387926,
"user": 1.9969136000000003,
"system": 1.4818389799999998,
"min": 2.7959710487600002,
"max": 2.9713076327600003,
"times": [
2.8679388127600003,
2.8457316997600004,
2.89367348276,
2.81856875976,
2.9713076327600003,
2.9343994007600003,
2.8924498957600004,
2.8166275907600005,
2.85050894576,
2.7959710487600002
]
},
{
"command": "pnpr@HEAD",
"mean": 1.6477406197600004,
"stddev": 0.14068188760602976,
"median": 1.62258011976,
"user": 1.2358562000000002,
"system": 1.3054099799999999,
"min": 1.43781101676,
"max": 1.89306893576,
"times": [
1.43781101676,
1.71998725176,
1.47911034776,
1.59847671376,
1.79276990676,
1.74015911076,
1.64530072976,
1.89306893576,
1.57086267476,
1.5998595097600001
]
},
{
"command": "pnpr@main",
"mean": 1.6233838515600003,
"stddev": 0.11409822408251338,
"median": 1.61364817526,
"user": 1.279516,
"system": 1.40643828,
"min": 1.43682111076,
"max": 1.77161722776,
"times": [
1.77161722776,
1.52115577376,
1.71813153376,
1.55639417676,
1.52936711376,
1.64111050876,
1.58618584176,
1.72365443476,
1.43682111076,
1.74940079376
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.7082828324199999,
"stddev": 0.051895999571743394,
"median": 0.6896909842200001,
"user": 0.8757735799999999,
"system": 0.7685334400000001,
"min": 0.64923367672,
"max": 0.79822958172,
"times": [
0.75945037272,
0.72933131072,
0.76543624872,
0.79822958172,
0.68272137972,
0.69666058872,
0.67857407072,
0.64923367672,
0.6492792227199999,
0.67391187172
]
},
{
"command": "pacquet@main",
"mean": 0.75887520612,
"stddev": 0.07772850922612767,
"median": 0.75001220572,
"user": 0.9395111799999999,
"system": 0.7889580400000001,
"min": 0.66148145672,
"max": 0.91139486772,
"times": [
0.71625096172,
0.75987935272,
0.71001485472,
0.75230453072,
0.70084081872,
0.74853534672,
0.75148906472,
0.87656080672,
0.91139486772,
0.66148145672
]
},
{
"command": "pnpr@HEAD",
"mean": 0.33034334022,
"stddev": 0.009929042078640213,
"median": 0.32996546872000004,
"user": 0.23767458000000002,
"system": 0.5609390399999998,
"min": 0.31030213272,
"max": 0.34513834872000004,
"times": [
0.34513834872000004,
0.32996558472000004,
0.32886396772000004,
0.32996535272000005,
0.34094280872000005,
0.33504958872,
0.33548250472,
0.32696968672000004,
0.31030213272,
0.32075342672
]
},
{
"command": "pnpr@main",
"mean": 0.31343928902,
"stddev": 0.01734391181913936,
"median": 0.31500064472,
"user": 0.21815768000000002,
"system": 0.53271014,
"min": 0.28750879672,
"max": 0.34731616472000004,
"times": [
0.32434587972,
0.31534357772000005,
0.31037601272000004,
0.32306849172,
0.29586667472,
0.28750879672,
0.29586879972,
0.31465771172,
0.34731616472000004,
0.32004078072000003
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.9958528472999997,
"stddev": 0.03393348060422392,
"median": 1.9846493410000001,
"user": 1.0807159999999998,
"system": 0.8018279399999999,
"min": 1.9542308935000001,
"max": 2.0527009295000003,
"times": [
1.9626201085000001,
1.9748396775000001,
1.9733972675000002,
2.0130421605,
1.9836831295000001,
1.9856155525,
2.0122191185,
2.0461796355,
2.0527009295000003,
1.9542308935000001
]
},
{
"command": "pacquet@main",
"mean": 1.9787441989,
"stddev": 0.038324840783706626,
"median": 1.9922131105000003,
"user": 1.0620675,
"system": 0.78508254,
"min": 1.9102892985,
"max": 2.0293921855,
"times": [
1.9151377805000003,
1.9898465785000001,
1.9102892985,
1.9704919805,
2.0071694785000003,
1.9766055655,
1.9956603805000002,
1.9945796425000002,
1.9982690985000002,
2.0293921855
]
},
{
"command": "pnpr@HEAD",
"mean": 0.322418855,
"stddev": 0.01716008018820972,
"median": 0.317572858,
"user": 0.2211355,
"system": 0.56986464,
"min": 0.3057092375,
"max": 0.3542868055,
"times": [
0.3071418675,
0.3057092375,
0.32178858250000003,
0.31920252650000003,
0.34638246850000004,
0.3159431895,
0.3080106085,
0.3108797595,
0.3348435045,
0.3542868055
]
},
{
"command": "pnpr@main",
"mean": 0.3136851325,
"stddev": 0.017498492152210374,
"median": 0.31023814400000005,
"user": 0.19711489999999998,
"system": 0.5476950400000001,
"min": 0.2932445195,
"max": 0.34587140450000003,
"times": [
0.34587140450000003,
0.3031660215,
0.3146802275,
0.3079138555,
0.3279940565,
0.33520607950000003,
0.29922389650000003,
0.2932445195,
0.2969888315,
0.31256243250000004
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.41391206544000003,
"stddev": 0.03047020217383184,
"median": 0.4105933727400001,
"user": 0.40375522,
"system": 0.060925240000000006,
"min": 0.37460865524000003,
"max": 0.46943148124000006,
"times": [
0.38780746824000006,
0.40541413424000006,
0.44614970124000003,
0.41577261124000003,
0.42276783324000006,
0.37460865524000003,
0.37909022724,
0.40188144124,
0.46943148124000006,
0.43619710124000005
]
},
{
"command": "pacquet@main",
"mean": 0.42022346874000005,
"stddev": 0.021514680400238653,
"median": 0.42273039324000006,
"user": 0.4028769199999999,
"system": 0.07207134,
"min": 0.39221494024000003,
"max": 0.46126586024000005,
"times": [
0.39703341824000005,
0.42456312924000006,
0.4012152452400001,
0.46126586024000005,
0.42089765724000006,
0.43545694524000006,
0.39221494024000003,
0.43069388224000005,
0.40468698224000005,
0.43420662724000003
]
},
{
"command": "pnpr@HEAD",
"mean": 0.09103037934000001,
"stddev": 0.0030039014415119683,
"median": 0.09073685724,
"user": 0.022960886666666666,
"system": 0.011084606666666663,
"min": 0.08584878424,
"max": 0.09862796524,
"times": [
0.09307982024,
0.09218484224,
0.09379250424,
0.09224500524,
0.08939616323999999,
0.09087103524,
0.09056411624,
0.08750502724,
0.08960190124,
0.08943488624,
0.09019978824,
0.08705807324,
0.09060267924,
0.08584878424,
0.08739177324,
0.08640136424,
0.08850048424,
0.09862796524,
0.09551063524,
0.09162679024,
0.09165696724,
0.09022354324,
0.09129000424,
0.09156872024,
0.09391681924,
0.08885608424,
0.09175799824,
0.09738380824,
0.08997018624,
0.09384361024
]
},
{
"command": "pnpr@main",
"mean": 0.09068341103310346,
"stddev": 0.0032411943297709976,
"median": 0.09025663624,
"user": 0.021644219999999995,
"system": 0.011753286896551722,
"min": 0.08483602324,
"max": 0.09719979024,
"times": [
0.09719979024,
0.09412426024,
0.09138933224,
0.08947814724,
0.08959326524,
0.08483602324,
0.08934776124,
0.09025663624,
0.08577788924,
0.08705626924,
0.08865676924,
0.08953876224,
0.08763478124,
0.08690305024,
0.09565815324,
0.09465965024,
0.09164225024,
0.09005943424,
0.09159285724,
0.09077846024,
0.08743055524,
0.09204734324,
0.09400093824,
0.09075587824,
0.08733362424,
0.08905573124,
0.09453841224,
0.09157272824,
0.09690016624
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.64532417678,
"stddev": 0.14465535935691878,
"median": 4.58961539078,
"user": 1.9746338599999997,
"system": 1.5604627199999999,
"min": 4.48531391728,
"max": 4.88081442828,
"times": [
4.88081442828,
4.59141958728,
4.54281475328,
4.52613428528,
4.79059991928,
4.54070286228,
4.5878111942799995,
4.48531391728,
4.65196159628,
4.85566922428
]
},
{
"command": "pacquet@main",
"mean": 4.7704231344800005,
"stddev": 0.19471535245282445,
"median": 4.80557215878,
"user": 2.2553975599999996,
"system": 1.6760050199999998,
"min": 4.50216425028,
"max": 5.05319158928,
"times": [
4.87692581928,
4.95004113228,
4.50216425028,
4.89107011028,
4.73421849828,
4.93312668528,
5.05319158928,
4.54724196628,
4.62899002528,
4.58726126828
]
},
{
"command": "pnpr@HEAD",
"mean": 3.6827898459800013,
"stddev": 0.1120912188959731,
"median": 3.63686444478,
"user": 1.67068756,
"system": 1.65601882,
"min": 3.56640721128,
"max": 3.8941215422799997,
"times": [
3.63438862428,
3.73956518628,
3.85003013028,
3.8941215422799997,
3.63934026528,
3.6942099492800002,
3.60261392328,
3.56640721128,
3.59031726728,
3.61690436028
]
},
{
"command": "pnpr@main",
"mean": 3.62260708258,
"stddev": 0.11152827516373476,
"median": 3.60386398128,
"user": 1.38999466,
"system": 1.3969883200000002,
"min": 3.50040299328,
"max": 3.8367834582800002,
"times": [
3.52212587428,
3.77292083828,
3.8367834582800002,
3.65468391828,
3.50040299328,
3.61939339428,
3.65757982928,
3.5497772742800002,
3.58833456828,
3.52406867728
]
}
]
} |
|
Addressed the review and benchmark regression in ea4eedd.
The benchmark fixture setup used the repository-pinned pnpm 12.0.0-alpha.21; the timed clients were the separately built pacquet revisions shown above. Written by an agent (Codex, GPT-5). |
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/resolving-deps-resolver/src/resolve_dependency_tree.rs (1)
1813-1825: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winDo not exclude relative workspace selectors.
Line 1815 filters out
workspace:./fooandworkspace:../foo, so their package identities never seed preferred versions for optional-peer hoisting. Exclude only the exact self-reference,workspace:..Proposed fix
- specifier.starts_with("workspace:") && !specifier.starts_with("workspace:.") + specifier.starts_with("workspace:") && specifier != "workspace:."As per path instructions, pacquet must preserve pnpm’s observable resolver behavior.
🤖 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/resolving-deps-resolver/src/resolve_dependency_tree.rs` around lines 1813 - 1825, Update the workspace selector condition in the preferred-version insertion block to exclude only the exact self-reference selector “workspace:.” while allowing relative selectors such as “workspace:./foo” and “workspace:../foo” to seed workspace_package_versions. Preserve the existing manifest name/version checks and insertion behavior.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/resolving-deps-resolver/src/resolve_dependency_tree.rs`:
- Around line 1813-1825: Update the workspace selector condition in the
preferred-version insertion block to exclude only the exact self-reference
selector “workspace:.” while allowing relative selectors such as
“workspace:./foo” and “workspace:../foo” to seed workspace_package_versions.
Preserve the existing manifest name/version checks and insertion behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e6560d40-de17-4143-9899-7325a45b0944
📒 Files selected for processing (3)
.changeset/mui-optional-peer-parity.mdpnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rspnpm/crates/resolving-deps-resolver/src/resolve_importer.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- .changeset/mui-optional-peer-parity.md
|
Code review by qodo was updated up to the latest commit ea4eedd |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
| Project | pnpm's project |
| Branch | pr/13431 |
| 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,437.81 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 305.71 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 310.30 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 85.85 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,360.17 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,566.41 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 260.43 ms |
|
Follow-up on the integrated benchmark alert: my earlier local comparison used the wrong scenario ( Results:
No further code change was needed after ea4eedd. The prior 318.34 ms sample was not reproduced. Written by an agent (Codex, GPT-5). |
Summary
Closes #13430.
Align pacquet's MUI resolution and dedupe behavior with TypeScript pnpm:
MUI validation used TypeScript pnpm 11.17.0 and pacquet 12.0.0-alpha.21 with package-manager switching disabled. Fresh lockfiles were byte-identical, both implementations reported the same dedupe changes on a fresh lockfile, and both accepted MUI's committed deduped lockfile.
Squash Commit Body
Checklist
pnpm/port with it.pacquet.Written by an agent (Codex, GPT-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
pnpm dedupe --checkpreserves valid existing lockfile pins without rewritingpnpm-lock.yaml.deprecatedfield no longer write an empty deprecation entry to the generated lockfile.