Skip to content

fix(package-manager): hold selected projects to the wanted lockfile after a filtered install - #17019

Merged
zkochan merged 2 commits into
pnpm:mainfrom
samanyudas:fix/17011-verify-deps-after-filtered-install
Oct 17, 2026
Merged

zkochan merged 2 commits into
pnpm:mainfrom
samanyudas:fix/17011-verify-deps-after-filtered-install

Conversation

@samanyudas

@samanyudas samanyudas commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

close #17011

After a filtered install for one project, pnpm run and pnpm exec treated another selected project as up to date even when its dependencies had changed and were never installed. The script then ran without them, and verifyDepsBeforeRun: error and warn reported nothing.

Root cause. A filtered install writes one workspace-wide lastValidatedTimestamp while materializing only the projects it selected. For a later filtered command, the gate checks that each selected project has a modules directory and an importer in the current lockfile. Both hold for a project installed earlier. No manifest or lockfile is newer than the refreshed timestamp, so check_freshness returns early and never compares the current lockfile with the wanted one. The current lockfile still holds that project's importer from before the change.

Fix. When the state records a filtered install, the gate now also requires the current lockfile to record what the wanted lockfile materializes for the selection. It builds materialization_closure for the selected importers from both lockfiles and compares their importers, snapshots, and packages. Two details:

  • The closures use the dependency groups the workspace state recorded. After pnpm install --prod --filter … the current lockfile has no dev dependencies, so comparing all groups would make the gate install before every script.
  • Only the selected importers are compared. An unselected project that is still stale does not make a filtered command reinstall on every run.

When it fails, the gate reports the installed dependencies are not up to date with the lockfile. That is the same message it gives for this repro when no filtered install ran in between. The string now lives in one constant shared with the existing assertion.

Cost. The extra work only runs after a filtered install and only for a selection that includes a project with dependencies. That path already read the current lockfile. It now also parses the wanted lockfile, which is loaded lazily and reused by the later freshness phase.

pnpm v11 is not fixed in this PR

The bug reproduces on 11.28.6 with the issue's script. v11 needs a different fix, so it is not included here. v11's filtered install writes the wanted importer of every unselected project into the current lockfile. After pnpm --filter a run x, node_modules/.pnpm/lock.yaml already lists ms under b even though b/node_modules lacks it. With a shared dependency, ms is also in packages, so nothing in v11's current lockfile shows that b is stale. Fixing v11 would need new state, such as recording which projects a filtered install materialized in the workspace state, or probing node_modules. I'd like a maintainer's view on the approach before attempting it. I filed the follow-up as pnpm/tasks#139.

Squash Commit Body

A filtered install refreshes the workspace-wide lastValidatedTimestamp
while materializing only the projects it selected. The verify-deps gate
before run and exec then found no manifest or lockfile newer than that
timestamp and reported the tree up to date, so a later filtered command
that selected another project, installed earlier but behind the wanted
lockfile since, ran its script without the new dependencies. The
"error" and "warn" actions reported nothing for the same reason.

After a filtered install the gate already required each selected project
with dependencies to have a modules directory and an importer in the
current lockfile. It now also requires the current lockfile to record
what the wanted lockfile materializes for the selection: the
materialization closure of the selected importers must match on both
sides. The closures are taken in the dependency groups the workspace
state recorded, so a production-only filtered install does not make
the gate install before every script. Projects the command did not
select stay exempt, so a stale unselected project cannot make the gate
reinstall on every run either.

pnpm v11 has the same bug, but its filtered install writes the wanted
importers of the unselected projects into the current lockfile, so the
current lockfile cannot show which projects are stale there. That needs
a different mechanism and is left out of this change.

Closes pnpm/pnpm#17011

How I tested it

  • Reproduced first on published pnpm 12.14.0 and 11.28.6 with the issue's script. In both, --config.verify-deps-before-run=error --filter b run x reported nothing and the script failed with Cannot find module 'ms'. The control without pnpm --filter a run x reported the drift on both versions.

  • Unit tests in optimistic_repeat_install/tests.rs:

    • a_filtered_state_requires_the_selected_projects_to_match_the_wanted_lockfile: a selected project behind the wanted lockfile is outdated even though nothing is newer than the timestamp. A stale unselected project does not affect the selection. This test fails without the fix.
    • a_filtered_state_without_a_wanted_lockfile_accepts_the_selected_projects: without pnpm-lock.yaml the current lockfile stands in for it, so the selection is not reported outdated. It fails if that branch is flipped.
    • a_filtered_state_compares_the_selected_projects_in_the_recorded_groups: a production-only filtered install is not reported outdated for its missing dev dependencies. It passes with or without the fix. I confirmed it fails when the fix compares all groups.
  • End-to-end test verify_deps_before_run::exec_installs_the_changed_dependencies_of_a_project_a_filtered_install_left_behind mirrors the issue against the mocked registry:

    • error fails with the outdated message.
    • install installs the new dependency for the selected project.
    • A following error run passes, so the gate does not loop.

    This test fails without the fix.

  • The issue's script against a local debug build of the branch: error reports the drift, pnpm --filter b run x installs ms and prints b: ok, and later error runs for both a and b pass without reinstalling.

  • pnpm test:rust -p pnpm-package-manager: 996 passed. The one skipped test is skipped on main too.

  • pnpm test:rust -p pnpm-cli -E 'test(/^verify_deps_before_run::/)': 46 passed.

  • cargo clippy --locked --workspace --all-targets -- --deny warnings, the pinned rustfmt --check, and typos on the changed files are clean.

  • Not run locally: cargo dylint, which isn't installed here. I kept the changed functions and files within the limits in dylint.toml. CI runs it.

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. (v12 only. v11 is affected too, but needs a different mechanism. See "pnpm v11 is not fixed in this PR" above.)
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

This PR was written with the help of an AI agent, and I reviewed and ran the tests described above.


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

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Filtered pnpm run and pnpm exec commands now detect when a selected project’s dependencies are out of date, even after another filtered install.
    • With verifyDepsBeforeRun=error, these commands report outdated dependencies. In install mode, they install the selected project’s changed dependencies before running.

…fter a filtered install

A filtered install refreshes the workspace-wide lastValidatedTimestamp
while materializing only the projects it selected. The verify-deps gate
before run and exec then found no manifest or lockfile newer than that
timestamp and reported the tree up to date, so a later filtered command
that selected another project, installed earlier but behind the wanted
lockfile since, ran its script without the new dependencies. The
"error" and "warn" actions reported nothing for the same reason.

After a filtered install the gate already required each selected project
with dependencies to have a modules directory and an importer in the
current lockfile. It now also requires the current lockfile to record
what the wanted lockfile materializes for the selection: the
materialization closure of the selected importers must match on both
sides. The closures are taken in the dependency groups the workspace
state recorded, so a production-only filtered install does not make
the gate install before every script. Projects the command did not
select stay exempt, so a stale unselected project cannot make the gate
reinstall on every run either.

The check only runs when the state records a filtered install and the
selection includes a project with dependencies. It adds a parse of the
wanted lockfile to that path, which already read the current lockfile.

pnpm v11 has the same bug, but its filtered install writes the wanted
importers of the unselected projects into the current lockfile, so the
current lockfile cannot show which projects are stale there. That needs
a different mechanism and is left out of this change.

Closes pnpm#17011

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

coderabbitai Bot commented Oct 17, 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: 554a6b7a-59a5-4dbd-be67-c68f4ca8cb6d
📥 Commits

Reviewing files that changed from the base of the PR and between aa0e4b4 and c99f7f6.

📒 Files selected for processing: 7
  • .changeset/verify-deps-after-filtered-install.md
  • pnpm/crates/cli/tests/suite/verify_deps_before_run.rs
  • pnpm/crates/package-manager/src/optimistic_repeat_install.rs
  • pnpm/crates/package-manager/src/optimistic_repeat_install/current_lockfile.rs
  • pnpm/crates/package-manager/src/optimistic_repeat_install/deps_status.rs
  • pnpm/crates/package-manager/src/optimistic_repeat_install/modules_dirs.rs
  • pnpm/crates/package-manager/src/optimistic_repeat_install/tests.rs

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

📝 Walkthrough

Filtered dependency verification now compares selected projects’ current lockfile state with the wanted lockfile. When the selected project is outdated, verification reports the outdated-dependencies diagnostic. Unit and end-to-end tests cover the filtered-install scenario.

Changes: Filtered dependency verification

