Skip to content

fix(install): relink renamed workspace bins with dedicated lockfiles - #17407

Merged
zkochan merged 2 commits into
mainfrom
fix-224-workspace-bin-relink
Oct 27, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix-224-workspace-bin-relink

Conversation

@zkochan

@zkochan zkochan commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Part 1 of pnpm/tasks#224, found by the repeat-install oracle in #17398.

The bug. With sharedWorkspaceLockfile: false, a dependent's .bin keeps the old name when a workspace project renames its command. pnpm install reported "Already up to date" even with --config.optimistic-repeat-install=false. The verifyDepsBeforeRun check passed too.

The cause. Each project installs from its own lockfile and records its own workspace state. The bins digest that proves an importer installed covered only the projects of that lockfile, so a sibling's bin field was in none of them. Three checks read that digest:

  • the repeat-install gate;
  • the frozen-tree check, which still runs when optimisticRepeatInstall is off;
  • the run gate.

The fix. With dedicated lockfiles, the digest now covers every workspace project, as it already does with a shared lockfile:

  • The install takes the projects from the workspace the dedicated loop already discovered.
  • The run gate now loads them too.
  • RepeatInstallManifests::workspace_projects documents the contract. The state write and the frozen-tree check read the same list.

Costs

  • The first install after upgrading runs in full in a dedicated-lockfile workspace where some project declares a command, because the states older versions wrote have no such digest.
  • With dedicated lockfiles, the run gate of a project that declares a dependency or a peer reads every workspace manifest. Before, it read only the gated project's. A project with neither still reads only its own.
  • Each per-project install of a project that declares a dependency or a peer builds a list of every workspace project from the manifests the loop already holds. Across the loop that is O(projects²) small allocations.

What remains open in pnpm/tasks#224. v12 on main already drops the old command from the dependent's .bin. In my first report, the v12 shared-lockfile row came from a stale binary. v11 still keeps the old command in both layouts. That is part 2, and this PR does not touch v11.

The repeat-install oracle's a_workspace_bin_renamed scenario now runs with dedicated lockfiles too, and workspace_bins.rs has a focused test. With the install side reverted, the focused test fails. With the run gate's side reverted, the oracle fails at "the run gate for b must pass right after a full install".

Verification, local:

  • pnpm-package-manager (1075 tests);
  • the CLI's repeat_install_oracle, repeat_install, workspace_bins, verify_deps_before_run, install_state, install_filters, workspace_install, inject_workspace_packages, injected_deps_with_dedicated_lockfiles, injected_freshness_matrix, lockfile_dir, pnpm_compatibility and bin modules with the v11 bundle set (476 tests);
  • pre-push-rust.sh.

Squash Commit Body

With sharedWorkspaceLockfile: false each project installs from its own
lockfile and records its own workspace state, and the bins digest that
proves an importer installed covered only the projects of that lockfile.
A sibling's bin field was in none of them, so the repeat-install gate,
the frozen-tree check and the run gate all reported a dependent up to
date after the sibling renamed its command, and the dependent's .bin kept
the old name.

The digest now covers every workspace project in that case. The install
takes them from the workspace the dedicated loop already discovered, and
the run gate loads them, as it does for a shared lockfile. A state that
an older version recorded has no such digest, so the first install after
the upgrade is a full one in a workspace whose projects declare commands.

The repeat-install oracle's renamed-bin scenario now runs with dedicated
lockfiles too.

Related to pnpm/tasks#224.

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

🤖 Generated with Claude Code


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
    • Fixed repeat installs with dedicated workspace lockfiles so renamed commands from sibling projects are correctly linked in dependent projects.
    • Dependent projects can now run the updated command after its name changes, including with isolated and hoisted installation layouts.
    • Workspace command checks now account for commands declared by other workspace projects when determining whether an installation is up to date.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 0024935 and f191dd6.

Files selected for processing: 4
  • pnpm/crates/package-manager/src/install/run/workspace.rs
  • pnpm/crates/package-manager/src/install/workspace_state/discovery.rs
  • pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs
  • pnpm/crates/package-manager/src/optimistic_repeat_install/validation/bins.rs

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

Walkthrough

Dedicated-lockfile installs now carry workspace project manifests into workspace-bin validation. Repeat-install and frozen-tree checks use the selected bin projects when calculating workspace-bin digests. CLI tests cover renamed workspace commands across linker and optimistic-repeat settings.

Changes: Workspace bin relinking

Layer / File(s) Summary
Select and pass workspace projects
pnpm/crates/package-manager/src/install/state_options.rs, pnpm/crates/package-manager/src/install/run/workspace.rs, pnpm/crates/package-manager/src/install/run/dispatch.rs, pnpm/crates/package-manager/src/install/run/execution.rs, pnpm/crates/package-manager/src/install/workspace_state/discovery.rs, pnpm/crates/package-manager/src/optimistic_repeat_install/manifest_source.rs, pnpm/crates/package-manager/src/optimistic_repeat_install/validation/bins.rs, pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs
Install scope and repeat-install inputs carry workspace project manifests. Discovery selects manifests according to lockfile mode, while bin helpers identify workspace projects whose commands are linked.
Record and validate workspace-bin state
pnpm/crates/package-manager/src/install/workspace_state/write.rs, pnpm/crates/package-manager/src/install.rs, pnpm/crates/package-manager/src/install/workspace_state.rs, pnpm/crates/package-manager/src/install/apply_materialization.rs, pnpm/crates/package-manager/src/install/prepare_modules_state.rs, pnpm/crates/package-manager/src/install/prepare_modules_state/up_to_date.rs, pnpm/crates/package-manager/src/optimistic_repeat_install.rs, pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs, pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs, pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs
State writes group current and optional workspace manifests. Up-to-date, frozen-tree, repeat-install, and validation paths calculate workspace-bin digests from the selected bin projects.
Verify renamed-bin relinking
pnpm/crates/cli/tests/suite/workspace_bins.rs, pnpm/crates/cli/tests/suite/repeat_install_oracle.rs, pnpm/crates/package-manager/src/install/prepare_modules_state/tests.rs, pnpm/crates/package-manager/src/install/tests/repeat_install.rs, pnpm/crates/package-manager/src/install/run/time_machine_capture/tests.rs, pnpm/crates/package-manager/src/optimistic_repeat_install/tests*, .changeset/dedicated-lockfiles-relink-workspace-bins.md
CLI tests check renamed command shims in dependent projects and execution from a dependent project. Fixtures provide the added workspace-state fields, and the changeset describes dedicated-lockfile relinking.

