Skip to content

fix(deps-restorer): build a shared global virtual store slot again when nothing is cached - #17528

Merged
zkochan merged 1 commit into
mainfrom
fix/gvs-rebuild-shared-slot
Oct 30, 2026
Merged

zkochan merged 1 commit into
mainfrom
fix/gvs-rebuild-shared-slot

Conversation

@zkochan

@zkochan zkochan commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #17526.

With enableGlobalVirtualStore, pnpm 12 skipped a dependency's build scripts in a project whose global virtual store slot another project had already built. When the build writes only outside its own package (a git hook installer writing into INIT_CWD), the side-effects cache row is empty, so nothing is restored either, and the second project never gets the effect. pnpm 11 runs the script again there.

The skip is built_by_an_earlier_install in slot_to_build.rs, added by #16286. That PR described it as matching v11, but v11 derives isBuilt only from the side-effects cache row (getFlatMap in store/create-cafs-store). safeToSkip changes how files are imported into the shared slot, not isBuilt. The only other v11 skip is in importIntoSlot: a slot that carried .pnpm-needs-build, then lost it while this install waited for the slot lock. v12 keeps that wait in slot_to_build as before.

This PR removes the slot-level skip. A slot whose build left output in the package still skips through the side-effects is_built gate, as in v11.

Notes for reviewers

  • The cost. With sideEffectsCache: false, or for a build that changes nothing inside its package, every install into a fresh node_modules now runs the build again. pnpm 11 does the same. v13: cache builds that change no package files tasks#242 plans to make skipping these the intended behavior in the next major version, with sideEffectsCache.exclude as the opt-out.
  • The replaced test. gvs_reinstall_does_not_rebuild_a_built_slot pinned the skip with sideEffectsCache: false. It is replaced by gvs_reinstall_builds_a_built_slot_with_nothing_cached, which uses the issue's shape: a git dependency whose postinstall writes into the project, side-effects cache on, two installs into a fresh node_modules.
  • v12 only. pnpm 11 already behaves as the issue expects, so pnpm11/ is unchanged.

Validation

  • The new test fails on main (the second install did not run the postinstall) and passes with the fix.
  • The issue's two-project reproduction against the debug binary prints hook-installed for both projects.
  • pnpm test:rust -p pnpm-cli -p pnpm-deps-restorer filtered to pnpm-deps-restorer, global_virtual_store, workspace_install and gvs: 813 passed.
  • pnpm/scripts/pre-push-rust.sh passes.

Squash Commit Body

With enableGlobalVirtualStore, an install skipped the build scripts of a
dependency whose slot an earlier install had built, even when the
side-effects cache had no build output to restore for it. A build whose
effect lands outside its own package, such as a git hook installer, then
never took effect in a second project that shares the slot.

pnpm v11 decides whether a slot is built only from the side-effects cache
(`isBuilt` from the matched row), apart from waiting out a concurrent
build. The slot-level skip had no v11 counterpart, so it is removed; the
side-effects `is_built` gate still skips builds that have output to
restore.

Closes pnpm/pnpm#17526

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.
  • 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.

🤖 Generated with Claude Code


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


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Bug Fixes
    • Dependency build scripts now run when no side-effects cache output is available, including when the package was built during an earlier install.
    • Build scripts that write outside their package directory may affect each project where they run.

…en nothing is cached

With enableGlobalVirtualStore, an install skipped the build scripts of a
dependency whose slot an earlier install had built, even when the
side-effects cache had no build output to restore for it. A build whose
effect lands outside its own package, such as a git hook installer, then
never took effect in a second project that shares the slot.

pnpm v11 decides whether a slot is built only from the side-effects cache
(`isBuilt` from the matched row), apart from waiting out a concurrent
build. The slot-level skip had no v11 counterpart, so it is removed; the
side-effects `is_built` gate still skips builds that have output to
restore.

Closes #17526

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

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between e9bee2a and c7d2811.

Files selected for processing: 3
  • .changeset/gvs-rebuild-shared-slot.md
  • pnpm/crates/cli/tests/suite/global_virtual_store/builds.rs
  • pnpm/crates/deps-restorer/src/build_modules/build_one_snapshot/slot_to_build.rs

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

Walkthrough

The global virtual store slot selection no longer skips a build based on an earlier install. The integration test checks that a Git dependency’s postinstall output is recreated on two installs. A patch changeset records the behavior.

Changes: Shared slot builds

Layer / File(s) Summary
Shared-slot build eligibility and regression coverage
pnpm/crates/deps-restorer/src/build_modules/build_one_snapshot/slot_to_build.rs, pnpm/crates/cli/tests/suite/global_virtual_store/builds.rs, .changeset/gvs-rebuild-shared-slot.md
The earlier-install check is removed, so eligible slots proceed to marker checks and locking. The updated test verifies that postinstall output is recreated on both installs. The changeset describes the shared-slot build scenario.

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

Change: Bug fix · Severity of issue fixed: Medium

Assessment against linked issues

Objective Addressed Explanation
Run a dependency’s build script in a project when another project has already built the shared global virtual store slot [#17526] ✅

Possibly related PRs

  • pnpm/pnpm#17231: Both changes address build execution for dependencies in global virtual-store slots, through different slot-building paths.
  • pnpm/pnpm#17318: Both changes alter dependency-restorer decisions about whether shared slots can be reused without running a build.
  • pnpm/pnpm#17499: Both changes address lifecycle scripts for packages used in shared installation layouts.

Suggested labels: product: pacquet

Suggested reviewers: rubnogueira

Merge Risk: Minimal · up to c7d28

The concurrent-install limitation predates this change. No identified issue with the new shared-slot build behavior blocks merging.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · 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.

@github-actions

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     10.9±0.21ms    34.3 MB/sec    1.14     12.5±0.45ms    30.0 MB/sec
packument/parse                                  1.00     40.4±1.10µs  1641.7 MB/sec    1.10     44.6±0.71µs  1487.4 MB/sec
tarball/download_dependency                      1.00   765.9±53.27µs     5.5 MB/sec    1.13   868.2±98.31µs     4.9 MB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    163.8±0.62ms 97.7 KElem/sec    1.22    199.1±3.49ms 80.4 KElem/sec
version_pick/repeated_ranges_file                1.00      3.9±0.20ms  8.0 KElem/sec    1.02      4.0±0.11ms  7.8 KElem/sec
version_pick/repeated_ranges_raw                 1.03      4.0±0.18ms  7.7 KElem/sec    1.00      3.9±0.10ms  8.0 KElem/sec
workspace_resolution/hoist_heavy                 1.00    205.7±4.75ms        ? ?/sec    1.09    224.1±4.44ms        ? ?/sec
workspace_sort/chained_projects                  1.03     13.4±1.98ms        ? ?/sec    1.00     13.0±0.80ms        ? ?/sec

@github-actions

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 2263.71 ms 2422.27 ms 7.0% 113.19 ms Inconclusive (overlapping samples)
isolated-fresh-restore-cold-cache-cold-store pnpr 1320.71 ms 1415.89 ms 7.2% 66.04 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pacquet 253.57 ms 253.41 ms -0.1% 12.68 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 265.49 ms 270.54 ms 1.9% 13.27 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 9.00 ms 9.24 ms 2.6% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 9.33 ms 9.29 ms -0.4% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 8.58 ms 8.39 ms -2.2% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 8.54 ms 8.48 ms -0.7% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2910.42 ms 2824.27 ms -3.0% 145.52 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1596.13 ms 1643.43 ms 3.0% 79.81 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 519.37 ms 500.99 ms -3.5% 25.97 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 317.01 ms 328.78 ms 3.7% 15.85 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1579.33 ms 1569.89 ms -0.6% 78.97 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 280.21 ms 277.56 ms -0.9% 14.01 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 281.40 ms 278.87 ms -0.9% 14.07 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 98.03 ms 100.91 ms 2.9% 4.90 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 204.16 ms 176.27 ms -13.7% 10.21 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 82.68 ms 81.64 ms -1.3% 4.13 ms Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 74.89 ms 75.93 ms 1.4% 3.74 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4416.77 ms 4574.88 ms 3.6% 220.84 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3579.94 ms 3568.07 ms -0.3% 179.00 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 137.21 ms 131.48 ms -4.2% 6.86 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 141.90 ms 143.18 ms 0.9% 7.09 ms Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1220.77 ms 1184.55 ms -3.0% 61.04 ms Within tolerance
cargo-repeat-install-hot-cache-hot-store pacquet 36.40 ms 35.05 ms -3.7% 2.00 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: c7d2811446c1

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked, injected, and Cargo workspace scenarios compare 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.407 ± 0.109 2.261 2.562 1.78 ± 0.14
pacquet@main 2.305 ± 0.117 2.235 2.624 1.70 ± 0.14
pnpr@HEAD 1.438 ± 0.124 1.278 1.638 1.06 ± 0.12
pnpr@main 1.355 ± 0.090 1.274 1.556 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.40655422944,
      "stddev": 0.10882228491201204,
      "median": 2.42226874264,
      "user": 1.9652159599999997,
      "system": 1.45158104,
      "min": 2.26147602364,
      "max": 2.5619968336400003
    },
    {
      "command": "pacquet@main",
      "mean": 2.30517653064,
      "stddev": 0.11677337912384073,
      "median": 2.2637093116400004,
      "user": 2.04461936,
      "system": 1.53343874,
      "min": 2.23522453564,
      "max": 2.62353210464
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4382670676399998,
      "stddev": 0.12436327382587045,
      "median": 1.41589292014,
      "user": 1.77649936,
      "system": 1.33595154,
      "min": 1.27817196364,
      "max": 1.63829834264
    },
    {
      "command": "pnpr@main",
      "mean": 1.3551073433399998,
      "stddev": 0.09030714517882879,
      "median": 1.3207100176399997,
      "user": 1.81032736,
      "system": 1.3632209400000002,
      "min": 1.2741589676399998,
      "max": 1.5556792146399998
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 256.0 ± 9.8 245.5 279.2 1.01 ± 0.05
pacquet@main 253.1 ± 8.0 241.4 269.3 1.00
pnpr@HEAD 270.9 ± 10.2 255.1 286.2 1.07 ± 0.05
pnpr@main 268.3 ± 9.2 255.4 283.2 1.06 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25600274204000006,
      "stddev": 0.009785586751089054,
      "median": 0.25340688664,
      "user": 0.32428842,
      "system": 0.6192541799999999,
      "min": 0.24554081064000002,
      "max": 0.27922400064
    },
    {
      "command": "pacquet@main",
      "mean": 0.25307491514,
      "stddev": 0.007963328703271452,
      "median": 0.25357433764000004,
      "user": 0.29550701999999995,
      "system": 0.6391823799999998,
      "min": 0.24142867764000003,
      "max": 0.26932252664
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27087281964,
      "stddev": 0.010210194788781329,
      "median": 0.27053969763999997,
      "user": 0.33180732,
      "system": 0.6565551799999998,
      "min": 0.25506199264,
      "max": 0.28621845264
    },
    {
      "command": "pnpr@main",
      "mean": 0.26827595953999994,
      "stddev": 0.009194089515017823,
      "median": 0.26549277514,
      "user": 0.31963832000000003,
      "system": 0.62050578,
      "min": 0.25537820564,
      "max": 0.28318257664
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 9.3 ± 0.7 7.9 12.7 1.02 ± 0.11
pacquet@main 9.1 ± 0.8 8.0 14.0 1.00
pnpr@HEAD 9.4 ± 0.7 8.2 12.7 1.03 ± 0.12
pnpr@main 9.4 ± 0.6 8.1 11.8 1.03 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.009272084429635037,
      "stddev": 0.0006563041231943803,
      "median": 0.009235007780000002,
      "user": 0.0051529464233576626,
      "system": 0.005013319051094891,
      "min": 0.007929879280000001,
      "max": 0.012710146280000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.009123764240365853,
      "stddev": 0.0008041818832295003,
      "median": 0.009000498280000001,
      "user": 0.005345966585365853,
      "system": 0.004563098292682927,
      "min": 0.007967190280000001,
      "max": 0.014019651280000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.009402529890921506,
      "stddev": 0.0006754033224446251,
      "median": 0.00928585328,
      "user": 0.005545200477815704,
      "system": 0.004668310921501706,
      "min": 0.008207540280000002,
      "max": 0.01273595528
    },
    {
      "command": "pnpr@main",
      "mean": 0.009408836320816327,
      "stddev": 0.0006067852728880632,
      "median": 0.00932572278,
      "user": 0.005709258231292517,
      "system": 0.004513734829931969,
      "min": 0.008085632280000001,
      "max": 0.01183944328
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 8.5 ± 0.7 7.3 13.1 1.00
pacquet@main 8.7 ± 0.7 7.6 14.6 1.03 ± 0.12
pnpr@HEAD 8.6 ± 0.5 7.4 11.6 1.01 ± 0.11
pnpr@main 8.6 ± 1.0 7.3 12.7 1.02 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.008489103205098042,
      "stddev": 0.0007191164851085578,
      "median": 0.008387580660000001,
      "user": 0.005035391764705885,
      "system": 0.0041780605490196075,
      "min": 0.0072503316600000004,
      "max": 0.013062871660000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.00871782571904059,
      "stddev": 0.0006776914688409446,
      "median": 0.008579701660000001,
      "user": 0.005277455276752768,
      "system": 0.004192585977859777,
      "min": 0.007620517660000001,
      "max": 0.014618946660000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.008588001601979523,
      "stddev": 0.0005209378994163197,
      "median": 0.008477580660000001,
      "user": 0.005446725392491467,
      "system": 0.0039450318088737205,
      "min": 0.007440169660000001,
      "max": 0.011598356660000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.008633935194883726,
      "stddev": 0.0009514242995972357,
      "median": 0.008539586660000001,
      "user": 0.005144185315614619,
      "system": 0.004191402657807308,
      "min": 0.007307549660000001,
      "max": 0.012650796660000001
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.874 ± 0.174 2.687 3.183 1.78 ± 0.16
pacquet@main 2.947 ± 0.184 2.729 3.273 1.82 ± 0.17
pnpr@HEAD 1.646 ± 0.083 1.522 1.826 1.02 ± 0.08
pnpr@main 1.618 ± 0.107 1.505 1.845 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.87366313374,
      "stddev": 0.1740179310870082,
      "median": 2.82426835374,
      "user": 3.347315079999999,
      "system": 2.30973648,
      "min": 2.6870004847400004,
      "max": 3.18344106274
    },
    {
      "command": "pacquet@main",
      "mean": 2.94720351774,
      "stddev": 0.18407148921488659,
      "median": 2.91042439774,
      "user": 3.3148181799999996,
      "system": 2.4694771799999997,
      "min": 2.7288996727400003,
      "max": 3.27346698874
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.64649109024,
      "stddev": 0.08331842802248046,
      "median": 1.64342639174,
      "user": 2.3617463800000005,
      "system": 2.00728148,
      "min": 1.52150426074,
      "max": 1.8255074627399999
    },
    {
      "command": "pnpr@main",
      "mean": 1.6182083942399998,
      "stddev": 0.10666955351399236,
      "median": 1.59612851674,
      "user": 2.22936518,
      "system": 1.88340518,
      "min": 1.5051731987399999,
      "max": 1.84540753674
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 504.4 ± 31.0 443.8 549.2 1.58 ± 0.12
pacquet@main 517.0 ± 31.3 476.0 559.9 1.62 ± 0.12
pnpr@HEAD 324.4 ± 15.9 292.5 347.0 1.01 ± 0.06
pnpr@main 320.0 ± 13.2 300.4 337.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.50437448668,
      "stddev": 0.030983098582563477,
      "median": 0.50099352798,
      "user": 0.7300378000000001,
      "system": 1.09771988,
      "min": 0.44384371398000005,
      "max": 0.54917162098
    },
    {
      "command": "pacquet@main",
      "mean": 0.51695854118,
      "stddev": 0.03125469264257942,
      "median": 0.51936571248,
      "user": 0.7718700999999999,
      "system": 1.1127802800000002,
      "min": 0.47596652498,
      "max": 0.55986681098
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32438334998000007,
      "stddev": 0.015923588926281002,
      "median": 0.32877964398000004,
      "user": 0.3124138,
      "system": 0.6426587799999999,
      "min": 0.29245434098000006,
      "max": 0.34699763698
    },
    {
      "command": "pnpr@main",
      "mean": 0.31999775358,
      "stddev": 0.013163794428821141,
      "median": 0.31700729948000006,
      "user": 0.3056358,
      "system": 0.65532638,
      "min": 0.30038954598000006,
      "max": 0.33751890498000003
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.574 ± 0.014 1.559 1.600 5.59 ± 0.21
pacquet@main 1.578 ± 0.011 1.563 1.592 5.61 ± 0.21
pnpr@HEAD 0.281 ± 0.010 0.271 0.302 1.00
pnpr@main 0.284 ± 0.013 0.264 0.309 1.01 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.5741563458599999,
      "stddev": 0.014343323549838586,
      "median": 1.5698937644600002,
      "user": 0.8178859800000001,
      "system": 0.7797301799999999,
      "min": 1.55900090846,
      "max": 1.60026169846
    },
    {
      "command": "pacquet@main",
      "mean": 1.5776316720600003,
      "stddev": 0.010878979878388038,
      "median": 1.5793336739600001,
      "user": 0.7784715799999999,
      "system": 0.78600158,
      "min": 1.56272119946,
      "max": 1.59155503446
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.28143715536,
      "stddev": 0.010386405144768778,
      "median": 0.27756158496000005,
      "user": 0.27572778,
      "system": 0.5491997799999999,
      "min": 0.27078241946000003,
      "max": 0.30232671846000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.28361917376,
      "stddev": 0.013083552591447159,
      "median": 0.28020944046,
      "user": 0.26422567999999996,
      "system": 0.57882628,
      "min": 0.26448169946,
      "max": 0.30886137746000003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 277.9 ± 11.6 253.7 297.3 2.81 ± 0.21
pacquet@main 277.9 ± 13.2 250.9 293.2 2.81 ± 0.22
pnpr@HEAD 101.5 ± 4.5 93.2 111.5 1.03 ± 0.08
pnpr@main 98.9 ± 6.0 88.5 114.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.27792279261999997,
      "stddev": 0.011619480965224404,
      "median": 0.27887424892,
      "user": 0.27108375999999995,
      "system": 0.31552226,
      "min": 0.25371445142,
      "max": 0.29731636542
    },
    {
      "command": "pacquet@main",
      "mean": 0.2778638413290909,
      "stddev": 0.013239556170810258,
      "median": 0.28140387542,
      "user": 0.2748027145454545,
      "system": 0.30755181454545455,
      "min": 0.25091833342000003,
      "max": 0.29315141342
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10152591514413792,
      "stddev": 0.004474586067479953,
      "median": 0.10091312142000002,
      "user": 0.04029450137931034,
      "system": 0.03260922206896552,
      "min": 0.09316919042,
      "max": 0.11154920042000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.09886913452344828,
      "stddev": 0.0059990717621073875,
      "median": 0.09802615342000001,
      "user": 0.04158167379310345,
      "system": 0.025975222068965517,
      "min": 0.08847794042000001,
      "max": 0.11414592242
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 179.0 ± 9.1 168.7 193.3 1.00
pacquet@main 201.6 ± 14.2 178.4 231.2 1.13 ± 0.10
pnpm@HEAD 3913.8 ± 362.7 3443.3 4548.8 21.86 ± 2.31
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.17903931665777778,
      "stddev": 0.009149239623557433,
      "median": 0.17627035588,
      "user": 0.19198798444444443,
      "system": 0.053137035555555566,
      "min": 0.16873152488,
      "max": 0.19329652088
    },
    {
      "command": "pacquet@main",
      "mean": 0.2016191127688889,
      "stddev": 0.014180364955467081,
      "median": 0.20416159988,
      "user": 0.22003954,
      "system": 0.05279881333333333,
      "min": 0.17838691588,
      "max": 0.23117159388
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.913799207213333,
      "stddev": 0.36270793530840445,
      "median": 3.77049478488,
      "user": 6.097112873333334,
      "system": 0.3737902577777778,
      "min": 3.4433346658799997,
      "max": 4.5487747268800005
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 81.7 ± 1.5 79.0 85.5 1.00
pacquet@main 83.3 ± 3.6 79.5 99.9 1.02 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.08173781620285714,
      "stddev": 0.0014850808255433717,
      "median": 0.08164379786,
      "user": 0.07077965714285712,
      "system": 0.047099720000000005,
      "min": 0.07895186586000001,
      "max": 0.08554059186
    },
    {
      "command": "pacquet@main",
      "mean": 0.08329049960285713,
      "stddev": 0.003561199783341567,
      "median": 0.08268438886000001,
      "user": 0.0779828,
      "system": 0.04163846285714285,
      "min": 0.07949352586000001,
      "max": 0.09994602486000001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 76.5 ± 1.9 74.4 83.8 1.01 ± 0.05
pacquet@main 75.8 ± 3.2 73.6 92.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.07650725383333333,
      "stddev": 0.0019000466202069518,
      "median": 0.0759274635,
      "user": 0.027113207692307694,
      "system": 0.05523485897435897,
      "min": 0.0744468465,
      "max": 0.08381994649999999
    },
    {
      "command": "pacquet@main",
      "mean": 0.07580496103846156,
      "stddev": 0.0031834588873449875,
      "median": 0.0748865405,
      "user": 0.026490053846153848,
      "system": 0.054971346153846155,
      "min": 0.0736400235,
      "max": 0.0924434625
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.660 ± 0.156 4.513 4.945 1.30 ± 0.06
pacquet@main 4.501 ± 0.160 4.366 4.857 1.25 ± 0.06
pnpr@HEAD 3.587 ± 0.102 3.490 3.828 1.00
pnpr@main 3.633 ± 0.158 3.477 3.945 1.01 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.66005235648,
      "stddev": 0.15603525382440045,
      "median": 4.57487608298,
      "user": 2.5145580399999994,
      "system": 1.8865029200000003,
      "min": 4.51339845498,
      "max": 4.94525402198
    },
    {
      "command": "pacquet@main",
      "mean": 4.500524518480001,
      "stddev": 0.15951085312891183,
      "median": 4.41677490248,
      "user": 2.1901108399999996,
      "system": 1.6227175199999997,
      "min": 4.36573155498,
      "max": 4.85748900998
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5874103988800004,
      "stddev": 0.10181119697991897,
      "median": 3.56806940298,
      "user": 2.3376727399999995,
      "system": 1.71352942,
      "min": 3.48993416098,
      "max": 3.82809248498
    },
    {
      "command": "pnpr@main",
      "mean": 3.63327792168,
      "stddev": 0.15789441375562077,
      "median": 3.57993724648,
      "user": 2.28232384,
      "system": 1.7394115200000002,
      "min": 3.47741307498,
      "max": 3.94506988198
    }
  ]
}

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 132.7 ± 6.8 122.9 145.2 1.00
pacquet@main 138.5 ± 6.3 128.7 156.1 1.04 ± 0.07
pnpr@HEAD 144.2 ± 5.2 134.9 156.3 1.09 ± 0.07
pnpr@main 143.1 ± 5.8 133.0 153.1 1.08 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.1326610059911111,
      "stddev": 0.006837106386959582,
      "median": 0.13148440488000002,
      "user": 0.16883786888888888,
      "system": 0.15919986666666666,
      "min": 0.12287082788,
      "max": 0.14522825688000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.1384720297221053,
      "stddev": 0.006348146479673363,
      "median": 0.13721243488,
      "user": 0.1790785326315789,
      "system": 0.1662095947368421,
      "min": 0.12866761788000003,
      "max": 0.15607294788
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.14421153010222224,
      "stddev": 0.00521934802252776,
      "median": 0.14318283088,
      "user": 0.17445247999999997,
      "system": 0.15946369999999996,
      "min": 0.13487907688,
      "max": 0.15625978988000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.14314355838000006,
      "stddev": 0.005823222972591723,
      "median": 0.14189827088,
      "user": 0.17622897999999998,
      "system": 0.15770014444444444,
      "min": 0.13296450688000003,
      "max": 0.15313093688
    }
  ]
}

Scenario: Store only: unlocked direct deps, cold cache + hot store

Store-only install (enableModulesDir: false, per-file store index, trusted lockfile) against a lockfile missing the direct dependencies that have peers, with the metadata cache wiped per iteration: the install resolves those from the registry, reuses their subtrees from the lockfile and checks the store, linking nothing. Direct installs only.

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.203 ± 0.052 1.150 1.313 1.00
pacquet@main 1.231 ± 0.044 1.178 1.298 1.02 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.20340640902,
      "stddev": 0.05158473058046694,
      "median": 1.18454628342,
      "user": 0.5338513399999999,
      "system": 0.2337574,
      "min": 1.1501329289200002,
      "max": 1.3126930299200001
    },
    {
      "command": "pacquet@main",
      "mean": 1.23145137232,
      "stddev": 0.04383114402044707,
      "median": 1.2207693754200002,
      "user": 0.5472590399999999,
      "system": 0.27496139999999997,
      "min": 1.17763480192,
      "max": 1.29761411592
    }
  ]
}

Scenario: Cargo: repeat install, hot cache + hot store

Frozen repeat install of a Cargo workspace (cargo.enabled: true) whose crates are already materialized in <storeDir>/v11/crates/ and linked into .pnpm/crates/crates-io. Direct installs only.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 36.3 ± 4.4 31.4 60.4 1.00
pacquet@main 36.9 ± 3.3 31.8 49.5 1.02 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.03626203830941176,
      "stddev": 0.004382730111924727,
      "median": 0.03505417978,
      "user": 0.02638593647058824,
      "system": 0.02109843058823529,
      "min": 0.03138514578,
      "max": 0.06044105878
    },
    {
      "command": "pacquet@main",
      "mean": 0.03691120209168831,
      "stddev": 0.0032789467904118567,
      "median": 0.03639918778,
      "user": 0.027254643116883127,
      "system": 0.0211332612987013,
      "min": 0.03183146378,
      "max": 0.049498285780000005
    }
  ]
}

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.67%. Comparing base (e9bee2a) to head (c7d2811).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17528   +/-   ##
=======================================
  Coverage   92.67%   92.67%           
=======================================
  Files        1927     1927           
  Lines      251409   251384   -25     
=======================================
- Hits       232988   232971   -17     
+ Misses      18421    18413    -8     

☔ 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.

@zkochan
zkochan marked this pull request as ready for review October 30, 2026 23:36
Copilot AI balanced review requested due to automatic review settings October 30, 2026 23:36

@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.

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 insufficient remaining quota. Try requesting a review at a lower effort level.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Rebuild shared global-store slots when no build output is cached

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Remove the slot-level skip that prevented build scripts from running in later projects.
• Preserve skips when cached build output can be restored or a concurrent build completes.
• Add a git-hook regression test and a patch changeset for the behavior.
Diagram

graph TD
  A["Fresh install"] --> B{"Cached output?"} -->|No| C["Acquire slot lock"] --> D{"Concurrent build?"} -->|No| E["Run build scripts"] --> F["Project effect"]
  B -->|Yes| G["Use cached output"]
  D -->|Yes| H["Skip slot build"]
Loading
High-Level Assessment

Removing the redundant slot-level skip is the most direct fix: the existing side-effects cache gate decides whether output can be restored, while slot locking still handles concurrent builds. Making the slot check conditional on cache state would duplicate that decision.

Files changed (3) +41 / -85

Bug fix (1) +3 / -44
slot_to_build.rsRemove the earlier-install slot skip +3/-44

Remove the earlier-install slot skip

• Deletes the check that treated an unmarked shared slot as already built. Builds without restorable cached output can now run again, while the existing lock and concurrent-build checks remain.

pnpm/crates/deps-restorer/src/build_modules/build_one_snapshot/slot_to_build.rs

Tests (1) +33 / -41
builds.rsTest reinstalling a git dependency with project-local output +33/-41

Test reinstalling a git dependency with project-local output

• Replaces the test that expected an already-built slot to be skipped. The new test installs a git dependency twice into fresh node_modules and verifies that its postinstall creates a project-local file both times.

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

Documentation (1) +5 / -0
gvs-rebuild-shared-slot.mdDocument the shared-slot rebuild fix +5/-0

Document the shared-slot rebuild fix

• Adds a patch changeset explaining that installs rerun build scripts when a shared slot has no cached output to restore, allowing project-local effects such as git hooks.

.changeset/gvs-rebuild-shared-slot.md

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can route each severity your way: inline, summary, both, or drop

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Auto-approved notes - no code review findings
- 'auto_approve_for_no_suggestions' flag enabled

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 30, 2026
@zkochan
zkochan merged commit c771057 into main Oct 30, 2026
63 checks passed
@zkochan
zkochan deleted the fix/gvs-rebuild-shared-slot branch October 30, 2026 23:58
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.

pnpm 12 skips a dependency's build script in a second project that shares a global virtual store slot

3 participants