Layer / File(s) Summary
Compare selected lockfile state
pnpm/crates/package-manager/src/optimistic_repeat_install/current_lockfile.rs
The selected-importer comparison materializes the wanted and current lockfiles and checks their importers, snapshots, and packages.
Classify filtered project status
pnpm/crates/package-manager/src/optimistic_repeat_install.rs, pnpm/crates/package-manager/src/optimistic_repeat_install/modules_dirs.rs, pnpm/crates/package-manager/src/optimistic_repeat_install/deps_status.rs
The selected-project check distinguishes a missing current importer from an outdated dependency state. Dependency verification reports the corresponding diagnostic.
Validate filtered dependency checks
pnpm/crates/package-manager/src/optimistic_repeat_install/tests.rs, pnpm/crates/cli/tests/suite/verify_deps_before_run.rs, .changeset/verify-deps-after-filtered-install.md
Tests cover stale selected importers, dependency groups excluded by a filtered install, and subsequent error and install mode runs. A Changeset records 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
[ #17011 ] Detect changed dependencies for a selected project after a filtered install, including in error and install modes. ✅

Possibly related PRs

  • pnpm/pnpm#15073: Both PRs change selected-project installation checks in the optimistic repeat-install path.

Suggested labels: product: pacquet

Suggested reviewers: neonsid

Merge Risk: ⚪ Minimal · up to c99f7

No confirmed issue remains that would block merging.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • 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 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.64865% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.54%. Comparing base (3f26021) to head (c99f7f6).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../src/optimistic_repeat_install/current_lockfile.rs 96.77% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17019   +/-   ##
=======================================
  Coverage   92.53%   92.54%           
=======================================
  Files        1775     1775           
  Lines      228495   228551   +56     
=======================================
+ Hits       211441   211505   +64     
+ Misses      17054    17046    -8     

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

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

@github-actions

github-actions Bot commented Oct 17, 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 2331.41 ms 2387.38 ms 2.4% 116.57 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1397.13 ms 1577.48 ms 12.9% 69.86 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pacquet 342.22 ms 229.50 ms -32.9% 17.11 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 247.78 ms 248.03 ms 0.1% 12.39 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 10.13 ms 10.15 ms 0.2% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 10.17 ms 10.14 ms -0.3% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 8.02 ms 8.40 ms 4.6% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 7.82 ms 7.95 ms 1.6% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2521.22 ms 2502.33 ms -0.7% 126.06 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1596.11 ms 1585.75 ms -0.6% 79.81 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 435.67 ms 423.00 ms -2.9% 21.78 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 279.55 ms 286.57 ms 2.5% 13.98 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1614.53 ms 1616.49 ms 0.1% 80.73 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 300.54 ms 299.63 ms -0.3% 15.03 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 225.57 ms 235.01 ms 4.2% 11.28 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 98.00 ms 92.78 ms -5.3% 4.90 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 244.63 ms 237.14 ms -3.1% 12.23 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 216.05 ms 214.78 ms -0.6% 10.80 ms Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 70.70 ms 69.61 ms -1.5% 3.53 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4380.00 ms 4544.64 ms 3.8% 219.00 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3544.08 ms 3415.37 ms -3.6% 177.20 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 153.81 ms 146.40 ms -4.8% 7.69 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 170.09 ms 168.93 ms -0.7% 8.50 ms Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1180.84 ms 1155.36 ms -2.2% 59.04 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: c99f7f64cece

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.425 ± 0.135 2.279 2.620 1.71 ± 0.13
pacquet@main 2.392 ± 0.123 2.270 2.567 1.69 ± 0.12
pnpr@HEAD 1.510 ± 0.170 1.288 1.689 1.07 ± 0.13
pnpr@main 1.416 ± 0.074 1.301 1.541 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4249131825,
      "stddev": 0.13462362819478088,
      "median": 2.3873834117,
      "user": 1.2783106,
      "system": 1.3781280199999997,
      "min": 2.2788634327,
      "max": 2.6195678317
    },
    {
      "command": "pacquet@main",
      "mean": 2.3920002796,
      "stddev": 0.12275533519388729,
      "median": 2.3314144592,
      "user": 1.2883250999999998,
      "system": 1.3827637199999998,
      "min": 2.2702976937,
      "max": 2.5666579787
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5100514246999999,
      "stddev": 0.17014395760183434,
      "median": 1.5774781922,
      "user": 1.1928486999999999,
      "system": 1.2389526199999998,
      "min": 1.2883565397,
      "max": 1.6888052757
    },
    {
      "command": "pnpr@main",
      "mean": 1.4155729276,
      "stddev": 0.07374141863137432,
      "median": 1.3971285582,
      "user": 1.3952737000000002,
      "system": 1.45574082,
      "min": 1.3012979297,
      "max": 1.5414869546999999
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 232.5 ± 12.3 216.5 249.9 1.00
pacquet@main 325.0 ± 83.2 222.2 421.7 1.40 ± 0.37
pnpr@HEAD 250.0 ± 15.1 222.1 276.8 1.08 ± 0.09
pnpr@main 244.4 ± 10.5 224.4 256.4 1.05 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23252149148,
      "stddev": 0.012290537506897261,
      "median": 0.22950360578,
      "user": 0.25092375999999994,
      "system": 0.5712558600000001,
      "min": 0.21646782478,
      "max": 0.24991281678
    },
    {
      "command": "pacquet@main",
      "mean": 0.3250224435800001,
      "stddev": 0.08319020048245795,
      "median": 0.34222024428000003,
      "user": 0.37559515999999993,
      "system": 0.7934986599999999,
      "min": 0.22216724678000002,
      "max": 0.42167829078
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.25002941628,
      "stddev": 0.015143981610153835,
      "median": 0.24802842628,
      "user": 0.26135016,
      "system": 0.60612796,
      "min": 0.22205771478,
      "max": 0.27675601578000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.24438304798,
      "stddev": 0.010513414987385167,
      "median": 0.24778448028,
      "user": 0.26615906,
      "system": 0.55733616,
      "min": 0.22437882178000002,
      "max": 0.25640579378
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 10.1 ± 0.6 8.5 12.5 1.00 ± 0.08
pacquet@main 10.1 ± 0.5 8.6 11.8 1.00
pnpr@HEAD 10.1 ± 0.5 8.4 11.6 1.00 ± 0.07
pnpr@main 10.1 ± 0.5 8.3 12.2 1.00 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.010138177545645152,
      "stddev": 0.000615770444206292,
      "median": 0.01015475334,
      "user": 0.00549832112903226,
      "system": 0.0056639561290322575,
      "min": 0.00847765784,
      "max": 0.01249080984
    },
    {
      "command": "pacquet@main",
      "mean": 0.010096676727159535,
      "stddev": 0.00045931302790806744,
      "median": 0.01012951784,
      "user": 0.0053332228015564205,
      "system": 0.0057922639688716,
      "min": 0.00856826784,
      "max": 0.01181977884
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.01010286084389106,
      "stddev": 0.000516240303177496,
      "median": 0.01013644784,
      "user": 0.005586203346303502,
      "system": 0.005568031439688714,
      "min": 0.00843434784,
      "max": 0.01159585884
    },
    {
      "command": "pnpr@main",
      "mean": 0.010133202798015268,
      "stddev": 0.0004791103719033977,
      "median": 0.01016735384,
      "user": 0.005839115114503817,
      "system": 0.005354003053435114,
      "min": 0.00832587784,
      "max": 0.01224656984
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 8.6 ± 0.8 7.3 11.8 1.09 ± 0.12
pacquet@main 8.1 ± 0.6 7.2 11.6 1.03 ± 0.09
pnpr@HEAD 8.0 ± 0.3 7.1 9.4 1.01 ± 0.07
pnpr@main 7.9 ± 0.5 6.9 10.3 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.00855330329760684,
      "stddev": 0.0007986820643805059,
      "median": 0.00839567246,
      "user": 0.004481379230769226,
      "system": 0.004837903675213679,
      "min": 0.0072506244600000005,
      "max": 0.01176138546
    },
    {
      "command": "pacquet@main",
      "mean": 0.008070046252253524,
      "stddev": 0.0005613908695148243,
      "median": 0.008023296959999999,
      "user": 0.004766351197183101,
      "system": 0.004008995985915491,
      "min": 0.007207353460000001,
      "max": 0.011582219460000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.007979037915830394,
      "stddev": 0.0003428775228370003,
      "median": 0.00794519046,
      "user": 0.004798620989399293,
      "system": 0.0040023347703180235,
      "min": 0.00712358546,
      "max": 0.00936936846
    },
    {
      "command": "pnpr@main",
      "mean": 0.007861774056551732,
      "stddev": 0.0004570432354166398,
      "median": 0.00781708946,
      "user": 0.004713862758620686,
      "system": 0.00388567455172414,
      "min": 0.006851564460000001,
      "max": 0.01029845546
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.539 ± 0.095 2.483 2.774 1.60 ± 0.13
pacquet@main 2.525 ± 0.024 2.497 2.584 1.59 ± 0.11
pnpr@HEAD 1.587 ± 0.110 1.412 1.746 1.00
pnpr@main 1.627 ± 0.138 1.477 1.870 1.03 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.53924231532,
      "stddev": 0.09469456451887182,
      "median": 2.50233111002,
      "user": 1.9531512,
      "system": 1.65228076,
      "min": 2.48299574502,
      "max": 2.77373365202
    },
    {
      "command": "pacquet@main",
      "mean": 2.52544229002,
      "stddev": 0.02446606303837267,
      "median": 2.52121587852,
      "user": 1.9046134999999995,
      "system": 1.59341526,
      "min": 2.49746653502,
      "max": 2.58381647102
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.58691054252,
      "stddev": 0.11021378234284102,
      "median": 1.58574772002,
      "user": 1.239354,
      "system": 1.3076777600000002,
      "min": 1.41191081602,
      "max": 1.7457315220200003
    },
    {
      "command": "pnpr@main",
      "mean": 1.62745560782,
      "stddev": 0.138047654994021,
      "median": 1.5961104000200002,
      "user": 1.1981484999999998,
      "system": 1.3264867599999999,
      "min": 1.47681155202,
      "max": 1.8704940410200002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 422.9 ± 20.0 396.6 450.7 1.51 ± 0.09
pacquet@main 437.0 ± 18.6 412.3 460.9 1.56 ± 0.08
pnpr@HEAD 288.0 ± 9.0 275.6 306.3 1.03 ± 0.05
pnpr@main 280.9 ± 9.0 267.3 294.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.42285421952,
      "stddev": 0.020015945188618493,
      "median": 0.42299752382,
      "user": 0.5802924,
      "system": 0.70804822,
      "min": 0.39659294582,
      "max": 0.45072915682
    },
    {
      "command": "pacquet@main",
      "mean": 0.43696666651999994,
      "stddev": 0.018626787051032625,
      "median": 0.43566582282,
      "user": 0.6268812,
      "system": 0.73951422,
      "min": 0.41229070182,
      "max": 0.46085186082
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.28798332091999995,
      "stddev": 0.00902430287810605,
      "median": 0.28656707732,
      "user": 0.23629569999999997,
      "system": 0.5724004199999999,
      "min": 0.27561563282,
      "max": 0.30625232182
    },
    {
      "command": "pnpr@main",
      "mean": 0.28088788072000004,
      "stddev": 0.009045936000266966,
      "median": 0.27954638032,
      "user": 0.22466819999999998,
      "system": 0.5439104199999999,
      "min": 0.26733522781999997,
      "max": 0.29416560782
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.621 ± 0.016 1.598 1.652 5.46 ± 0.17
pacquet@main 1.613 ± 0.011 1.590 1.627 5.44 ± 0.17
pnpr@HEAD 0.297 ± 0.009 0.283 0.307 1.00 ± 0.04
pnpr@main 0.297 ± 0.009 0.279 0.306 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.6209350097600002,
      "stddev": 0.0158838794536392,
      "median": 1.61648530646,
      "user": 0.8742757400000002,
      "system": 0.9139475599999998,
      "min": 1.59817183096,
      "max": 1.65211569096
    },
    {
      "command": "pacquet@main",
      "mean": 1.61331329666,
      "stddev": 0.011422756395026877,
      "median": 1.61453412446,
      "user": 0.8761702400000001,
      "system": 0.88595056,
      "min": 1.58953875396,
      "max": 1.62726335296
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29680687906,
      "stddev": 0.009491590164194973,
      "median": 0.29962730046,
      "user": 0.24334414,
      "system": 0.58611116,
      "min": 0.28333548096000005,
      "max": 0.30711955396
    },
    {
      "command": "pnpr@main",
      "mean": 0.29668068416000004,
      "stddev": 0.008940544196858049,
      "median": 0.30054395096000003,
      "user": 0.24650873999999998,
      "system": 0.59029906,
      "min": 0.27897466596000003,
      "max": 0.30638414396
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 238.6 ± 8.8 228.1 252.9 2.55 ± 0.11
pacquet@main 230.4 ± 11.4 221.1 252.9 2.47 ± 0.13
pnpr@HEAD 93.4 ± 1.9 91.6 98.5 1.00
pnpr@main 107.7 ± 16.3 91.1 137.5 1.15 ± 0.18
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23858306352909092,
      "stddev": 0.008761485874439654,
      "median": 0.23501085562000001,
      "user": 0.22631796363636364,
      "system": 0.09537022909090909,
      "min": 0.22806284062,
      "max": 0.25287258062000006
    },
    {
      "command": "pacquet@main",
      "mean": 0.23041748652909091,
      "stddev": 0.01139228434375831,
      "median": 0.22556584962,
      "user": 0.20849305454545455,
      "system": 0.09312850181818182,
      "min": 0.22112320162000001,
      "max": 0.25291816562
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09339424858774195,
      "stddev": 0.0019241726416941466,
      "median": 0.09277660362000001,
      "user": 0.03232063225806451,
      "system": 0.01667766451612903,
      "min": 0.09158152362000001,
      "max": 0.09852461862
    },
    {
      "command": "pnpr@main",
      "mean": 0.10770258498666667,
      "stddev": 0.016270227949200057,
      "median": 0.09799609912000001,
      "user": 0.042342899999999996,
      "system": 0.02192322,
      "min": 0.09109113462,
      "max": 0.13751474262000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 242.4 ± 9.8 231.9 257.9 1.00
pacquet@main 243.7 ± 11.9 230.0 268.8 1.01 ± 0.06
pnpm@HEAD 3651.7 ± 112.4 3496.4 3828.9 15.06 ± 0.77
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24242113781111113,
      "stddev": 0.009836844798686224,
      "median": 0.23714087170000003,
      "user": 0.24859888666666663,
      "system": 0.05428165777777778,
      "min": 0.23191121270000004,
      "max": 0.25791493870000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.24366225036666667,
      "stddev": 0.011919439008429681,
      "median": 0.24462790970000003,
      "user": 0.2531704422222222,
      "system": 0.05172554666666666,
      "min": 0.22999819170000002,
      "max": 0.26882814070000005
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.651653769366666,
      "stddev": 0.1123913941810724,
      "median": 3.6590145087,
      "user": 5.5429102199999996,
      "system": 0.38001188,
      "min": 3.4964473947,
      "max": 3.8289300476999997
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 214.9 ± 4.6 207.3 222.2 1.00
pacquet@main 215.2 ± 4.8 206.9 222.0 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.21488134174769233,
      "stddev": 0.0046384203170463725,
      "median": 0.21478218444000002,
      "user": 0.17290750923076922,
      "system": 0.08682258461538463,
      "min": 0.20729740744000003,
      "max": 0.22220041244000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.21521993159384617,
      "stddev": 0.004809090414384733,
      "median": 0.21604834644000004,
      "user": 0.1773141246153846,
      "system": 0.0834501230769231,
      "min": 0.20694089744000002,
      "max": 0.22202736144000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 70.0 ± 2.0 67.7 76.6 1.00
pacquet@main 71.3 ± 3.6 66.9 85.5 1.02 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.07000263723052629,
      "stddev": 0.001960526704632806,
      "median": 0.06961452252,
      "user": 0.02533191578947368,
      "system": 0.049691727368421056,
      "min": 0.06773794952,
      "max": 0.07661997951999999
    },
    {
      "command": "pacquet@main",
      "mean": 0.07134270442476191,
      "stddev": 0.0036433325950412138,
      "median": 0.07069854102,
      "user": 0.0257671,
      "system": 0.05076637523809523,
      "min": 0.06691046752,
      "max": 0.08548470652
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.539 ± 0.140 4.327 4.803 1.32 ± 0.05
pacquet@main 4.423 ± 0.110 4.326 4.685 1.28 ± 0.05
pnpr@HEAD 3.447 ± 0.091 3.383 3.677 1.00
pnpr@main 3.557 ± 0.122 3.397 3.714 1.03 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.53905305354,
      "stddev": 0.13975586390607986,
      "median": 4.54464097894,
      "user": 1.5558682400000001,
      "system": 1.5555865,
      "min": 4.32738751994,
      "max": 4.8028777519400006
    },
    {
      "command": "pacquet@main",
      "mean": 4.42318172944,
      "stddev": 0.110128552162899,
      "median": 4.37999638344,
      "user": 1.42577284,
      "system": 1.4055514999999998,
      "min": 4.32615248194,
      "max": 4.68488294494
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.4470990421399996,
      "stddev": 0.09068590283117692,
      "median": 3.41536962844,
      "user": 1.33458634,
      "system": 1.3190075999999997,
      "min": 3.38349234494,
      "max": 3.67730657594
    },
    {
      "command": "pnpr@main",
      "mean": 3.5573272274399996,
      "stddev": 0.12175628680544383,
      "median": 3.5440815909400003,
      "user": 1.32957224,
      "system": 1.3565229,
      "min": 3.39747982594,
      "max": 3.71417961894
    }
  ]
}

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 148.0 ± 5.2 141.5 158.6 1.00
pacquet@main 154.8 ± 4.7 147.8 160.9 1.05 ± 0.05
pnpr@HEAD 168.0 ± 3.9 161.2 175.0 1.14 ± 0.05
pnpr@main 170.6 ± 6.1 159.7 180.4 1.15 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.14796137254888886,
      "stddev": 0.005209576650712406,
      "median": 0.14639844716,
      "user": 0.17866596222222222,
      "system": 0.1770371288888889,
      "min": 0.14154982716,
      "max": 0.15862152516
    },
    {
      "command": "pacquet@main",
      "mean": 0.15477449234750001,
      "stddev": 0.004705813084128723,
      "median": 0.15380756516,
      "user": 0.17964299,
      "system": 0.19631092749999998,
      "min": 0.14776795216000002,
      "max": 0.16093595616
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.1679973768933333,
      "stddev": 0.003928865337331295,
      "median": 0.16893022516,
      "user": 0.19837440666666664,
      "system": 0.18486093999999997,
      "min": 0.16122359816,
      "max": 0.17502626116
    },
    {
      "command": "pnpr@main",
      "mean": 0.17059575669333332,
      "stddev": 0.006084575846497306,
      "median": 0.17009410716,
      "user": 0.20506920666666667,
      "system": 0.18111087333333334,
      "min": 0.15972410616000002,
      "max": 0.18041623516000002
    }
  ]
}

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.155 ± 0.020 1.134 1.196 1.00
pacquet@main 1.221 ± 0.092 1.141 1.387 1.06 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.15533718412,
      "stddev": 0.01991187053457181,
      "median": 1.15536083082,
      "user": 0.53571114,
      "system": 0.22235902,
      "min": 1.13362327782,
      "max": 1.19575405082
    },
    {
      "command": "pacquet@main",
      "mean": 1.2209594006200004,
      "stddev": 0.09188373319030721,
      "median": 1.18084485282,
      "user": 0.6668830399999999,
      "system": 0.28688782,
      "min": 1.14091917682,
      "max": 1.38733025882
    }
  ]
}

…d lockfile

Without pnpm-lock.yaml the current lockfile stands in for it, so the
selection check has nothing to compare and must not report the selected
projects outdated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

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

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

zkochan commented Oct 17, 2026

Copy link
Copy Markdown
Member

Reviewed the full change on c99f7f6. The rebase onto main was a no-op, since the branch was already on the latest base, and I found nothing that needs a code change.

What I checked:

  • Platform-skipped optional dependencies. materialization_closure runs with an empty skip set on both lockfiles. That is safe because the current lockfile keeps installability-skipped entries (filter_lockfile_for_current prunes only transient skips). A tree with, for example, fsevents on Linux therefore does not report outdated on every run. A failed optional fetch does report outdated, and the reinstall retries the fetch. This matches what materialized_shape_matches already does.
  • Dependency groups. The run gate ignores dev/optional/production drift, so the closures correctly use the groups recorded in the workspace state. v12 always writes these groups, so the unwrap_or(true) default is never used for a state v12 wrote.
  • Workspace links. If a selected project links to a workspace project that the current lockfile lacks, the selection is reported outdated. The install the gate spawns selects the dependencies of the selected projects, so it converges.
  • Cost. The extra parse and two closure walks run only after a filtered install, and only for a selection that has dependencies.

Status: all checks are green. CodeRabbit approved this head. Greptile (trial ended) and Qodo (paused for this user) did not review. Nothing is left to do in this PR. The v11 half is still open as pnpm/tasks#139, as the description says.


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

@zkochan
zkochan merged commit 086165d into pnpm:main Oct 17, 2026
58 checks passed
@welcome

welcome Bot commented Oct 17, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

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 state: automerge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

verifyDepsBeforeRun: after a filtered install, a filtered run of another project skips the install its changed dependencies need

3 participants