Priority: Normal

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

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant InstallScope
  participant DedicatedBinProjects
  participant RepeatInstallManifests
  participant WorkspaceBinDigest
  InstallScope->>DedicatedBinProjects: select projects that link workspace commands
  DedicatedBinProjects->>RepeatInstallManifests: pass selected manifests
  RepeatInstallManifests->>WorkspaceBinDigest: provide bin projects for digest calculation
Loading

Possibly related issues

  • pnpm/pnpm#17324: Reports workspace package bin changes missed by repeat and frozen install checks. This PR extends workspace-bin digest validation to dedicated lockfiles.
  • pnpm/pnpm#17374: Concerns repeat and frozen install validation of local workspace state. This PR changes workspace-bin validation in that area, but the reported v11 local-directory performance cost is outside this change.

Possibly related PRs

  • pnpm/pnpm#17325: Adds workspace-bin digests to repeat-install and frozen-tree validation; this PR extends that validation to dedicated lockfiles.
  • pnpm/pnpm#17371: Removes stale .bin shims after workspace bin changes; this PR covers relinking renamed workspace commands.
  • pnpm/pnpm#17398: Skips renamed-bin coverage for dedicated lockfiles; this PR enables that scenario.

Suggested labels: product: pacquet

Suggested reviewers: kairosci, dextheking1, altaywtf

Merge Risk: Minimal · up to f191d

No actionable merge-blocking risk was established for workspace command relinking.

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.

With `sharedWorkspaceLockfile: false` each project installs from its own
lockfile and records its own workspace state, and the bins digest that
proves an importer installed covered only the projects of that lockfile.
A sibling's `bin` field was in none of them, so the repeat-install gate,
the frozen-tree check and the run gate all reported a dependent up to
date after the sibling renamed its command, and the dependent's `.bin`
kept the old name.

The digest now covers every workspace project in that case. The install
takes them from the workspace it already discovered, and the run gate
loads them, as it does for a shared lockfile. A state that a previous
version recorded has no such digest, so the first install after the
upgrade is a full one in a workspace whose projects declare commands.

The repeat-install oracle's renamed-bin scenario now runs with dedicated
lockfiles too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zkochan
zkochan force-pushed the fix-224-workspace-bin-relink branch from 1a628be to 0024935 Compare October 26, 2026 23:12
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                    pr
-----                                            ----                                    --
lockfile/parse_pnpm_lock                         1.00     15.2±1.70ms    24.6 MB/sec     1.11     17.0±2.90ms    22.1 MB/sec
packument/parse                                  1.00     48.7±1.91µs  1361.0 MB/sec     1.05     51.2±9.19µs  1296.3 MB/sec
tarball/download_dependency                      1.08  1243.2±165.01µs     3.4 MB/sec    1.00  1148.8±206.30µs     3.7 MB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00   293.7±12.58ms 54.5 KElem/sec     1.03   303.7±19.69ms 52.7 KElem/sec
version_pick/repeated_ranges_file                1.08      5.8±0.57ms  5.4 KElem/sec     1.00      5.4±0.66ms  5.8 KElem/sec
version_pick/repeated_ranges_raw                 1.00      5.3±0.55ms  5.9 KElem/sec     1.00      5.3±0.64ms  5.9 KElem/sec
workspace_resolution/hoist_heavy                 1.42   444.3±23.92ms        ? ?/sec     1.00   312.8±19.44ms        ? ?/sec
workspace_sort/chained_projects                  1.39     25.4±3.51ms        ? ?/sec     1.00     18.3±3.69ms        ? ?/sec

@github-actions

github-actions Bot commented Oct 26, 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 2618.74 ms 2627.29 ms 0.3% 130.94 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1579.61 ms 1613.93 ms 2.2% 78.98 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 468.10 ms 476.04 ms 1.7% 23.41 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 518.93 ms 542.89 ms 4.6% 25.95 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 12.20 ms 14.00 ms 14.8% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 13.82 ms 13.12 ms -5.0% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 13.07 ms 13.33 ms 2.0% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 9.93 ms 10.52 ms 5.9% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2985.06 ms 3144.60 ms 5.3% 149.25 ms Inconclusive (overlapping samples)
isolated-fresh-install-cold-cache-cold-store pnpr 1749.27 ms 1696.65 ms -3.0% 87.46 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 1263.68 ms 1097.11 ms -13.2% 63.18 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 611.16 ms 612.42 ms 0.2% 30.56 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 2181.45 ms 1958.80 ms -10.2% 109.07 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 468.38 ms 474.15 ms 1.2% 23.42 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 621.23 ms 620.61 ms -0.1% 31.06 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 160.54 ms 158.37 ms -1.4% 8.03 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 287.83 ms 283.41 ms -1.5% 14.39 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 129.77 ms 138.09 ms 6.4% 6.49 ms Inconclusive (overlapping samples)
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 172.56 ms 178.34 ms 3.3% 8.63 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 5454.23 ms 5079.69 ms -6.9% 272.71 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3929.53 ms 3857.38 ms -1.8% 196.48 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 199.86 ms 170.09 ms -14.9% 9.99 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 200.61 ms 209.34 ms 4.4% 10.03 ms Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1530.41 ms 1511.38 ms -1.2% 76.52 ms Within tolerance
cargo-repeat-install-hot-cache-hot-store pacquet 57.07 ms 53.62 ms -6.1% 2.85 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: f191dd6a5324

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked, injected, and Cargo workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.692 ± 0.217 2.484 3.127 1.68 ± 0.17
pacquet@main 2.688 ± 0.142 2.558 2.919 1.68 ± 0.14
pnpr@HEAD 1.627 ± 0.142 1.408 1.812 1.02 ± 0.11
pnpr@main 1.598 ± 0.104 1.410 1.726 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.69151150464,
      "stddev": 0.21673065597720786,
      "median": 2.6272884755400003,
      "user": 2.7368812800000004,
      "system": 2.284248,
      "min": 2.4840834800400002,
      "max": 3.12652805404
    },
    {
      "command": "pacquet@main",
      "mean": 2.68821671264,
      "stddev": 0.14237793684348982,
      "median": 2.61873773954,
      "user": 2.8171674799999997,
      "system": 2.1500895,
      "min": 2.55820726504,
      "max": 2.91901226904
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.62730621024,
      "stddev": 0.14232716747611715,
      "median": 1.6139315595400001,
      "user": 2.56393908,
      "system": 2.1822424,
      "min": 1.4082216660400002,
      "max": 1.8118737820400002
    },
    {
      "command": "pnpr@main",
      "mean": 1.59757494804,
      "stddev": 0.10404280106518983,
      "median": 1.57960767404,
      "user": 2.54250958,
      "system": 2.2656012999999997,
      "min": 1.4100495240400002,
      "max": 1.7256655730400001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 517.6 ± 109.8 396.3 696.0 1.09 ± 0.25
pacquet@main 476.1 ± 47.1 405.0 551.0 1.00
pnpr@HEAD 557.4 ± 57.7 473.4 669.6 1.17 ± 0.17
pnpr@main 527.5 ± 55.9 441.8 604.8 1.11 ± 0.16
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5175623656000001,
      "stddev": 0.1098411759001702,
      "median": 0.4760440717,
      "user": 0.55404912,
      "system": 1.0520286999999997,
      "min": 0.3962523217,
      "max": 0.6960010377000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.47612451590000004,
      "stddev": 0.047118781398705276,
      "median": 0.4681015792,
      "user": 0.48887121999999994,
      "system": 1.0478874999999999,
      "min": 0.4050351437,
      "max": 0.5510139817
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.5574353994000001,
      "stddev": 0.05768033825489676,
      "median": 0.5428883257000001,
      "user": 0.5548604199999999,
      "system": 1.0929611,
      "min": 0.47341056870000003,
      "max": 0.6696234187000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.5275439743000001,
      "stddev": 0.055930428545541,
      "median": 0.5189280837000001,
      "user": 0.52045742,
      "system": 1.0158140999999998,
      "min": 0.4418266887,
      "max": 0.6047646497000001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 14.0 ± 1.6 10.7 20.5 1.15 ± 0.21
pacquet@main 12.2 ± 1.7 9.1 20.0 1.00
pnpr@HEAD 13.4 ± 2.0 10.1 23.2 1.10 ± 0.22
pnpr@main 13.9 ± 1.9 10.5 19.8 1.14 ± 0.22
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.014033577438876413,
      "stddev": 0.0016495283154427341,
      "median": 0.014004566540000003,
      "user": 0.007746169887640451,
      "system": 0.00792445494382022,
      "min": 0.01068033254,
      "max": 0.02053745154
    },
    {
      "command": "pacquet@main",
      "mean": 0.012223006849417035,
      "stddev": 0.001660260271519523,
      "median": 0.012203840540000002,
      "user": 0.007365671928251125,
      "system": 0.006210869955156949,
      "min": 0.009137400540000002,
      "max": 0.01999605154
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.013398743972038841,
      "stddev": 0.0020086874242897885,
      "median": 0.013120741040000002,
      "user": 0.007428026601941747,
      "system": 0.007395383009708736,
      "min": 0.010136500540000001,
      "max": 0.02315379354
    },
    {
      "command": "pnpr@main",
      "mean": 0.013904065601349687,
      "stddev": 0.001908688954395514,
      "median": 0.013816271540000001,
      "user": 0.007837024785276071,
      "system": 0.0074841998773006084,
      "min": 0.010497410540000002,
      "max": 0.01984402354
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 13.5 ± 1.1 10.9 16.5 1.35 ± 0.17
pacquet@main 13.0 ± 1.7 9.6 19.4 1.30 ± 0.21
pnpr@HEAD 10.7 ± 1.0 8.6 15.4 1.07 ± 0.15
pnpr@main 10.0 ± 1.0 8.1 13.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.013476642143243251,
      "stddev": 0.0011166137278634718,
      "median": 0.0133323659,
      "user": 0.007752825405405401,
      "system": 0.007044530810810809,
      "min": 0.0108814784,
      "max": 0.016510869400000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.01302454486192894,
      "stddev": 0.001690740965400693,
      "median": 0.0130682904,
      "user": 0.007311658578680208,
      "system": 0.007022737461928933,
      "min": 0.0095901454,
      "max": 0.019389590400000004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.01068930527387388,
      "stddev": 0.0010465514990547133,
      "median": 0.010521066400000001,
      "user": 0.005932735315315317,
      "system": 0.00586221189189189,
      "min": 0.0086354434,
      "max": 0.015369538400000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.009985801587755102,
      "stddev": 0.0009572295997285631,
      "median": 0.0099302534,
      "user": 0.005483916244897959,
      "system": 0.005504764897959181,
      "min": 0.0081467064,
      "max": 0.0137322664
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.114 ± 0.209 2.820 3.397 1.83 ± 0.18
pacquet@main 2.994 ± 0.178 2.772 3.326 1.76 ± 0.17
pnpr@HEAD 1.699 ± 0.128 1.523 1.884 1.00
pnpr@main 1.756 ± 0.134 1.575 1.946 1.03 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.1141977871799997,
      "stddev": 0.20884149514575345,
      "median": 3.14459817188,
      "user": 3.4828008599999998,
      "system": 3.17505376,
      "min": 2.82002884938,
      "max": 3.3970996893799996
    },
    {
      "command": "pacquet@main",
      "mean": 2.9935315446799997,
      "stddev": 0.1778873316595817,
      "median": 2.9850579588799997,
      "user": 3.4427666599999993,
      "system": 2.7239787599999996,
      "min": 2.7715304383799997,
      "max": 3.3258572203799996
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.69938474368,
      "stddev": 0.12790119393732602,
      "median": 1.69665423188,
      "user": 2.3993185599999998,
      "system": 2.42743346,
      "min": 1.52295812338,
      "max": 1.8839320673800002
    },
    {
      "command": "pnpr@main",
      "mean": 1.7563013975800001,
      "stddev": 0.1336810079313757,
      "median": 1.74927279488,
      "user": 2.4102864599999996,
      "system": 2.3150572599999997,
      "min": 1.57481126038,
      "max": 1.9455692523800001
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.152 ± 0.221 0.921 1.610 1.98 ± 0.44
pacquet@main 1.270 ± 0.172 0.989 1.487 2.18 ± 0.38
pnpr@HEAD 0.625 ± 0.060 0.547 0.755 1.07 ± 0.16
pnpr@main 0.582 ± 0.066 0.486 0.651 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.1516172720200002,
      "stddev": 0.22082431242964487,
      "median": 1.09710712482,
      "user": 1.34682486,
      "system": 2.2524067199999998,
      "min": 0.92111076532,
      "max": 1.60998131832
    },
    {
      "command": "pacquet@main",
      "mean": 1.2700068249199998,
      "stddev": 0.17151874813186813,
      "median": 1.26367956382,
      "user": 1.4382900599999997,
      "system": 2.54743602,
      "min": 0.98945074832,
      "max": 1.48681474732
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.62494625482,
      "stddev": 0.06036449405122661,
      "median": 0.61242221332,
      "user": 0.52319366,
      "system": 1.11825062,
      "min": 0.54650193932,
      "max": 0.75543547532
    },
    {
      "command": "pnpr@main",
      "mean": 0.58203252222,
      "stddev": 0.06603675075299587,
      "median": 0.6111633598199999,
      "user": 0.47345026000000007,
      "system": 1.0618294199999998,
      "min": 0.48623832232,
      "max": 0.65130815632
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.981 ± 0.082 1.863 2.104 4.24 ± 0.29
pacquet@main 2.143 ± 0.135 1.881 2.336 4.58 ± 0.38
pnpr@HEAD 0.481 ± 0.027 0.445 0.530 1.03 ± 0.08
pnpr@main 0.468 ± 0.026 0.431 0.516 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.9810514782400002,
      "stddev": 0.0823035193758931,
      "median": 1.9587964129400002,
      "user": 1.4759805999999998,
      "system": 1.5958654799999998,
      "min": 1.8634127744400002,
      "max": 2.10405587944
    },
    {
      "command": "pacquet@main",
      "mean": 2.14258305024,
      "stddev": 0.13469453644577675,
      "median": 2.1814475684400003,
      "user": 1.6389136999999998,
      "system": 1.7302065800000002,
      "min": 1.8807771514400002,
      "max": 2.3358004994400003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.48095873104000003,
      "stddev": 0.02682088089122474,
      "median": 0.47414697444,
      "user": 0.3952805999999999,
      "system": 0.93916828,
      "min": 0.44476343744,
      "max": 0.52970759244
    },
    {
      "command": "pnpr@main",
      "mean": 0.46763224163999995,
      "stddev": 0.025756651075728245,
      "median": 0.46837610194,
      "user": 0.40516189999999996,
      "system": 0.8708418799999998,
      "min": 0.43056085944,
      "max": 0.51625410844
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 631.8 ± 58.0 569.2 769.1 3.92 ± 0.46
pacquet@main 621.9 ± 64.9 538.3 729.4 3.86 ± 0.50
pnpr@HEAD 161.0 ± 20.7 125.8 205.6 1.00 ± 0.15
pnpr@main 161.0 ± 12.0 141.4 180.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6317885560200001,
      "stddev": 0.05798827616216435,
      "median": 0.6206064197200001,
      "user": 0.64540176,
      "system": 0.7451304999999999,
      "min": 0.56915353222,
      "max": 0.76913216422
    },
    {
      "command": "pacquet@main",
      "mean": 0.62190355552,
      "stddev": 0.06493197956088556,
      "median": 0.62122866522,
      "user": 0.6310796599999999,
      "system": 0.744274,
      "min": 0.53832233122,
      "max": 0.72936296822
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.16102558639647063,
      "stddev": 0.020727226846069507,
      "median": 0.15836764922000002,
      "user": 0.07748284235294117,
      "system": 0.07099234705882351,
      "min": 0.12584749422,
      "max": 0.20556945122
    },
    {
      "command": "pnpr@main",
      "mean": 0.16096980721999998,
      "stddev": 0.011989418626179445,
      "median": 0.16054130322000001,
      "user": 0.08242037176470587,
      "system": 0.06507046470588236,
      "min": 0.14135743122,
      "max": 0.18004733222
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 290.8 ± 25.1 265.7 353.9 1.02 ± 0.10
pacquet@main 284.6 ± 15.2 251.4 306.3 1.00
pnpm@HEAD 5678.9 ± 1090.0 4755.2 7238.2 19.95 ± 3.98
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2907943088111111,
      "stddev": 0.025135857931653103,
      "median": 0.2834082087,
      "user": 0.3128445044444444,
      "system": 0.09503001999999999,
      "min": 0.2657476507,
      "max": 0.3538742147
    },
    {
      "command": "pacquet@main",
      "mean": 0.28458573170000007,
      "stddev": 0.015185971541296066,
      "median": 0.2878269687,
      "user": 0.3157311711111111,
      "system": 0.07954513111111111,
      "min": 0.25137449570000003,
      "max": 0.30626593770000005
    },
    {
      "command": "pnpm@HEAD",
      "mean": 5.67890237681111,
      "stddev": 1.0899968507976627,
      "median": 4.974532787699999,
      "user": 8.635769726666666,
      "system": 0.5880952422222222,
      "min": 4.7551938997,
      "max": 7.2381542817
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 142.5 ± 16.0 120.1 181.3 1.07 ± 0.20
pacquet@main 133.5 ± 19.5 107.9 179.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.1424723000888889,
      "stddev": 0.016003142061475024,
      "median": 0.1380871622,
      "user": 0.13460189777777778,
      "system": 0.10548087777777777,
      "min": 0.12014201170000001,
      "max": 0.1812532617
    },
    {
      "command": "pacquet@main",
      "mean": 0.13354148017999998,
      "stddev": 0.0195450137253845,
      "median": 0.1297717137,
      "user": 0.11976815999999997,
      "system": 0.10098989999999997,
      "min": 0.1079449567,
      "max": 0.1792209317
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 177.8 ± 14.4 154.5 213.1 1.04 ± 0.13
pacquet@main 170.9 ± 15.9 141.9 198.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.17775392806749996,
      "stddev": 0.014422930751323792,
      "median": 0.17833798588,
      "user": 0.069836755,
      "system": 0.12347730000000003,
      "min": 0.15445688238,
      "max": 0.21310685338
    },
    {
      "command": "pacquet@main",
      "mean": 0.17087939438000002,
      "stddev": 0.01589524603082293,
      "median": 0.17256130538,
      "user": 0.06431663,
      "system": 0.11995605000000001,
      "min": 0.14185506938,
      "max": 0.19848479038
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 5.177 ± 0.312 4.818 5.758 1.34 ± 0.10
pacquet@main 5.413 ± 0.314 4.927 5.917 1.40 ± 0.10
pnpr@HEAD 3.863 ± 0.146 3.708 4.207 1.00
pnpr@main 3.954 ± 0.157 3.767 4.207 1.02 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 5.1771048311,
      "stddev": 0.31205531948492715,
      "median": 5.079689994300001,
      "user": 3.288295279999999,
      "system": 2.9055066199999997,
      "min": 4.8182410003000005,
      "max": 5.7580669543
    },
    {
      "command": "pacquet@main",
      "mean": 5.4126105365,
      "stddev": 0.31397177257388587,
      "median": 5.454228821800001,
      "user": 3.31742438,
      "system": 2.92704992,
      "min": 4.9272506193000005,
      "max": 5.9167552893
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.8627245197999995,
      "stddev": 0.14579869748381202,
      "median": 3.8573774847999998,
      "user": 2.8599442799999997,
      "system": 2.50698292,
      "min": 3.7080094183,
      "max": 4.2069916933
    },
    {
      "command": "pnpr@main",
      "mean": 3.9544515044,
      "stddev": 0.15742583846546898,
      "median": 3.9295262788,
      "user": 2.8801128799999995,
      "system": 2.5543772199999992,
      "min": 3.7671845953000003,
      "max": 4.2073217203
    }
  ]
}

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 171.4 ± 14.5 149.7 194.3 1.00
pacquet@main 200.1 ± 14.3 179.2 227.3 1.17 ± 0.13
pnpr@HEAD 207.4 ± 16.1 182.2 231.7 1.21 ± 0.14
pnpr@main 198.6 ± 12.9 175.0 219.8 1.16 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.17141580894000003,
      "stddev": 0.014540271487026496,
      "median": 0.17009353593999998,
      "user": 0.2189597975,
      "system": 0.16122293000000001,
      "min": 0.14967902694,
      "max": 0.19425658994
    },
    {
      "command": "pacquet@main",
      "mean": 0.2000980972127273,
      "stddev": 0.014267741705389778,
      "median": 0.19986285394,
      "user": 0.2600889963636364,
      "system": 0.1629424981818182,
      "min": 0.17924729594,
      "max": 0.22727396994000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.20742608666727272,
      "stddev": 0.016072496815310283,
      "median": 0.20934418294,
      "user": 0.2511384509090909,
      "system": 0.1690220436363636,
      "min": 0.18217384694,
      "max": 0.23168679394
    },
    {
      "command": "pnpr@main",
      "mean": 0.19859842860666665,
      "stddev": 0.01285494407282155,
      "median": 0.20061270943999998,
      "user": 0.23229210999999997,
      "system": 0.16984193,
      "min": 0.17501145094,
      "max": 0.21979401294
    }
  ]
}

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.536 ± 0.069 1.469 1.658 1.00
pacquet@main 1.556 ± 0.080 1.449 1.719 1.01 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.53615152926,
      "stddev": 0.06870943181533454,
      "median": 1.51138012786,
      "user": 0.9413458799999999,
      "system": 0.5348819,
      "min": 1.46898261736,
      "max": 1.65754068636
    },
    {
      "command": "pacquet@main",
      "mean": 1.5562383853600001,
      "stddev": 0.07957567814043817,
      "median": 1.53040629186,
      "user": 0.9748042799999999,
      "system": 0.5315942,
      "min": 1.44912212436,
      "max": 1.7185941553600002
    }
  ]
}

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

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 54.6 ± 7.0 41.4 69.6 1.00
pacquet@main 57.8 ± 7.3 45.5 74.3 1.06 ± 0.19
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.054635648749803936,
      "stddev": 0.006999404452199406,
      "median": 0.05361738824000001,
      "user": 0.03696708392156862,
      "system": 0.03312774823529412,
      "min": 0.04135048924,
      "max": 0.06956273024000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.05782382813130436,
      "stddev": 0.007309044470454521,
      "median": 0.05707212324000001,
      "user": 0.040604345217391306,
      "system": 0.034133920869565224,
      "min": 0.045477483240000005,
      "max": 0.07433764724000001
    }
  ]
}

