Repository navigation
fix: materialize and hash link: dependencies in virtual-store slots - #13658
Conversation
A package whose peer dependency is satisfied by a `link:` records that edge in the lockfile but never got a symlink for it. Project-locally the omission is invisible: the slot sits under the importer's `node_modules`, so Node's upward walk reaches the importer's own copy of the link. Under the global virtual store the slot lives in the shared store, that walk never reaches the project, and the dependency is missing at runtime. The same edge was dropped from the GVS hash, so two projects linking different directories collapsed onto one slot and shared whichever symlink was written first. Scope by the resolved link target rather than by the project, so projects linking the same directory still share. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough
ChangesGlobal virtual store link dependency handling
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant InstallWithFreshLockfile
participant CreateVirtualStore
participant VirtualStoreLayout
participant create_symlink_layout
InstallWithFreshLockfile->>CreateVirtualStore: pass optional dependency selection
CreateVirtualStore->>VirtualStoreLayout: build layout with lockfile directory
VirtualStoreLayout->>VirtualStoreLayout: hash resolved link target
CreateVirtualStore->>create_symlink_layout: materialize slot dependencies
create_symlink_layout-->>CreateVirtualStore: create or remove optional link
✨ 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 GVS slots: materialize
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previously reported lossy-path behavior is deliberate, documented, and preserves cross-stack slot identity. Reviews (7): Last reviewed commit: "fix: rebuild dangling optional links" | Re-trigger Greptile |
Micro-Benchmark ResultsLinux |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #13658 +/- ##
========================================
Coverage 88.07% 88.08%
========================================
Files 590 604 +14
Lines 98784 98986 +202
========================================
+ Hits 87005 87189 +184
- Misses 11779 11797 +18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
pnpm/crates/deps-restorer/src/virtual_store_layout/tests.rs (1)
573-616: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAdd alias-sensitive slot coverage.
link_target_scopeincludes the alias because it changes the symlink path inside the slot. Add a test where two snapshots use different aliases for one resolved target and assert that their slot directories differ.As per path instructions, tests should be regression-proving and meaningful.
🤖 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/deps-restorer/src/virtual_store_layout/tests.rs` around lines 573 - 616, Extend snapshots_with_link_deps_get_a_slot_per_link_target with coverage for alias-sensitive paths: create two snapshots using different dependency aliases that resolve to the same link target, compute each slot through VirtualStoreLayout::slot_dir, and assert the slot directories differ. Keep the existing distinct-target assertion and use the snapshot/link helper symbols already present.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.
Inline comments:
In @.changeset/gvs-link-deps-in-slots.md:
- Around line 7-9: Update the changeset description to retain only the concise,
user-facing explanation of the fix and remove the internal layout details,
failure mechanism, lockfile examples, and global virtual store implementation
discussion. Keep the observable behavior and affected dependency-linking
scenario described in the existing release note.
---
Nitpick comments:
In `@pnpm/crates/deps-restorer/src/virtual_store_layout/tests.rs`:
- Around line 573-616: Extend
snapshots_with_link_deps_get_a_slot_per_link_target with coverage for
alias-sensitive paths: create two snapshots using different dependency aliases
that resolve to the same link target, compute each slot through
VirtualStoreLayout::slot_dir, and assert the slot directories differ. Keep the
existing distinct-target assertion and use the snapshot/link helper symbols
already present.
🪄 Autofix
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: 3a23ca56-22b2-4570-be5e-e94a1019dee1
📒 Files selected for processing (6)
.changeset/gvs-link-deps-in-slots.mdpnpm/crates/cli/tests/global_virtual_store.rspnpm/crates/deps-restorer/src/create_symlink_layout.rspnpm/crates/deps-restorer/src/create_symlink_layout/tests.rspnpm/crates/deps-restorer/src/virtual_store_layout.rspnpm/crates/deps-restorer/src/virtual_store_layout/tests.rs
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
- `[crate::create_symlink_layout]` is ambiguous between the function and its test module; CI documents with `-D warnings --document-private-items` so it failed there while a plain `cargo doc` passed. - Document why the link-target scope converts paths lossily, matching the rationale already recorded for `project_scope`. - Trim the changeset to the user-facing effect. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit 1f1cc31 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
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. 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.6359223556799996,
"stddev": 0.16025149572069927,
"median": 2.5826830206799998,
"user": 2.0467825399999997,
"system": 1.60080862,
"min": 2.37042254168,
"max": 2.90704723468,
"times": [
2.53405104668,
2.5873980886799997,
2.55268120668,
2.57796795268,
2.90704723468,
2.84797878468,
2.56162438868,
2.7463234866799997,
2.67372882568,
2.37042254168
]
},
{
"command": "pacquet@main",
"mean": 2.4747470850799997,
"stddev": 0.14034595798640023,
"median": 2.4071497756799998,
"user": 1.6064325400000001,
"system": 1.40721812,
"min": 2.36650152568,
"max": 2.75790188968,
"times": [
2.36650152568,
2.40153978168,
2.3907309356799997,
2.42012572868,
2.37097597168,
2.66212812168,
2.5827476316799998,
2.41275976968,
2.38205949468,
2.75790188968
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5101973868800003,
"stddev": 0.14362663696628897,
"median": 1.4793567871800002,
"user": 1.14108784,
"system": 1.18155822,
"min": 1.3594268736800001,
"max": 1.7625133316800001,
"times": [
1.55572247768,
1.3960393966800002,
1.7030158946800003,
1.4064529706800002,
1.3784535396800002,
1.5522606036800002,
1.7625133316800001,
1.4030269236800001,
1.58506185668,
1.3594268736800001
]
},
{
"command": "pnpr@main",
"mean": 1.4856529970800003,
"stddev": 0.14288647426886406,
"median": 1.4377017356800001,
"user": 1.1248190399999998,
"system": 1.20338502,
"min": 1.3577736076800002,
"max": 1.7526258246800002,
"times": [
1.3577736076800002,
1.36399411468,
1.4487314266800002,
1.6494971196800001,
1.38155098768,
1.3791521266800002,
1.6472941496800002,
1.44923856868,
1.42667204468,
1.7526258246800002
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.29540338520000003,
"stddev": 0.010903201932267187,
"median": 0.2943160943,
"user": 0.25599281999999995,
"system": 0.56118382,
"min": 0.2745612563,
"max": 0.3103542103,
"times": [
0.2884490573,
0.29100776429999997,
0.3071072203,
0.2927364423,
0.3103542103,
0.2958957463,
0.2745612563,
0.3003933273,
0.30602112929999997,
0.2875076983
]
},
{
"command": "pacquet@main",
"mean": 0.2667872477,
"stddev": 0.018795512075450476,
"median": 0.2622286378,
"user": 0.23067991999999998,
"system": 0.50751082,
"min": 0.24421987530000003,
"max": 0.3068162933,
"times": [
0.3068162933,
0.2920332813,
0.2664674603,
0.2593332673,
0.24421987530000003,
0.2605579193,
0.2638993563,
0.2583119083,
0.2653783353,
0.25085478029999997
]
},
{
"command": "pnpr@HEAD",
"mean": 0.2890502359,
"stddev": 0.010489873663219943,
"median": 0.28657929979999996,
"user": 0.22975441999999996,
"system": 0.56562102,
"min": 0.2766677343,
"max": 0.3060122933,
"times": [
0.3025297103,
0.3060122933,
0.2985061823,
0.2921684053,
0.2871411303,
0.2771392483,
0.2790939023,
0.2860174693,
0.2852262833,
0.2766677343
]
},
{
"command": "pnpr@main",
"mean": 0.2859939857,
"stddev": 0.01336150822829008,
"median": 0.2818687798,
"user": 0.23169071999999996,
"system": 0.56379402,
"min": 0.2721930373,
"max": 0.3203083693,
"times": [
0.2852004143,
0.3203083693,
0.2797246273,
0.2944967693,
0.2774140663,
0.2817889443,
0.2819486153,
0.2817282003,
0.2851368133,
0.2721930373
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.6249119749000007,
"stddev": 0.029425791631036886,
"median": 2.6162306390000003,
"user": 1.52884002,
"system": 1.3828929200000002,
"min": 2.594985798,
"max": 2.6901297920000005,
"times": [
2.594985798,
2.645178382,
2.5976681170000004,
2.6110668090000004,
2.6901297920000005,
2.6289070750000003,
2.647650167,
2.601072331,
2.6113692860000004,
2.621091992
]
},
{
"command": "pacquet@main",
"mean": 2.5987484669,
"stddev": 0.013600763370041426,
"median": 2.5985950115000005,
"user": 1.4919887200000002,
"system": 1.34714682,
"min": 2.5793538910000002,
"max": 2.6254171170000005,
"times": [
2.598913356,
2.5793538910000002,
2.6254171170000005,
2.606408688,
2.5938992610000002,
2.6110923030000004,
2.582578829,
2.5982766670000004,
2.601405837,
2.59013872
]
},
{
"command": "pnpr@HEAD",
"mean": 1.6862172873000003,
"stddev": 0.11855405832025918,
"median": 1.6762698630000001,
"user": 1.10358432,
"system": 1.1569331199999997,
"min": 1.504880676,
"max": 1.83996211,
"times": [
1.529552793,
1.83996211,
1.7936822890000002,
1.8183471750000002,
1.504880676,
1.768862414,
1.633905999,
1.6421153210000001,
1.620439691,
1.7104244050000001
]
},
{
"command": "pnpr@main",
"mean": 1.6218023551999998,
"stddev": 0.1386604731710847,
"median": 1.592354993,
"user": 1.0855876199999999,
"system": 1.1690465199999998,
"min": 1.45284812,
"max": 1.864094284,
"times": [
1.506797356,
1.45284812,
1.864094284,
1.549889287,
1.7235102770000001,
1.598163484,
1.746741589,
1.456570391,
1.732862262,
1.586546502
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.39752819446000004,
"stddev": 0.02020300931645038,
"median": 0.39505814506000003,
"user": 0.50984686,
"system": 0.7105164,
"min": 0.36796850506,
"max": 0.44747581506000006,
"times": [
0.36796850506,
0.39627991906000004,
0.38921981406000006,
0.39779585606,
0.39863950906,
0.40609129006000005,
0.38928306306000005,
0.44747581506000006,
0.38869180206000004,
0.39383637106
]
},
{
"command": "pacquet@main",
"mean": 0.38100873246000005,
"stddev": 0.02165056479995112,
"median": 0.37627692456000006,
"user": 0.50328396,
"system": 0.6506635000000001,
"min": 0.35142779306000005,
"max": 0.43138731106000006,
"times": [
0.37280740106000004,
0.36265222606,
0.37397625506000004,
0.35142779306000005,
0.37282639706000004,
0.38309579606000005,
0.38679272706,
0.43138731106000006,
0.37857759406,
0.39654382406000005
]
},
{
"command": "pnpr@HEAD",
"mean": 0.31506824576,
"stddev": 0.004694766793100149,
"median": 0.31490368106,
"user": 0.20172136,
"system": 0.5329598000000001,
"min": 0.30672352306,
"max": 0.32361714006000003,
"times": [
0.31464263106,
0.30672352306,
0.31516473106000004,
0.31250016806,
0.31769531306000004,
0.31716404406000004,
0.31898730706,
0.32361714006000003,
0.31359654706,
0.31059105306
]
},
{
"command": "pnpr@main",
"mean": 0.31951886636000004,
"stddev": 0.00888198496906527,
"median": 0.31634379456000006,
"user": 0.20914986,
"system": 0.5512659999999999,
"min": 0.30840883706000005,
"max": 0.33637722506,
"times": [
0.33637722506,
0.32782857706,
0.32635829506,
0.31715483706,
0.30840883706000005,
0.31355419806,
0.32455300706,
0.31031937406000004,
0.31553275206000003,
0.31510156106000003
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.77785995704,
"stddev": 0.028004533697235517,
"median": 1.7782558127399999,
"user": 0.8094870399999999,
"system": 0.7966021400000001,
"min": 1.73561683024,
"max": 1.82439492924,
"times": [
1.7585000442399998,
1.7788412512399998,
1.7762008112399998,
1.74268778424,
1.77818387724,
1.73561683024,
1.8137869712399999,
1.82439492924,
1.77832774824,
1.79205932324
]
},
{
"command": "pacquet@main",
"mean": 1.7699876117400002,
"stddev": 0.029775088344458592,
"median": 1.76440655074,
"user": 0.7847919399999999,
"system": 0.8047704400000001,
"min": 1.72716734724,
"max": 1.81313870324,
"times": [
1.79797893324,
1.79374803624,
1.8021702182400001,
1.75949019024,
1.76932291124,
1.72716734724,
1.74604442024,
1.74348949024,
1.7473258672399998,
1.81313870324
]
},
{
"command": "pnpr@HEAD",
"mean": 0.3572296434400001,
"stddev": 0.014796562374578198,
"median": 0.35911055074000003,
"user": 0.24665134000000002,
"system": 0.62232394,
"min": 0.33054048424000004,
"max": 0.38019826224000003,
"times": [
0.33054048424000004,
0.34341794524,
0.36028588424,
0.36701215024000006,
0.36875871124000004,
0.36793586424,
0.35128801024000006,
0.34492390524000005,
0.38019826224000003,
0.35793521724000005
]
},
{
"command": "pnpr@main",
"mean": 0.35099409094000006,
"stddev": 0.018953351742900266,
"median": 0.34895253774,
"user": 0.24432403999999996,
"system": 0.6035456399999999,
"min": 0.32725032224000006,
"max": 0.37949243524000004,
"times": [
0.37949243524000004,
0.37004111924000005,
0.37603034124000007,
0.35497303324000007,
0.34940936124000005,
0.34849571424000003,
0.34017885024000005,
0.32725032224000006,
0.33391655624000005,
0.33015317624
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.17768163590666666,
"stddev": 0.006431167362174902,
"median": 0.17610055364000002,
"user": 0.16525915333333335,
"system": 0.06754936666666667,
"min": 0.17027811964,
"max": 0.19026056364000002,
"times": [
0.19026056364000002,
0.17745448564,
0.17806785664,
0.18933729964,
0.17610055364000002,
0.17381452064,
0.17027811964,
0.17343889564,
0.17159135664,
0.17222671964,
0.17289028564,
0.18767764364,
0.17564038964,
0.17815468064,
0.17829116764
]
},
{
"command": "pacquet@main",
"mean": 0.18594589170249998,
"stddev": 0.012699074590553777,
"median": 0.18157436214,
"user": 0.17390894499999995,
"system": 0.0681971,
"min": 0.17198017564,
"max": 0.21962800064000002,
"times": [
0.17448715364,
0.17787984464,
0.21962800064000002,
0.17566847164000002,
0.18152595164000002,
0.19944223464,
0.19036358664,
0.19638442164,
0.19242589964,
0.19109768464000002,
0.19411742664,
0.17867053964000001,
0.18162277264,
0.17682434264,
0.17301576064000002,
0.17198017564
]
},
{
"command": "pnpr@HEAD",
"mean": 0.08746946960969697,
"stddev": 0.0011286587072284482,
"median": 0.08717846364,
"user": 0.02144494121212121,
"system": 0.008568363636363636,
"min": 0.08583691464,
"max": 0.09228654564,
"times": [
0.08583691464,
0.09228654564,
0.08636989564,
0.08658391764,
0.08845375964,
0.08983415164,
0.08646029564,
0.08767412364,
0.08725775264,
0.08796717463999999,
0.08704714664,
0.08713862864,
0.08689372964,
0.08717846364,
0.08815126164,
0.08744038563999999,
0.08675884664,
0.08732619164,
0.08756678363999999,
0.08694252063999999,
0.08712697664,
0.08718691964,
0.08818742864,
0.08694148964,
0.08688874964,
0.08812769764,
0.08680387064,
0.08787615464,
0.08692723264,
0.08765731264,
0.08706026264,
0.08744137764,
0.08709853464
]
},
{
"command": "pnpr@main",
"mean": 0.08749788042125001,
"stddev": 0.0008816990299068934,
"median": 0.08736733414,
"user": 0.02001735125,
"system": 0.00955821875,
"min": 0.08554498664,
"max": 0.09044469664,
"times": [
0.08807273364,
0.08554498664,
0.08777494364,
0.08716846464,
0.08709771164,
0.08729118564,
0.08781258564,
0.08748271564,
0.08690358764,
0.08757897564,
0.08806480764,
0.08729786764,
0.08690455864,
0.08745875964,
0.08765827464,
0.08691494864,
0.08768754064,
0.08738021364,
0.08735445464,
0.08717148064,
0.08741744264,
0.08724974764,
0.09044469664,
0.08952379764,
0.08696300964,
0.08734827264,
0.08723655163999999,
0.08774584864,
0.08820744563999999,
0.08652766164,
0.08608847664,
0.08855842564
]
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.9631811835666668,
"stddev": 0.18446330159853572,
"median": 0.9738289529,
"user": 0.8971054955555555,
"system": 0.19635352888888885,
"min": 0.7475901679,
"max": 1.2273975189000002,
"times": [
0.8339900229,
0.9738289529,
1.0110327759000002,
0.7904559429,
1.2221323829000001,
1.0687285879000001,
0.7475901679,
0.7934742999000001,
1.2273975189000002
]
},
{
"command": "pacquet@main",
"mean": 0.9187875739000001,
"stddev": 0.22677926078356617,
"median": 0.8250051499000001,
"user": 0.8550318288888888,
"system": 0.19752464000000003,
"min": 0.5994172369,
"max": 1.2223134529000002,
"times": [
0.9747422289000001,
1.2051762619000002,
1.1345470939,
0.5994172369,
0.8057173309,
0.8250051499000001,
0.6887341169,
0.8134352929,
1.2223134529000002
]
},
{
"command": "pnpm@HEAD",
"mean": 3.0196944219,
"stddev": 0.19464897062941502,
"median": 2.9832120558999997,
"user": 4.58511194,
"system": 0.27360052888888886,
"min": 2.7690383538999996,
"max": 3.3835854879,
"times": [
2.9521873109,
3.2873056898999997,
2.7690383538999996,
3.0085138819,
2.8708763619,
2.9863342359,
2.9832120558999997,
3.3835854879,
2.9361964189
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.53395724608,
"stddev": 0.12281406172572143,
"median": 4.47724010488,
"user": 1.78669022,
"system": 1.3762508,
"min": 4.45339907388,
"max": 4.84561848488,
"times": [
4.48554532288,
4.46893488688,
4.50748772688,
4.45339907388,
4.84561848488,
4.5512850258799995,
4.46514714188,
4.46545812688,
4.63412018788,
4.46257648288
]
},
{
"command": "pacquet@main",
"mean": 4.5882660914799995,
"stddev": 0.10828827593155252,
"median": 4.58855335288,
"user": 1.87396102,
"system": 1.4116542,
"min": 4.47516205488,
"max": 4.76584325288,
"times": [
4.5214597118799995,
4.65564699388,
4.76584325288,
4.69122152988,
4.47516205488,
4.4761796048799996,
4.49163855388,
4.66007630488,
4.65658341288,
4.48884949488
]
},
{
"command": "pnpr@HEAD",
"mean": 3.49876981368,
"stddev": 0.03761406819782511,
"median": 3.49046386088,
"user": 1.3021770199999998,
"system": 1.2826944,
"min": 3.45417022988,
"max": 3.55618587188,
"times": [
3.47528702788,
3.46273564988,
3.45417022988,
3.48813493088,
3.55618587188,
3.46858243288,
3.49279279088,
3.55512693188,
3.49901467788,
3.53566759288
]
},
{
"command": "pnpr@main",
"mean": 3.53883111808,
"stddev": 0.059967012978334545,
"median": 3.5130819123799997,
"user": 1.3874583199999997,
"system": 1.3455909,
"min": 3.4705127328799996,
"max": 3.6716581758799998,
"times": [
3.60093342288,
3.5138104758799997,
3.5089398368799998,
3.5123533488799996,
3.4705127328799996,
3.6716581758799998,
3.50340585088,
3.56481290088,
3.54746236988,
3.49442206588
]
}
]
} |
Represent resolved link targets as leaf nodes in the global virtual store graph. This lets changes propagate to every ancestor in both pnpm implementations. Keep optional link materialization aligned with selected dependency groups, including warm slots.
link: deps inside virtual-store slotslink: dependencies in virtual-store slots
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
pnpm/crates/deps-restorer/src/create_symlink_layout.rs (1)
61-61: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winNormalize the link target here as the hasher does.
lockfile_to_dep_graphhashespacquet_fs::lexical_normalize(&lockfile_dir.join(link_target)). This call site symlinks the unnormalized join. Both resolve to the same directory, so behavior is unchanged, but the slot identity and the materialized target are then derived from two different textual forms of one path. Use the same helper so a future change to the resolution rule stays applied in both places.♻️ Proposed change
- return symlink_package(&lockfile_dir.join(link_target), &symlink_path).map(drop); + let target = pacquet_fs::lexical_normalize(&lockfile_dir.join(link_target)); + return symlink_package(&target, &symlink_path).map(drop);🤖 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/deps-restorer/src/create_symlink_layout.rs` at line 61, Update the symlink target passed by the return path around symlink_package to wrap lockfile_dir.join(link_target) with pacquet_fs::lexical_normalize, matching the path normalization used by lockfile_to_dep_graph and keeping slot identity and materialized targets consistent.pnpm/crates/deps-restorer/src/virtual_store_layout.rs (1)
564-565: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCollect link targets inside the closure instead of re-scanning by string prefix.
build_children_withacceptsFnMut, so the closure can record the node when it creates it. This removes the second pass and the implicit assumption that no resolved snapshot key starts withlink:.♻️ Proposed refactor
for (snapshot_key, snapshot) in snapshots { let children = crate::deps_graph::build_children_with(snapshot, |alias, dep_ref| { if let Some(snapshot_key) = dep_ref.resolve(alias) { return Some(snapshot_key.to_string()); } let link_target = dep_ref.as_link_target()?; let lockfile_dir = lockfile_dir?; let resolved = pacquet_fs::lexical_normalize(&lockfile_dir.join(link_target)); - Some(format!("link:{}", resolved.to_string_lossy())) + let node = format!("link:{}", resolved.to_string_lossy()); + link_target_nodes.insert(node.clone()); + Some(node) }); - link_target_nodes - .extend(children.values().filter(|child_key| child_key.starts_with("link:")).cloned());🤖 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/deps-restorer/src/virtual_store_layout.rs` around lines 564 - 565, Update build_children_with to collect each link target directly inside its FnMut closure when the node is created, appending it to link_target_nodes at that point. Remove the later children.values() scan and starts_with("link:") filtering, while preserving collection of all and only the resolved link nodes.pnpm/crates/deps-restorer/src/create_virtual_dir_by_snapshot.rs (1)
66-68: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDocument a non-obvious contract or remove these comments.
Both comments restate their Boolean field.
pnpm/crates/deps-restorer/src/create_virtual_dir_by_snapshot.rs#L66-L68: remove the comment, or document the slot-layout invariant that requires this flag.pnpm/crates/deps-restorer/src/create_virtual_store.rs#L152-L154: remove the comment, or document the install-mode contract that determines this flag.As per coding guidelines, comments must not merely restate code.
🤖 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/deps-restorer/src/create_virtual_dir_by_snapshot.rs` around lines 66 - 68, Remove the Boolean-restating comments for include_optional_dependencies in create_virtual_dir_by_snapshot.rs (lines 66-68) and create_virtual_store.rs (lines 152-154), or replace them with comments documenting the respective slot-layout invariant and install-mode contract that determine the flag.Source: Coding guidelines
🤖 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 `@pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs`:
- Line 1380: Update the include_optional_dependencies assignment in the install
configuration so partial installs always pass true, regardless of whether
dependency_groups contains DependencyGroup::Optional; only a full install that
explicitly omits optional dependencies should pass false. Add a regression test
covering a partial install without the optional group and verify existing
optional child links are preserved.
---
Nitpick comments:
In `@pnpm/crates/deps-restorer/src/create_symlink_layout.rs`:
- Line 61: Update the symlink target passed by the return path around
symlink_package to wrap lockfile_dir.join(link_target) with
pacquet_fs::lexical_normalize, matching the path normalization used by
lockfile_to_dep_graph and keeping slot identity and materialized targets
consistent.
In `@pnpm/crates/deps-restorer/src/create_virtual_dir_by_snapshot.rs`:
- Around line 66-68: Remove the Boolean-restating comments for
include_optional_dependencies in create_virtual_dir_by_snapshot.rs (lines 66-68)
and create_virtual_store.rs (lines 152-154), or replace them with comments
documenting the respective slot-layout invariant and install-mode contract that
determine the flag.
In `@pnpm/crates/deps-restorer/src/virtual_store_layout.rs`:
- Around line 564-565: Update build_children_with to collect each link target
directly inside its FnMut closure when the node is created, appending it to
link_target_nodes at that point. Remove the later children.values() scan and
starts_with("link:") filtering, while preserving collection of all and only the
resolved link nodes.
🪄 Autofix
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: 5ca71276-ef80-4475-8607-bf0ac36c00cf
📒 Files selected for processing (19)
.changeset/gvs-link-deps-in-slots.mdpnpm/crates/cli/tests/global_virtual_store.rspnpm/crates/deps-restorer/src/create_symlink_layout.rspnpm/crates/deps-restorer/src/create_symlink_layout/tests.rspnpm/crates/deps-restorer/src/create_virtual_dir_by_snapshot.rspnpm/crates/deps-restorer/src/create_virtual_dir_by_snapshot/tests.rspnpm/crates/deps-restorer/src/create_virtual_store.rspnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rspnpm/crates/deps-restorer/src/create_virtual_store/tests.rspnpm/crates/deps-restorer/src/deps_graph.rspnpm/crates/deps-restorer/src/install_frozen_lockfile.rspnpm/crates/deps-restorer/src/install_package_by_snapshot.rspnpm/crates/deps-restorer/src/install_package_by_snapshot/tests.rspnpm/crates/deps-restorer/src/virtual_store_layout.rspnpm/crates/deps-restorer/src/virtual_store_layout/tests.rspnpm/crates/package-manager/src/install_with_fresh_lockfile.rspnpm11/deps/graph-builder/src/iteratePkgsForVirtualStore.tspnpm11/deps/graph-hasher/src/index.tspnpm11/deps/graph-hasher/test/lockfileToDepGraph.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- .changeset/gvs-link-deps-in-slots.md
|
Code review by qodo was updated up to the latest commit a5a3f38 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Summary
Fix
link:dependencies in global-virtual-store package slots across the TypeScript CLI and pacquet.--no-optional, including when reusing a warm global-virtual-store slot, while preserving transitive optionals during partial installs.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 (Codex, GPT-5).
Summary by CodeRabbit
Bug Fixes
link:dependencies when using the global virtual store.Tests