Skip to content

fix: keep built and patched slots on a repeat install - #16709

Merged
zkochan merged 2 commits into
mainfrom
fix/16705
Oct 7, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix/16705

Conversation

@zkochan

@zkochan zkochan commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #16705.

A repeat pnpm install that misses the repeat-install fast path (for example under recursiveInstall: false, or with a root file: dependency) re-imported every patched package and every package with a build script into its project-local virtual-store slot, and reran builds whose side-effects cache had nothing to restore. The snapshot plan correctly left those slots alone, but BuildModules still walked every build/patch candidate reachable from the importers. A side-effects cache hit then re-imported the overlay, because only the global virtual store checks whether a slot already carries it.

The isolated linker now scopes the build phase like the hoisted linker already does. It considers only the snapshots this install materialized, plus those the previous install's .modules.yaml recorded as unbuilt (pendingBuilds/ignoredBuilds), so a previous --ignore-scripts install still gets built. A rebuild or an allowBuilds change still considers every candidate. The global virtual store and the hoisted linker keep their existing handling.

pnpm v11 is not affected: it builds only new nodes on this path (depsToBuild: newDepPaths), so this is a v12-only fix.

Squash Commit Body

An install that misses the repeat-install fast path, such as one under
`recursiveInstall: false` or with a `file:` dependency, re-imported the
side-effects overlay into every project-local slot of a patched or built
package and reran builds whose cache had nothing to restore. Only the
global virtual store checked whether a slot already carried the overlay.

The isolated linker now scopes the build phase the way the hoisted
linker does: the snapshots this install materialized, plus those the
previous install recorded as unbuilt in `.modules.yaml`. A rebuild or an
`allowBuilds` change still considers every candidate. pnpm v11 already
builds only new nodes on this path, so it is not affected.

The check for an entry recorded as unbuilt moved into a shared helper,
which also matches an `ignoredBuilds` key that carries a patch hash.

Closes https://github.com/pnpm/pnpm/issues/16705

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.

The new e2e test repeat_install_keeps_the_built_and_patched_slots_it_leaves_in_place fails without the fix (the postinstall runs again on the repeat install). Locally: pnpm-deps-restorer, pnpm-package-manager, and the full pnpm-cli suite pass.

🤖 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. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes
    • Repeat installs now skip re-importing unchanged patched packages and packages with build scripts, and avoid rerunning their builds when the fast path is unavailable.
    • Build scripts are limited to packages within the applicable build scope, helping prevent unrelated packages from being rebuilt.

An install that misses the repeat-install fast path, such as one under
`recursiveInstall: false` or with a `file:` dependency, re-imported the
side-effects overlay into every project-local slot of a patched or built
package and reran builds whose cache had nothing to restore. Only the
global virtual store checked whether a slot already carried the overlay.

The isolated linker now scopes the build phase the way the hoisted
linker does: the snapshots this install materialized, plus those the
previous install recorded as unbuilt in `.modules.yaml`. A rebuild or an
`allowBuilds` change still considers every candidate. pnpm v11 already
builds only new nodes on this path, so it is not affected.

Closes #16705

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

coderabbitai Bot commented Oct 7, 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: e11fcb44-11da-429d-bb18-785248c16761
📥 Commits

Reviewing files that changed from the base of the PR and between c70e4c7 and 5884647.

📒 Files selected for processing (1)
  • .changeset/keep-built-slots-on-repeat-install.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/keep-built-slots-on-repeat-install.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

The isolated linker now supplies an optional build scope to build processing. Build candidates and deferred-build reporting use that scope. A CLI test checks repeat installs with build-script dependencies and a patched dependency.

Changes

Repeat-install build scope

Layer / File(s) Summary
Compute and pass the build scope
pnpm/crates/deps-restorer/src/build_scope.rs, pnpm/crates/deps-restorer/src/build_options.rs, pnpm/crates/deps-restorer/src/linking.rs, pnpm/crates/deps-restorer/src/phase_options.rs, pnpm/crates/deps-restorer/src/install_frozen_lockfile/*, pnpm/crates/package-manager/src/install_with_fresh_lockfile/on_disk.rs, pnpm/crates/deps-restorer/src/lib.rs
The isolated linker computes an optional package-key scope and passes it through the install paths to build processing.
Filter build processing
pnpm/crates/deps-restorer/src/build_modules.rs, pnpm/crates/deps-restorer/src/build_modules/build_one_snapshot.rs, pnpm/crates/deps-restorer/src/install_frozen_lockfile/hoisted.rs, pnpm/crates/deps-restorer/src/build_modules/tests/*, pnpm/crates/deps-restorer/src/install_frozen_lockfile/build_phase/tests.rs
Build candidate selection and deferred-build reporting filter snapshots by scope. Hoisted build-root selection uses the shared unbuilt-record helper. Existing test fixtures initialize the new scope field.
Validate repeat-install behavior
pnpm/crates/cli/tests/suite/repeat_install.rs, .changeset/keep-built-slots-on-repeat-install.md
The CLI test checks that a repeat install does not rerun an external postinstall or change witnessed built and patched files. The changeset describes the behavior.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Assessment against linked issues

Objective Addressed Explanation
Keep unchanged patched packages and packages with build scripts from being re-imported or rebuilt on a no-op install under the reported install conditions [#16705] ✅

Suggested labels: product: pacquet

Merge Risk: ⚪ Minimal · up to 58846

No actionable issue is identified in this change; it is ready for normal merge checks.

✨ Finishing Touches
🧪 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 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.43%. Comparing base (cef5fc3) to head (5884647).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16709   +/-   ##
=======================================
  Coverage   92.42%   92.43%           
=======================================
  Files        1594     1595    +1     
  Lines      210285   210337   +52     
=======================================
+ Hits       194362   194415   +53     
+ Misses      15923    15922    -1     

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

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.01     15.9±0.83ms    23.6 MB/sec    1.00     15.6±0.85ms    24.0 MB/sec
packument/parse                                  1.00     46.9±1.56µs  1415.3 MB/sec    1.07     50.1±1.47µs  1323.1 MB/sec
tarball/download_dependency                      1.00      5.2±0.67ms   828.0 KB/sec    1.09      5.7±1.09ms   759.2 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00   279.3±16.35ms 57.3 KElem/sec    1.08   302.2±16.39ms 52.9 KElem/sec
version_pick/repeated_ranges_file                1.03      4.9±0.20ms  6.4 KElem/sec    1.00      4.8±0.07ms  6.6 KElem/sec
version_pick/repeated_ranges_raw                 1.04      5.1±0.29ms  6.1 KElem/sec    1.00      4.9±0.17ms  6.3 KElem/sec
workspace_resolution/hoist_heavy                 1.07   298.4±11.85ms        ? ?/sec    1.00   280.1±12.45ms        ? ?/sec
workspace_sort/chained_projects                  1.28     20.0±3.96ms        ? ?/sec    1.00     15.5±1.59ms        ? ?/sec

@github-actions

github-actions Bot commented Oct 7, 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 2477.87 ms 2485.03 ms 0.3% 123.89 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1659.09 ms 1559.56 ms -6.0% 82.95 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 416.42 ms 350.93 ms -15.7% 20.82 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 580.93 ms 397.55 ms -31.6% 29.05 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 12.88 ms 11.64 ms -9.6% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 13.95 ms 11.70 ms -16.1% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 23.37 ms 22.36 ms -4.4% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 20.45 ms 23.56 ms 15.3% 2.00 ms Inconclusive (overlapping samples)
isolated-fresh-install-cold-cache-cold-store pacquet 3145.87 ms 3155.74 ms 0.3% 157.29 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1828.34 ms 1832.80 ms 0.2% 91.42 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 471.73 ms 588.46 ms 24.7% 23.59 ms Inconclusive (not reproduced)
isolated-fresh-install-hot-cache-hot-store pnpr 337.31 ms 318.20 ms -5.7% 16.87 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1985.26 ms 1846.27 ms -7.0% 99.26 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 375.72 ms 485.27 ms 29.2% 18.79 ms Inconclusive (not reproduced)
isolated-fresh-resolve-hot-cache-offline pacquet 490.63 ms 521.75 ms 6.3% 24.53 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pnpr 175.79 ms 166.19 ms -5.5% 8.79 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 394.18 ms 360.26 ms -8.6% 19.71 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 226.08 ms 235.81 ms 4.3% 11.30 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 5025.35 ms 4730.41 ms -5.9% 251.27 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 4409.66 ms 4118.24 ms -6.6% 220.48 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 200.39 ms 216.43 ms 8.0% 10.02 ms Inconclusive (overlapping samples)
gvs-fresh-restore-hot-cache-hot-store pnpr 215.32 ms 239.05 ms 11.0% 10.77 ms Inconclusive (overlapping samples)

Integrated-Benchmark Report (Linux)

Commit: 58846474b717

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.502 ± 0.169 2.330 2.760 1.59 ± 0.17
pacquet@main 2.501 ± 0.131 2.318 2.708 1.59 ± 0.16
pnpr@HEAD 1.572 ± 0.129 1.428 1.805 1.00
pnpr@main 1.643 ± 0.110 1.441 1.781 1.05 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5015406384000003,
      "stddev": 0.16855421304210907,
      "median": 2.4850320663,
      "user": 1.69959676,
      "system": 1.61118198,
      "min": 2.3301689673,
      "max": 2.7597029833
    },
    {
      "command": "pacquet@main",
      "mean": 2.5011336278000003,
      "stddev": 0.131461260837487,
      "median": 2.4778671463,
      "user": 1.7020340600000001,
      "system": 1.6740167799999999,
      "min": 2.3183936923,
      "max": 2.7083346773
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5716976370999998,
      "stddev": 0.1294031621773458,
      "median": 1.5595625757999998,
      "user": 2.0384983599999993,
      "system": 1.95898758,
      "min": 1.4275929103,
      "max": 1.8053649482999998
    },
    {
      "command": "pnpr@main",
      "mean": 1.6429542753,
      "stddev": 0.11031825268040543,
      "median": 1.6590876548,
      "user": 2.2807248600000003,
      "system": 2.16404288,
      "min": 1.4405170223,
      "max": 1.7809449822999999
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 359.9 ± 57.9 290.4 466.5 1.00
pacquet@main 426.9 ± 94.9 292.1 577.9 1.19 ± 0.33
pnpr@HEAD 427.7 ± 86.3 320.1 576.2 1.19 ± 0.31
pnpr@main 562.8 ± 137.0 361.2 747.8 1.56 ± 0.46
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3598550351400001,
      "stddev": 0.05786678648222961,
      "median": 0.35092510474000005,
      "user": 0.3991453399999999,
      "system": 0.73458502,
      "min": 0.29035786674,
      "max": 0.46654597974000006
    },
    {
      "command": "pacquet@main",
      "mean": 0.42685427114,
      "stddev": 0.09492794192956437,
      "median": 0.41642310674000005,
      "user": 0.46719974,
      "system": 0.84114322,
      "min": 0.29208699774,
      "max": 0.57789942174
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.42769130494000007,
      "stddev": 0.08625398550090647,
      "median": 0.39754866274000006,
      "user": 0.48004923999999993,
      "system": 0.81221622,
      "min": 0.32009978174000003,
      "max": 0.57616202574
    },
    {
      "command": "pnpr@main",
      "mean": 0.5628466984399999,
      "stddev": 0.13696605380944848,
      "median": 0.5809338912399999,
      "user": 0.52960904,
      "system": 0.9145534200000001,
      "min": 0.36123012474000005,
      "max": 0.74783555274
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 11.8 ± 1.1 9.4 16.7 1.00
pacquet@main 13.5 ± 2.4 10.3 23.4 1.15 ± 0.23
pnpr@HEAD 12.2 ± 1.8 9.5 17.2 1.04 ± 0.18
pnpr@main 14.4 ± 2.2 11.0 21.0 1.22 ± 0.22
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.011764232190526316,
      "stddev": 0.0010527803837565232,
      "median": 0.01163914318,
      "user": 0.006959695087719296,
      "system": 0.005901051228070176,
      "min": 0.00938066718,
      "max": 0.016740479180000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.013494676707659565,
      "stddev": 0.0024002980633834035,
      "median": 0.012881534180000001,
      "user": 0.007440591914893609,
      "system": 0.007271428085106387,
      "min": 0.01030758218,
      "max": 0.02338905418
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.012183905453170728,
      "stddev": 0.001753898903986169,
      "median": 0.01170218118,
      "user": 0.006856138048780488,
      "system": 0.006416613170731707,
      "min": 0.009519962180000001,
      "max": 0.017205940180000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.014357636607807485,
      "stddev": 0.0022299283474404466,
      "median": 0.01394752118,
      "user": 0.008070278181818182,
      "system": 0.00763523315508021,
      "min": 0.01098299018,
      "max": 0.02098427318
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 23.0 ± 3.0 18.4 34.4 1.13 ± 0.22
pacquet@main 24.5 ± 5.0 17.1 45.6 1.20 ± 0.30
pnpr@HEAD 24.0 ± 4.0 17.8 48.1 1.18 ± 0.26
pnpr@main 20.4 ± 2.9 14.2 28.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.02300953150811594,
      "stddev": 0.002962200993933214,
      "median": 0.02235661574,
      "user": 0.012614991884057968,
      "system": 0.012209837681159423,
      "min": 0.01843583674,
      "max": 0.03439500874
    },
    {
      "command": "pacquet@main",
      "mean": 0.024520599447964614,
      "stddev": 0.005016770302494737,
      "median": 0.02337457374,
      "user": 0.013072547610619465,
      "system": 0.012872841592920355,
      "min": 0.01707594574,
      "max": 0.045627835740000004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.023966001911717175,
      "stddev": 0.003976517330986794,
      "median": 0.02356485674,
      "user": 0.013619709494949492,
      "system": 0.012093967676767669,
      "min": 0.01776472174,
      "max": 0.04813826074000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.020370076640000002,
      "stddev": 0.0029460082899888653,
      "median": 0.020446053239999998,
      "user": 0.01166910545454546,
      "system": 0.010831599090909087,
      "min": 0.014178863740000002,
      "max": 0.02883581974
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.197 ± 0.193 2.934 3.522 1.76 ± 0.15
pacquet@main 3.199 ± 0.194 2.995 3.514 1.76 ± 0.15
pnpr@HEAD 1.853 ± 0.099 1.670 2.000 1.02 ± 0.08
pnpr@main 1.822 ± 0.114 1.640 2.032 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.19717203776,
      "stddev": 0.1933428673431412,
      "median": 3.15574440636,
      "user": 3.59845158,
      "system": 2.65723276,
      "min": 2.93389182736,
      "max": 3.52186108736
    },
    {
      "command": "pacquet@main",
      "mean": 3.1986446894600005,
      "stddev": 0.19382774051672105,
      "median": 3.1458662343599997,
      "user": 3.5828093799999996,
      "system": 2.5867079599999996,
      "min": 2.99500295336,
      "max": 3.51412824236
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.8533580009600001,
      "stddev": 0.09903387839025421,
      "median": 1.83279780886,
      "user": 2.10498488,
      "system": 2.2278289599999996,
      "min": 1.66979105636,
      "max": 1.9999553243600001
    },
    {
      "command": "pnpr@main",
      "mean": 1.82174302656,
      "stddev": 0.11380008508823018,
      "median": 1.82834377386,
      "user": 1.9535344799999996,
      "system": 2.01555606,
      "min": 1.63952648036,
      "max": 2.03173906936
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 593.9 ± 40.5 526.9 659.9 1.75 ± 0.36
pacquet@main 476.0 ± 25.8 441.4 518.8 1.40 ± 0.28
pnpr@HEAD 338.8 ± 65.1 291.3 510.1 1.00
pnpr@main 351.6 ± 54.4 309.6 498.1 1.04 ± 0.26

Confirmation (reversed target order)

Command Mean [ms] Min [ms] Max [ms] Relative
pnpr@main 317.7 ± 13.2 300.5 340.1 1.00
pnpr@HEAD 379.7 ± 59.9 320.3 483.1 1.20 ± 0.19
pacquet@main 593.4 ± 65.5 487.0 669.5 1.87 ± 0.22
pacquet@HEAD 513.5 ± 50.1 448.2 615.4 1.62 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5938566875400001,
      "stddev": 0.0405484355275822,
      "median": 0.58846058274,
      "user": 0.8591932999999999,
      "system": 0.9108661599999998,
      "min": 0.52692817774,
      "max": 0.6598951777400001
    },
    {
      "command": "pacquet@main",
      "mean": 0.4760200427400001,
      "stddev": 0.025781971596722308,
      "median": 0.47173334774000003,
      "user": 0.6624629000000001,
      "system": 0.73973526,
      "min": 0.44137612674000004,
      "max": 0.5188013517400001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33881243634,
      "stddev": 0.06514001410169612,
      "median": 0.31820425224000004,
      "user": 0.3049231,
      "system": 0.64125546,
      "min": 0.29130151074,
      "max": 0.51014813674
    },
    {
      "command": "pnpr@main",
      "mean": 0.35160190983999995,
      "stddev": 0.05438953742796617,
      "median": 0.33731071124,
      "user": 0.33072359999999995,
      "system": 0.6594797599999997,
      "min": 0.30963052974,
      "max": 0.49807955574
    }
  ],
  "confirmation": {
    "results": [
      {
        "command": "pnpr@main",
        "mean": 0.3177089073,
        "stddev": 0.013171026593599323,
        "median": 0.315867106,
        "user": 0.28836642,
        "system": 0.6081794999999999,
        "min": 0.30049893050000004,
        "max": 0.3400576765
      },
      {
        "command": "pnpr@HEAD",
        "mean": 0.3796768797000001,
        "stddev": 0.05985875847444762,
        "median": 0.355911482,
        "user": 0.34971142000000005,
        "system": 0.6700622999999999,
        "min": 0.32028831250000006,
        "max": 0.48305580950000004
      },
      {
        "command": "pacquet@main",
        "mean": 0.5934241369000001,
        "stddev": 0.06546398896053818,
        "median": 0.616703615,
        "user": 0.83511212,
        "system": 0.8893226999999999,
        "min": 0.48697610850000006,
        "max": 0.6695223055
      },
      {
        "command": "pacquet@HEAD",
        "mean": 0.5135046382999999,
        "stddev": 0.05008256284954319,
        "median": 0.5093928315,
        "user": 0.7081289199999998,
        "system": 0.8099470999999999,
        "min": 0.44820823150000005,
        "max": 0.6153583925
      }
    ]
  }
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.848 ± 0.078 1.719 1.938 4.93 ± 0.39
pacquet@main 2.003 ± 0.105 1.849 2.221 5.34 ± 0.46
pnpr@HEAD 0.518 ± 0.087 0.429 0.662 1.38 ± 0.25
pnpr@main 0.375 ± 0.025 0.330 0.427 1.00

Confirmation (reversed target order)

Command Mean [ms] Min [ms] Max [ms] Relative
pnpr@main 371.4 ± 41.9 313.6 433.9 1.00
pnpr@HEAD 395.9 ± 27.0 355.0 440.0 1.07 ± 0.14
pacquet@main 2128.5 ± 101.9 1926.5 2245.6 5.73 ± 0.70
pacquet@HEAD 1903.6 ± 79.0 1797.4 2042.5 5.13 ± 0.62
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8483678728600001,
      "stddev": 0.07778297989997301,
      "median": 1.84627403056,
      "user": 1.3722730799999998,
      "system": 1.11192856,
      "min": 1.71895061806,
      "max": 1.93844396206
    },
    {
      "command": "pacquet@main",
      "mean": 2.0032327832600005,
      "stddev": 0.10461758438333639,
      "median": 1.98526478656,
      "user": 1.6506538800000001,
      "system": 1.21587386,
      "min": 1.84903155506,
      "max": 2.2214128890600002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.5179686048600001,
      "stddev": 0.08693266604217227,
      "median": 0.48526899006,
      "user": 0.48618958,
      "system": 0.83197156,
      "min": 0.42913014006000005,
      "max": 0.66212410406
    },
    {
      "command": "pnpr@main",
      "mean": 0.37493122256000005,
      "stddev": 0.025449047731528184,
      "median": 0.37572409306000004,
      "user": 0.36432907999999997,
      "system": 0.6908903599999999,
      "min": 0.33013906206,
      "max": 0.42673156206000007
    }
  ],
  "confirmation": {
    "results": [
      {
        "command": "pnpr@main",
        "mean": 0.37135890044000003,
        "stddev": 0.04185351148745463,
        "median": 0.36781173864000005,
        "user": 0.32571958,
        "system": 0.7284728600000001,
        "min": 0.31356896864,
        "max": 0.43388380864000003
      },
      {
        "command": "pnpr@HEAD",
        "mean": 0.39590455724,
        "stddev": 0.02703701788332459,
        "median": 0.39963409514000003,
        "user": 0.38641418000000005,
        "system": 0.7182184599999999,
        "min": 0.35504695864,
        "max": 0.43997443864
      },
      {
        "command": "pacquet@main",
        "mean": 2.1285086570400003,
        "stddev": 0.10190826081704453,
        "median": 2.1654125556399997,
        "user": 1.8609867799999997,
        "system": 1.3727773599999995,
        "min": 1.9264539786400001,
        "max": 2.24556359964
      },
      {
        "command": "pacquet@HEAD",
        "mean": 1.9035733439399998,
        "stddev": 0.07896780746245785,
        "median": 1.88283685664,
        "user": 1.42856358,
        "system": 1.1394820599999997,
        "min": 1.79735569564,
        "max": 2.04254632664
      }
    ]
  }
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 516.0 ± 40.5 445.8 580.9 3.11 ± 0.36
pacquet@main 491.0 ± 41.8 435.1 540.8 2.96 ± 0.36
pnpr@HEAD 165.7 ± 14.0 134.6 199.7 1.00
pnpr@main 171.9 ± 13.2 141.8 194.7 1.04 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5159807141400001,
      "stddev": 0.04045837806149392,
      "median": 0.52174769594,
      "user": 0.5209883800000001,
      "system": 0.22475501999999997,
      "min": 0.4458388689400001,
      "max": 0.58087658494
    },
    {
      "command": "pacquet@main",
      "mean": 0.49103429764000006,
      "stddev": 0.04184811483534439,
      "median": 0.49062767494000004,
      "user": 0.5182493800000001,
      "system": 0.19692332,
      "min": 0.43507304894000004,
      "max": 0.54076183194
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.16568745949555555,
      "stddev": 0.014028756417514558,
      "median": 0.16618900894000002,
      "user": 0.09514431333333334,
      "system": 0.02905469777777778,
      "min": 0.13456747794,
      "max": 0.19965026794000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.17188707444,
      "stddev": 0.013225471006412389,
      "median": 0.17579136394,
      "user": 0.09325469428571428,
      "system": 0.03558477714285715,
      "min": 0.14179569594000002,
      "max": 0.19473212494
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 356.4 ± 30.7 308.4 393.0 1.00
pacquet@main 405.3 ± 29.9 370.6 451.3 1.14 ± 0.13
pnpm@HEAD 5493.6 ± 420.3 4878.9 6222.9 15.41 ± 1.78
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3564383463644445,
      "stddev": 0.03074336142055889,
      "median": 0.36026098592000005,
      "user": 0.3813700688888889,
      "system": 0.0896194288888889,
      "min": 0.30837012192,
      "max": 0.39303693492
    },
    {
      "command": "pacquet@main",
      "mean": 0.4053301591422223,
      "stddev": 0.029935381674123716,
      "median": 0.39418023092000004,
      "user": 0.4356222911111111,
      "system": 0.09456842888888889,
      "min": 0.37056713892000004,
      "max": 0.45129527492000004
    },
    {
      "command": "pnpm@HEAD",
      "mean": 5.493634581475555,
      "stddev": 0.4202778177516442,
      "median": 5.4038406629199995,
      "user": 8.666262402222221,
      "system": 0.5423422066666667,
      "min": 4.87890347092,
      "max": 6.222893216919999
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 248.6 ± 34.7 218.6 318.9 1.11 ± 0.17
pacquet@main 224.6 ± 12.0 204.9 237.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2486217448666667,
      "stddev": 0.034738573084414213,
      "median": 0.23581362970000003,
      "user": 0.20079894333333334,
      "system": 0.09477960333333331,
      "min": 0.21861997970000002,
      "max": 0.3188588687
    },
    {
      "command": "pacquet@main",
      "mean": 0.22459828903333343,
      "stddev": 0.011985477821720398,
      "median": 0.22608392520000004,
      "user": 0.18052786,
      "system": 0.08682151999999999,
      "min": 0.2048712457,
      "max": 0.23751058270000003
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.752 ± 0.124 4.543 4.973 1.14 ± 0.07
pacquet@main 5.119 ± 0.456 4.583 5.950 1.23 ± 0.13
pnpr@HEAD 4.172 ± 0.244 3.907 4.778 1.00
pnpr@main 4.404 ± 0.264 3.971 4.820 1.06 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.75195346296,
      "stddev": 0.1242164490574405,
      "median": 4.73041476036,
      "user": 2.37722354,
      "system": 2.0839902199999996,
      "min": 4.54338070186,
      "max": 4.9725919998600006
    },
    {
      "command": "pacquet@main",
      "mean": 5.11891835496,
      "stddev": 0.45643663573557125,
      "median": 5.02535026436,
      "user": 2.4444955399999997,
      "system": 2.29309492,
      "min": 4.582538389860001,
      "max": 5.949511490860001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 4.17232369716,
      "stddev": 0.2441212663485734,
      "median": 4.1182434503600005,
      "user": 2.60338134,
      "system": 2.31574962,
      "min": 3.90660470886,
      "max": 4.77836546386
    },
    {
      "command": "pnpr@main",
      "mean": 4.4038043367599995,
      "stddev": 0.2641676804988937,
      "median": 4.409661444360001,
      "user": 2.7925546399999996,
      "system": 2.5896971199999994,
      "min": 3.97079433186,
      "max": 4.81980889386
    }
  ]
}

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 227.0 ± 40.3 177.4 327.6 1.10 ± 0.21
pacquet@main 206.2 ± 15.4 186.2 229.5 1.00
pnpr@HEAD 243.4 ± 37.6 206.8 331.0 1.18 ± 0.20
pnpr@main 223.3 ± 38.7 178.8 312.2 1.08 ± 0.20
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.22703984438,
      "stddev": 0.04028327909979148,
      "median": 0.21642979338,
      "user": 0.27494481714285707,
      "system": 0.19355002,
      "min": 0.17739145038,
      "max": 0.32757555738
    },
    {
      "command": "pacquet@main",
      "mean": 0.2062107410723077,
      "stddev": 0.015434668670017202,
      "median": 0.20039157238000002,
      "user": 0.25903038307692305,
      "system": 0.17043867384615383,
      "min": 0.18622267938000003,
      "max": 0.22948381838
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.24343369338,
      "stddev": 0.03757849931323958,
      "median": 0.23904704788000003,
      "user": 0.29312337666666666,
      "system": 0.16892177,
      "min": 0.20681089338000003,
      "max": 0.33099722838
    },
    {
      "command": "pnpr@main",
      "mean": 0.22328793478000003,
      "stddev": 0.03868540572896989,
      "median": 0.21532357288000004,
      "user": 0.24376875999999997,
      "system": 0.19108321999999997,
      "min": 0.17878354538000002,
      "max": 0.31223972438
    }
  ]
}

@zkochan
zkochan marked this pull request as ready for review October 7, 2026 18:53
Copilot AI balanced review requested due to automatic review settings October 7, 2026 18:53

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

Preserve built and patched slots on repeat installs

🐞 Bug fix 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Limit isolated-linker builds to newly materialized or previously unbuilt packages on repeat
 installs.
• Preserve existing build outputs and patches without rerunning scripts or restoring cached
 overlays.
• Add an end-to-end regression test and a patch release note.
Diagram

graph TD
  Materialized["Materialized snapshots"] --> Scope["Isolated build scope"] --> Gate{"In scope?"} -->|Yes| Build["Build or patch"]
  Prior["Prior unbuilt entries"] --> Scope
  Gate -->|No| Preserve["Preserve existing slot"]
  Gate -->|Yes| Deferred["Report deferred builds"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Check each local slot before restoring an overlay
  • ➕ Could prevent redundant overlay imports independently of build selection.
  • ➖ Would not by itself prevent unnecessary script runs or incorrect deferred-build reporting.
  • ➖ Requires reliable per-slot state checks.

Recommendation: Keep the proposed scope-based approach: it aligns isolated linking with the hoisted linker's treatment of untouched packages and addresses builds, patches, and reporting together. Retain unrestricted selection for rebuilds and build-policy changes.

Files changed (22) +226 / -13

Bug fix (11) +99 / -13
build_modules.rsScope deferred builds and snapshot processing +14/-1

Scope deferred builds and snapshot processing

• Filters deferred builds by the build scope and passes that scope to per-snapshot build processing.

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

build_one_snapshot.rsSkip build candidates outside the scope +3/-0

Skip build candidates outside the scope

• Rejects out-of-scope snapshots before considering their patches, scripts, or cached build outputs.

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

build_options.rsAdd build-scope inputs +5/-0

Add build-scope inputs

• Adds an optional snapshot set to graph and per-snapshot build inputs; None continues to consider every candidate.

pnpm/crates/deps-restorer/src/build_options.rs

build_scope.rsCompute the isolated-linker build scope +58/-0

Compute the isolated-linker build scope

• Combines materialized snapshots with previously unbuilt entries, including patch-hash keys. Leaves hoisted, global-store, rebuild-all, and unknown-materialization paths unrestricted.

pnpm/crates/deps-restorer/src/build_scope.rs

build_phase.rsPass the scope into frozen-lockfile builds +1/-0

Pass the scope into frozen-lockfile builds

• Threads the selected build scope from build-phase graph inputs into BuildModules.

pnpm/crates/deps-restorer/src/install_frozen_lockfile/build_phase.rs

hoisted.rsShare prior-unbuilt matching with hoisted linking +5/-10

Share prior-unbuilt matching with hoisted linking

• Replaces the hoisted linker's local unbuilt-entry check with the shared helper, which also recognizes patch-hash keys.

pnpm/crates/deps-restorer/src/install_frozen_lockfile/hoisted.rs

materialization.rsCarry the scope into frozen materialization +1/-0

Carry the scope into frozen materialization

• Passes the link phase's build scope into the frozen-lockfile build-phase graph.

pnpm/crates/deps-restorer/src/install_frozen_lockfile/materialization.rs

lib.rsRegister the build-scope module +1/-0

Register the build-scope module

• Makes the shared build-scope helpers available within deps-restorer.

pnpm/crates/deps-restorer/src/lib.rs

linking.rsExpose the isolated-linker build scope +7/-1

Expose the isolated-linker build scope

• Computes the scope during project linking and carries it in the link-phase output; the empty output remains unrestricted.

pnpm/crates/deps-restorer/src/linking.rs

phase_options.rsAdd scope to build-phase graph inputs +3/-1

Add scope to build-phase graph inputs

• Allows build-phase callers to pass an optional set of eligible snapshots.

pnpm/crates/deps-restorer/src/phase_options.rs

on_disk.rsCarry the scope through fresh-lockfile installs +1/-0

Carry the scope through fresh-lockfile installs

• Passes the linked build scope into the fresh-lockfile install's build-phase inputs.

pnpm/crates/package-manager/src/install_with_fresh_lockfile/on_disk.rs

Tests (10) +122 / -0
repeat_install.rsTest preservation of built and patched slots +96/-0

Test preservation of built and patched slots

• Adds an end-to-end repeat-install test that bypasses the fast path and checks script-run count, built-file identity, and patched-file identity.

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

tests.rsAdapt build test inputs to optional scoping +1/-0

Adapt build test inputs to optional scoping

• Sets the new scope to None in the existing frozen-backstop test setup.

pnpm/crates/deps-restorer/src/build_modules/tests.rs

build_policy.rsAdapt build-policy tests to optional scoping +9/-0

Adapt build-policy tests to optional scoping

• Sets an unrestricted scope in existing build-policy and side-effects-cache test setups.

pnpm/crates/deps-restorer/src/build_modules/tests/build_policy.rs

frozen.rsAdapt frozen-store test inputs +1/-0

Adapt frozen-store test inputs

• Sets an unrestricted scope in the frozen-store build test.

pnpm/crates/deps-restorer/src/build_modules/tests/frozen.rs

gvs_markers.rsPreserve unrestricted global-store marker tests +1/-0

Preserve unrestricted global-store marker tests

• Sets the new scope to None in the global virtual store marker test setup.

pnpm/crates/deps-restorer/src/build_modules/tests/gvs_markers.rs

installation.rsAdapt installation build tests +4/-0

Adapt installation build tests

• Sets an unrestricted scope in existing installation and side-effects-upload test setups.

pnpm/crates/deps-restorer/src/build_modules/tests/installation.rs

patches_and_approvals.rsAdapt patch and approval tests +3/-0

Adapt patch and approval tests

• Sets an unrestricted scope in existing patch and build-approval test setups.

pnpm/crates/deps-restorer/src/build_modules/tests/patches_and_approvals.rs

store.rsAdapt store integration tests +3/-0

Adapt store integration tests

• Sets an unrestricted scope in existing slot materialization and side-effects-cache tests.

pnpm/crates/deps-restorer/src/build_modules/tests/store.rs

workspace.rsAdapt workspace rebuild test +1/-0

Adapt workspace rebuild test

• Sets an unrestricted scope in the workspace rebuild-selection test.

pnpm/crates/deps-restorer/src/build_modules/tests/workspace.rs

tests.rsAdapt frozen build-phase tests +3/-0

Adapt frozen build-phase tests

• Sets an unrestricted scope in existing build-phase test graph inputs.

pnpm/crates/deps-restorer/src/install_frozen_lockfile/build_phase/tests.rs

Documentation (1) +5 / -0
keep-built-slots-on-repeat-install.mdDocument the repeat-install fix +5/-0

Document the repeat-install fix

• Adds a patch changeset explaining that unchanged built and patched packages are no longer re-imported or rebuilt.

.changeset/keep-built-slots-on-repeat-install.md

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. The release note combines two fixes ✓ Resolved
Description
The changeset entry combines avoiding re-imports with avoiding repeated builds in one sentence
instead of separating the two logical changes. When users read the release note, they cannot
distinguish the slot-preservation behavior from the build-execution behavior, so the entry
enumerates separate outcomes in a single sentence.
Code

.changeset/keep-built-slots-on-repeat-install.md[5]

+A repeat `pnpm install` no longer imports patched packages and packages with build scripts again when nothing changed, and no longer reruns their builds. This happened when `recursiveInstall` was `false` or the project had a `file:` dependency [#16705](https://github.com/pnpm/pnpm/issues/16705).
Relevance

●●● Strong

Recent reviews consistently require separate sentences for distinct changeset outcomes.

PR-#16692
PR-#15121

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changeset sentence uses one sentence to enumerate both slot re-import prevention and build rerun
prevention, which violates the requirement that each changeset sentence describe only one logical
change.

Rule 3058304: Avoid compound sentences in individual changeset entries
.changeset/keep-built-slots-on-repeat-install.md[5-5]

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 changeset entry describes two distinct observable changes in one compound sentence: repeat installs no longer re-import patched or built packages, and their builds no longer rerun.

## Fix Focus Areas
- .changeset/keep-built-slots-on-repeat-install.md[5-5]

## Recommended Fix
Rewrite the entry as separate sentences, with each sentence describing one logical user-visible behavior change. Preserve the issue reference and avoid implementation details.

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



Informational

2. Warm installs rescan every package 🐞 Bug ➹ Performance
Description
isolated_build_scope formats and checks every lockfile snapshot whenever the previous install
recorded even one unbuilt package. A warm isolated install with one denied build therefore repeats
per-package string allocation and up to three set lookups before each build phase, even when it
materialized no packages.
Code

pnpm/crates/deps-restorer/src/build_scope.rs[R48-50]

+        .filter(|_| !unbuilt.is_empty())
+        .map(|(snapshot_key, _)| snapshot_key)
+        .filter(|snapshot_key| records_unbuilt(unbuilt, &snapshot_key.to_string()));
Relevance

● Weak

A close precedent rejected optimizing full snapshot scans and per-key string allocations in
deps-restorer.

PR-#15310

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new iterator walks the complete lockfile snapshot map and calls to_string() and
records_unbuilt for each entry when unbuilt is nonempty. Prior unbuilt entries come from
persisted pending and ignored builds, so one such entry is enough to trigger this work on subsequent
installs.

pnpm/crates/deps-restorer/src/build_scope.rs[43-56]
pnpm/crates/deps-restorer/src/build_scope.rs[18-23]
pnpm/crates/package-manager/src/install/materialize/scope.rs[29-47]

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

## Issue description
A single persisted unbuilt entry makes every warm isolated install format and probe every lockfile snapshot while constructing its build scope.
## Fix Focus Areas
- pnpm/crates/deps-restorer/src/build_scope.rs[43-56]
## Recommended Fix
Derive matching snapshot keys from an index keyed by the persisted unbuilt identities, preserving matches for peer and patch variants, rather than formatting and probing every snapshot on each install. Skip the lookup entirely when the unbuilt set is empty.

ⓘ 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
Review mode: Auto: ⏭️ Skipped: Changeset prose only; no runtime or behavioral code changed

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

Previous reviews

Review updated until commit 5884647

Results up to commit c70e4c7 ⚖️ Balanced


🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. The release note combines two fixes ✓ Resolved
Description
The changeset entry combines avoiding re-imports with avoiding repeated builds in one sentence
instead of separating the two logical changes. When users read the release note, they cannot
distinguish the slot-preservation behavior from the build-execution behavior, so the entry
enumerates separate outcomes in a single sentence.
Code

.changeset/keep-built-slots-on-repeat-install.md[5]

+A repeat `pnpm install` no longer imports patched packages and packages with build scripts again when nothing changed, and no longer reruns their builds. This happened when `recursiveInstall` was `false` or the project had a `file:` dependency [#16705](https://github.com/pnpm/pnpm/issues/16705).
Relevance

●●● Strong

Recent reviews consistently require separate sentences for distinct changeset outcomes.

PR-#16692
PR-#15121

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changeset sentence uses one sentence to enumerate both slot re-import prevention and build rerun
prevention, which violates the requirement that each changeset sentence describe only one logical
change.

Rule 3058304: Avoid compound sentences in individual changeset entries
.changeset/keep-built-slots-on-repeat-install.md[5-5]

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 changeset entry describes two distinct observable changes in one compound sentence: repeat installs no longer re-import patched or built packages, and their builds no longer rerun.

## Fix Focus Areas
- .changeset/keep-built-slots-on-repeat-install.md[5-5]

## Recommended Fix
Rewrite the entry as separate sentences, with each sentence describing one logical user-visible behavior change. Preserve the issue reference and avoid implementation details.

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



Informational
2. Warm installs rescan every package 🐞 Bug ➹ Performance
Description
isolated_build_scope formats and checks every lockfile snapshot whenever the previous install
recorded even one unbuilt package. A warm isolated install with one denied build therefore repeats
per-package string allocation and up to three set lookups before each build phase, even when it
materialized no packages.
Code

pnpm/crates/deps-restorer/src/build_scope.rs[R48-50]

+        .filter(|_| !unbuilt.is_empty())
+        .map(|(snapshot_key, _)| snapshot_key)
+        .filter(|snapshot_key| records_unbuilt(unbuilt, &snapshot_key.to_string()));
Relevance

● Weak

A close precedent rejected optimizing full snapshot scans and per-key string allocations in
deps-restorer.

PR-#15310

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new iterator walks the complete lockfile snapshot map and calls to_string() and
records_unbuilt for each entry when unbuilt is nonempty. Prior unbuilt entries come from
persisted pending and ignored builds, so one such entry is enough to trigger this work on subsequent
installs.

pnpm/crates/deps-restorer/src/build_scope.rs[43-56]
pnpm/crates/deps-restorer/src/build_scope.rs[18-23]
pnpm/crates/package-manager/src/install/materialize/scope.rs[29-47]

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

## Issue description
A single persisted unbuilt entry makes every warm isolated install format and probe every lockfile snapshot while constructing its build scope.
## Fix Focus Areas
- pnpm/crates/deps-restorer/src/build_scope.rs[43-56]
## Recommended Fix
Derive matching snapshot keys from an index keyed by the persisted unbuilt identities, preserving matches for peer and patch variants, rather than formatting and probing every snapshot on each install. Skip the lookup entirely when the unbuilt set is empty.

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

Dismiss ↗ | View ↗


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 7, 2026
Copilot AI balanced review requested due to automatic review settings October 7, 2026 19:00

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.

@zkochan

zkochan commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

Replies to the Qodo review of c70e4c7:

  1. Release note combines two fixes: fixed in 5884647. The changeset now gives each outcome its own sentence.
  2. Warm installs rescan every package: not acting. The scan only runs on an install that already missed the repeat-install fast path. That install walks every snapshot several times in planning and in the build graph. The hoisted linker does the same records_unbuilt check per node. One string per snapshot plus up to three hash lookups is noise next to that, and an index keyed by the recorded entries would still have to normalize each snapshot to match peer and patch variants.

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

@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

Code review by qodo was updated up to the latest commit 5884647

@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 merged commit 736ffe4 into main Oct 7, 2026
56 checks passed
@zkochan
zkochan deleted the fix/16705 branch October 7, 2026 19:43
@zkochan zkochan mentioned this pull request Oct 11, 2026
2 of 5 tasks
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.

No-op pnpm install re-imports patched packages and packages with build scripts when recursiveInstall: false (regression from v11)

3 participants