@codecov-commenter

codecov-commenter commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.69%. Comparing base (ed32254) to head (f191dd6).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17407   +/-   ##
=======================================
  Coverage   92.69%   92.69%           
=======================================
  Files        1891     1891           
  Lines      244250   244328   +78     
=======================================
+ Hits       226402   226483   +81     
+ Misses      17848    17845    -3     

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

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

@zkochan
zkochan marked this pull request as ready for review October 27, 2026 00:28
@zkochan

zkochan commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review


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

Copilot AI balanced review requested due to automatic review settings October 27, 2026 00:28

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Relink renamed workspace bins with dedicated lockfiles

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Include every workspace project’s commands when validating installs with dedicated lockfiles.
• Apply the same bins digest to repeat-install, frozen-tree, state-write, and run-gate checks.
• Cover renamed commands across lockfile layouts, linkers, and optimistic-install settings.
Diagram

graph TD
  W["Workspace manifests"] --> S["Install scope"] --> D["Bins digest"] --> T[("Workspace state")]
  W --> G["Run gate"] --> D
  T --> R["Repeat gate"] --> D
  T --> F["Frozen tree"] --> D
  T --> G
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Hash only each importer’s workspace dependencies
  • ➕ Avoids invalidating a dependent when an unrelated workspace project changes its commands.
  • ➖ Requires dependency-aware bin tracking across lockfile layouts and all three freshness checks, increasing complexity and the risk of missed relinks.

Recommendation: Keep the workspace-wide digest for this fix: it makes recording and every gate use the same conservative contract without introducing another dependency graph. Dependency-scoped hashing is worth considering only if unnecessary reinstalls become a measured problem.

Files changed (25) +182 / -39

Bug fix (17) +116 / -29
install.rsExpose the state-project grouping to install modules +3/-3

Expose the state-project grouping to install modules

• Re-exports StateProjects so install paths can pass selected importers and workspace-wide bin projects to state recording.

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

apply_materialization.rsRecord workspace-wide bin inputs after materialization +4/-1

Record workspace-wide bin inputs after materialization

• Passes both importer manifests and available workspace projects to the applied workspace-state writer.

pnpm/crates/package-manager/src/install/apply_materialization.rs

prepare_modules_state.rsSupply workspace bin projects to prepared-state checks +6/-1

Supply workspace bin projects to prepared-state checks

• Propagates workspace projects into the up-to-date state refresh and frozen-tree check. The frozen-tree check uses them for bins when available, while retaining its importer-scoped project list.

pnpm/crates/package-manager/src/install/prepare_modules_state.rs

up_to_date.rsCheck workspace-wide bins before accepting a frozen tree +5/-2

Check workspace-wide bins before accepting a frozen tree

• Computes the frozen-tree bins digest from bin projects rather than only the importers represented by the local lockfile. State refresh also retains that scope when recording validation.

pnpm/crates/package-manager/src/install/prepare_modules_state/up_to_date.rs

dispatch.rsCarry bin-project scope into dispatched install metadata +1/-0

Carry bin-project scope into dispatched install metadata

• Passes the install scope’s workspace projects into metadata used by the dispatched install path.

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

execution.rsCarry bin-project scope into selected importers +1/-0

Carry bin-project scope into selected importers

• Adds the install scope’s workspace projects to selected-importer inputs used during execution.

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

workspace.rsCollect workspace manifests for dedicated-lockfile installs +11/-0

Collect workspace manifests for dedicated-lockfile installs

• Builds a workspace-wide project list from already discovered projects when lockfiles are dedicated. Supplies it to the repeat-install verdict without changing the selected importer list.

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

state_options.rsDistinguish importer projects from bin projects +7/-0

Distinguish importer projects from bin projects

• Adds optional workspace-project inputs to selected importers and install metadata, plus an explicit bin-project list for recorded-workspace checks.

pnpm/crates/package-manager/src/install/state_options.rs

workspace_state.rsExport the workspace-state project inputs +1/-1

Export the workspace-state project inputs

• Makes StateProjects available to install paths through the workspace-state module.

pnpm/crates/package-manager/src/install/workspace_state.rs

discovery.rsLoad all workspace manifests for the run gate +35/-10

Load all workspace manifests for the run gate

• Loads workspace projects for dedicated as well as shared lockfiles. The run gate still compares only the gated importer with dedicated lockfiles, but uses all workspace projects as bin-digest inputs.

pnpm/crates/package-manager/src/install/workspace_state/discovery.rs

write.rsRecord importer state with workspace-wide bin inputs +12/-3

Record importer state with workspace-wide bin inputs

• Introduces StateProjects to separate manifests whose importer state is written from projects contributing to the bins digest. Passes both scopes to validation recording.

pnpm/crates/package-manager/src/install/workspace_state/write.rs

optimistic_repeat_install.rsCentralize selection of bin-digest projects +8/-0

Centralize selection of bin-digest projects

• Adds a helper that prefers explicit workspace projects for bin hashing and otherwise uses the check’s importer manifests.

pnpm/crates/package-manager/src/optimistic_repeat_install.rs

freshness.rsPreserve bin-project scope during state refresh +4/-1

Preserve bin-project scope during state refresh

• Passes workspace projects through refreshed-state recording so a successful freshness check writes the same bin scope it validated.

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs

drift.rsDetect bin drift across workspace projects +2/-4

Detect bin drift across workspace projects

• Computes the bins digest from the check’s bin-project scope instead of just its importer manifests.

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs

manifest_source.rsDefine the workspace-wide manifest contract +9/-1

Define the workspace-wide manifest contract

• Adds an optional workspace-project list to RepeatInstallManifests and documents when it differs from the checked importers. The on-disk default has no separate list.

pnpm/crates/package-manager/src/optimistic_repeat_install/manifest_source.rs

validation.rsRecord a workspace-wide bins digest +6/-1

Record a workspace-wide bins digest

• Extends validation inputs with optional workspace projects and uses them, when present, to compute the digest recorded for importer validation.

pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs

bins.rsCompare held bins against the workspace-wide digest +1/-1

Compare held bins against the workspace-wide digest

• Uses the shared bin-project selection when checking held importer records, so renamed sibling commands invalidate a previously accepted install.

pnpm/crates/package-manager/src/optimistic_repeat_install/validation/bins.rs

Tests (7) +61 / -10
repeat_install_oracle.rsExercise renamed bins with dedicated lockfiles +0/-5

Exercise renamed bins with dedicated lockfiles

• Removes the skip that restricted the renamed-workspace-command scenario to shared lockfiles.

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

workspace_bins.rsTest relinking renamed commands into dependents +33/-0

Test relinking renamed commands into dependents

• Adds a dedicated-lockfile regression test covering isolated and hoisted linkers with optimistic repeat install enabled and disabled. It checks both dependent bin directories and execution from a dependent.

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

tests.rsAdapt short-circuit tests to explicit bin projects +7/-1

Adapt short-circuit tests to explicit bin projects

• Initializes the new bin-project field in existing prepared-state test fixtures.

pnpm/crates/package-manager/src/install/prepare_modules_state/tests.rs

tests.rsAdapt install-scope fixture to workspace projects +1/-0

Adapt install-scope fixture to workspace projects

• Sets the new optional workspace-project field to None in an existing capture test.

pnpm/crates/package-manager/src/install/run/time_machine_capture/tests.rs

repeat_install.rsAdapt repeat-install state fixtures +12/-3

Adapt repeat-install state fixtures

• Wraps importer manifests in StateProjects with no separate workspace-project list for existing repeat-install tests.

pnpm/crates/package-manager/src/install/tests/repeat_install.rs

tests.rsAdapt validation and state-recording fixtures +6/-1

Adapt validation and state-recording fixtures

• Sets the new optional workspace-project input to None in existing repeat-install test helpers.

pnpm/crates/package-manager/src/optimistic_repeat_install/tests.rs

validation.rsAdapt validation-recording tests +2/-0

Adapt validation-recording tests

• Supplies no separate workspace-project list in existing validation test inputs.

pnpm/crates/package-manager/src/optimistic_repeat_install/tests/validation.rs

Documentation (1) +5 / -0
dedicated-lockfiles-relink-workspace-bins.mdDocument the dedicated-lockfile bin relinking fix +5/-0

Document the dedicated-lockfile bin relinking fix

• Adds a patch changeset describing how install now relinks renamed workspace commands into dependent projects.

.changeset/dedicated-lockfiles-relink-workspace-bins.md

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Unrelated bad manifests block scripts 🐞 Bug ≡ Correctness
Description
check_discovered_deps now treats a failure to load any workspace project manifest as an inability
to check the current project's dependencies. With dedicated lockfiles and
verifyDepsBeforeRun=error, a malformed or unreadable unrelated sibling manifest rejects run or
exec before the current project's command starts.
Code

pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[R189-190]

+    let Ok(workspace_projects) =
+        load_workspace_projects(workspace_root, workspace_manifest, &config.managed_directories())
Relevance

●●● Strong

Unrelated manifest read failures causing command rejection are a concrete correctness regression,
with recent precedent favoring explicit failure handling.

PR-#14073

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The newly unconditional loader reads every discovered project's manifest; a read or parse error
propagates to cannot_check_deps(). The run and exec gates invoke this check, and their error
action rejects an outdated status.

pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[184-195]
pnpm/crates/package-manager/src/install/lifecycle.rs[21-37]
pnpm/crates/workspace/src/projects.rs[318-343]
pnpm/crates/cli/src/cli_args/verify_deps.rs[79-105]

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

## Issue description
Dedicated-lockfile command gates now fail when an unrelated workspace manifest cannot be read or parsed.
## Fix Focus Areas
- pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[189-195]
- pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[231-245]
## Recommended Fix
Keep bin validation conservative without making unrelated manifest read failures reject a project's runnable command; scope discovery to relevant workspace dependencies where possible and add a dedicated-lockfile gate test with an invalid sibling manifest.

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

Dismiss ↗ | View ↗



Informational

2. Every script run now reads all workspace manifests ✓ Resolved
Description
check_discovered_deps calls load_workspace_projects on every eligible gated pnpm run or exec
with dedicated lockfiles, rereading workspace manifests even when project_bins_digest will discard
the result for a non-root project without runtime dependencies or peers. This adds a full-workspace
filesystem cost to repeated gates, and an unreadable or invalid sibling package.json can now make
an otherwise installed project report outdated through cannot_check_deps().
Code

pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[R189-192]

+    let Ok(workspace_projects) =
+        load_workspace_projects(workspace_root, workspace_manifest, &config.managed_directories())
    else {
        return cannot_check_deps();
Relevance

●●● Strong

Recent reviews accepted avoiding repeated filesystem scans and eager manifest work when consumers
may not need the results.

PR-#17042
PR-#17047

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The run and exec commands invoke the gate, whose dedicated-lockfile path now calls
load_workspace_projects; discovery expands workspace patterns and reads the discovered manifests,
and errors flow to cannot_check_deps(). project_bins_digest uses the workspace bins digest only
for the root or projects with runtime dependencies or peers, so the walk supplies no useful digest
for other gated projects; previously, dedicated-lockfile gates skipped this discovery.

pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[167-196]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation/bins.rs[38-57]
pnpm/crates/cli/src/cli_args/run.rs[207-209]
pnpm/crates/cli/src/cli_args/exec.rs[108-113]
pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[184-195]
pnpm/crates/package-manager/src/install/lifecycle.rs[21-37]
pnpm/crates/workspace/src/projects.rs[114-167]
PR-#16986

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

## Issue description
Dedicated-lockfile run and exec gates now traverse the workspace and reread its manifests on each invocation, including when the gated project cannot use a workspace bins digest. A broken sibling manifest can consequently make that project's gate report it outdated.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[184-246]
- pnpm/crates/package-manager/src/install/lifecycle.rs[21-37]

## Recommended Fix
In dedicated-lockfile mode, call `load_workspace_projects` only when the gated project's importer would record a bins digest: it is the root, `manifest_has_runtime_deps(manifest)` is true, or it declares peers. Otherwise pass `workspace_projects: None` and skip the walk; preserve shared-lockfile behavior. Where discovery is still needed, reuse it if available or consider a lightweight, safely invalidated bin-input check to avoid repeated full-workspace parsing. Benchmark repeated gated commands in a large workspace.

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


3. Repeat installs scale quadratically 🐞 Bug ➹ Performance
Description
InstallScope::select clones the entire workspace-project path list for every dedicated-lockfile
project install, then supplies that list to a bin digest that scans it again. A repeat install
across P projects therefore adds P full-list copies and P full-list digest traversals to its
per-project fast-path checks.
Code

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

+            workspace_projects: workspace_projects
+                .filter(|_| !install.context.config.shares_one_lockfile())
+                .map(|projects| {
+                    projects
Relevance

● Weak

Recent bins-digest performance precedent rejected narrowing workspace-wide coverage; this PR
explicitly accepts the quadratic allocation cost.

PR-#17325

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Dedicated mode schedules one install per project, and each selects a scope that clones all project
paths. Every scope's freshness check computes a digest by iterating the supplied full list.

pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs[52-83]
pnpm/crates/package-manager/src/install/run/workspace.rs[238-245]
pnpm/crates/package-manager/src/install/run/workspace.rs[292-295]
pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs[193-225]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation/bins.rs[7-37]

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

## Issue description
Each dedicated-lockfile project repeats full-workspace path cloning and bin-digest traversal on the install fast path.
## Fix Focus Areas
- pnpm/crates/package-manager/src/install/run/workspace.rs[238-245]
- pnpm/crates/package-manager/src/optimistic_repeat_install/validation/bins.rs[7-37]
## Recommended Fix
Build or cache the workspace bin digest once for the dedicated-install batch and reuse it across project checks; avoid cloning the full path list into every scope. Measure repeat installs with a large workspace before and after.

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

Dismiss ↗ | View ↗


Grey Divider

Context sources
⚠️ Tickets: not configured — No jira, linear integration is connected for the linked tickets
✅ Compliance rules (platform): 60 rules
✅ Cross-repo context — repo relationships
  Explored: repo: pnpm/update (sha: 2457663d) — View relationship
  Explored: repo: pnpm/exec (sha: d9dca8d2) — View relationship
  Explored: repo: pnpm/setup (sha: 186022e4) — View relationship
Review mode: Auto: ⚖️ Balanced: Behavioral workspace install changes span multiple correctness and performance-sensitive paths.
✅ Fix-loop round: fix loop

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit f191dd6

Results up to commit 0024935 🧠 Deep


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


Remediation recommended
1. Unrelated bad manifests block scripts 🐞 Bug ≡ Correctness
Description
check_discovered_deps now treats a failure to load any workspace project manifest as an inability
to check the current project's dependencies. With dedicated lockfiles and
verifyDepsBeforeRun=error, a malformed or unreadable unrelated sibling manifest rejects run or
exec before the current project's command starts.
Code

pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[R189-190]

+    let Ok(workspace_projects) =
+        load_workspace_projects(workspace_root, workspace_manifest, &config.managed_directories())
Relevance

●●● Strong

Unrelated manifest read failures causing command rejection are a concrete correctness regression,
with recent precedent favoring explicit failure handling.

PR-#14073

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The newly unconditional loader reads every discovered project's manifest; a read or parse error
propagates to cannot_check_deps(). The run and exec gates invoke this check, and their error
action rejects an outdated status.

pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[184-195]
pnpm/crates/package-manager/src/install/lifecycle.rs[21-37]
pnpm/crates/workspace/src/projects.rs[318-343]
pnpm/crates/cli/src/cli_args/verify_deps.rs[79-105]

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

## Issue description
Dedicated-lockfile command gates now fail when an unrelated workspace manifest cannot be read or parsed.
## Fix Focus Areas
- pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[189-195]
- pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[231-245]
## Recommended Fix
Keep bin validation conservative without making unrelated manifest read failures reject a project's runnable command; scope discovery to relevant workspace dependencies where possible and add a dedicated-lockfile gate test with an invalid sibling manifest.

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

Dismiss ↗ | View ↗



Informational
2. Every script run now reads all workspace manifests ✓ Resolved
Description
check_discovered_deps calls load_workspace_projects on every eligible gated pnpm run or exec
with dedicated lockfiles, rereading workspace manifests even when project_bins_digest will discard
the result for a non-root project without runtime dependencies or peers. This adds a full-workspace
filesystem cost to repeated gates, and an unreadable or invalid sibling package.json can now make
an otherwise installed project report outdated through cannot_check_deps().
Code

pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[R189-192]

+    let Ok(workspace_projects) =
+        load_workspace_projects(workspace_root, workspace_manifest, &config.managed_directories())
    else {
        return cannot_check_deps();
Relevance

●●● Strong

Recent reviews accepted avoiding repeated filesystem scans and eager manifest work when consumers
may not need the results.

PR-#17042
PR-#17047

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The run and exec commands invoke the gate, whose dedicated-lockfile path now calls
load_workspace_projects; discovery expands workspace patterns and reads the discovered manifests,
and errors flow to cannot_check_deps(). project_bins_digest uses the workspace bins digest only
for the root or projects with runtime dependencies or peers, so the walk supplies no useful digest
for other gated projects; previously, dedicated-lockfile gates skipped this discovery.

pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[167-196]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation/bins.rs[38-57]
pnpm/crates/cli/src/cli_args/run.rs[207-209]
pnpm/crates/cli/src/cli_args/exec.rs[108-113]
pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[184-195]
pnpm/crates/package-manager/src/install/lifecycle.rs[21-37]
pnpm/crates/workspace/src/projects.rs[114-167]
PR-#16986

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

## Issue description
Dedicated-lockfile run and exec gates now traverse the workspace and reread its manifests on each invocation, including when the gated project cannot use a workspace bins digest. A broken sibling manifest can consequently make that project's gate report it outdated.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/workspace_state/discovery.rs[184-246]
- pnpm/crates/package-manager/src/install/lifecycle.rs[21-37]

## Recommended Fix
In dedicated-lockfile mode, call `load_workspace_projects` only when the gated project's importer would record a bins digest: it is the root, `manifest_has_runtime_deps(manifest)` is true, or it declares peers. Otherwise pass `workspace_projects: None` and skip the walk; preserve shared-lockfile behavior. Where discovery is still needed, reuse it if available or consider a lightweight, safely invalidated bin-input check to avoid repeated full-workspace parsing. Benchmark repeated gated commands in a large workspace.

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


3. Repeat installs scale quadratically 🐞 Bug ➹ Performance
Description
InstallScope::select clones the entire workspace-project path list for every dedicated-lockfile
project install, then supplies that list to a bin digest that scans it again. A repeat install
across P projects therefore adds P full-list copies and P full-list digest traversals to its
per-project fast-path checks.
Code

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

+            workspace_projects: workspace_projects
+                .filter(|_| !install.context.config.shares_one_lockfile())
+                .map(|projects| {
+                    projects
Relevance

● Weak

Recent bins-digest performance precedent rejected narrowing workspace-wide coverage; this PR
explicitly accepts the quadratic allocation cost.

PR-#17325

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Dedicated mode schedules one install per project, and each selects a scope that clones all project
paths. Every scope's freshness check computes a digest by iterating the supplied full list.

pnpm/crates/cli/src/cli_args/pipelines/dedicated_runs.rs[52-83]
pnpm/crates/package-manager/src/install/run/workspace.rs[238-245]
pnpm/crates/package-manager/src/install/run/workspace.rs[292-295]
pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs[193-225]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation/bins.rs[7-37]

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

## Issue description
Each dedicated-lockfile project repeats full-workspace path cloning and bin-digest traversal on the install fast path.
## Fix Focus Areas
- pnpm/crates/package-manager/src/install/run/workspace.rs[238-245]
- pnpm/crates/package-manager/src/optimistic_repeat_install/validation/bins.rs[7-37]
## Recommended Fix
Build or cache the workspace bin digest once for the dedicated-install batch and reuse it across project checks; avoid cloning the full path list into every scope. Measure repeat installs with a large workspace before and after.

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

Dismiss ↗ | View ↗


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

With dedicated lockfiles every project is the root importer of its own
lockfile, and a project without dependencies or peers links no
workspace command. The install and the run gate now pass the workspace
projects for the bins digest only for a project that declares one, so
the run gate of such a project no longer walks the workspace, and both
sides record and compare the same digest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Oct 27, 2026
Copilot AI balanced review requested due to automatic review settings October 27, 2026 00:43
@zkochan

zkochan commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Replies to the Qodo review:

  1. The run gate reads every workspace manifest. Fixed in f191dd6, with a different predicate than the one suggested. With dedicated lockfiles, each project is the root importer (.) of its own lockfile, and project_bins_digest always gives the root the workspace digest. So "only when the project would record a digest" would never skip anything. The new predicate is links_workspace_commands: a dependency or a peer, which project_bins_digest now uses too. The install's dedicated_bin_projects and the run gate's load_gated_workspace both read the workspace projects only when the project links commands through one, so the recorded digest and the compared digest stay the same. A project with no dependencies no longer walks the workspace on pnpm run.
  2. Unrelated broken manifests block scripts. After the change above, this applies only to a project that links workspace commands. For such a project, the gate cannot prove its .bin without its siblings' bin fields, so it reports that it cannot check the dependencies rather than passing. The dedicated-lockfile install of the same workspace fails on that manifest too.
  3. Repeat installs scale quadratically. The change above also narrows this to projects that link commands. For each of them, the cost is one (PathBuf, &PackageManifest) per workspace project. The per-project loop already discovered those manifests and holds them in memory, so building the list reads nothing new. The digest reads the bin and directories.bin of each one.

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

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@qodo-code-review

Copy link
Copy Markdown

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

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

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@zkochan
zkochan merged commit cdb69ca into main Oct 27, 2026
62 checks passed
@zkochan
zkochan deleted the fix-224-workspace-bin-relink branch October 27, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants