Skip to content

fix(install): repair an incomplete global virtual store slot the current lockfile records - #16649

Merged
zkochan merged 3 commits into
mainfrom
fix-16642
Oct 6, 2026
Merged

zkochan merged 3 commits into
mainfrom
fix-16642

Conversation

@zkochan

@zkochan zkochan commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Summary

With enableGlobalVirtualStore, the warm-slot probe skipped the completion-marker and child-link checks for any slot the project's current lockfile (node_modules/.pnpm/lock.yaml) records unchanged. That record is written only by a completed install, but it vouches for a slot only this project writes. A global virtual store slot is shared, so another project's interrupted install may re-create it after the record was written and leave it without child links or package files. Every later install then kept the damaged slot.

Under GVS the record no longer vouches for the slot. The probe always checks package.json and every child link the symlink layout would create, as it already did for a GVS slot with no record. A project-local virtual store keeps trusting the record.

Related to #16642. This is a partial fix, see below.

What this covers and what it does not

The repair happens in any install that materializes the virtual store. Examples: a manifest or lockfile change, a missing or broken direct-dependency link, or --force. Before this PR those installs left the incomplete slots in place, as in the issue's Reproduction 2, step 5.

An install in a project where nothing changed still short-circuits before the slot probe and does not repair a slot:

  • The CLI repeat-install fast path (optimistic_repeat_install.rs) compares only manifest and lockfile mtimes.
  • frozen_tree_up_to_date checks only importer links under GVS (frozen_tree_intact skips all_virtual_store_slots_present because GVS slot paths depend on graph hashes).

So the issue's Reproduction 1 (plain pnpm install or --frozen-lockfile with nothing changed) still prints "Already up to date". Closing that gap means walking every reachable GVS slot on each no-op install, a cost that needs a separate decision.

pnpm v11

v11 has the same gap and is not changed here. checkPkgDirReuse in @pnpm/deps.graph-builder returns up-to-date for a recorded GVS slot. Even when the slot is kept in the graph, linkIsolatedLayout skips internal linking on warm GVS reinstalls on purpose (skipGvsInternalLinking, #11073), with or without a current lockfile. A v11 fix would have to undo that optimization, so it is left for a maintainer to decide.

Squash Commit Body

A project's current lockfile only vouches for slots that project alone
writes. A global virtual store slot is shared, so another project's
interrupted install may have re-created it without its child links or
package files after the record was written. The warm-slot probe now
checks the completion marker and every child link of a GVS slot even
when the current lockfile records it unchanged.

The repeat-install fast path and the frozen up-to-date short-circuit
still run before the probe, so an install in an unchanged project does
not reach it.

Related to pnpm/pnpm#16642.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version. (v11 is affected and is not changed here, see above.)
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

Written by an agent (Claude Code, claude-opus-5-5).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Installs with the global virtual store enabled now restore missing package files and dependency links in shared package slots, even when the project’s existing installation and lockfile already record those packages.
    • This also repairs incomplete shared slots during frozen installs, including slots missing their package completion marker.

…ent lockfile records

A project's current lockfile only vouches for slots that project alone
writes. A global virtual store slot is shared, so another project's
interrupted install may have re-created it without its child links or
package files after the record was written. The warm-slot probe now
checks the completion marker and every child link of a GVS slot even
when the current lockfile records it unchanged.

Fixes #16642

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: pnpm/pnpm/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a659c291-a339-478f-91b6-a385aa391955
📥 Commits

Reviewing files that changed from the base of the PR and between 2102f9d and fae1a13.

📒 Files selected for processing (4)
  • .changeset/gvs-repair-incomplete-slots.md
  • pnpm/crates/cli/tests/suite/global_virtual_store.rs
  • pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs
  • pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan/tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

When the global virtual store is enabled, unchanged lockfile entries no longer bypass checks for a slot’s package marker or child links. Unit and CLI tests verify that installs restore missing slot contents, including when the project already records the package.

Changes

Global virtual store slot repair

Layer / File(s) Summary
Check and verify slot completeness
pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs, pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan/tests.rs, pnpm/crates/cli/tests/suite/global_virtual_store.rs, .changeset/gvs-repair-incomplete-slots.md
An unchanged lockfile entry vouches for slot completeness only when the global virtual store is disabled. Tests verify that frozen installs repair missing child links and package markers for shared slots, while a matching lockfile can still vouch for an existing project-local slot. The changeset records the repair behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Suggested labels: product: pacquet

Merge Risk: ⚪ Minimal · up to fae1a

No actionable merge-blocking issue is identified. The scoped GVS repair is mergeable after normal checks.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

codecov-commenter commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.34%. Comparing base (9f2e8ea) to head (fae1a13).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16649      +/-   ##
==========================================
- Coverage   92.34%   92.34%   -0.01%     
==========================================
  Files        1590     1590              
  Lines      210019   210021       +2     
==========================================
  Hits       193947   193947              
- Misses      16072    16074       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.02     14.0±0.61ms    26.7 MB/sec    1.00     13.7±0.09ms    27.3 MB/sec
packument/parse                                  1.07     49.4±2.02µs  1343.1 MB/sec    1.00     46.0±0.49µs  1443.3 MB/sec
tarball/download_dependency                      1.04      4.9±0.33ms   877.3 KB/sec    1.00      4.8±0.26ms   908.6 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.05   251.5±12.90ms 63.6 KElem/sec    1.00    239.6±7.73ms 66.8 KElem/sec
version_pick/repeated_ranges_file                1.07      5.0±0.08ms  6.2 KElem/sec    1.00      4.7±0.04ms  6.6 KElem/sec
version_pick/repeated_ranges_raw                 1.05      4.9±0.09ms  6.4 KElem/sec    1.00      4.7±0.08ms  6.7 KElem/sec
workspace_resolution/hoist_heavy                 1.00    249.2±8.16ms        ? ?/sec    1.02    253.0±6.95ms        ? ?/sec
workspace_sort/chained_projects                  1.00     17.3±1.60ms        ? ?/sec    1.03     17.8±2.36ms        ? ?/sec

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Same-run regression check

HEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval.

Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2423.48 ms 2606.37 ms 7.5% 121.17 ms Inconclusive (overlapping samples)
isolated-fresh-restore-cold-cache-cold-store pnpr 1514.78 ms 1452.41 ms -4.1% 75.74 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 230.58 ms 232.73 ms 0.9% 11.53 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 247.12 ms 231.37 ms -6.4% 12.36 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 14.25 ms 12.65 ms -11.2% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 8.61 ms 8.47 ms -1.7% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 12.23 ms 12.72 ms 4.0% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 12.46 ms 11.70 ms -6.1% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2606.40 ms 2601.37 ms -0.2% 130.32 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1508.71 ms 1639.09 ms 8.6% 75.44 ms Inconclusive (overlapping samples)
isolated-fresh-install-hot-cache-hot-store pacquet 657.80 ms 595.00 ms -9.5% 32.89 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 379.20 ms 384.20 ms 1.3% 18.96 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1632.85 ms 1629.22 ms -0.2% 81.64 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 292.59 ms 295.09 ms 0.9% 14.63 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 217.54 ms 246.51 ms 13.3% 10.88 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pnpr 92.44 ms 92.20 ms -0.3% 4.62 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 206.36 ms 212.72 ms 3.1% 10.32 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 246.40 ms 252.59 ms 2.5% 12.32 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4493.17 ms 4513.27 ms 0.4% 224.66 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3693.61 ms 3554.84 ms -3.8% 184.68 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 169.17 ms 185.31 ms 9.5% 8.46 ms Inconclusive (overlapping samples)
gvs-fresh-restore-hot-cache-hot-store pnpr 156.54 ms 148.49 ms -5.1% 7.83 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: fae1a1313fd2

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked-workspace scenario compares current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs.

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.598 ± 0.163 2.310 2.870 1.78 ± 0.16
pacquet@main 2.465 ± 0.123 2.313 2.655 1.69 ± 0.13
pnpr@HEAD 1.459 ± 0.090 1.353 1.665 1.00
pnpr@main 1.547 ± 0.118 1.359 1.701 1.06 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.59788000268,
      "stddev": 0.163279810177893,
      "median": 2.60637187228,
      "user": 1.8660202399999999,
      "system": 1.8759512600000001,
      "min": 2.3102306177800003,
      "max": 2.8704627937800002
    },
    {
      "command": "pacquet@main",
      "mean": 2.4650917034799997,
      "stddev": 0.12342101849023708,
      "median": 2.42347814378,
      "user": 1.5366094399999999,
      "system": 1.5961384599999997,
      "min": 2.3126680517800002,
      "max": 2.65470483178
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4585547385800004,
      "stddev": 0.09025088916340898,
      "median": 1.4524092302800002,
      "user": 1.5359069399999998,
      "system": 1.48676856,
      "min": 1.3527418957800001,
      "max": 1.66518572278
    },
    {
      "command": "pnpr@main",
      "mean": 1.5466434818800001,
      "stddev": 0.11837206647772762,
      "median": 1.5147803732800003,
      "user": 1.6375280399999999,
      "system": 1.64116896,
      "min": 1.35900368178,
      "max": 1.7011029127800001
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 230.3 ± 12.0 213.0 248.3 1.00
pacquet@main 233.2 ± 12.7 219.7 255.9 1.01 ± 0.08
pnpr@HEAD 233.5 ± 12.3 216.8 250.7 1.01 ± 0.08
pnpr@main 248.8 ± 21.5 221.9 298.4 1.08 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23027125799999998,
      "stddev": 0.011982695288325225,
      "median": 0.23273476070000002,
      "user": 0.27224648,
      "system": 0.53428444,
      "min": 0.21295229170000002,
      "max": 0.2483070867
    },
    {
      "command": "pacquet@main",
      "mean": 0.23324815120000003,
      "stddev": 0.012737790046448956,
      "median": 0.23058094170000001,
      "user": 0.26010417999999996,
      "system": 0.58390274,
      "min": 0.2197423947,
      "max": 0.2558793177
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.23348708069999996,
      "stddev": 0.012316574341314326,
      "median": 0.23137099020000002,
      "user": 0.25802478000000006,
      "system": 0.52404184,
      "min": 0.2168381457,
      "max": 0.2506573637
    },
    {
      "command": "pnpr@main",
      "mean": 0.24878340710000005,
      "stddev": 0.021502458875693263,
      "median": 0.2471198007,
      "user": 0.26514667999999997,
      "system": 0.5635322399999999,
      "min": 0.2218589407,
      "max": 0.2984196267
    }
  ]
}

Scenario: Isolated linker: repeat install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 12.7 ± 3.1 7.9 24.0 1.44 ± 0.39
pacquet@main 14.2 ± 2.3 8.6 21.1 1.61 ± 0.33
pnpr@HEAD 9.2 ± 2.2 7.0 16.2 1.04 ± 0.28
pnpr@main 8.8 ± 1.1 7.3 15.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.01268846593294965,
      "stddev": 0.003097145802511796,
      "median": 0.012653143120000002,
      "user": 0.007262492086330936,
      "system": 0.006469076546762596,
      "min": 0.00793269712,
      "max": 0.023995010120000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.014196232313069315,
      "stddev": 0.002331783741205539,
      "median": 0.01424911262,
      "user": 0.007990305940594059,
      "system": 0.007382890495049503,
      "min": 0.00856649512,
      "max": 0.02111346512
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.009154541480000002,
      "stddev": 0.002176845013517713,
      "median": 0.00846571512,
      "user": 0.005549457142857142,
      "system": 0.004415105828571429,
      "min": 0.007042295120000001,
      "max": 0.016157060120000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.008821546362424246,
      "stddev": 0.0011082107850798504,
      "median": 0.00861405412,
      "user": 0.005100059932659932,
      "system": 0.004441285656565655,
      "min": 0.007275463120000001,
      "max": 0.01505971212
    }
  ]
}

Scenario: Isolated linker: repeat install, cold cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 13.4 ± 2.7 8.7 22.7 1.10 ± 0.28
pacquet@main 12.8 ± 2.2 9.6 19.7 1.05 ± 0.25
pnpr@HEAD 12.2 ± 2.0 9.2 18.9 1.00
pnpr@main 12.9 ± 2.3 9.2 24.3 1.06 ± 0.26
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.013379955395000007,
      "stddev": 0.002699298378912203,
      "median": 0.01272434734,
      "user": 0.006742157400000001,
      "system": 0.008066817399999999,
      "min": 0.00866924384,
      "max": 0.022695346840000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.012848299555151512,
      "stddev": 0.0021633655309204166,
      "median": 0.01223315384,
      "user": 0.007011919999999999,
      "system": 0.0071651473939393934,
      "min": 0.00955177284,
      "max": 0.019709945840000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.012205753981791042,
      "stddev": 0.001981013000731466,
      "median": 0.01169818284,
      "user": 0.007054258805970149,
      "system": 0.006418129552238806,
      "min": 0.00918912484,
      "max": 0.018935371840000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.012909118363255813,
      "stddev": 0.002309505118544634,
      "median": 0.01246135234,
      "user": 0.007201525813953489,
      "system": 0.007079796976744187,
      "min": 0.00920291884,
      "max": 0.02431009484
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.640 ± 0.086 2.586 2.816 1.67 ± 0.16
pacquet@main 2.629 ± 0.075 2.561 2.771 1.66 ± 0.16
pnpr@HEAD 1.650 ± 0.117 1.509 1.823 1.04 ± 0.12
pnpr@main 1.585 ± 0.142 1.466 1.850 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6404725691799995,
      "stddev": 0.08632245232910858,
      "median": 2.6013715821799996,
      "user": 2.30795456,
      "system": 1.8398006999999996,
      "min": 2.58561430418,
      "max": 2.81602577818
    },
    {
      "command": "pacquet@main",
      "mean": 2.62858300718,
      "stddev": 0.07539641517804978,
      "median": 2.60640227268,
      "user": 2.26111766,
      "system": 1.7937662999999993,
      "min": 2.5609774231799998,
      "max": 2.7708848381799998
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6499183159800002,
      "stddev": 0.11653844769121989,
      "median": 1.63909419818,
      "user": 1.5302624599999999,
      "system": 1.583643,
      "min": 1.5088753931799999,
      "max": 1.82339273818
    },
    {
      "command": "pnpr@main",
      "mean": 1.5846415940799996,
      "stddev": 0.14235732963416944,
      "median": 1.50870872018,
      "user": 1.4668788599999996,
      "system": 1.5397807999999997,
      "min": 1.4662814581799999,
      "max": 1.84992382918
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 600.6 ± 22.3 577.2 644.0 1.58 ± 0.08
pacquet@main 741.1 ± 175.7 584.6 1031.7 1.96 ± 0.47
pnpr@HEAD 383.9 ± 15.2 362.3 407.7 1.01 ± 0.05
pnpr@main 379.1 ± 11.8 355.5 394.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6006013698000001,
      "stddev": 0.02227714798781686,
      "median": 0.5950032805000001,
      "user": 0.83773242,
      "system": 1.05319956,
      "min": 0.5771884285000001,
      "max": 0.6439759235000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.7411327533,
      "stddev": 0.17572457765661842,
      "median": 0.6578046770000001,
      "user": 1.06409282,
      "system": 1.3144228599999999,
      "min": 0.5845931665,
      "max": 1.0316609454999999
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.38393557970000014,
      "stddev": 0.015151563524989826,
      "median": 0.38419725550000006,
      "user": 0.36690051999999995,
      "system": 0.8150196599999999,
      "min": 0.36225344950000005,
      "max": 0.40766242850000006
    },
    {
      "command": "pnpr@main",
      "mean": 0.3790803756,
      "stddev": 0.011766647571692126,
      "median": 0.37920139650000007,
      "user": 0.3643509199999999,
      "system": 0.8009745599999999,
      "min": 0.35552213450000003,
      "max": 0.3942381945
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.629 ± 0.019 1.598 1.661 5.63 ± 0.22
pacquet@main 1.633 ± 0.021 1.602 1.663 5.64 ± 0.23
pnpr@HEAD 0.295 ± 0.012 0.267 0.310 1.02 ± 0.06
pnpr@main 0.289 ± 0.011 0.273 0.304 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.6288884022799999,
      "stddev": 0.019441490472297696,
      "median": 1.6292190740799999,
      "user": 0.8846509200000001,
      "system": 0.8169790000000001,
      "min": 1.59776799658,
      "max": 1.66093526458
    },
    {
      "command": "pacquet@main",
      "mean": 1.6328520364799999,
      "stddev": 0.020588047823911538,
      "median": 1.6328457800799998,
      "user": 0.8987715199999998,
      "system": 0.8047399000000001,
      "min": 1.60178509558,
      "max": 1.66304069958
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29540052008,
      "stddev": 0.011834507255476533,
      "median": 0.29509192258,
      "user": 0.26093612,
      "system": 0.5702061,
      "min": 0.26685834458,
      "max": 0.30979782058
    },
    {
      "command": "pnpr@main",
      "mean": 0.28931005957999995,
      "stddev": 0.010945628519826837,
      "median": 0.29258666608,
      "user": 0.25248701999999995,
      "system": 0.5665281,
      "min": 0.27293126258,
      "max": 0.30354192758
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 239.6 ± 17.9 211.0 261.4 2.60 ± 0.20
pacquet@main 222.3 ± 16.2 201.5 261.0 2.41 ± 0.18
pnpr@HEAD 92.6 ± 2.2 87.3 99.9 1.00 ± 0.03
pnpr@main 92.1 ± 1.3 87.7 93.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23960622583636368,
      "stddev": 0.017946596448831495,
      "median": 0.24650678820000002,
      "user": 0.2130986872727273,
      "system": 0.09848658000000002,
      "min": 0.21104937320000003,
      "max": 0.2614285102
    },
    {
      "command": "pacquet@main",
      "mean": 0.22234002658461538,
      "stddev": 0.01618592262785015,
      "median": 0.21753780820000002,
      "user": 0.1919073446153846,
      "system": 0.07885458,
      "min": 0.20150586520000002,
      "max": 0.2609990432
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.0925969281032258,
      "stddev": 0.002176153774176331,
      "median": 0.09220386020000002,
      "user": 0.03329363741935484,
      "system": 0.01467291612903226,
      "min": 0.0873228612,
      "max": 0.0999394462
    },
    {
      "command": "pnpr@main",
      "mean": 0.09213725952258066,
      "stddev": 0.0012991403623108984,
      "median": 0.09244479420000001,
      "user": 0.031939476129032245,
      "system": 0.012853496774193549,
      "min": 0.08773718920000001,
      "max": 0.09360338520000001
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 208.4 ± 12.2 190.2 228.3 1.01 ± 0.10
pacquet@main 206.1 ± 16.1 181.7 231.1 1.00
pnpm@HEAD 3819.1 ± 527.0 3459.0 5159.8 18.53 ± 2.94
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2084132980377778,
      "stddev": 0.012190719869080298,
      "median": 0.21272365626000003,
      "user": 0.2103006222222222,
      "system": 0.04793661555555555,
      "min": 0.19022524826000003,
      "max": 0.22834205526000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.20607688481555558,
      "stddev": 0.01607709770750159,
      "median": 0.20635916426000003,
      "user": 0.20371051111111113,
      "system": 0.04270939333333333,
      "min": 0.18167062526000002,
      "max": 0.23106354026000003
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.819108823926667,
      "stddev": 0.5269955082787402,
      "median": 3.61777118926,
      "user": 5.849329733333333,
      "system": 0.4151745044444445,
      "min": 3.45903256526,
      "max": 5.15983575826
    }
  ]
}

Scenario: Isolated linker: linked-workspace resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 255.5 ± 17.6 236.0 299.4 1.03 ± 0.08
pacquet@main 248.9 ± 10.6 236.1 267.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25548428916000004,
      "stddev": 0.017566664829701463,
      "median": 0.25258706386,
      "user": 0.21148907999999994,
      "system": 0.10310617999999998,
      "min": 0.23600675336000002,
      "max": 0.29935490236000006
    },
    {
      "command": "pacquet@main",
      "mean": 0.24890902763272732,
      "stddev": 0.01059968428263961,
      "median": 0.24640457636000002,
      "user": 0.19871793454545453,
      "system": 0.10725901636363638,
      "min": 0.23613508436000002,
      "max": 0.26752766936000005
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.581 ± 0.161 4.446 4.883 1.29 ± 0.05
pacquet@main 4.542 ± 0.115 4.472 4.840 1.28 ± 0.04
pnpr@HEAD 3.550 ± 0.049 3.481 3.639 1.00
pnpr@main 3.713 ± 0.112 3.500 3.913 1.05 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.5806902880400004,
      "stddev": 0.16062528024741934,
      "median": 4.51327112204,
      "user": 1.9032268400000003,
      "system": 2.0945332,
      "min": 4.44628829254,
      "max": 4.88345734254
    },
    {
      "command": "pacquet@main",
      "mean": 4.54192536634,
      "stddev": 0.11465511599369868,
      "median": 4.493171433540001,
      "user": 1.8079161400000001,
      "system": 1.9960027999999999,
      "min": 4.47193965754,
      "max": 4.84047272054
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5501873651399998,
      "stddev": 0.04875063562292437,
      "median": 3.55483558154,
      "user": 1.69363214,
      "system": 1.8479433999999997,
      "min": 3.48138915254,
      "max": 3.63913050554
    },
    {
      "command": "pnpr@main",
      "mean": 3.71274826744,
      "stddev": 0.11223195763561145,
      "median": 3.69360513204,
      "user": 1.8502807399999999,
      "system": 1.9813366,
      "min": 3.49993123754,
      "max": 3.91294885054
    }
  ]
}

Scenario: GVS linker: fresh restore, hot cache + hot store

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 189.3 ± 20.1 161.4 221.3 1.24 ± 0.17
pacquet@main 173.1 ± 11.4 155.7 193.2 1.14 ± 0.12
pnpr@HEAD 152.1 ± 12.3 139.4 181.0 1.00
pnpr@main 160.9 ± 14.5 145.1 201.1 1.06 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.18930249917142858,
      "stddev": 0.020078571049644285,
      "median": 0.18530892860000003,
      "user": 0.22748211999999995,
      "system": 0.16771282857142852,
      "min": 0.16144461460000004,
      "max": 0.22129703060000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.17306621321538465,
      "stddev": 0.011355786966558094,
      "median": 0.16917340560000002,
      "user": 0.2141028123076923,
      "system": 0.15991432307692308,
      "min": 0.15569695960000002,
      "max": 0.19317112260000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.15214918265555558,
      "stddev": 0.012260398001428205,
      "median": 0.14849167510000003,
      "user": 0.18119862000000003,
      "system": 0.14075073333333335,
      "min": 0.1393852506,
      "max": 0.18100973060000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.16092153260000003,
      "stddev": 0.014510854439309629,
      "median": 0.15654149160000003,
      "user": 0.20013950461538463,
      "system": 0.13965039999999998,
      "min": 0.14512399260000003,
      "max": 0.2011314466
    }
  ]
}

optimisticRepeatInstall: false only disables the CLI fast path. The
frozen up-to-date check still short-circuited on Windows, so removing
the project's direct link makes the install materialize on every
platform.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zkochan
zkochan marked this pull request as ready for review October 6, 2026 11:47
Copilot AI balanced review requested due to automatic review settings October 6, 2026 11:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Repair incomplete global virtual store slots despite current lockfile records

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Probe shared virtual-store slots for missing package files and child links even when the current
 lockfile matches.
• Preserve the current-lockfile reuse shortcut for project-local slots.
• Add repair regressions and document that no-op installs remain outside this fix.
Diagram

graph TD
  A["Snapshot planner"] --> B{"Global store?"} -- "yes" --> C{"Marker present?"} -- "yes" --> D{"Child links intact?"} -- "yes" --> E["Reuse slot"]
  B -- "no" --> F{"Record unchanged?"} -- "yes" --> E
  C -- "no" --> G["Materialize slot"]
  D -- "no" --> G
  F -- "no" --> G
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Probe slots during no-op installs
  • ➕ Would also repair damaged shared slots when an install otherwise reports already up to date.
  • ➖ Requires walking reachable shared slots on every no-op install and changing earlier short-circuit paths.

Recommendation: Keep this targeted change to snapshot planning: it repairs slots whenever installation materializes the virtual store without imposing a new cost on no-op installs. Decide separately whether closing the remaining no-op gap warrants a full slot walk.

Files changed (4) +108 / -12

Bug fix (1) +17 / -12
snapshot_plan.rsStop trusting current-lockfile records for shared slots +17/-12

Stop trusting current-lockfile records for shared slots

• Changes the warm-slot probe to require a completion marker and expected child links for global virtual store slots even when the current lockfile entry is unchanged. Project-local slots retain their record-based reuse behavior.

pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs

Tests (2) +86 / -0
global_virtual_store.rsTest frozen reinstall repair with a retained current lockfile +53/-0

Test frozen reinstall repair with a retained current lockfile

• Adds an end-to-end test that removes a shared slot's child link and then its package.json marker, verifying each is restored. It removes the project's direct link before each reinstall to ensure installation reaches materialization.

pnpm/crates/cli/tests/suite/global_virtual_store.rs

tests.rsCover shared-slot damage and local-slot reuse +33/-0

Cover shared-slot damage and local-slot reuse

• Extends planner tests to require repair of missing markers and regular child links despite a matching current lockfile. Adds a project-local regression test confirming that its matching record still vouches for the slot.

pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan/tests.rs

Documentation (1) +5 / -0
gvs-repair-incomplete-slots.mdDocument the scoped global-slot repair +5/-0

Document the scoped global-slot repair

• Adds a pacquet patch changeset explaining that installs updating node_modules repair incomplete shared slots previously retained because the project's current lockfile recorded them.

.changeset/gvs-repair-incomplete-slots.md

@zkochan

zkochan commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@qodo-code-review

qodo-code-review Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (2)

Grey Divider


Remediation recommended

1. Windows installs lack slot-repair coverage 📜 Skill insight ▣ Testability
Description
slot_contents_complete now validates global-store package markers and dependency links, but the
added tests cover only generic symlink and directory behavior without a Windows-specific case. On
Windows, junction handling and path separators can exercise different code paths, so the changed
repair behavior is not verified there.
Code

pnpm/crates/cli/tests/suite/global_virtual_store.rs[R354-357]

+#[test]
+fn an_incomplete_slot_is_repaired_even_when_the_current_lockfile_records_it() {
+    let CommandTempCwd { root, workspace, npmrc_info, .. } =
+        CommandTempCwd::init().add_mocked_registry();
Relevance

●●● Strong

Recent symlink and junction precedents favor explicit Windows regression coverage for
platform-specific filesystem behavior.

PR-#15381
PR-#15735

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires path, symlink, and hardlink changes to include Windows-specific coverage. The
changed probe now validates the slot marker and child links, while the added test only performs
platform-neutral operations and does not include a Windows separator or explicit Windows-specific
scenario.

pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[323-350]
pnpm/crates/cli/tests/suite/global_virtual_store.rs[354-395]
Skill: review-code

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The global virtual store repair logic changes symlink and junction probing, but the new regression test does not exercise Windows-specific separators or junction behavior.

## Fix Focus Areas
- pnpm/crates/cli/tests/suite/global_virtual_store.rs[354-395]
- pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[323-350]

## Recommended Fix
Add an explicit Windows test case or Windows CI coverage that removes a child junction and the slot completion marker, runs the reinstall, and asserts both are restored using Windows path and link semantics.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


2. Warm installs slow down on large graphs 🐞 Bug ➹ Performance
Description
record_vouches_for_slot is now false for every global-store slot, so slot_contents_complete
probes package.json and every required child link even when the current lockfile records the
snapshot unchanged. When an install materializes a large dependency graph, the sequential
snapshot-planning fold performs thousands of additional filesystem metadata operations before
linking begins.
Code

pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[R318-319]

+    let record_vouches_for_slot =
+        current_entry_unchanged && !probe.layout.enable_global_virtual_store();
Relevance

●● Moderate

Filesystem-probe performance concerns receive mixed treatment, and no close precedent resolves this
intentional correctness tradeoff.

PR-#13170
PR-#15888

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed condition makes recorded GVS entries take the file and regular-child checks. Each
regular child invokes filesystem metadata inspection, and the snapshot fold executes those checks
sequentially.

pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[102-123]
pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[318-350]
pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan/children.rs[25-38]
pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan/children.rs[68-89]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Recorded global-store slots now incur a serial `package.json` probe and one filesystem probe per required child link during installs that materialize the store. Preserve detection of interrupted installs while reducing this warm-path cost.

## Fix Focus Areas
- pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan.rs[318-350]
- pnpm/crates/deps-restorer/src/create_virtual_store/snapshot_plan/children.rs[25-38]

## Recommended Fix
Design a cheap shared-slot completion signal written only after both file import and required child linking finish, with a safe fallback for existing slots; alternatively bound and parallelize the probes. Measure the warm-install impact on a realistic large dependency graph while verifying that interrupted slots are still repaired.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗



Informational

3. The older installer has no regression guard 📜 Skill insight ▣ Testability
Description
The incomplete-slot repair is changed and tested only in the Rust installer, while pnpm 11 retains a
separate global-store reuse path without an equivalent test. When a shared slot is missing
package.json or a child link but the lockfile still records it, the older implementation can
regress without a test detecting it.
Code

pnpm/crates/cli/tests/suite/global_virtual_store.rs[R354-357]

+#[test]
+fn an_incomplete_slot_is_repaired_even_when_the_current_lockfile_records_it() {
+    let CommandTempCwd { root, workspace, npmrc_info, .. } =
+        CommandTempCwd::init().add_mocked_registry();
Relevance

● Weak

The PR explicitly scopes out pnpm 11; a similar cross-implementation parity request was rejected.

PR-#15340

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires shared CLI bug fixes affecting both release lines to include regression
coverage for each implementation. The PR adds the repair scenarios only in the v12 Rust test suite,
while pnpm 11 has separate global virtual store implementation and test paths and no equivalent
missing-marker or missing-child-link test.

pnpm/crates/cli/tests/suite/global_virtual_store.rs[354-395]
pnpm11/installing/deps-restorer/src/linkAllPkgs.ts[73-105]
pnpm11/installing/deps-restorer/src/linkAllPkgs.ts[189-218]
pnpm11/installing/deps-installer/test/install/globalVirtualStore.ts[1-105]
Skill: review-code

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR adds incomplete global virtual store slot regression tests only for the Rust implementation, although pnpm 11 has a separate affected implementation and the PR description states that it retains the same gap.

## Fix Focus Areas
- pnpm/crates/cli/tests/suite/global_virtual_store.rs[354-395]
- pnpm11/installing/deps-installer/test/install/globalVirtualStore.ts[1-105]

## Recommended Fix
Add a pnpm 11 regression test that retains the current lockfile, removes a slot's completion marker and child link, runs the real install path, and asserts both are restored; ensure the test fails against the current pnpm 11 behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Compliance rules (platform): 66 rules
✅ Cross-repo context — repo relationships
Review mode: Auto: ⚖️ Balanced: Shared virtual-store integrity and performance behavior require careful single-pass review.

Grey Divider

Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Oct 6, 2026
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@zkochan
zkochan merged commit cd539d7 into main Oct 6, 2026
58 checks passed
@zkochan
zkochan deleted the fix-16642 branch October 6, 2026 14:31
@zkochan

zkochan commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

Correction: the description says a v11 fix would have to undo skipGvsInternalLinking (#11073). That was wrong. The skip applies only when the install fetches nothing. #16663 fixes v11 without touching it.


Written by an agent (Claude Code, claude-opus-5-5).

zkochan added a commit that referenced this pull request Oct 6, 2026
…nt lockfile records (#16663)

A project's current lockfile vouches only for slots that project alone
writes. A global virtual store slot is shared, so another project's
interrupted install may have re-created it without its child links.
Such a slot now stays in the dependency graph as reusable instead of
up to date, so the linker restores its children.

skipGvsInternalLinking (#11073) still skips linking when the
install fetches nothing, because reusable nodes do not count as added.
This matches pnpm v12 after #16649.

Related to #16642

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants