Skip to content

fix: keep importers of projects missing from disk in filtered installs - #16936

Merged
zkochan merged 4 commits into
mainfrom
fix-16931
Oct 14, 2026
Merged

zkochan merged 4 commits into
mainfrom
fix-16931

Conversation

@zkochan

@zkochan zkochan commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Summary

A filtered install drops lockfile entries of workspace projects that are listed in pnpm-workspace.yaml but missing from disk, as in a sparse checkout. Closes #16931.

Measured on the reporter's repro (packages/c off disk, a dependency added to packages/a, then pnpm install --lockfile-only --filter ...):

filter = every project on disk narrower filter
pnpm 11.17.0 drops c importer, only-c catalog, left-pad keeps importer and left-pad, drops only-c catalog
pnpm 12.12.1 drops all drops all
this PR (both) keeps all keeps all

Changes:

  • v12: a --filter selection now always requests its importers. The stale-importer prune is skipped and the filtered lockfile merge runs, even when the filter matches every project on disk. The workspace state's filteredInstall stays count-based, as in v11, so --filter "*" still records an unfiltered install (install_filters::filter_matching_every_real_project_is_not_partial still passes).
  • v12: merge_filtered_wanted_lockfile keeps previous importers outside the workspace walk, plus their packages and catalog entries. It used to drop them for any filter. One unit test pinned the drop and was updated.
  • v11: pruneLockfileImporters defaults to false when filter/filterProd is set.
  • v11: createNewLockfile carries over the catalog entries used by importers the resolution left untouched.

Not covered: an unfiltered pnpm install in a sparse checkout still prunes the off-disk importer (the issue's scenario 1). Without a filter, pnpm can't tell a project removed from the workspace from one a sparse checkout hides. This PR fixes the filter case the issue asks for.

Squash Commit Body

A filtered install whose selection matched every project on disk was
treated as a full install, so it pruned lockfile importers of workspace
projects that are listed but not on disk, as in a sparse checkout.

pnpm v12:
- A --filter selection now always requests its importers, so the
  stale-importer prune is skipped and the filtered lockfile merge runs.
  The workspace state still records the install as unfiltered when every
  project was selected.
- The filtered merge keeps importers the previous lockfile records for
  projects outside the workspace walk, plus their packages and catalog
  entries. Before, it dropped them even for a narrower filter.

pnpm v11:
- pruneLockfileImporters defaults to false when a filter is given.
- The lockfile catalogs keep the entries used by importers that the
  resolution left untouched. Before, a narrower filter kept the
  importer but dropped its catalog entries.

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

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.

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
    • Filtered workspace installs now preserve lockfile information for projects that are missing from disk, including their dependency snapshots and catalog entries. Installs can still update selected projects’ dependencies without recreating missing project directories, whether the filter selects one on-disk project or all on-disk projects.

@coderabbitai

coderabbitai Bot commented Oct 14, 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: e222a50d-748a-464f-88fa-27d6ea5d7f55
📥 Commits

Reviewing files that changed from the base of the PR and between ad63103 and d95f2fe.

⛔ Files ignored due to path filters: 1
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
📒 Files selected for processing: 14
  • .changeset/filtered-install-keeps-missing-projects.md
  • pnpm/crates/cli/tests/suite/multiple_importers.rs
  • pnpm/crates/deps-restorer/Cargo.toml
  • pnpm/crates/deps-restorer/src/current_lockfile.rs
  • pnpm/crates/deps-restorer/src/current_lockfile/missing_projects.rs
  • pnpm/crates/deps-restorer/src/current_lockfile/tests/lockfile.rs
  • pnpm/crates/package-manager/src/install/run/importer_selection.rs
  • pnpm/crates/package-manager/src/install/run/workspace.rs
  • pnpm11/installing/commands/src/install.ts
  • pnpm11/installing/commands/src/recursive/context.ts
  • pnpm11/installing/commands/src/recursive/options.ts
  • pnpm11/installing/commands/test/miscRecursive.ts
  • pnpm11/installing/deps-resolver/src/getCatalogSnapshots.ts
  • pnpm11/installing/deps-resolver/src/index.ts

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

📝 Walkthrough

Filtered installs now retain lockfile entries and catalog data for workspace projects missing from disk. Filter detection, lockfile merging, and recursive-install catalog handling are covered by Rust and TypeScript tests.

Changes: Missing workspace project lockfile retention

Layer / File(s) Summary
Filter-aware importer selection and pruning
pnpm/crates/package-manager/src/install/run/*, pnpm11/installing/commands/src/install.ts, pnpm11/installing/commands/src/recursive/*
Filter options are passed into install selection. A nonempty filter list marks the install as filtered, including when the filter matches every on-disk project.
Retain missing importers in the Rust lockfile merge
pnpm/crates/deps-restorer/Cargo.toml, pnpm/crates/deps-restorer/src/current_lockfile*, pnpm/crates/deps-restorer/src/current_lockfile/tests/lockfile.rs, pnpm/crates/cli/tests/suite/multiple_importers.rs, .changeset/filtered-install-keeps-missing-projects.md
The merge retains prior importer snapshots and used catalog entries for project IDs absent from the real importer set. Tests cover filtered lockfile-only installs with a missing project.
Preserve catalog snapshots in recursive installs
pnpm11/installing/deps-resolver/src/*, pnpm11/installing/commands/test/miscRecursive.ts
The resolver adds catalog entries from prior lockfile importers that were not resolved. Recursive-install tests verify that missing project lockfile data remains present.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Merge as merge_filtered_wanted_lockfile
  participant Retain as retain_importers
  participant Previous as previous wanted lockfile
  Merge->>Retain: fresh lockfile and real importer IDs
  Retain->>Previous: read absent importer snapshots and used catalog entries
  Previous-->>Retain: importer snapshots and catalog entries
  Retain-->>Merge: retained importer snapshots
  Merge->>Merge: add importers, overlay packages and snapshots, compute closure
Loading

Assessment against linked issues

Objective Addressed Explanation
[#16931] Preserve lockfile entries for workspace projects that are not on disk when a filter selects all on-disk projects. ✅

Suggested labels: product: pnpm@11, product: pacquet

Suggested reviewers: altaywtf, ksxgithub

Merge Risk: ⚪ Minimal · up to d95f2

The filtered-install change is mergeable after normal checks; no outstanding issue was established.

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

@codecov-commenter

codecov-commenter commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16936   +/-   ##
=======================================
  Coverage   92.61%   92.62%           
=======================================
  Files        1713     1714    +1     
  Lines      222774   222837   +63     
=======================================
+ Hits       206322   206392   +70     
+ Misses      16452    16445    -7     

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

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.27     21.6±3.34ms    17.4 MB/sec    1.00     17.0±1.40ms    22.1 MB/sec
packument/parse                                  1.18     53.1±6.24µs  1250.3 MB/sec    1.00     44.9±2.78µs  1477.1 MB/sec
tarball/download_dependency                      1.06      7.7±1.50ms   559.8 KB/sec    1.00      7.3±1.35ms   592.6 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.31   371.2±15.45ms 43.1 KElem/sec    1.00   282.5±19.22ms 56.6 KElem/sec
version_pick/repeated_ranges_file                1.08      5.6±0.81ms  5.6 KElem/sec    1.00      5.2±0.45ms  6.0 KElem/sec
version_pick/repeated_ranges_raw                 1.00      5.5±0.80ms  5.6 KElem/sec    1.01      5.6±0.66ms  5.6 KElem/sec
workspace_resolution/hoist_heavy                 1.50   540.7±58.58ms        ? ?/sec    1.00   360.4±24.94ms        ? ?/sec
workspace_sort/chained_projects                  1.58    42.9±10.70ms        ? ?/sec    1.00     27.2±9.99ms        ? ?/sec

@github-actions

github-actions Bot commented Oct 14, 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 2541.90 ms 2645.84 ms 4.1% 127.10 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1689.07 ms 1573.26 ms -6.9% 84.45 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 357.85 ms 290.04 ms -18.9% 17.89 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 287.28 ms 302.06 ms 5.1% 14.36 ms Inconclusive (overlapping samples)
isolated-repeat-install-hot-cache-hot-store pacquet 21.71 ms 19.68 ms -9.4% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 21.66 ms 20.67 ms -4.6% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 18.52 ms 18.30 ms -1.2% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 18.11 ms 17.17 ms -5.2% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 3014.87 ms 2899.84 ms -3.8% 150.74 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1988.92 ms 2370.63 ms 19.2% 99.45 ms Inconclusive (overlapping samples)
isolated-fresh-install-hot-cache-hot-store pacquet 925.15 ms 854.93 ms -7.6% 46.26 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 505.90 ms 519.06 ms 2.6% 25.29 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 2072.11 ms 1896.70 ms -8.5% 103.61 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 436.02 ms 525.80 ms 20.6% 21.80 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pacquet 358.68 ms 399.39 ms 11.3% 17.93 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pnpr 118.81 ms 125.15 ms 5.3% 5.94 ms Inconclusive (overlapping samples)
isolated-peer-heavy-resolve-hot-cache-offline pacquet 364.18 ms 347.32 ms -4.6% 18.21 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 238.43 ms 236.43 ms -0.8% 11.92 ms Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 98.58 ms 101.68 ms 3.1% 4.93 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4712.27 ms 4785.21 ms 1.5% 235.61 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 4066.83 ms 3614.56 ms -11.1% 203.34 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 228.80 ms 234.65 ms 2.6% 11.44 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 341.55 ms 280.41 ms -17.9% 17.08 ms Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1550.25 ms 1427.07 ms -7.9% 77.51 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: d95f2fe7af78

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked and injected 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.660 ± 0.117 2.506 2.875 1.64 ± 0.16
pacquet@main 2.587 ± 0.159 2.446 3.011 1.59 ± 0.17
pnpr@HEAD 1.624 ± 0.144 1.492 1.952 1.00
pnpr@main 1.647 ± 0.180 1.370 1.863 1.01 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6597368318,
      "stddev": 0.1170699947661535,
      "median": 2.6458410277000004,
      "user": 2.09994064,
      "system": 2.0606075600000002,
      "min": 2.5060971267000003,
      "max": 2.8750284357
    },
    {
      "command": "pacquet@main",
      "mean": 2.5871804152999998,
      "stddev": 0.15915465855945649,
      "median": 2.5419000607,
      "user": 2.0580673399999996,
      "system": 1.9822096599999999,
      "min": 2.4456083777,
      "max": 3.0106626117
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6239085473,
      "stddev": 0.1443241392935664,
      "median": 1.5732565602,
      "user": 2.19409084,
      "system": 2.22065276,
      "min": 1.4920068317,
      "max": 1.9521239917000002
    },
    {
      "command": "pnpr@main",
      "mean": 1.6467292763999999,
      "stddev": 0.18043553496539594,
      "median": 1.6890681237,
      "user": 1.8424593399999996,
      "system": 1.7140596599999998,
      "min": 1.3703624347,
      "max": 1.8628324637
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 336.2 ± 95.4 253.1 527.2 1.16 ± 0.34
pacquet@main 360.7 ± 35.0 296.3 403.3 1.25 ± 0.14
pnpr@HEAD 300.8 ± 32.8 252.1 362.4 1.04 ± 0.13
pnpr@main 289.7 ± 17.0 273.8 331.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.33624530208,
      "stddev": 0.09541373189509134,
      "median": 0.29004381008,
      "user": 0.38168898,
      "system": 0.74532196,
      "min": 0.25307242858,
      "max": 0.5271955325800001
    },
    {
      "command": "pacquet@main",
      "mean": 0.36067945388,
      "stddev": 0.03498087715509388,
      "median": 0.35785143558,
      "user": 0.46308598000000006,
      "system": 0.8109489599999999,
      "min": 0.29629601758,
      "max": 0.40331461258
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30079344257999996,
      "stddev": 0.03275443711048822,
      "median": 0.30205542758000004,
      "user": 0.34796298,
      "system": 0.65125266,
      "min": 0.25209149558,
      "max": 0.36244675558
    },
    {
      "command": "pnpr@main",
      "mean": 0.28966581288000004,
      "stddev": 0.016960986348151266,
      "median": 0.28727986608,
      "user": 0.31007058,
      "system": 0.64996106,
      "min": 0.27378806558,
      "max": 0.33147382458
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 20.1 ± 3.0 14.1 29.0 1.00
pacquet@main 22.3 ± 3.8 13.4 34.6 1.11 ± 0.25
pnpr@HEAD 21.3 ± 4.4 12.6 32.8 1.06 ± 0.27
pnpr@main 22.5 ± 4.5 13.8 39.7 1.12 ± 0.28
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.020050643434409945,
      "stddev": 0.002999926877552261,
      "median": 0.01968101254,
      "user": 0.011125219254658383,
      "system": 0.010640467453416153,
      "min": 0.014146417540000001,
      "max": 0.02896144754
    },
    {
      "command": "pacquet@main",
      "mean": 0.022256226319999996,
      "stddev": 0.003815937071328936,
      "median": 0.021714905040000003,
      "user": 0.012026020000000002,
      "system": 0.011824575200000001,
      "min": 0.013386344540000001,
      "max": 0.03455676554
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.021256946554492753,
      "stddev": 0.00437473350230592,
      "median": 0.02066767154,
      "user": 0.012591618840579707,
      "system": 0.01007547913043478,
      "min": 0.01264759254,
      "max": 0.03282993054
    },
    {
      "command": "pnpr@main",
      "mean": 0.022483825681176465,
      "stddev": 0.004461984251151934,
      "median": 0.021661065040000003,
      "user": 0.011836811764705881,
      "system": 0.012020265647058824,
      "min": 0.013758375540000001,
      "max": 0.039719350540000004
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 18.6 ± 3.5 13.0 31.3 1.07 ± 0.28
pacquet@main 18.5 ± 3.2 12.7 25.3 1.06 ± 0.27
pnpr@HEAD 17.4 ± 3.2 11.4 24.4 1.00
pnpr@main 18.7 ± 3.8 12.7 31.6 1.08 ± 0.29
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.018639777411034484,
      "stddev": 0.003454199711402752,
      "median": 0.01830142648,
      "user": 0.009681551724137928,
      "system": 0.010623865172413793,
      "min": 0.012950690980000002,
      "max": 0.03134017898
    },
    {
      "command": "pacquet@main",
      "mean": 0.018542023151232885,
      "stddev": 0.003154455107597362,
      "median": 0.01851988848,
      "user": 0.009586184931506847,
      "system": 0.010602043287671243,
      "min": 0.012692214980000002,
      "max": 0.02529643698
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.01741962205246377,
      "stddev": 0.003236916503773554,
      "median": 0.01717045298,
      "user": 0.009564384057971014,
      "system": 0.009429680289855072,
      "min": 0.011372632980000002,
      "max": 0.02438183398
    },
    {
      "command": "pnpr@main",
      "mean": 0.01873970952938272,
      "stddev": 0.0037623646347997755,
      "median": 0.01810525448,
      "user": 0.010092246913580249,
      "system": 0.01025603037037037,
      "min": 0.012741738980000002,
      "max": 0.031628430980000004
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.891 ± 0.157 2.619 3.113 1.47 ± 0.16
pacquet@main 3.155 ± 0.389 2.744 4.020 1.60 ± 0.25
pnpr@HEAD 2.213 ± 0.348 1.649 2.584 1.12 ± 0.20
pnpr@main 1.972 ± 0.180 1.721 2.228 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.89088083848,
      "stddev": 0.15735920597595188,
      "median": 2.8998376764800002,
      "user": 3.0011421600000006,
      "system": 2.25471432,
      "min": 2.6194459309800004,
      "max": 3.11310849898
    },
    {
      "command": "pacquet@main",
      "mean": 3.1550019385800008,
      "stddev": 0.38870754629478693,
      "median": 3.01487363698,
      "user": 3.2863469599999995,
      "system": 2.59974182,
      "min": 2.7442622189800003,
      "max": 4.01966573598
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.21292988028,
      "stddev": 0.34759804734982097,
      "median": 2.37062501698,
      "user": 2.17961226,
      "system": 2.4654532199999997,
      "min": 1.64946909598,
      "max": 2.58431118898
    },
    {
      "command": "pnpr@main",
      "mean": 1.9718250157800004,
      "stddev": 0.17982428368798728,
      "median": 1.98892030598,
      "user": 2.13584606,
      "system": 2.2919383199999994,
      "min": 1.72127602898,
      "max": 2.2279556359800003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 870.7 ± 72.0 800.0 1042.4 1.71 ± 0.16
pacquet@main 909.8 ± 43.5 820.9 946.9 1.78 ± 0.11
pnpr@HEAD 521.5 ± 20.1 497.6 562.2 1.02 ± 0.06
pnpr@main 509.9 ± 21.6 484.6 543.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.870657978,
      "stddev": 0.07201955382254256,
      "median": 0.8549276681,
      "user": 1.3292061199999998,
      "system": 1.2937634999999998,
      "min": 0.7999869186,
      "max": 1.0423915016
    },
    {
      "command": "pacquet@main",
      "mean": 0.9097690774,
      "stddev": 0.043497745381755513,
      "median": 0.9251476146,
      "user": 1.3390811200000001,
      "system": 1.2926357999999998,
      "min": 0.8208643186,
      "max": 0.9468853976
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.5215365362,
      "stddev": 0.020052557276653553,
      "median": 0.5190576861,
      "user": 0.5198190200000001,
      "system": 0.8853651999999999,
      "min": 0.49760153760000003,
      "max": 0.5621747346
    },
    {
      "command": "pnpr@main",
      "mean": 0.5099138891000001,
      "stddev": 0.021602721613598597,
      "median": 0.5058985076,
      "user": 0.51827432,
      "system": 0.8903644999999999,
      "min": 0.48458636560000007,
      "max": 0.5435425996
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.913 ± 0.147 1.749 2.252 4.21 ± 0.72
pacquet@main 2.078 ± 0.220 1.787 2.582 4.58 ± 0.85
pnpr@HEAD 0.518 ± 0.088 0.395 0.650 1.14 ± 0.26
pnpr@main 0.454 ± 0.070 0.369 0.606 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.91314169926,
      "stddev": 0.14674057586893546,
      "median": 1.8966973143599999,
      "user": 1.4907262,
      "system": 1.2326041599999997,
      "min": 1.74945392936,
      "max": 2.25228896436
    },
    {
      "command": "pacquet@main",
      "mean": 2.0781724735599996,
      "stddev": 0.22047793038886282,
      "median": 2.07210849186,
      "user": 1.7790105999999999,
      "system": 1.3968485599999998,
      "min": 1.78678660936,
      "max": 2.5823175473599997
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.51848209666,
      "stddev": 0.08750560386239468,
      "median": 0.52579762586,
      "user": 0.5025665,
      "system": 0.9085176599999999,
      "min": 0.39465777936,
      "max": 0.65045866036
    },
    {
      "command": "pnpr@main",
      "mean": 0.45405273506,
      "stddev": 0.06958081110184518,
      "median": 0.43601673486000003,
      "user": 0.4372885,
      "system": 0.82248906,
      "min": 0.36923838336,
      "max": 0.60577604636
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 403.4 ± 30.1 349.5 458.8 3.35 ± 0.43
pacquet@main 364.8 ± 18.9 342.3 397.4 3.03 ± 0.36
pnpr@HEAD 124.8 ± 8.3 111.7 141.6 1.04 ± 0.13
pnpr@main 120.3 ± 12.7 102.8 160.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.40337927896000003,
      "stddev": 0.030139146829737593,
      "median": 0.39938746195999997,
      "user": 0.4149264,
      "system": 0.16616288,
      "min": 0.34954064946,
      "max": 0.45875586446
    },
    {
      "command": "pacquet@main",
      "mean": 0.36481515776,
      "stddev": 0.018895810587354962,
      "median": 0.35868487646,
      "user": 0.37613339999999995,
      "system": 0.15730287999999998,
      "min": 0.34234869146,
      "max": 0.39743925546000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.1247769229382609,
      "stddev": 0.008318971927748579,
      "median": 0.12515318946,
      "user": 0.05819095652173913,
      "system": 0.024775758260869564,
      "min": 0.11170139246,
      "max": 0.14159382446000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.12028794434888888,
      "stddev": 0.012690445308413097,
      "median": 0.11881233746,
      "user": 0.055001222222222215,
      "system": 0.023585835555555552,
      "min": 0.10284179446000001,
      "max": 0.16018884346000004
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 356.7 ± 32.7 293.6 391.9 1.00
pacquet@main 358.9 ± 25.2 319.1 400.4 1.01 ± 0.12
pnpm@HEAD 4294.3 ± 501.7 3781.3 5329.9 12.04 ± 1.79
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.35667005280666664,
      "stddev": 0.03268739486330768,
      "median": 0.34732298914000004,
      "user": 0.3728298644444445,
      "system": 0.07423508666666666,
      "min": 0.29357750214000006,
      "max": 0.39187685914000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.3589086426955556,
      "stddev": 0.02516474852792287,
      "median": 0.36417542514000006,
      "user": 0.38086842,
      "system": 0.07812630888888888,
      "min": 0.31911780014,
      "max": 0.40043088114000003
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.294286027028889,
      "stddev": 0.5016992671670346,
      "median": 4.08348208214,
      "user": 6.602089531111111,
      "system": 0.44756519777777776,
      "min": 3.7813067521400003,
      "max": 5.32989006614
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 236.6 ± 5.7 226.7 244.7 1.00
pacquet@main 241.1 ± 9.0 230.9 257.6 1.02 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23657168399333336,
      "stddev": 0.005699161112276025,
      "median": 0.23642726766000002,
      "user": 0.18129672666666666,
      "system": 0.09553923999999997,
      "min": 0.22667880766000004,
      "max": 0.24473557766000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.24110547249333336,
      "stddev": 0.00901955255757416,
      "median": 0.23842609066000003,
      "user": 0.19326097666666667,
      "system": 0.09138940666666666,
      "min": 0.23089544466000003,
      "max": 0.25760738666
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 108.2 ± 16.1 86.4 144.1 1.03 ± 0.23
pacquet@main 104.6 ± 17.2 87.2 144.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.10817478121833334,
      "stddev": 0.016096192881526552,
      "median": 0.10167801726,
      "user": 0.043830296666666664,
      "system": 0.07385563833333335,
      "min": 0.08644606976000001,
      "max": 0.14409559476000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.10455625406769231,
      "stddev": 0.017237186805522484,
      "median": 0.09858256776000002,
      "user": 0.044519610769230764,
      "system": 0.06951533384615384,
      "min": 0.08719395876000001,
      "max": 0.14463787676000003
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.783 ± 0.155 4.565 5.055 1.29 ± 0.08
pacquet@main 4.742 ± 0.148 4.567 5.007 1.28 ± 0.08
pnpr@HEAD 3.713 ± 0.206 3.516 4.031 1.00
pnpr@main 4.059 ± 0.095 3.856 4.195 1.09 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.782705577300001,
      "stddev": 0.15518621130792254,
      "median": 4.7852060106,
      "user": 2.2091133399999996,
      "system": 2.03482336,
      "min": 4.5648219250999995,
      "max": 5.0553444011
    },
    {
      "command": "pacquet@main",
      "mean": 4.7415956821,
      "stddev": 0.14756415937395342,
      "median": 4.7122692136,
      "user": 2.0942793399999995,
      "system": 1.8457470599999997,
      "min": 4.5670699270999995,
      "max": 5.0067508031
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.7131886231,
      "stddev": 0.20563971544717682,
      "median": 3.6145624996,
      "user": 1.9599105399999996,
      "system": 1.82242536,
      "min": 3.5164021820999998,
      "max": 4.0309710491
    },
    {
      "command": "pnpr@main",
      "mean": 4.0590845156,
      "stddev": 0.09538246690752279,
      "median": 4.066830533099999,
      "user": 2.55290854,
      "system": 2.34300996,
      "min": 3.8563048661,
      "max": 4.1954555661
    }
  ]
}

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 240.6 ± 21.7 219.3 282.2 1.06 ± 0.13
pacquet@main 227.6 ± 19.1 199.2 261.8 1.00
pnpr@HEAD 292.3 ± 41.7 237.1 365.7 1.28 ± 0.21
pnpr@main 341.0 ± 41.5 272.7 431.2 1.50 ± 0.22
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24061399592000005,
      "stddev": 0.021676713297350773,
      "median": 0.23465028232000001,
      "user": 0.28522171999999996,
      "system": 0.19246121999999996,
      "min": 0.21934166832000002,
      "max": 0.28216305532
    },
    {
      "command": "pacquet@main",
      "mean": 0.22756619685846152,
      "stddev": 0.01912625039424454,
      "median": 0.22879585432000002,
      "user": 0.276808843076923,
      "system": 0.18806969692307693,
      "min": 0.19920884332000002,
      "max": 0.26178393632
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29227692092,
      "stddev": 0.0417159523403884,
      "median": 0.28041217932,
      "user": 0.32939582,
      "system": 0.21219881999999995,
      "min": 0.23706517532000002,
      "max": 0.36567906132
    },
    {
      "command": "pnpr@main",
      "mean": 0.34101752242,
      "stddev": 0.04147891180824956,
      "median": 0.34155336332,
      "user": 0.36270932,
      "system": 0.23417422000000002,
      "min": 0.27267697732,
      "max": 0.43119183632
    }
  ]
}

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.447 ± 0.083 1.346 1.593 1.00
pacquet@main 1.545 ± 0.109 1.404 1.745 1.07 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.4465297742,
      "stddev": 0.08278936422412563,
      "median": 1.4270734193,
      "user": 0.9900777,
      "system": 0.45273534,
      "min": 1.3460434553,
      "max": 1.5929045893000002
    },
    {
      "command": "pacquet@main",
      "mean": 1.5446790218,
      "stddev": 0.10923910639755914,
      "median": 1.5502461898000002,
      "user": 1.0777502,
      "system": 0.4666751400000001,
      "min": 1.4037425593,
      "max": 1.7454664493
    }
  ]
}

@zkochan

zkochan commented Oct 14, 2026

Copy link
Copy Markdown
Member Author

Status: 67 checks pass. The only failure is Rust CI / Cargo Deny (and the Success roll-up). It flags new rustls advisories RUSTSEC-2026-0346 through 0349 against rustls 0.23.45 in Cargo.lock. main fails the same job at 583f02a, so it doesn't come from this diff. A rustls bump belongs in its own PR. This one stays a draft until that lands and it's rebased.


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

@zkochan

zkochan commented Oct 14, 2026

Copy link
Copy Markdown
Member Author

Review-and-fix pass on 5a32c62:

  • Rebased onto main (d1accb2), no conflicts.
  • Reworded the changeset (5a32c62). The old sentence read "missing from disk from pnpm-lock.yaml".
  • Review found nothing else to act on. Two points I checked:
    • The count-based filtered_install still drives the node_modules prune, auto-dedupe, and the workspace state. That is right, because every on-disk project is materialized either way.
    • Missing-project catalog entries are merged before resolution_inputs_match. This only adds entries the fresh resolution lacks, so it cannot hide a changed catalog pin.
  • The earlier Cargo Deny failure came from new rustls advisories (RUSTSEC-2026-0346/0347/0348), not from this change. It passed on this head only because that run could not reach the crates index. fix(deps): update rustls to 0.23.46 #16941 bumps rustls to 0.23.46.
  • Ran locally: pnpm-deps-restorer plus the multiple_importers:: CLI module (691 passed), and the two new miscRecursive cases (passed).

CI is green on 5a32c62. This PR is still a draft, and I kept it that way, so no automated review round has started (CodeRabbit skips drafts). No external review exists yet. Nothing else is left within this pass.


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

A filtered install whose selection matched every project on disk was
treated as a full install, so it pruned lockfile importers of workspace
projects that are listed but not on disk, as in a sparse checkout.

pnpm v12:
- A --filter selection now always requests its importers, so the
  stale-importer prune is skipped and the filtered lockfile merge runs.
  The workspace state still records the install as unfiltered when every
  project was selected.
- The filtered merge keeps importers the previous lockfile records for
  projects outside the workspace walk, plus their packages and catalog
  entries. Before, it dropped them even for a narrower filter.

pnpm v11:
- pruneLockfileImporters defaults to false when a filter is given.
- The lockfile catalogs keep the entries used by importers that the
  resolution left untouched. Before, a narrower filter kept the
  importer but dropped its catalog entries.

Closes #16931
@zkochan

zkochan commented Oct 14, 2026

Copy link
Copy Markdown
Member Author

#16941 (rustls 0.23.46) has merged. This branch is rebased onto it at d95f2fe with no conflicts.

  • Cargo.lock now locks rustls 0.23.46. A fresh local cargo deny --all-features check advisories passes, including RUSTSEC-2026-0349.
  • CI is green on d95f2fe, including Cargo Deny.
  • This PR is still a draft. I kept it that way, so no automated review round has started and no external review exists yet. The blocker named in the earlier status comment is cleared. Nothing else is left within this pass.

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

@zkochan
zkochan marked this pull request as ready for review October 14, 2026 22:48
Copilot AI balanced review requested due to automatic review settings October 14, 2026 22:48

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 missing workspace projects during filtered installs

🐞 Bug fix 🕐 40+ Minutes

Grey Divider

AI Description

• Keep off-disk workspace importers, their packages, and catalog entries during filtered installs.
• Treat explicit filters as filtered installs even when they select every project on disk.
• Add v11 and v12 regression tests for narrow and all-on-disk filters.
Diagram

graph TD
  A["Filter request"] --> B["v12 importer selection"] --> C["Filtered lockfile merge"] --> G[("Wanted lockfile")]
  A --> D["v11 prune policy"] --> E["Catalog retention"] --> G
  F[("Previous lockfile")] --> C
  F --> E
Loading
High-Level Assessment

Keep the targeted preservation approach. Reusing the entire previous lockfile would also retain unrelated stale entries; preserving missing importers and their needed catalog entries while applying the existing reachability closure limits that risk. Unfiltered installs remain outside this fix because a missing project cannot reliably be distinguished from a removed one.

Files changed (15) +299 / -26

Bug fix (9) +148 / -16
current_lockfile.rsMerge missing importers into filtered wanted lockfiles +23/-10

Merge missing importers into filtered wanted lockfiles

• Retains previous importers outside the workspace walk before computing the wanted lockfile's dependency closure. Extracts package and snapshot overlay into a helper.

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

missing_projects.rsPreserve missing importers and their catalog entries +72/-0

Preserve missing importers and their catalog entries

• Copies prior importer snapshots absent from the current workspace walk. Restores only their referenced catalog entries when fresh resolution did not record them.

pnpm/crates/deps-restorer/src/current_lockfile/missing_projects.rs

importer_selection.rsRequest importers for every explicit v12 filter +5/-1

Request importers for every explicit v12 filter

• Makes an explicit filter request importer selection even when it matches every project found on disk.

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

workspace.rsUse explicit filters to prevent v12 importer pruning +3/-1

Use explicit filters to prevent v12 importer pruning

• Passes filter presence into importer selection and bases stale-importer pruning on whether importers were requested. Leaves the count-based filtered-install flag unchanged.

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

install.tsExpose filters in v11 install command options +1/-1

Expose filters in v11 install command options

• Adds optional filter and production-filter fields to the install command options type.

pnpm11/installing/commands/src/install.ts

context.tsDisable default v11 importer pruning for filters +9/-0

Disable default v11 importer pruning for filters

• Defaults pruneLockfileImporters to false when a filter or production filter is present, including when it selects every on-disk project.

pnpm11/installing/commands/src/recursive/context.ts

options.tsType filters on recursive install options +1/-1

Type filters on recursive install options

• Adds optional filter and production-filter configuration fields used by the pruning decision.

pnpm11/installing/commands/src/recursive/options.ts

getCatalogSnapshots.tsRecover catalogs referenced by untouched importers +26/-1

Recover catalogs referenced by untouched importers

• Adds a helper that reads catalog specifiers from importer snapshots and copies their previous catalog entries when fresh resolution omitted them.

pnpm11/installing/deps-resolver/src/getCatalogSnapshots.ts

index.tsCarry untouched importers' catalogs into v11 lockfiles +8/-1

Carry untouched importers' catalogs into v11 lockfiles

• Invokes catalog retention while creating a lockfile, using importers that were not resolved in the current run.

pnpm11/installing/deps-resolver/src/index.ts

Tests (3) +141 / -10
multiple_importers.rsTest sparse-checkout installs in v12 +66/-0

Test sparse-checkout installs in v12

• Adds end-to-end coverage for narrow filters and filters matching every on-disk project. Checks that the missing importer, its package snapshot, and its catalog entry survive while a selected project resolves a new dependency.

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

lockfile.rsExpect missing importers to survive filtered merges +9/-10

Expect missing importers to survive filtered merges

• Changes the merge test to assert that an off-disk importer and its snapshot remain, while obsolete dependencies of refreshed importers are removed.

pnpm/crates/deps-restorer/src/current_lockfile/tests/lockfile.rs

miscRecursive.tsTest sparse-checkout installs in v11 +66/-0

Test sparse-checkout installs in v11

• Adds narrow-filter and all-on-disk-filter cases that verify retention of the missing importer, package, and catalog entry while the selected project changes.

pnpm11/installing/commands/test/miscRecursive.ts

Documentation (1) +8 / -0
filtered-install-keeps-missing-projects.mdDocument the filtered-install fix +8/-0

Document the filtered-install fix

• Adds patch changesets for the affected v11 and v12 packages and describes retention of off-disk projects' lockfile entries.

.changeset/filtered-install-keeps-missing-projects.md

Other (2) +2 / -0
Cargo.tomlAdd catalog protocol parser dependency +1/-0

Add catalog protocol parser dependency

• Adds the parser needed to identify catalog references in retained importer snapshots.

pnpm/crates/deps-restorer/Cargo.toml

Cargo.lockLock the deps-restorer catalog parser dependency +1/-0

Lock the deps-restorer catalog parser dependency

• Records pnpm-catalogs-protocol-parser as a deps-restorer dependency.

Cargo.lock

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. New catalog helper omits trailing commas 📘 Rule violation ⚙ Maintainability
Description
addCatalogEntriesOfImporters declares a multi-line parameter list without a trailing comma after
prevCatalogs, and its new multi-line call also omits a trailing comma after the final argument.
These TypeScript constructs violate the repository’s required collection and multi-line construct
formatting and make later additions create noisier diffs.
Code

pnpm11/installing/deps-resolver/src/getCatalogSnapshots.ts[R37-40]

+export function addCatalogEntriesOfImporters (
+  catalogSnapshots: CatalogSnapshots,
+  importers: readonly ProjectSnapshot[],
+  prevCatalogs: CatalogSnapshots | undefined
Relevance

●●● Strong

Recent TypeScript reviews accepted adding trailing commas to multiline signatures and calls.

PR-#16887

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new TypeScript function parameter list ends at prevCatalogs without a comma, and the new
multi-line invocation ends at opts.wantedLockfile.catalogs without a comma. Both are covered by
the checklist’s requirement for trailing commas in multi-line parameter and argument lists.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/installing/deps-resolver/src/getCatalogSnapshots.ts[37-41]
pnpm11/installing/deps-resolver/src/index.ts[354-360]

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 TypeScript helper and its call site use multi-line parameter and argument lists without trailing commas on their final entries.

## Fix Focus Areas
- pnpm11/installing/deps-resolver/src/getCatalogSnapshots.ts[37-41]
- pnpm11/installing/deps-resolver/src/index.ts[354-360]

## Recommended Fix
Add a trailing comma after `prevCatalogs` in `addCatalogEntriesOfImporters`, and add a trailing comma after `opts.wantedLockfile.catalogs` in the new call to that helper.

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

Dismiss ↗ | View ↗


2. All-project filters repeat graph walks 🐞 Bug ➹ Performance
Description
ImporterSelection::select now sets requested_importer_ids for an explicit filter even when it
selects every on-disk project, routing fresh resolution through a filtered lockfile merge and
enabling additional materialization closures. On a non-short-circuited install --filter '*', these
passes traverse the workspace dependency graph even when the previous lockfile contains no
missing-project importer to retain.
Code

pnpm/crates/package-manager/src/install/run/importer_selection.rs[30]

+            requested_importer_ids: (filtered_install || has_filter)
Relevance

●● Moderate

Extra graph traversal is plausible, but no close precedent confirms this all-project filter
performance concern.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new condition makes requested IDs present for an all-project filter. Fresh lockfile construction
consequently invokes the filtered merge, whose full closure walks the graph; materialization also
computes closures specifically when requested IDs are present.

pnpm/crates/package-manager/src/install/run/importer_selection.rs[24-39]
pnpm/crates/package-manager/src/install_with_fresh_lockfile/lockfile_build.rs[251-269]
pnpm/crates/deps-restorer/src/current_lockfile.rs[164-169]
pnpm/crates/deps-restorer/src/current_lockfile.rs[274-286]
pnpm/crates/package-manager/src/install/apply_materialization/selection.rs[21-68]

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

## Issue description
An explicit filter selecting every on-disk project activates workspace-scale filtered merge and materialization walks even when there is no off-disk importer to preserve.
## Fix Focus Areas
- pnpm/crates/package-manager/src/install/run/importer_selection.rs[25-40]
- pnpm/crates/package-manager/src/install/run/workspace.rs[213-225]
- pnpm/crates/deps-restorer/src/current_lockfile.rs[132-169]
## Recommended Fix
Preserve the filtered retention path when the prior lockfile has importers outside the on-disk set, but avoid its additional graph closures for an all-project selection when no such importer exists. Verify the no-missing-project case with a non-short-circuited install.

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

Dismiss ↗ | View ↗



Informational

3. One changeset mixes v11 and v12 📘 Rule violation § Compliance
Description
.changeset/filtered-install-keeps-missing-projects.md targets both the TypeScript pnpm package
and the Rust pacquet package in one changeset. Because this PR changes both stacks, the release
metadata needs separate version-specific changesets so each package receives the appropriate release
note and bump.
Code

.changeset/filtered-install-keeps-missing-projects.md[R2-5]

+"@pnpm/installing.commands": patch
+"@pnpm/installing.deps-resolver": patch
+"pacquet": patch
+"pnpm": patch
Relevance

● Weak

Recent reviews reject splitting v11 and v12 changesets; combined release metadata is accepted by
repository practice.

PR-#16684
PR-#16636

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed changeset lists both pacquet and pnpm in the same front matter, while the checklist
requires separate changesets when a single PR touches both the TypeScript v11 and Rust v12
implementations.

Rule 713436: Changesets for pnpm v11 vs v12 (pacquet) must target the correct package and bump type
.changeset/filtered-install-keeps-missing-projects.md[2-5]
pnpm/crates/deps-restorer/src/current_lockfile.rs[132-183]
pnpm11/installing/commands/src/recursive/context.ts[134-157]

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 combines the TypeScript v11 `pnpm` package and the Rust v12 `pacquet` package, while the release metadata convention requires separate changesets when one PR changes both stacks.

## Fix Focus Areas
- .changeset/filtered-install-keeps-missing-projects.md[1-8]

## Recommended Fix
Replace the combined changeset with separate changeset files: one targeting the affected v11 packages with `pnpm: patch`, and another targeting `pacquet: patch` for the v12 implementation. Keep each release note accurate for the behavior changed in its respective stack.

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

Dismiss ↗ | View ↗


4. Installs with recursive-install off never prune removed projects 🐞 Bug ≡ Correctness
Description
The new filter check (!config.filter.is_empty() || !config.filter_prod.is_empty() in v12,
hasFilter(opts) in v11) treats any non-empty filter as a user --filter. But when
recursive-install=false and the user gives no filter, apply_project_selectors (v12) and
enableRecursiveByDefault (v11) quietly add the default filter {.}.... So a plain pnpm install
in those workspaces now always skips the stale-importer prune, and v12's
merge_filtered_wanted_lockfile keeps every previous importer outside the workspace walk. As a
result, importers, packages and catalog entries of projects the user deleted from the workspace stay
in pnpm-lock.yaml until someone runs pnpm install -r.
Code

pnpm/crates/package-manager/src/install/run/workspace.rs[R216-217]

+            !install.context.config.filter.is_empty()
+                || !install.context.config.filter_prod.is_empty(),
Relevance

● Weak

The PR explicitly excludes unfiltered sparse-checkout pruning; similar stale-importer findings were
rejected as out of scope.

PR-#13081

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Both CLIs push {.}... into filter when recursive_install is false and the user gave no filter.
The PR then reads any non-empty filter as an explicit user filter, so pruning is turned off and
missing-project importers are kept. In v12 cli_settings gets the filter key only for an explicit
filter (before the default is pushed), so the code already has a way to tell the two cases apart.

pnpm/crates/cli/src/cli_args/dispatch/configuration.rs[276-297]
pnpm11/pnpm/src/selectWorkspaceProjects.ts[24-45]
pnpm/crates/deps-restorer/src/current_lockfile.rs[135-169]
pnpm11/installing/commands/src/recursive/context.ts[135-157]

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 filter detection added for sparse checkouts also fires for the implicit `{.}...` filter that pnpm adds when `recursive-install=false`. As a result, a plain `pnpm install` never prunes importers of removed projects, and v12 keeps them in the filtered merge.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/run/workspace.rs[216-217]
- pnpm/crates/cli/src/cli_args/dispatch/configuration.rs[276-297]
- pnpm11/installing/commands/src/recursive/context.ts[151-157]
- pnpm11/pnpm/src/selectWorkspaceProjects.ts[40-45]

## Recommended Fix
Count only a filter the user gave explicitly. In v12, check `config.cli_settings.contains("filter") || config.cli_settings.contains("filterProd")` (or add a dedicated flag) rather than whether `filter` is non-empty. In v11, record whether the filter was user-supplied (for example, set a flag in `enableRecursiveByDefault` when it injects `{.}...`) and have `hasFilter` ignore the implicit default. Add a test with `recursive-install=false` where a project removed from the workspace gets pruned.

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

Dismiss ↗ | View ↗


5. Sparse installs still delete hidden projects 📎 Requirement gap ≡ Correctness
Description
may_prune_stale_importers still receives `filtered_install:
importers.requested_importer_ids.is_some(), so an install without --filter` continues down the
stale-importer pruning path. In a sparse checkout, that condition treats every off-disk workspace
project as stale and deletes its importer and reachable lockfile data even though the project
remains listed in workspace configuration.
Code

pnpm/crates/package-manager/src/install/run/workspace.rs[222]

+            filtered_install: importers.requested_importer_ids.is_some(),
Relevance

● Weak

The PR explicitly limits preservation to filtered installs; similar unfiltered stale-importer
findings were rejected.

PR-#13081

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The ticket-derived rule requires sparse-checkout installs to preserve off-disk workspace lockfile
entries for both ordinary installs and filtered installs. The changed pruning decision only treats
an install as filtered when requested importer IDs exist, so the unfiltered sparse-checkout case
remains on the pruning path.

Preserve lockfile entries for off-disk workspace packages during sparse-checkout installs
pnpm/crates/package-manager/src/install/run/workspace.rs[216-224]
pnpm/crates/cli/tests/suite/multiple_importers.rs[121-126]

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

## Issue description
Unfiltered installs still prune lockfile importers for workspace projects whose manifests are absent because of a sparse checkout. Extend workspace discovery or sparse-checkout detection so configured-but-hidden projects are distinguished from projects intentionally removed from the workspace before stale-importer pruning.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/run/workspace.rs[216-224]
- pnpm/crates/package-manager/src/install/run/importer_selection.rs[12-33]

## Recommended Fix
Add a safe sparse-checkout-aware signal to importer selection and use it when deciding whether stale importers may be pruned. Preserve importers and their reachable packages and catalogs only for workspace paths confirmed to be hidden by sparse checkout, while continuing to prune importers that are no longer configured in the workspace.

ⓘ 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/update (sha: 2457663d) — View relationship
Review mode: Auto: 🧠 Deep: Multiple lockfile paths and implementations introduce several subtle preservation risks.

Grey Divider

Tip of the day
💡 Did you know, you can switch off images and animations for a plain-text comment

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Oct 14, 2026
@zkochan
zkochan merged commit 9e13c41 into main Oct 14, 2026
71 checks passed
@zkochan
zkochan deleted the fix-16931 branch October 14, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filtering to include all on-disk packages removes lockfile entries for packages outside sparse checkout

3 participants