Skip to content

fix(loaded): preserve frozen-store installs and prune unused GVS entries - #16600

Merged
zkochan merged 2 commits into
mainfrom
fix/loaded-store-pruning
Oct 5, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix/loaded-store-pruning

Conversation

@zkochan

@zkochan zkochan commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes two edge cases in the newly merged loaded linker (#16482).

When storeDir is a non-hidden directory inside the project, pnpm store prune could crawl the store itself and keep unused GVS slots alive. The project scan and dependency walker now exclude the canonical store root, while preserving roots referenced by the loaded manifest. The regression covers both store and node_modules/store inside the project.

Loaded installs with frozenStore: true now skip project registration writes. Writable loaded stores still require successful registration to protect their files from pruning. The loader documentation explains retention for externally managed frozen stores.

Validation: 24 scoped Rust tests passed, covering store pruning and the loaded CLI. The new regressions verify that a non-hidden local store loses unused GVS trees, retains live roots, and permits frozen installation when the store registry cannot be written. The original feature's full 14,570-test Rust run passed before merge. CI passed on 1e6c9482ff816eece2d1cdc597a87e328b09589b: Rust tests on Linux, macOS, and Windows, all lints, WebContainers, and benchmark checks. All 52 completed checks passed (7 skipped). Required push hooks also passed. CodeRabbit approved this head with no actionable comments. Qodo found no bugs; its Windows-coverage suggestion is answered with passing Windows job evidence in #16600 (comment). Copilot and Greptile were unable to review because of service quota/trial limits.

No changeset is needed because these fixes affect the unreleased loaded-linker feature. The separate prefetch reuse work is tracked with explicit completion criteria in pnpm/tasks#77.

Squash Commit Body

Exclude the store from registered-project scans and direct directory walks so GVS entries
cannot mark themselves live when the store is inside the project.

Skip loaded-project registration for frozen stores, preserving the existing
strict registration requirement for writable loaded stores. Document external
ownership of frozen-store retention and cover both cases with regressions.

Follow-up to https://github.com/pnpm/pnpm/pull/16482.

Checklist

  • I checked the referenced PR; these follow-up fixes were not included in its merge.
  • Bug fixes are implemented in every affected version. The loaded linker exists only in the Rust CLI.
  • No changeset is required for fixes to this unreleased feature.
  • Added or updated tests.
  • Updated the documentation.

Written by an agent (Codex, GPT-6).

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (4)
AGENTS.md — auto-discovered
pnpm/AGENTS.md — auto-discovered
DOCUMENTATION.md — auto-discovered
pnpm/CODE_STYLE_GUIDE.md — auto-discovered

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: 159302e1-35c1-4b0f-b973-0a0e98127179
📥 Commits

Reviewing files that changed from the base of the PR and between d2e90b9 and 1e6c948.

📒 Files selected for processing (5)
  • pnpm/crates/cli/tests/suite/cas_linker.rs
  • pnpm/crates/package-manager/src/install/run/fast_path.rs
  • pnpm/crates/store-dir/src/prune.rs
  • pnpm/crates/store-dir/src/prune/tests.rs
  • pnpm/docs/store-loader.md

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


📝 Walkthrough

Walkthrough

Frozen stores now skip loaded-project registration. Project scanning also excludes local stores during pruning, with tests covering frozen installs and loaded-project pruning.

Changes

Frozen store handling

Layer / File(s) Summary
Skip registration for frozen stores
pnpm/crates/package-manager/src/install/run/fast_path.rs, pnpm/crates/cli/tests/suite/cas_linker.rs, pnpm/docs/store-loader.md
Loaded projects are not registered in a frozen store. The test verifies that installation succeeds without changing the blocked registry file. The documentation describes the required pre-populated store and retained files.
Exclude local stores during pruning
pnpm/crates/store-dir/src/prune.rs, pnpm/crates/store-dir/src/prune/tests.rs
Project scanning excludes the canonicalized store path, and symlink walking skips the canonical links root. Tests check that pruning retains the live slot and removes unused slots for both local store paths.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested labels: product: pacquet

Suggested reviewers: altaywtf

Merge Risk: ⚪ Minimal · up to 1e6c9

No actionable merge-blocking risk remains from the supplied review. The change is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 1e6c9

Writable loaded installs still require registration, and frozen stores now have an explicit external retention owner. Pruning is confined to the configured store, but sharing a frozen store with a separately pruned writable store requires care.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The affected assets are files in a configured store shared by projects using it. Project manifests and dependency links influence which slots are retained, but the reviewed change does not establish a new network entrypoint or elevated filesystem authority.

Trust Boundaries and Controls

  • observed — Writable Loaded installs retain strict registration; frozen Loaded installs transfer retention responsibility to the external store owner. Pruning accepts roots only from registered projects whose manifests identify the same store.

Resilience and Maintainability Implications

  • inferred — Operation locks prevent cooperating prune and install processes from overlapping, but do not provide retention after installation ends. That later guarantee depends on the documented external owner for an unregistered frozen project.

Hardening Proposals

  • proposed — Where a frozen store can also be pruned for writable projects, make the external owner's retention policy explicit—for example, separate immutable stores from pruned stores or pin the frozen project's required roots before pruning.
✨ 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 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.72727% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.31%. Comparing base (8aec506) to head (1e6c948).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/store-dir/src/prune.rs 92.30% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16600   +/-   ##
=======================================
  Coverage   92.31%   92.31%           
=======================================
  Files        1576     1576           
  Lines      208719   208738   +19     
=======================================
+ Hits       192678   192700   +22     
+ Misses      16041    16038    -3     

☔ 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 5, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.08     13.5±0.53ms    27.7 MB/sec    1.00     12.6±0.09ms    29.8 MB/sec
packument/parse                                  1.00     43.5±0.26µs  1525.8 MB/sec    1.01     44.0±1.18µs  1508.5 MB/sec
tarball/download_dependency                      1.04      4.3±0.36ms   997.5 KB/sec    1.00      4.2±0.19ms  1035.8 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.05    206.2±9.19ms 77.6 KElem/sec    1.00    195.6±4.43ms 81.8 KElem/sec
version_pick/repeated_ranges_file                1.05      4.6±0.04ms  6.8 KElem/sec    1.00      4.4±0.04ms  7.2 KElem/sec
version_pick/repeated_ranges_raw                 1.01      4.4±0.03ms  7.1 KElem/sec    1.00      4.4±0.03ms  7.2 KElem/sec
workspace_resolution/hoist_heavy                 1.00   216.1±12.19ms        ? ?/sec    1.02    219.4±4.27ms        ? ?/sec
workspace_sort/chained_projects                  1.10     13.9±2.39ms        ? ?/sec    1.00     12.6±0.58ms        ? ?/sec

@github-actions

github-actions Bot commented Oct 5, 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 2377.31 ms 2412.68 ms 1.5% 118.87 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1411.40 ms 1457.00 ms 3.2% 70.57 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 246.40 ms 237.64 ms -3.6% 12.32 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 244.52 ms 247.54 ms 1.2% 12.23 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 9.89 ms 9.50 ms -4.0% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 9.24 ms 9.42 ms 2.0% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 8.61 ms 8.61 ms -0.0% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 8.92 ms 9.64 ms 8.2% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2554.41 ms 2534.99 ms -0.8% 127.72 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1529.33 ms 1571.60 ms 2.8% 76.47 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 484.53 ms 617.07 ms 27.4% 24.23 ms Inconclusive (overlapping samples)
isolated-fresh-install-hot-cache-hot-store pnpr 349.72 ms 308.30 ms -11.8% 17.49 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1613.10 ms 1621.32 ms 0.5% 80.66 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 330.40 ms 339.95 ms 2.9% 16.52 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 228.47 ms 236.49 ms 3.5% 11.42 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 112.53 ms 92.31 ms -18.0% 5.63 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 209.58 ms 225.94 ms 7.8% 10.48 ms Inconclusive (overlapping samples)
isolated-linked-workspace-resolve-hot-cache-offline pacquet 189.09 ms 187.81 ms -0.7% 9.45 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4443.64 ms 4414.87 ms -0.6% 222.18 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3550.70 ms 3585.06 ms 1.0% 177.54 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 119.75 ms 122.44 ms 2.2% 5.99 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 130.13 ms 134.37 ms 3.3% 6.51 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: 1e6c9482ff81

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.453 ± 0.139 2.324 2.698 1.69 ± 0.17
pacquet@main 2.393 ± 0.133 2.248 2.623 1.65 ± 0.17
pnpr@HEAD 1.475 ± 0.145 1.321 1.753 1.02 ± 0.13
pnpr@main 1.452 ± 0.122 1.300 1.669 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.45272261064,
      "stddev": 0.138634186243501,
      "median": 2.4126770778399997,
      "user": 1.57218978,
      "system": 1.5280414400000002,
      "min": 2.32372848034,
      "max": 2.69809443334
    },
    {
      "command": "pacquet@main",
      "mean": 2.39348966254,
      "stddev": 0.13280880482566593,
      "median": 2.37731095884,
      "user": 1.3048507799999998,
      "system": 1.30805884,
      "min": 2.24829654934,
      "max": 2.62300369734
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.47532807644,
      "stddev": 0.14543654574679235,
      "median": 1.45700025834,
      "user": 1.2653321799999997,
      "system": 1.27930484,
      "min": 1.32072660134,
      "max": 1.75315790834
    },
    {
      "command": "pnpr@main",
      "mean": 1.4516889346400002,
      "stddev": 0.12171486052980529,
      "median": 1.4114040233399998,
      "user": 1.3662585799999998,
      "system": 1.36677624,
      "min": 1.3001311683399999,
      "max": 1.66920284634
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 241.9 ± 18.2 216.6 284.9 1.00
pacquet@main 246.4 ± 12.3 225.7 262.4 1.02 ± 0.09
pnpr@HEAD 258.0 ± 31.6 237.9 345.4 1.07 ± 0.15
pnpr@main 244.6 ± 4.4 236.9 250.6 1.01 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24188701586,
      "stddev": 0.018178284405743216,
      "median": 0.23764125296,
      "user": 0.26354278,
      "system": 0.5655866199999999,
      "min": 0.21656366696,
      "max": 0.28486869096000006
    },
    {
      "command": "pacquet@main",
      "mean": 0.24644427925999998,
      "stddev": 0.01231893529884063,
      "median": 0.24640158246,
      "user": 0.27417218,
      "system": 0.5833622199999999,
      "min": 0.22571884596,
      "max": 0.26235796796000005
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.25800740236,
      "stddev": 0.03162248521748838,
      "median": 0.24753847596,
      "user": 0.26875027999999995,
      "system": 0.5831466199999998,
      "min": 0.23793643196,
      "max": 0.34542078696000006
    },
    {
      "command": "pnpr@main",
      "mean": 0.24459638245999998,
      "stddev": 0.00439599885240273,
      "median": 0.24452230346,
      "user": 0.27778058,
      "system": 0.5492185199999999,
      "min": 0.23688301996,
      "max": 0.25060551296000005
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 9.8 ± 1.1 8.3 14.6 1.04 ± 0.14
pacquet@main 10.0 ± 1.1 8.1 14.3 1.07 ± 0.14
pnpr@HEAD 9.6 ± 0.9 8.2 13.6 1.02 ± 0.13
pnpr@main 9.4 ± 0.8 8.0 12.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.009800758969473682,
      "stddev": 0.0010692577952668963,
      "median": 0.009498478380000001,
      "user": 0.005848833684210526,
      "system": 0.004810104526315788,
      "min": 0.00829326088,
      "max": 0.014627708880000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.010039528364429066,
      "stddev": 0.001063948972536503,
      "median": 0.009890860880000001,
      "user": 0.006054057577854675,
      "system": 0.0049603463667820084,
      "min": 0.008084919880000001,
      "max": 0.014292259880000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.009582070101757323,
      "stddev": 0.0008853450003068864,
      "median": 0.009424584880000001,
      "user": 0.006032395983263601,
      "system": 0.004442424267782426,
      "min": 0.00821087788,
      "max": 0.01359261588
    },
    {
      "command": "pnpr@main",
      "mean": 0.009400642339649127,
      "stddev": 0.0007788678120843026,
      "median": 0.009237262880000001,
      "user": 0.005520430175438595,
      "system": 0.004751707578947365,
      "min": 0.00800299688,
      "max": 0.012574294880000001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 8.8 ± 1.0 6.8 14.6 1.00
pacquet@main 8.9 ± 1.2 6.9 13.8 1.02 ± 0.18
pnpr@HEAD 9.8 ± 1.2 7.2 15.7 1.11 ± 0.19
pnpr@main 9.2 ± 1.3 7.1 13.3 1.04 ± 0.19
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.008785363113333331,
      "stddev": 0.0009586122359635919,
      "median": 0.00860931962,
      "user": 0.0052202072888888895,
      "system": 0.004378274044444448,
      "min": 0.0068320156200000004,
      "max": 0.014629757620000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.008928874882135915,
      "stddev": 0.0012445759048052047,
      "median": 0.008610902620000001,
      "user": 0.005269106407766989,
      "system": 0.004495650938511326,
      "min": 0.00694624062,
      "max": 0.01375372362
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.009777696306192475,
      "stddev": 0.0012307554343087088,
      "median": 0.009643136620000001,
      "user": 0.00596479933054393,
      "system": 0.004676172552301254,
      "min": 0.007249769620000001,
      "max": 0.015749679620000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.00916112986381626,
      "stddev": 0.0013064874121272174,
      "median": 0.008915770620000001,
      "user": 0.0051606956890459365,
      "system": 0.004799514204946999,
      "min": 0.0070733136200000005,
      "max": 0.013268962620000001
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.537 ± 0.026 2.510 2.596 1.61 ± 0.13
pacquet@main 2.567 ± 0.055 2.520 2.711 1.63 ± 0.13
pnpr@HEAD 1.634 ± 0.133 1.513 1.813 1.04 ± 0.12
pnpr@main 1.576 ± 0.122 1.463 1.794 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.53654290354,
      "stddev": 0.026298567791146102,
      "median": 2.5349935289400003,
      "user": 1.8834666799999997,
      "system": 1.5742272400000001,
      "min": 2.5099226934400005,
      "max": 2.5958432304400003
    },
    {
      "command": "pacquet@main",
      "mean": 2.56673384504,
      "stddev": 0.05473448582097064,
      "median": 2.55440613994,
      "user": 1.99765568,
      "system": 1.6309481399999999,
      "min": 2.5199375924400003,
      "max": 2.71083357044
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.63391681604,
      "stddev": 0.1326030521884578,
      "median": 1.57159644844,
      "user": 1.48384588,
      "system": 1.5902462400000001,
      "min": 1.51258892844,
      "max": 1.81277144444
    },
    {
      "command": "pnpr@main",
      "mean": 1.5757287387399999,
      "stddev": 0.12216252797116174,
      "median": 1.52933367944,
      "user": 1.47983898,
      "system": 1.47989814,
      "min": 1.46269139944,
      "max": 1.79429891644
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 584.7 ± 95.6 453.6 704.2 1.91 ± 0.32
pacquet@main 488.6 ± 24.5 460.5 534.3 1.60 ± 0.10
pnpr@HEAD 306.1 ± 12.8 289.0 328.5 1.00
pnpr@main 346.2 ± 32.3 301.1 401.8 1.13 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5846805586000001,
      "stddev": 0.09558309185134924,
      "median": 0.6170658573000001,
      "user": 0.78538126,
      "system": 0.9438129,
      "min": 0.45360166830000004,
      "max": 0.7041828623
    },
    {
      "command": "pacquet@main",
      "mean": 0.4886269756,
      "stddev": 0.02453451887197345,
      "median": 0.4845280913,
      "user": 0.65980586,
      "system": 0.7747233999999998,
      "min": 0.4605321073,
      "max": 0.5342637593
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30613014790000004,
      "stddev": 0.012793387678664872,
      "median": 0.3083020553,
      "user": 0.26535855999999997,
      "system": 0.5832306,
      "min": 0.2889643673,
      "max": 0.3284536263
    },
    {
      "command": "pnpr@main",
      "mean": 0.3462078289,
      "stddev": 0.03226676093848259,
      "median": 0.3497150443,
      "user": 0.30612816,
      "system": 0.6448790999999999,
      "min": 0.3010959783,
      "max": 0.4018485053
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.621 ± 0.021 1.587 1.661 4.72 ± 0.65
pacquet@main 1.623 ± 0.023 1.601 1.668 4.73 ± 0.65
pnpr@HEAD 0.347 ± 0.043 0.310 0.460 1.01 ± 0.19
pnpr@main 0.343 ± 0.047 0.292 0.428 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.6213600210999999,
      "stddev": 0.02065196293955151,
      "median": 1.6213215007,
      "user": 0.86112728,
      "system": 0.84802938,
      "min": 1.5866761892,
      "max": 1.6610661012
    },
    {
      "command": "pacquet@main",
      "mean": 1.6228296492000003,
      "stddev": 0.023083611666628166,
      "median": 1.6131034342000001,
      "user": 0.8699263800000001,
      "system": 0.7977918800000001,
      "min": 1.6010469042000002,
      "max": 1.6680547802
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.34662929140000004,
      "stddev": 0.043462162918130216,
      "median": 0.3399514912,
      "user": 0.31023537999999995,
      "system": 0.64328488,
      "min": 0.3104224762,
      "max": 0.46048447220000005
    },
    {
      "command": "pnpr@main",
      "mean": 0.3433450478,
      "stddev": 0.04672218178356054,
      "median": 0.3303983412,
      "user": 0.30844737999999994,
      "system": 0.67567718,
      "min": 0.2921502852,
      "max": 0.4280490242
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 243.2 ± 13.2 228.9 268.7 2.62 ± 0.16
pacquet@main 229.9 ± 10.1 210.9 250.2 2.47 ± 0.13
pnpr@HEAD 92.9 ± 2.4 88.4 100.1 1.00
pnpr@main 111.1 ± 14.4 89.2 139.3 1.20 ± 0.16
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24319053397666668,
      "stddev": 0.013188501124466775,
      "median": 0.23648735056000003,
      "user": 0.21612887333333333,
      "system": 0.09245880999999999,
      "min": 0.22890212356000003,
      "max": 0.26867900356
    },
    {
      "command": "pacquet@main",
      "mean": 0.22991282255999998,
      "stddev": 0.010060472034616292,
      "median": 0.22847385106,
      "user": 0.21805529,
      "system": 0.08328664333333333,
      "min": 0.21085906656000003,
      "max": 0.25022306256000004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09291748446000003,
      "stddev": 0.0024492054450495375,
      "median": 0.09230909206,
      "user": 0.03321000666666666,
      "system": 0.014764958,
      "min": 0.08836662356,
      "max": 0.10013242656
    },
    {
      "command": "pnpr@main",
      "mean": 0.11109156210838708,
      "stddev": 0.014427271519713536,
      "median": 0.11253341556,
      "user": 0.04358745935483871,
      "system": 0.02440418903225806,
      "min": 0.08921719556,
      "max": 0.13925479556
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 227.0 ± 12.0 211.0 250.7 1.08 ± 0.08
pacquet@main 211.0 ± 11.0 199.2 236.7 1.00
pnpm@HEAD 3855.6 ± 129.6 3625.4 4001.9 18.28 ± 1.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.22699054260444443,
      "stddev": 0.011958852614754094,
      "median": 0.22594400216000002,
      "user": 0.23114009111111106,
      "system": 0.052837706666666664,
      "min": 0.21096524816,
      "max": 0.25070042516
    },
    {
      "command": "pacquet@main",
      "mean": 0.21095569449333335,
      "stddev": 0.010963492970830206,
      "median": 0.20957587016,
      "user": 0.21256575777777778,
      "system": 0.04410192888888889,
      "min": 0.19917741616,
      "max": 0.23670286216000003
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.8556413810488888,
      "stddev": 0.12958620506631519,
      "median": 3.8957755621600003,
      "user": 5.954325757777777,
      "system": 0.41561704,
      "min": 3.6254189021600003,
      "max": 4.00188230716
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 187.6 ± 1.3 185.7 190.3 1.00
pacquet@main 190.0 ± 2.7 187.3 197.4 1.01 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.18756188542000005,
      "stddev": 0.0012874791911299404,
      "median": 0.18780826462,
      "user": 0.1490828266666667,
      "system": 0.06776356,
      "min": 0.18567006262,
      "max": 0.19027528362
    },
    {
      "command": "pacquet@main",
      "mean": 0.19003159515333337,
      "stddev": 0.002712357229005265,
      "median": 0.18909376662,
      "user": 0.15417029333333332,
      "system": 0.06659816,
      "min": 0.18729822762,
      "max": 0.19735901562
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.436 ± 0.067 4.383 4.613 1.24 ± 0.05
pacquet@main 4.473 ± 0.096 4.390 4.652 1.25 ± 0.05
pnpr@HEAD 3.616 ± 0.127 3.496 3.878 1.01 ± 0.05
pnpr@main 3.583 ± 0.119 3.438 3.793 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.436089762420001,
      "stddev": 0.06702454985353151,
      "median": 4.414872752020001,
      "user": 1.6791323599999994,
      "system": 1.6244135199999998,
      "min": 4.38335900352,
      "max": 4.61253218852
    },
    {
      "command": "pacquet@main",
      "mean": 4.473216880819999,
      "stddev": 0.09563649390416282,
      "median": 4.443643592520001,
      "user": 1.7102647599999998,
      "system": 1.61296222,
      "min": 4.38973272652,
      "max": 4.65238913752
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.61610481772,
      "stddev": 0.12671419766823458,
      "median": 3.58506138202,
      "user": 1.61205446,
      "system": 1.60207342,
      "min": 3.49566189252,
      "max": 3.8780479185199996
    },
    {
      "command": "pnpr@main",
      "mean": 3.5828225222200003,
      "stddev": 0.11878537093375202,
      "median": 3.55070329052,
      "user": 1.5882830599999997,
      "system": 1.48639292,
      "min": 3.43775052052,
      "max": 3.79331898952
    }
  ]
}

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 122.5 ± 5.2 115.7 130.2 1.01 ± 0.08
pacquet@main 121.1 ± 8.1 112.8 141.5 1.00
pnpr@HEAD 133.1 ± 4.6 126.5 141.4 1.10 ± 0.08
pnpr@main 130.6 ± 5.9 122.8 149.9 1.08 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.12252861340000003,
      "stddev": 0.005180671798111519,
      "median": 0.12243885880000001,
      "user": 0.14592087999999998,
      "system": 0.12892361,
      "min": 0.11567676880000001,
      "max": 0.1302467898
    },
    {
      "command": "pacquet@main",
      "mean": 0.12109686245217396,
      "stddev": 0.008078527177110521,
      "median": 0.11975411080000001,
      "user": 0.14966332782608696,
      "system": 0.13193623826086956,
      "min": 0.11276297180000001,
      "max": 0.14153518280000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.1330825118526316,
      "stddev": 0.004589659103500809,
      "median": 0.13436770280000002,
      "user": 0.15849055894736844,
      "system": 0.1287692336842105,
      "min": 0.1264634108,
      "max": 0.14141046880000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.13057507980000002,
      "stddev": 0.005899678701713678,
      "median": 0.1301316438,
      "user": 0.15148140105263158,
      "system": 0.12975675999999997,
      "min": 0.1227517758,
      "max": 0.1498611668
    }
  ]
}

@zkochan
zkochan marked this pull request as ready for review October 5, 2026 11:55
Copilot AI balanced review requested due to automatic review settings October 5, 2026 11:55

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

Prevent local stores from keeping unused GVS slots alive

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Exclude project-local stores from prune walks so unused GVS slots can be removed.
• Skip loaded-project registration for frozen stores while keeping writable-store registration
 mandatory.
• Add regressions and document who retains files in externally managed frozen stores.
Diagram

graph TD
  Install["Loaded install"] --> Frozen{"Frozen store?"} -->|No| Registry["Project registry"] --> Scan["Project scan"] -->|Exclude store| Reachable["Reachable slots"] --> Sweep["GVS sweep"]
  Frozen -->|Yes| Owner["External owner"]
  Manifest["Manifest roots"] --> Reachable
Loading
High-Level Assessment

Keep the targeted store exclusion and frozen-store registration guard. Excluding the canonical store from both directory discovery and dependency traversal prevents self-references without losing manifest-referenced roots; skipping writes only for frozen loaded installs preserves protection for writable stores.

Files changed (5) +104 / -42

Bug fix (2) +60 / -40
fast_path.rsSkip loaded-project registration for frozen stores +4/-0

Skip loaded-project registration for frozen stores

• Returns before writing a loaded project's registry entry when its store is frozen. Writable loaded installs still require successful registration.

pnpm/crates/package-manager/src/install/run/fast_path.rs

prune.rsExclude the store root from prune reachability walks +56/-40

Exclude the store root from prune reachability walks

• Passes the canonical store root into project directory discovery and prevents dependency traversal from descending into it. This stops store contents from marking their own GVS slots reachable.

pnpm/crates/store-dir/src/prune.rs

Tests (2) +42 / -2
cas_linker.rsCover frozen loaded installs with an unwritable registry +12/-2

Cover frozen loaded installs with an unwritable registry

• Uses a non-hidden local store in the loaded-linker CLI test. Confirms writable installs fail when registration is blocked, while a frozen install succeeds without changing the registry.

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

tests.rsTest pruning with non-hidden project-local stores +30/-0

Test pruning with non-hidden project-local stores

• Covers stores at 'store' and 'node_modules/store'. Verifies that a manifest-referenced slot survives while unused slots and their dependency links are removed.

pnpm/crates/store-dir/src/prune/tests.rs

Documentation (1) +2 / -0
store-loader.mdDocument frozen-store retention responsibility +2/-0

Document frozen-store retention responsibility

• Explains that frozen loaded installs do not register with the read-only store and that its external owner must retain required files.

pnpm/docs/store-loader.md

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Windows store paths lack regression coverage 📜 Skill insight ▣ Testability
Description
loaded_project_with_nonhidden_local_store_does_not_mark_unused_store_slots only varies store and
node_modules/store, so it never supplies a Windows-style separator or an explicit Windows-only
path case. A future regression in separator-sensitive store exclusion or symlink walking can
therefore pass this test while breaking Windows installs.
Code

pnpm/crates/store-dir/src/prune/tests.rs[R223-225]

+#[test]
+fn loaded_project_with_nonhidden_local_store_does_not_mark_unused_store_slots() {
+    for store_path in ["store", "node_modules/store"] {
Relevance

●●● Strong

Team accepts platform-specific path regressions and explicit Windows coverage for filesystem safety
changes.

PR-#14103
PR-#16238

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed pruning logic compares and canonicalizes filesystem paths while excluding the local
store during recursive directory and symlink walks. Compliance rule 3365308 requires path and
symlink changes to include Windows-separator coverage or an explicit Windows-specific test, but the
added test cases contain only store and node_modules/store.

pnpm/crates/store-dir/src/prune/tests.rs[223-250]
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 new store-pruning regression covers only platform-neutral path components and does not explicitly exercise Windows separators or Windows-specific store paths.

## Fix Focus Areas
- pnpm/crates/store-dir/src/prune/tests.rs[223-250]

## Recommended Fix
Add an explicit Windows-specific regression case, or parameterize the relevant path inputs to include Windows-style separators and assert that local-store exclusion and symlink walking retain live slots while pruning unused slots.

ⓘ 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
  Explored: repo: pnpm/pnpm.io (sha: e36dcc55) — View relationship
Review mode: Auto: ⚖️ Balanced: The PR changes store-pruning traversal and frozen/writable loaded-store registration, with potentially significant retention and install behavior, but the logic is sufficiently localized for one careful review pass.

Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

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.

@zkochan

zkochan commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

Reviewed Qodo's Windows-coverage suggestion against the actual CI run on 1e6c9482ff816eece2d1cdc597a87e328b09589b.

Both new/extended regressions ran and passed in the Windows test job: loaded_project_with_nonhidden_local_store_does_not_mark_unused_store_slots and loaded_project_local_store_survives_prune_and_requires_registration. They create real Windows directories, canonicalize their native filesystem paths, and use the Windows directory-link implementation. The node_modules/store input also exercises forward slashes within a native Windows path; the exclusion compares Path values from canonicalization and directory entries, rather than splitting strings on a separator.

I am keeping that cross-platform regression instead of adding a second test that changes only the spelling of the same path. The changed store-exclusion behavior is already exercised on Windows, including retaining the live root and deleting the unused transitive GVS slots.


Written by an agent (Codex, GPT-6).

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Oct 5, 2026
@zkochan
zkochan merged commit 1f6b830 into main Oct 5, 2026
59 checks passed
@zkochan
zkochan deleted the fix/loaded-store-pruning branch October 5, 2026 12:21
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