Skip to content

fix(package-manager): record which projects each install proved installed - #17030

Merged
zkochan merged 19 commits into
mainfrom
refactor/repeat-install-state
Oct 17, 2026
Merged

zkochan merged 19 commits into
mainfrom
refactor/repeat-install-state

Conversation

@zkochan

@zkochan zkochan commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Redesigns how pnpm v12 decides that node_modules is up to date, in the repeat-install fast path and the verifyDepsBeforeRun gate. This follows the "is node_modules up to date?" loop in pnpm/tasks#142 and adds the test harness pnpm/tasks#141 asks for. That loop had 14 fixes in 90 days, #17019 being the latest.

Both checks compared file mtimes with one workspace-wide lastValidatedTimestamp and a filteredInstall flag. That state can't say which projects an install validated, and mtime ordering misses edits that keep their mtime.

What changes

  • Per-project validation records. The workspace state gains a validation key, which pnpm v11 neither reads nor writes. It records, for each importer id, the content digest of the manifest that project was proven installed with and of the lockfile it was proven against. A project is proven while both digests still match. A filtered install vouches only for the projects it materialized and carries the other records forward, unless a workspace-wide input changed (settings, catalogs, pnpmfiles, config dependencies, patches).
  • Content digests instead of mtime ordering. Manifests are hashed from the parsed value: keys sorted, length-prefixed, nothing serialized. The lockfile, patches, and pnpmfiles are recorded with a stat signature (mtime, inode change time, size) next to their digest. A file is read again only when its stat moved or falls in the window where a racy rewrite could hide. A file read again with the same content is recorded again, so the next run trusts its stat. The change time (the inode's on Unix, NTFS's on Windows) is what catches cp -p, rsync -a, or touch -r restoring an mtime.
  • Scope. A gate holds only the projects its install can fix, so it cannot loop:
    • an unfiltered install holds every project;
    • a filtered install or a filtered run/exec holds the selection plus the workspace projects it links;
    • an unfiltered run/exec holds every stale project anywhere (a root script may touch them), but a never-installed project only where the selection needs it.
  • Install proof. A held project whose lockfile changed, or that was never proven, must match what the wanted lockfile materializes for it in the current lockfile. Every group the current lockfile records counts, so a tree that still holds dev dependencies after a --prod filtered install doesn't pass. A project the current lockfile doesn't list keeps v11's wording: "Workspace package … has dependencies but was not installed".
  • One state writer. All three writers (after materialization, the up-to-date refresh, the gate refresh) go through recorded_workspace_state. The fields a writer carries over (autoDedupe, kept dependency groups, which projects it vouches for) are required inputs, so no writer can drop one (the class behind fix: stop the pre-run install for a dedupe baseline a frozen install cannot record #16396 and fix: settle single-project lockfile checks #16996).
  • The gate reports non-convergence. If the install the gate spawned leaves the tree stale, it warns instead of reinstalling silently on every command. The warning fired in the existing suite and exposed two real loops, both fixed here:
    • in a shared-lockfile workspace with no root package.json, the gate treated the missing root manifest as unreadable;
    • with sharedWorkspaceLockfile: false, a filtered command didn't verify the workspace projects its selection links. They are now verified and installed project by project, except injected ones, which live inside the dependent's own install.
  • ManifestFreshness removed. In-memory manifests (@pnpm/napi) are judged by content like any other, instead of every project being content-checked on every run.

States written by older pnpm v12 releases or by pnpm v11 have no records. Every project is then proven once from the lockfiles and recorded. After a pnpm v11 filtered install, the install gate still refuses, because v11's current lockfile lists the projects that install left out as installed (pnpm/tasks#139).

It overlaps #16588, which changes the same state writers. Whichever lands second rebases onto the other.

Bugs this fixes

The new harness (repeat_install_oracle, 14 scenarios × 8 layouts) failed 38 of 112 tests on the commit this PR started from, and passes all 112 here. #17025 has since made the install fast path refuse every project whose dedicated lockfile injects a workspace package (pnpm/tasks#145). In those two layouts, the harness still checks that every gate is sound but no longer requires the install fast path. The failures before this PR:

  • an edit to a project that a later install --filter left out: the run gate passed with the new dependency missing;
  • a manifest or lockfile edit that kept its mtime (cp -p, rsync -a, archive extraction, Docker COPY) went unseen by both gates;
  • after install --filter, a repeat of the same filtered install, and a full install after filtered commands had installed every project, never took the fast path;
  • a workspace without a root package.json reinstalled before every run/exec;
  • a state without records was not re-proven.

Performance

A synthetic 1000-project workspace (3 workspace links each), release builds, median of 150 interleaved runs (60 for the touch rows). The machine was under load from other jobs, so CPU time (user+sys) is listed next to wall time. All times in ms.

Scenario main wall PR wall main CPU PR CPU
repeat install 22.5 22.2 45.4 44.7
run gate 24.4 23.8 44.3 43.4
filtered run gate 44.5 43.9 69.0 67.8
install after touching every manifest 31.3 21.1 54.6 40.8
install after touching the lockfile 40.1 24.8 68.8 55.7
repeat filtered install 25.0 25.1 48.3 46.5

Steady state is unchanged. A rewrite that keeps the content no longer costs a content check. Manifests are hashed sequentially: parallel hashing on the rayon pool cost about 3 ms more CPU per run for 1000 projects, from waking the workers. The state file grows from 119 KB to 180 KB for 1000 projects, because records are keyed by importer id and the lockfile digest is stored once.

Limitations

  • The writer hashes the lockfile from disk at write time. A concurrent edit between the install's lockfile write and the state write would be blessed. The timestamp baseline already had the same window.

Tests that changed meaning

These asserted the old mtime behavior and now assert the content behavior. Each still pins what it was written for:

  • the "poisoned lockfile" convergence tests (*_mtime_collision, single_project_*_converges_*) asserted that a same-size edit with its mtime restored stayed up to date. They now assert that a converged check writes nothing, and a Unix test asserts the poisoned lockfile is detected;
  • tests that "touched" a manifest to force a content check now make a real edit the lockfile still satisfies;
  • the in-memory manifest tests no longer assert that the mtime mode misses in-memory edits;
  • dedupe_peers_lockfile_regeneration… relied on an identical regenerated lockfile still triggering an install. An identical lockfile now needs none. The test reaches the spawned install through a layout-only rewrite and keeps its reporter-order assertions;
  • the fix(package-manager): hold selected projects to the wanted lockfile after a filtered install #17019 filtered-state unit tests build their states from records. One now expects a selected project whose manifest gained an unrecorded dependency to be outdated without pnpm-lock.yaml too.

Hand-written states in the unit tests now get their validation from the real record_validation. The harness builds its states from real installs only.

pnpm v11

v11 has the same mtime and filtered-install bugs. #17034 fixes them there and writes this validation format. A test in each stack pins the same manifest digest, so each CLI reuses the other's records. The v11/v12 differential test from pnpm/tasks#141 needs a harness that runs both binaries. It follows once both PRs land.

Squash Commit Body

The repeat-install fast path and the verifyDepsBeforeRun gate compared
file mtimes with one workspace-wide lastValidatedTimestamp and a
filteredInstall flag. That could not say which projects an install had
validated: a filtered install refreshed the timestamp for the projects it
left out too, so an edit to one of them went unnoticed, and an edit that
kept its mtime was never seen at all.

The workspace state now records, under a validation key pnpm v11 ignores,
the content digest of each project's manifest and of the lockfile it was
proven against, keyed by importer id, plus a stat signature (mtime, inode
change time, size) and digest for the lockfile, patches, and pnpmfiles. A
project is proven installed while both digests match. Manifests are
hashed from the parsed value with sorted keys. A shared input is read
again only when its stat moved or falls inside the window a racy write
could hide in.

Each gate holds only the projects its install can fix: every project for
an unfiltered install, the selection and the workspace projects it links
for a filtered install or command, and for an unfiltered command every
stale project plus the never-installed ones the selection needs. A held
project is checked against the lockfile, and against the current lockfile
when its lockfile changed or it was never proven, comparing every group
the current lockfile records. A filtered install vouches only for what it
materialized and carries the other records unless a workspace-wide input
changed. Every state write goes through recorded_workspace_state, so a
writer cannot drop a carried field.

The gate now warns when the install it spawned leaves the dependencies
out of date. That exposed two gates that reinstalled before every
command: a shared-lockfile workspace without a root package.json, and
filtered commands under dedicated lockfiles, which now also verify the
workspace projects the selection links.

ManifestFreshness is removed: in-memory manifests are judged by content
like every other one.

A new end-to-end harness checks every gate against a full install in
both directions across lockfile layouts, linkers, and injected packages.
It failed 38 of its 112 tests on the commit this change started from.

Part of pnpm/tasks#141 and pnpm/tasks#142.

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. (v11 half: fix(deps.status): record which projects each install proved installed #17034.)
  • 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.
  • Updated the documentation if needed.

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

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Performance
    • Repeated filtered installs skip reinstalling when selected projects are up to date. Unfiltered installs also skip reinstalling after filtered installs have covered the workspace.
  • Bug Fixes
    • Changes to manifests, lockfiles, and patch files are detected by content, even when modification times are unchanged.
    • pnpm run and pnpm exec check dependencies for selected projects and their workspace dependencies, including in workspaces without a root manifest.
    • A warning appears if an automatic install finishes with dependencies still out of date.
  • Documentation
    • Clarified dependency checks and repeat-install validation for filtered commands.

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: pnpm/pnpm/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 63eff544-7098-4853-aa73-d07cd5688e24
📥 Commits

Reviewing files that changed from the base of the PR and between 79cdfc8 and 2c0ace0.

📒 Files selected for processing: 1
  • .changeset/verify-deps-gates-converge.md
+------------------------------+
| Here's looking at you, code. |
+------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

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: 049ec5be-1b37-4413-b200-3bbae46af19c
📥 Commits

Reviewing files that changed from the base of the PR and between 51f2516 and 79cdfc8.

📒 Files selected for processing: 1
  • pnpm/crates/package-manager/src/optimistic_repeat_install/manifest_agreement.rs

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

📝 Walkthrough

The change adds content-digest validation to workspace state and uses it in repeat-install and pre-command dependency checks. It also changes project-scope handling, install-state recording, CLI install behavior, integration tests, release notes, and documentation.

Changes: Repeat-install validation and gates

Layer / File(s) Summary
Record validation in workspace state
pnpm/crates/workspace-state/*, pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs, pnpm/crates/package-manager/src/install/..., pnpm/crates/package-manager/src/install/tests/*, pnpm/crates/napi/src/install.rs, pnpm/crates/package-manager/src/update/install.rs, pnpm/crates/package-manager/Cargo.toml
Workspace state now stores validation signatures and per-project manifest and lockfile digests. Install-state writers record validation for all or vouched projects. Install policy and its fixtures no longer use manifest_freshness.
Check content drift and settle repeat installs
pnpm/crates/package-manager/src/optimistic_repeat_install*
Repeat-install checks compare recorded content digests for manifests, lockfiles, patches, and shared inputs. They classify project status, apply scope to held projects, compare lockfile entries, and record refreshed state after settlement.
Apply project scope to install and command gates
pnpm/crates/cli/src/cli_args/*, pnpm/crates/cli/tests/suite/*, pnpm/crates/package-manager/src/install/run/*, pnpm/docs/settings/*, .changeset/*
Install and command gates check selected projects and relevant workspace dependencies. The CLI rechecks dependency status after a wait and after a successful spawned install. Tests cover workspace layouts and content edits; documentation and changesets describe the updated behavior.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant RunOrExec
  participant DependencyGate
  participant InstallGate
  participant WorkspaceState
  participant CurrentLockfile
  RunOrExec->>DependencyGate: check selected projects and workspace dependencies
  DependencyGate->>InstallGate: request install when dependencies are outdated
  InstallGate->>WorkspaceState: read recorded validation
  InstallGate->>CurrentLockfile: compare held projects against lockfiles
  InstallGate->>WorkspaceState: record validation after settlement
  DependencyGate->>RunOrExec: continue after dependency status check
Loading

Suggested reviewers: neonsid

Merge Risk: ⚪ Minimal · up to 79cdf

No actionable merge-blocking issue was established in this review scope; the change is mergeable after normal checks.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

codecov-commenter commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.92549% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.55%. Comparing base (198cc7f) to head (2c0ace0).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...manager/src/optimistic_repeat_install/freshness.rs 90.38% 10 Missing ⚠️
pnpm/crates/cli/src/cli_args/verify_deps.rs 67.85% 9 Missing ⚠️
...anager/src/optimistic_repeat_install/validation.rs 96.73% 8 Missing ⚠️
...s/package-manager/src/optimistic_repeat_install.rs 91.11% 4 Missing ⚠️
...r/src/optimistic_repeat_install/freshness/drift.rs 97.18% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #17030    +/-   ##
========================================
  Coverage   92.55%   92.55%            
========================================
  Files        1778     1784     +6     
  Lines      228533   228911   +378     
========================================
+ Hits       211521   211872   +351     
- Misses      17012    17039    +27     

☔ 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

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.03     12.0±0.11ms    31.2 MB/sec    1.00     11.6±0.04ms    32.3 MB/sec
packument/parse                                  1.00     38.5±0.10µs  1724.6 MB/sec    1.08     41.6±0.50µs  1596.0 MB/sec
tarball/download_dependency                      1.00      3.2±0.06ms  1361.8 KB/sec    1.02      3.2±0.09ms  1340.0 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    182.8±2.31ms 87.5 KElem/sec    1.00    182.7±2.70ms 87.6 KElem/sec
version_pick/repeated_ranges_file                1.00      4.2±0.09ms  7.5 KElem/sec    1.02      4.2±0.02ms  7.4 KElem/sec
version_pick/repeated_ranges_raw                 1.00      4.2±0.09ms  7.5 KElem/sec    1.02      4.3±0.02ms  7.3 KElem/sec
workspace_resolution/hoist_heavy                 1.00    198.1±1.27ms        ? ?/sec    1.05    207.1±2.46ms        ? ?/sec
workspace_sort/chained_projects                  1.03     14.1±0.41ms        ? ?/sec    1.00     13.6±0.72ms        ? ?/sec

@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 2287.08 ms 2434.21 ms 6.4% 114.35 ms Inconclusive (overlapping samples)
isolated-fresh-restore-cold-cache-cold-store pnpr 1332.35 ms 1473.77 ms 10.6% 66.62 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pacquet 238.78 ms 237.77 ms -0.4% 11.94 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 260.65 ms 232.42 ms -10.8% 13.03 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 9.01 ms 8.90 ms -1.2% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 9.20 ms 9.63 ms 4.7% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 7.67 ms 7.65 ms -0.2% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 7.84 ms 7.85 ms 0.2% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2507.88 ms 2508.17 ms 0.0% 125.39 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1552.91 ms 1531.97 ms -1.3% 77.65 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 575.64 ms 730.63 ms 26.9% 28.78 ms Inconclusive (overlapping samples)
isolated-fresh-install-hot-cache-hot-store pnpr 364.17 ms 375.98 ms 3.2% 18.21 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1620.59 ms 1612.59 ms -0.5% 81.03 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 288.76 ms 285.96 ms -1.0% 14.44 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 229.90 ms 219.46 ms -4.5% 11.50 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 125.35 ms 93.18 ms -25.7% 6.27 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 207.99 ms 218.20 ms 4.9% 10.40 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 204.17 ms 203.20 ms -0.5% 10.21 ms Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 147.27 ms 86.60 ms -41.2% 7.36 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4445.66 ms 4459.08 ms 0.3% 222.28 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3624.10 ms 3522.82 ms -2.8% 181.21 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 129.76 ms 118.78 ms -8.5% 6.49 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 232.57 ms 212.61 ms -8.6% 11.63 ms Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1143.00 ms 1147.74 ms 0.4% 57.15 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: 79cdfc8f8057

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.446 ± 0.092 2.272 2.577 1.79 ± 0.13
pacquet@main 2.345 ± 0.111 2.241 2.553 1.71 ± 0.13
pnpr@HEAD 1.480 ± 0.133 1.305 1.682 1.08 ± 0.12
pnpr@main 1.369 ± 0.084 1.300 1.563 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.44617719644,
      "stddev": 0.0919728918163283,
      "median": 2.4342116576399997,
      "user": 1.2176171399999998,
      "system": 1.3107253,
      "min": 2.27175413114,
      "max": 2.57734715614
    },
    {
      "command": "pacquet@main",
      "mean": 2.34538253774,
      "stddev": 0.11136341792562898,
      "median": 2.28708470014,
      "user": 1.1979692400000002,
      "system": 1.3157321999999998,
      "min": 2.2408251031399997,
      "max": 2.55318049414
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4802143548399997,
      "stddev": 0.13253280556862332,
      "median": 1.4737701531399998,
      "user": 1.11845994,
      "system": 1.2224431,
      "min": 1.3053986441399998,
      "max": 1.6816954391399999
    },
    {
      "command": "pnpr@main",
      "mean": 1.36865067524,
      "stddev": 0.08355217615743538,
      "median": 1.33235156514,
      "user": 1.1458502400000001,
      "system": 1.1419621000000002,
      "min": 1.29965448614,
      "max": 1.5629311551399998
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 238.2 ± 11.6 223.4 258.1 1.01 ± 0.07
pacquet@main 238.8 ± 9.4 221.8 260.6 1.02 ± 0.06
pnpr@HEAD 235.2 ± 11.7 220.9 265.3 1.00
pnpr@main 309.7 ± 90.1 242.0 442.1 1.32 ± 0.39
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23816085187999997,
      "stddev": 0.011559710507222347,
      "median": 0.23776896918,
      "user": 0.27158819999999995,
      "system": 0.5726200799999999,
      "min": 0.22340846768,
      "max": 0.25813623668
    },
    {
      "command": "pacquet@main",
      "mean": 0.23877081608,
      "stddev": 0.009440815724486048,
      "median": 0.23877982218,
      "user": 0.27334329999999996,
      "system": 0.58130848,
      "min": 0.22175535568,
      "max": 0.26058453568
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.23515615478,
      "stddev": 0.011697338272070902,
      "median": 0.23241544868,
      "user": 0.2629481,
      "system": 0.5158449799999999,
      "min": 0.22088845368,
      "max": 0.26532099868000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.30974139788,
      "stddev": 0.09011651998809346,
      "median": 0.26065426518,
      "user": 0.3464573,
      "system": 0.6870351799999999,
      "min": 0.24201681268,
      "max": 0.44206513568000005
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 9.1 ± 0.9 8.1 14.4 1.00
pacquet@main 9.4 ± 1.2 8.2 15.1 1.03 ± 0.17
pnpr@HEAD 9.9 ± 1.1 8.1 13.8 1.09 ± 0.17
pnpr@main 9.6 ± 1.2 8.1 14.5 1.04 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.00914635455355263,
      "stddev": 0.0009439665986185516,
      "median": 0.008901940820000002,
      "user": 0.005214765,
      "system": 0.004825233421052628,
      "min": 0.00805711482,
      "max": 0.014380164820000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.009375449289798658,
      "stddev": 0.0011718054419661867,
      "median": 0.009011162320000002,
      "user": 0.0051775103355704705,
      "system": 0.005128015302013423,
      "min": 0.008150226820000002,
      "max": 0.01511582782
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.009934412411836738,
      "stddev": 0.0011434025700314309,
      "median": 0.009633738320000002,
      "user": 0.005551078775510206,
      "system": 0.0053398669387755135,
      "min": 0.008140732820000001,
      "max": 0.013802996820000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.009552499997083335,
      "stddev": 0.0011663334681899752,
      "median": 0.00920076832,
      "user": 0.00530289,
      "system": 0.0051758162500000005,
      "min": 0.008147492820000001,
      "max": 0.014536825820000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 7.8 ± 0.8 7.0 13.3 1.01 ± 0.11
pacquet@main 7.7 ± 0.3 7.0 9.4 1.00
pnpr@HEAD 7.9 ± 0.4 7.1 9.9 1.03 ± 0.06
pnpr@main 7.8 ± 0.3 7.0 9.7 1.02 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.007785774073333332,
      "stddev": 0.0008089596975390785,
      "median": 0.007652018240000001,
      "user": 0.0049401280808080835,
      "system": 0.003467878888888887,
      "min": 0.006998403740000001,
      "max": 0.013332994740000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.007686694676507934,
      "stddev": 0.0003106207508794497,
      "median": 0.00766907474,
      "user": 0.004851935873015874,
      "system": 0.003536516634920636,
      "min": 0.006978266740000001,
      "max": 0.00943499574
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.007884333377037036,
      "stddev": 0.00038393108196475335,
      "median": 0.00785403824,
      "user": 0.005051231111111108,
      "system": 0.003581536444444443,
      "min": 0.0071147137400000005,
      "max": 0.00988647374
    },
    {
      "command": "pnpr@main",
      "mean": 0.007828116061543416,
      "stddev": 0.00032014188828351567,
      "median": 0.00783692174,
      "user": 0.00454050327974276,
      "system": 0.004069104694533763,
      "min": 0.006988966740000001,
      "max": 0.00966424674
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.512 ± 0.011 2.500 2.533 1.64 ± 0.10
pacquet@main 2.513 ± 0.021 2.492 2.565 1.64 ± 0.10
pnpr@HEAD 1.535 ± 0.092 1.408 1.735 1.00
pnpr@main 1.577 ± 0.099 1.431 1.731 1.03 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.51241926964,
      "stddev": 0.010828299146958072,
      "median": 2.5081714136400004,
      "user": 1.8857484800000002,
      "system": 1.6390030600000003,
      "min": 2.49990700114,
      "max": 2.53266374414
    },
    {
      "command": "pacquet@main",
      "mean": 2.5129886637400007,
      "stddev": 0.02103287890166235,
      "median": 2.50787889314,
      "user": 1.89669478,
      "system": 1.6356736600000001,
      "min": 2.49169335814,
      "max": 2.56458266814
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5345993747400004,
      "stddev": 0.09161342241876613,
      "median": 1.5319672676400002,
      "user": 1.22228078,
      "system": 1.32021236,
      "min": 1.40833781214,
      "max": 1.7350794551400002
    },
    {
      "command": "pnpr@main",
      "mean": 1.57690852034,
      "stddev": 0.09915507153165502,
      "median": 1.5529120926400002,
      "user": 1.20967018,
      "system": 1.30547046,
      "min": 1.4306044531400002,
      "max": 1.73077805514
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 702.8 ± 106.0 572.7 851.3 1.88 ± 0.29
pacquet@main 576.1 ± 16.6 544.2 605.0 1.54 ± 0.06
pnpr@HEAD 373.4 ± 8.0 360.3 385.2 1.00
pnpr@main 406.8 ± 93.5 353.1 610.0 1.09 ± 0.25
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.7028436908400001,
      "stddev": 0.10600625258992212,
      "median": 0.7306254354400001,
      "user": 1.10951136,
      "system": 1.2658316200000002,
      "min": 0.5726555909400001,
      "max": 0.8513043359400001
    },
    {
      "command": "pacquet@main",
      "mean": 0.5760911251400002,
      "stddev": 0.016593310730587642,
      "median": 0.57564187194,
      "user": 0.8377565600000001,
      "system": 1.0806596199999998,
      "min": 0.54424419794,
      "max": 0.6050331759400001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.37343927764000007,
      "stddev": 0.008011973459865429,
      "median": 0.37598305094000006,
      "user": 0.35586735999999997,
      "system": 0.80123512,
      "min": 0.36026375294,
      "max": 0.38519700594
    },
    {
      "command": "pnpr@main",
      "mean": 0.40675542104000006,
      "stddev": 0.09351525243052893,
      "median": 0.36416882594,
      "user": 0.38679995999999994,
      "system": 0.87258982,
      "min": 0.35309245794,
      "max": 0.61003236394
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.614 ± 0.013 1.601 1.643 5.64 ± 0.20
pacquet@main 1.652 ± 0.111 1.558 1.950 5.78 ± 0.44
pnpr@HEAD 0.286 ± 0.010 0.272 0.308 1.00
pnpr@main 0.287 ± 0.009 0.271 0.302 1.00 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.6138405282600001,
      "stddev": 0.01280672508646285,
      "median": 1.61259058526,
      "user": 0.8721250399999999,
      "system": 0.9000722000000001,
      "min": 1.60097848926,
      "max": 1.6430416722599999
    },
    {
      "command": "pacquet@main",
      "mean": 1.6522702293600002,
      "stddev": 0.11063877438975438,
      "median": 1.62059287626,
      "user": 0.9919197399999999,
      "system": 0.9663628,
      "min": 1.55829501426,
      "max": 1.94989865726
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.28590061616000007,
      "stddev": 0.010079134724355168,
      "median": 0.28595530976000005,
      "user": 0.25527774,
      "system": 0.5347230000000001,
      "min": 0.27167167926,
      "max": 0.30809910926000006
    },
    {
      "command": "pnpr@main",
      "mean": 0.2872732266600001,
      "stddev": 0.00913154725156901,
      "median": 0.28876294276000003,
      "user": 0.23800154,
      "system": 0.5723812,
      "min": 0.27109002426000006,
      "max": 0.30226520426000003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 222.2 ± 11.8 206.7 241.2 2.24 ± 0.32
pacquet@main 232.9 ± 11.7 217.9 255.4 2.35 ± 0.33
pnpr@HEAD 99.1 ± 13.0 89.0 133.1 1.00
pnpr@main 125.3 ± 4.9 117.8 133.2 1.26 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.22222055487846154,
      "stddev": 0.011761750670734209,
      "median": 0.21945564634,
      "user": 0.20660556769230767,
      "system": 0.07796248923076923,
      "min": 0.20673152034,
      "max": 0.24119619534000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.23292110988545459,
      "stddev": 0.011748326407722715,
      "median": 0.22990228234,
      "user": 0.1989356236363636,
      "system": 0.08865853818181818,
      "min": 0.21793121834,
      "max": 0.25536209634
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.0990664128757143,
      "stddev": 0.013029610728638088,
      "median": 0.09318357034000001,
      "user": 0.03642961714285715,
      "system": 0.018186612857142855,
      "min": 0.08899508334,
      "max": 0.13311792434
    },
    {
      "command": "pnpr@main",
      "mean": 0.12530585670363636,
      "stddev": 0.004858724707545139,
      "median": 0.12535074084,
      "user": 0.06117444181818181,
      "system": 0.024766310909090906,
      "min": 0.11778061734,
      "max": 0.13319276434000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 219.1 ± 11.9 200.1 242.0 1.04 ± 0.08
pacquet@main 210.0 ± 10.7 197.1 226.4 1.00
pnpm@HEAD 3397.1 ± 53.9 3314.4 3466.6 16.18 ± 0.87
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.21912200787111114,
      "stddev": 0.011905111358230516,
      "median": 0.21820425176000002,
      "user": 0.21790348888888886,
      "system": 0.04814182222222222,
      "min": 0.20010937476000001,
      "max": 0.24203338176000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.20995727731555558,
      "stddev": 0.010723230461406618,
      "median": 0.20798612676000003,
      "user": 0.2109419333333333,
      "system": 0.05401804444444445,
      "min": 0.19713338976000003,
      "max": 0.22639404076000003
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.397098857204444,
      "stddev": 0.053854195086652366,
      "median": 3.38283816976,
      "user": 5.281912044444445,
      "system": 0.3314454888888888,
      "min": 3.31441383076,
      "max": 3.46659900076
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 204.8 ± 5.8 197.3 217.5 1.00
pacquet@main 206.0 ± 4.8 200.5 218.6 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.20483415942461536,
      "stddev": 0.005766439445666588,
      "median": 0.20319832004000002,
      "user": 0.1580881123076923,
      "system": 0.08054629999999999,
      "min": 0.19725439304,
      "max": 0.21745207104
    },
    {
      "command": "pacquet@main",
      "mean": 0.20602439239714282,
      "stddev": 0.004801454611702065,
      "median": 0.20417210104,
      "user": 0.1537072057142857,
      "system": 0.08672851428571429,
      "min": 0.20046351804,
      "max": 0.21857325904000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 98.8 ± 25.4 81.4 162.2 1.00
pacquet@main 146.2 ± 15.1 121.3 183.2 1.48 ± 0.41
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.09882820810500002,
      "stddev": 0.025404756276863224,
      "median": 0.08660324048000001,
      "user": 0.0366610375,
      "system": 0.06978334250000003,
      "min": 0.08143808298,
      "max": 0.16223969298000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.14616088848,
      "stddev": 0.015120262271665295,
      "median": 0.14726539648000003,
      "user": 0.06107726666666666,
      "system": 0.0962270022222222,
      "min": 0.12130534498000001,
      "max": 0.18318134898000002
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.505 ± 0.139 4.386 4.788 1.27 ± 0.05
pacquet@main 4.483 ± 0.092 4.412 4.714 1.27 ± 0.04
pnpr@HEAD 3.543 ± 0.066 3.476 3.685 1.00
pnpr@main 3.623 ± 0.086 3.469 3.751 1.02 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.504677570580001,
      "stddev": 0.13865937001966666,
      "median": 4.45907811378,
      "user": 1.61463496,
      "system": 1.8986562399999998,
      "min": 4.38626643178,
      "max": 4.78847642678
    },
    {
      "command": "pacquet@main",
      "mean": 4.48269603838,
      "stddev": 0.09221383200658045,
      "median": 4.44566064678,
      "user": 1.6012918600000003,
      "system": 1.9252512400000001,
      "min": 4.41154702478,
      "max": 4.71431501278
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.543344657080001,
      "stddev": 0.06628470555920507,
      "median": 3.5228225762800003,
      "user": 1.56433936,
      "system": 1.76649454,
      "min": 3.47617891778,
      "max": 3.68524834278
    },
    {
      "command": "pnpr@main",
      "mean": 3.62261168798,
      "stddev": 0.08555700682776429,
      "median": 3.6241049112800003,
      "user": 1.52501586,
      "system": 1.80848244,
      "min": 3.46898797978,
      "max": 3.7511039747800003
    }
  ]
}

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 124.7 ± 20.2 112.3 206.8 1.00
pacquet@main 149.9 ± 37.0 114.0 217.6 1.20 ± 0.35
pnpr@HEAD 217.2 ± 21.5 185.7 260.3 1.74 ± 0.33
pnpr@main 231.4 ± 32.7 171.0 276.0 1.86 ± 0.40
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.12472459740952381,
      "stddev": 0.02015636257309643,
      "median": 0.11877819860000001,
      "user": 0.15041633523809522,
      "system": 0.11747480285714283,
      "min": 0.11232969660000001,
      "max": 0.20677351260000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.14987609670000002,
      "stddev": 0.03697643205560811,
      "median": 0.12975682309999997,
      "user": 0.18144543999999999,
      "system": 0.14852326,
      "min": 0.11403562860000001,
      "max": 0.2176281336
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.21717432768333333,
      "stddev": 0.021506344823022945,
      "median": 0.2126120716,
      "user": 0.25395240666666663,
      "system": 0.18756641,
      "min": 0.1856520196,
      "max": 0.26029956760000006
    },
    {
      "command": "pnpr@main",
      "mean": 0.23138399750909092,
      "stddev": 0.03273524847899002,
      "median": 0.2325719236,
      "user": 0.2659694218181818,
      "system": 0.1947521145454546,
      "min": 0.1709970226,
      "max": 0.27595821360000006
    }
  ]
}

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.152 ± 0.024 1.118 1.205 1.00
pacquet@main 1.158 ± 0.063 1.119 1.333 1.01 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.15206012224,
      "stddev": 0.024344271150513852,
      "median": 1.14774320124,
      "user": 0.5357356,
      "system": 0.20889602,
      "min": 1.11754813074,
      "max": 1.2047874457399999
    },
    {
      "command": "pacquet@main",
      "mean": 1.1579242449399998,
      "stddev": 0.06337112157174235,
      "median": 1.14299552274,
      "user": 0.5691185,
      "system": 0.21739441999999998,
      "min": 1.1194314937399998,
      "max": 1.33279904374
    }
  ]
}

zkochan and others added 12 commits October 17, 2026 13:42
Add an end-to-end harness that runs sequences of installs, filtered
installs, and edits across lockfile layouts, linkers, and injected
workspace packages, and checks each gate in both directions after every
step. The install fast path must be taken exactly when a full install
with optimisticRepeatInstall off changes nothing in node_modules or the
lockfiles. A filtered run gate must let its command through exactly when
a clean install of a copy of the sources resolves the selection the same
way and records the same wanted and current lockfile entries for it.
Right after an install, every gate it satisfied must pass without
installing again.

On the parent commit the harness fails for an edit to a project that a
later filtered install left out, for a manifest or lockfile edit that
kept its mtime, and for repeated filtered installs and full installs
after filtered commands, which never took the fast path.

Part of pnpm/tasks#141 and pnpm/tasks#142.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lled

The repeat-install fast path and the verifyDepsBeforeRun gate compared
the mtimes of the manifests, the lockfile, patches, and pnpmfiles with
one workspace-wide lastValidatedTimestamp, plus a filteredInstall flag.
That could not say which projects an install had validated: a filtered
install refreshed the timestamp for the projects it left out too, so an
edit to one of them went unnoticed, and an edit that kept its mtime was
never seen at all. Every fix taught one decider one more case.

The workspace state now records, under a validation key pnpm v11 ignores,
the content digest of each project's manifest and of the lockfile it was
proven against, keyed by importer id, plus a stat signature (mtime, inode
change time, size) and digest for the lockfile, patches, and pnpmfiles. A
project is proven installed while both digests still match. Manifests
are hashed from the parsed value, so a rewrite that keeps the content
keeps the fast path. A shared input file is read again only when its
stat no longer matches or falls inside the window a racy write could
hide in.

The gates hold only the projects their install can fix: every project
for an unfiltered install, the selection and the workspace projects it
links for a filtered install or command, and for an unfiltered command
every stale project plus the never-installed ones the selection needs.
A held project is checked against the lockfile, and against the current
lockfile when its lockfile changed or it was never proven, comparing
every group the current lockfile records. A filtered install vouches
only for what it materialized and carries the other records forward
unless a workspace-wide input changed. Every state write goes through
one assembler, recorded_workspace_state, so carried fields cannot be
dropped by one writer.

A state without validation records, as pnpm v11 writes it, is proven
again from the lockfiles once. After a pnpm v11 filtered install the
install gate still refuses it, since that current lockfile lists the
projects the install left out as installed.

ManifestFreshness is gone: in-memory manifests are judged by content
like every other one, and are no longer all content-checked on every
run.

Part of pnpm/tasks#142.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Three gates kept reporting stale dependencies after the install they
spawned, so every command installed again:

- In a workspace with one shared lockfile and no root package.json, the
  gate treated the missing root manifest as unreadable. It now checks
  the workspace projects without a root importer, as the install does.
- Under dedicated per-project lockfiles, a filtered command verified
  only the selected projects, not the workspace projects they link. It
  now verifies and installs those too, one project at a time, unless
  the workspace injects its packages.
- When the install the gate spawned still leaves the dependencies out
  of date, the gate now warns instead of looping silently, so a gate
  that cannot converge is reported.

Part of pnpm/tasks#142.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… same

A lockfile stat'd in the clock tick its validation was recorded in is
not trusted, so the next check reads it. When its content was unchanged
that check left the state as it was, so every later run read the file
again. It now records the state, after which the stat stands for the
content.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-path refusal

#17025 makes the repeat-install check refuse its fast path for
any project whose dedicated lockfile injects a workspace package, since
nothing compares the file: snapshot with the injected package. The
oracle still checks that layout's install gate for soundness and every
run gate, but no longer requires it to take the fast path
(pnpm/tasks#145).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zkochan
zkochan force-pushed the refactor/repeat-install-state branch from aaa27a7 to 771cfa8 Compare October 17, 2026 11:55
A check that re-read a lockfile or patch whose recorded stat fell in the
racy window recorded it again. When that check ran in the same
filesystem clock tick as the file's last change, the new record was just
as untrusted, so every check in that tick wrote the state again and
Code Coverage caught a run gate that never converged.

Such a write now happens only when every file it records will be
trusted. Otherwise the next check reads the file again, which it would
have done anyway. Tests that assert convergence wait for the filesystem
clock to pass the setup's writes, as a real install and the next command
never share a tick.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zkochan
zkochan marked this pull request as ready for review October 17, 2026 12:31
Copilot AI balanced review requested due to automatic review settings October 17, 2026 12:31
@zkochan

zkochan commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@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 reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Record per-project install proofs for repeat-install and run gates

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Record which projects each install proved current, preserving unaffected proofs across filtered
 installs.
• Replace mtime ordering with content digests and limit each gate to projects its install can fix.
• Add an end-to-end oracle for fast-path correctness and run-gate convergence.
Diagram

graph TD
  Install["Install path"] --> Scope["Project scope"] --> Gate{"Proof valid?"} -->|yes| State["Validation state"]
  Run["Run gate"] --> Scope
  Inputs["Content digests"] --> Gate
  Gate -->|no| Materialize["Install dependencies"] --> State
Loading
High-Level Assessment

The per-project proof is appropriate: workspace-wide timestamps cannot represent filtered materialization, and lockfile comparison alone cannot establish which projects were installed. One shared writer and freshness check keep the two gates aligned without introducing a separate state store.

Files changed (65) +2816 / -1224

Enhancement (1) +79 / -0
lib.rsPersist per-project validation evidence +79/-0

Persist per-project validation evidence

• Adds optional backward-compatible validation containing project manifest digests, their lockfile digests, and stat-backed signatures for shared files.

pnpm/crates/workspace-state/src/lib.rs

Bug fix (14) +1215 / -649
recursive.rsInclude linked projects in recursive verification +15/-14

Include linked projects in recursive verification

• Extends selection through workspace dependencies with dedicated lockfiles, except where injected packages are covered by their consumer’s install.

pnpm/crates/cli/src/cli_args/recursive.rs

verify_deps.rsWarn when a gate-triggered install does not converge +37/-12

Warn when a gate-triggered install does not converge

• Rechecks dependency status after a successful spawned install and warns if it remains outdated; failed installs retain their existing behavior.

pnpm/crates/cli/src/cli_args/verify_deps.rs

apply_materialization.rsRecord only materialized projects after installation +56/-26

Record only materialized projects after installation

• Routes post-materialization writes through the shared writer. Filtered installs vouch for materialized projects and may carry earlier proofs for the others.

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

fast_path.rsPass install scope into the repeat-install gate +11/-8

Pass install scope into the repeat-install gate

• Lets the fast path judge the projects the current install covers instead of always requiring the whole workspace.

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

workspace.rsDerive scope from requested workspace importers +22/-1

Derive scope from requested workspace importers

• Maps filtered importer IDs to project directories for the repeat-install verdict.

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

discovery.rsAccept workspace roots without a manifest +8/-0

Accept workspace roots without a manifest

• Treats a missing root importer manifest as an empty manifest for gate discovery instead of making repeated checks fail.

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

optimistic_repeat_install.rsWire scoped, content-based repeat-install checks +84/-98

Wire scoped, content-based repeat-install checks

• Replaces workspace-wide filtered and timestamp assumptions with scoped proofs, digest-based pnpmfile drift, and compatibility with states lacking validation.

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

current_lockfile.rsCompare selected projects’ materialized shape +48/-80

Compare selected projects’ materialized shape

• Checks selected importer closures against the wanted lockfile and counts every dependency group still recorded in the current lockfile.

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

deps_status.rsApply repairable scopes to the pre-run gate +26/-53

Apply repairable scopes to the pre-run gate

• Distinguishes filtered from unfiltered commands, delegates install proof to shared freshness logic, and preserves missing-project diagnostics.

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

freshness.rsRework shared freshness around project proofs +150/-182

Rework shared freshness around project proofs

• Checks unproven projects within a gate’s scope against the lockfile, refreshes passing proofs through the shared writer, and avoids unnecessary state writes.

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

drift.rsDetermine per-project drift and gate scope +242/-0

Determine per-project drift and gate scope

• Classifies projects by manifest and lockfile proof, follows workspace links for selections, and tracks lockfile and patch digest changes.

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

manifest_agreement.rsRequire installation proof for unproven projects +109/-169

Require installation proof for unproven projects

• Checks held manifests against the wanted lockfile and verifies that the current lockfile records materialized dependencies when prior proof is absent or obsolete.

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

relocation.rsInvalidate path-bound proofs on relocation +3/-6

Invalidate path-bound proofs on relocation

• Clears validation records when rebasing a moved tree, then records fresh proofs after relocation is established.

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

validation.rsImplement content signatures and project proof recording +404/-0

Implement content signatures and project proof recording

• Hashes parsed manifests canonically, caches file digests behind stat signatures with race-window checks, and records or carries per-project proofs according to shared inputs.

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

Refactor (12) +129 / -200
install.rsRemove obsolete manifest-freshness option +0/-1

Remove obsolete manifest-freshness option

• Stops selecting an in-memory freshness mode now that supplied manifests are judged by content.

pnpm/crates/napi/src/install.rs

install.rsExport shared workspace-state writer +4/-4

Export shared workspace-state writer

• Exposes centralized state-writing inputs and functions to installation and freshness paths.

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

prepare_modules_state.rsSimplify carried up-to-date state +1/-4

Simplify carried up-to-date state

• Removes the old filtered-install carryover field in favor of validation records.

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

up_to_date.rsRecord fully validated up-to-date trees +28/-30

Record fully validated up-to-date trees

• Uses the shared writer to vouch for every project when the up-to-date install path has established the entire tree.

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

run.rsRemove timestamp freshness plumbing +0/-5

Remove timestamp freshness plumbing

• Drops the obsolete manifest-freshness option from install execution.

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

workspace_state.rsSeparate base state construction from proof recording +8/-3

Separate base state construction from proof recording

• Registers the shared writer and leaves filtered status and validation records for that writer to determine.

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

write.rsCentralize workspace-state writes +65/-0

Centralize workspace-state writes

• Builds state, retains established dedupe and dependency-group settings where applicable, and records projects each write vouches for.

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

manifest_source.rsRemove manifest mtime/content mode split +1/-18

Remove manifest mtime/content mode split

• Drops the freshness selector because both on-disk and in-memory manifests now use parsed content.

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

modules_dirs.rsLeave install proof to shared freshness logic +4/-87

Leave install proof to shared freshness logic

• Removes the separate selected-project current-lockfile check while retaining modules-directory checks and exposing project IDs for diagnostics.

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

settle.rsReport whether a wanted lockfile was restored +6/-4

Report whether a wanted lockfile was restored

• Returns a write indicator so freshness can refresh validation after regenerating a missing wanted lockfile.

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

timestamps.rsProvide nanosecond filesystem clock probes +12/-43

Provide nanosecond filesystem clock probes

• Adds nanosecond-resolution recording support and removes timestamp helpers formerly used to judge manifest drift.

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

install.rsRemove obsolete update freshness option +0/-1

Remove obsolete update freshness option

• Drops manifest-freshness selection from update-triggered installs.

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

Tests (32) +1367 / -374
main.rsRegister repeat-install oracle suite +1/-0

Register repeat-install oracle suite

• Includes the new end-to-end oracle in the CLI test suite.

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

repeat_install_oracle.rsCompare both gates against real installs +794/-0

Compare both gates against real installs

• Adds scenarios across linkers, lockfile layouts, and injected packages. It compares fast paths with full installs and run gates with clean-copy installs, including filtered edits and preserved mtimes.

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

verify_deps_before_run.rsDistinguish unchanged and rewritten lockfiles +20/-13

Distinguish unchanged and rewritten lockfiles

• Expects no install for equivalent regenerated content and tests a subsequent lockfile rewrite.

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

tests.rsUpdate install test fixtures +1/-7

Update install test fixtures

• Aligns test fixtures with the new validation model and removes obsolete freshness inputs.

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

build_workspace_state_tests.rsAdapt workspace-state builder tests +1/-6

Adapt workspace-state builder tests

• Updates calls and expectations after filtered status moves into validation recording.

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

builds.rsSimplify build test install inputs +0/-1

Simplify build test install inputs

• Removes the obsolete manifest-freshness policy field.

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

external_importers.rsSimplify external-importer test inputs +0/-1

Simplify external-importer test inputs

• Removes the obsolete manifest-freshness policy field.

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

fresh_outputs.rsAdapt fresh-output test fixtures +0/-5

Adapt fresh-output test fixtures

• Removes obsolete freshness-mode settings from install cases.

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

frozen_dispatch.rsAdapt frozen-dispatch test fixtures +1/-10

Adapt frozen-dispatch test fixtures

• Updates the workspace-state builder import and removes obsolete freshness-mode settings.

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

frozen_freshness.rsSimplify frozen-freshness test inputs +0/-9

Simplify frozen-freshness test inputs

• Removes the former manifest-freshness field from frozen install cases.

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

frozen_optional.rsSimplify frozen-optional test inputs +0/-8

Simplify frozen-optional test inputs

• Removes the former manifest-freshness field from optional-dependency cases.

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

frozen_policy.rsAdapt frozen-policy test inputs +1/-5

Adapt frozen-policy test inputs

• Updates test policy construction after removal of the manifest-freshness option.

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

install_outputs.rsSimplify install-output test inputs +0/-7

Simplify install-output test inputs

• Removes the obsolete manifest-freshness option from install cases.

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

lockfile_recovery.rsAdapt lockfile-recovery state fixtures +2/-5

Adapt lockfile-recovery state fixtures

• Adds the optional validation field to constructed state and removes obsolete install freshness settings.

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

lockfile_writes.rsSimplify lockfile-write test inputs +0/-9

Simplify lockfile-write test inputs

• Removes the obsolete manifest-freshness option from install policies.

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

modules_dir_disabled.rsSimplify disabled-modules test input +0/-1

Simplify disabled-modules test input

• Removes the obsolete manifest-freshness option.

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

repeat_install.rsSeed proof records in repeat-install tests +77/-51

Seed proof records in repeat-install tests

• Constructs validation records for fast-path fixtures and tests a manifest content edit rather than an mtime-only change.

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

reporting.rsSimplify reporting test inputs +0/-5

Simplify reporting test inputs

• Removes obsolete manifest-freshness settings.

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

resolution.rsSimplify resolution test inputs +0/-8

Simplify resolution test inputs

• Removes obsolete manifest-freshness settings.

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

runtimes.rsSimplify runtime install test inputs +0/-6

Simplify runtime install test inputs

• Removes obsolete manifest-freshness settings.

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

store.rsSimplify store test inputs +0/-3

Simplify store test inputs

• Removes obsolete manifest-freshness settings.

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

workspace.rsSimplify workspace install test inputs +0/-5

Simplify workspace install test inputs

• Removes obsolete manifest-freshness settings.

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

tests.rsSeed realistic validation in gate fixtures +154/-80

Seed realistic validation in gate fixtures

• Adds helpers for installed and filtered project proofs and adjusts expectations to content-based checks and converged state writes.

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

auto_dedupe.rsAdapt auto-dedupe gate tests +2/-2

Adapt auto-dedupe gate tests

• Updates assertions and fixtures for the shared validation-writing path.

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

builds.rsTest patch edits that preserve mtime +7/-27

Test patch edits that preserve mtime

• Expects the run gate to reject changed patch content despite a restored mtime and removes an obsolete ignored-settings check.

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

in_memory_manifests.rsTest content checks for supplied manifests +12/-59

Test content checks for supplied manifests

• Removes comparisons with the former mtime mode and verifies missing on-disk files and in-memory edits through the unified content check.

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

injected.rsRecord injected sibling’s installed manifest +13/-3

Record injected sibling’s installed manifest

• Seeds the content actually installed for an injected workspace sibling before checking changed in-memory manifests.

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

installation.rsDistinguish changed from unchanged manifest rewrites +30/-7

Distinguish changed from unchanged manifest rewrites

• Tests that changed manifest content defeats the shortcut while rewriting identical content does not.

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

lockfile.rsCover preserved-mtime and racy lockfile changes +84/-12

Cover preserved-mtime and racy lockfile changes

• Adds checks for size-and-mtime-preserving edits and files recorded in the same filesystem tick, and updates convergence assertions.

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

validation.rsUnit-test digests and per-project carryover +146/-0

Unit-test digests and per-project carryover

• Checks canonical manifest hashing, trusted versus racy file signatures, prior lockfile proofs, and filtered carryover across shared-input changes.

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

workspace.rsAdapt workspace proof and scope cases +17/-19

Adapt workspace proof and scope cases

• Updates workspace gate cases to the per-project validation and filtered-install model.

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

tests.rsAdapt workspace-state serialization fixtures +4/-0

Adapt workspace-state serialization fixtures

• Includes the optional validation field in existing serialization and update tests.

pnpm/crates/workspace-state/src/tests.rs

Documentation (5) +25 / -0
repeat-filtered-install-fast-path.mdAnnounce filtered repeat-install fast paths +5/-0

Announce filtered repeat-install fast paths

• Records the patch release note for repeated filtered installs and full installs after filtered commands cover every project.

.changeset/repeat-filtered-install-fast-path.md

repeat-install-content-digests.mdAnnounce content-based freshness fixes +7/-0

Announce content-based freshness fixes

• Describes preserved-mtime edit detection and stale projects left out of filtered installs.

.changeset/repeat-install-content-digests.md

verify-deps-gates-converge.mdAnnounce run-gate convergence fixes +9/-0

Announce run-gate convergence fixes

• Documents rootless-workspace, dedicated-lockfile dependency selection, and post-install warning fixes.

.changeset/verify-deps-gates-converge.md

build.mdDocument filtered pre-run verification scope +2/-0

Document filtered pre-run verification scope

• Explains that a filtered run checks selected projects and their workspace dependencies.

pnpm/docs/settings/build.md

other.mdDocument content-based repeat-install checks +2/-0

Document content-based repeat-install checks

• Explains preserved-mtime edit detection and the scope of filtered install checks.

pnpm/docs/settings/other.md

Other (1) +1 / -1
Cargo.tomlMake SHA-256 hashing a runtime dependency +1/-1

Make SHA-256 hashing a runtime dependency

• Moves sha2 from development dependencies to regular dependencies for manifest digests.

pnpm/crates/package-manager/Cargo.toml

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Filtered runs reparse the lockfile ✓ Resolved
Description
reached_importers loads the current lockfile to calculate a filtered selection when the wanted
lockfile is absent, but it does not pass that parsed lockfile to the subsequent checks. If a project
is unproven, the manifest check loads the same file again, and the run gate's stand-in check can
load it a third time before the command proceeds.
Code

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs[R225-227]

+            current =
+                Lockfile::load_current_from_install_state_dir(&check.config.install_state_dir)
+                    .ok()??;
Relevance

●●● Strong

Recent reviews accept avoiding repeated lockfile loads and explicitly request reusing already parsed
lockfiles.

PR-#16992
PR-#17025

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new reachability fallback parses the current lockfile, while the later manifest and run-gate
paths independently load that same file. These loads occur in one filtered freshness check when the
wanted lockfile is absent and a project needs checking.

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs[213-232]
pnpm/crates/package-manager/src/optimistic_repeat_install/manifest_agreement.rs[69-85]
pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs[218-232]

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

## Issue description
Filtered checks can parse the entire current lockfile multiple times when the wanted lockfile is missing.

## Fix Focus Areas
- pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs[221-232]
- pnpm/crates/package-manager/src/optimistic_repeat_install/manifest_agreement.rs[69-85]
- pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs[218-232]

## Recommended Fix
Load the current lockfile once per freshness check and share the parsed value with reachability, manifest agreement, and the missing-wanted-lockfile stand-in check.

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


2. Windows misses edits that restore file times ✓ Resolved
Description
FileDigests::of reuses the recorded digest whenever FileStat::matches sees the same mtime, ctime
and size. On non-Unix targets ctime_ns is always None, so only mtime and size are compared. On
Windows, a lockfile, pnpmfile or patch file rewritten with the same byte length and a restored mtime
(robocopy /COPY:T, archive extraction, touch -r) keeps its old digest. The install fast path and
the verifyDepsBeforeRun gate then report up to date, which the changeset says can no longer
happen.
Code

pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[R244-247]

+#[cfg(not(unix))]
+fn ctime_ns(_metadata: &fs::Metadata) -> Option<i64> {
+    None
+}
Relevance

●●● Strong

Recent accepted reviews prioritize detecting content changes that preserve mtimes, supporting this
cross-platform correctness gap.

PR-#14515
PR-#13916

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
On a stat match, of returns the recorded signature without reading the file (lines 128-132).
matches compares only mtime, ctime and size (224-228), and the non-Unix ctime_ns returns None
(244-247), so on Windows the inode-change-time guard is gone. Trust then depends only on the old
mtime being earlier than recorded_at_ns (191-195), and a restored mtime still is. The changeset
says edits that keep the modification time are now noticed, with no platform caveat.

pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[118-146]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[191-247]
.changeset/repeat-install-content-digests.md[1-7]

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

## Issue description
On non-Unix platforms `FileStat` has no change time (`ctime_ns` is `None`), so a file whose mtime and size were restored after an edit still matches its recorded signature. `FileDigests::of` then reuses the stale digest, and the lockfile, pnpmfile or patch edit goes unnoticed.

## Fix Focus Areas
- pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[118-158]
- pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[191-247]

## Recommended Fix
When the signature has no `ctime_ns`, treat it as untrusted in `recorded_signature`/`signature_trusted`, so the file is hashed again every time. This is cheap for patches and pnpmfiles. For the lockfile, if hashing it on every run costs too much, use the Windows change time from `GetFileInformationByHandleEx(FileBasicInfo).ChangeTime` instead. If neither is done, state the platform limit in the changeset and docs.

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


3. Validation comments describe old behavior ✓ Resolved
Description
The WorkspaceState::validation documentation explains the field by describing what pnpm v11 did
not read or write and what a state it wrote contained. Because this is migration history rather than
the current field contract, later readers must parse historical implementation details to understand
the active behavior.
Code

pnpm/crates/workspace-state/src/lib.rs[R87-88]

+    /// What the last validation proved about each project. pnpm v11 neither
+    /// reads nor writes it, so a state it wrote has none.
Relevance

●●● Strong

Recent reviews accepted rewriting comments from historical implementation narratives toward current
behavioral contracts.

PR-#14148

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed comments explicitly refer to pnpm v11's past state-writing behavior and use that
historical implementation to explain the new field. The same historical framing is repeated in the
new oracle test documentation, which confirms this is an added commenting pattern rather than
pre-existing context.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/workspace-state/src/lib.rs[87-90]
pnpm/crates/cli/tests/suite/repeat_install_oracle.rs[192-192]

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

## Issue description
The validation-field comments describe pnpm v11's historical read and write behavior instead of documenting the current contract.

## Fix Focus Areas
- pnpm/crates/workspace-state/src/lib.rs[87-90]
- pnpm/crates/cli/tests/suite/repeat_install_oracle.rs[192-192]
- pnpm/crates/cli/tests/suite/repeat_install_oracle.rs[682-684]

## Recommended Fix
Rewrite the comments to describe the current compatibility invariant directly, such as that validation is optional for backward-compatible state files and that absent records require validation before a fast path can be trusted. Move version-history and migration rationale to release or design documentation rather than inline source comments.

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



Informational

4. Release notes obscure the prior reinstall behavior 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The first sentence of the changeset combines the new up-to-date behavior with the prior
repeated-install behavior instead of stating the prior behavior in its own past-tense sentence.
Because the entry documents a bug fix for rootless workspaces, readers must infer the historical
behavior from “no longer” rather than seeing a separate account of what happened before.
Code

.changeset/verify-deps-gates-converge.md[5]

+In a workspace that has no `package.json` at its root, `pnpm run` and `pnpm exec` no longer reinstall before every command when the dependencies are up to date.
Relevance

● Weak

Recent changeset reviews rejected equivalent requests to split “no longer” behavior into separate
past-tense sentences.

PR-#16992
PR-#16977
PR-#16996

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changeset describes a bug fix using “no longer reinstall,” which mentions the previous behavior
in the same sentence as the new behavior rather than in a separate past-tense sentence.

Rule 3058498: Describe previous buggy behavior in a separate past-tense sentence
.changeset/verify-deps-gates-converge.md[5-5]

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

## Issue description
The first changeset sentence uses “no longer reinstall” to combine the previous buggy behavior with the corrected behavior, which does not meet the release-note convention for describing prior behavior separately.

## Fix Focus Areas
- .changeset/verify-deps-gates-converge.md[5-5]

## Recommended Fix
Rewrite the entry with a separate past-tense sentence describing that `pnpm run` and `pnpm exec` previously reinstalled before every command in rootless workspaces, followed by a sentence stating that they now skip the reinstall when dependencies are up to date.

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

Dismiss ↗ | View ↗


5. Content hashing lacks performance evidence 📜 Skill insight ➹ Performance
Description
FileDigests::of falls back to hashing complete lockfiles and patch files, while manifest_digest
hashes every parsed project manifest on freshness checks. Whenever cached file signatures cannot be
trusted, these reads run in install and pre-run paths, yet the PR supplies no before/after timing or
benchmark results for the added work.
Code

pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[R128-145]

+        if let Some(recorded) = self.recorded_signature(path)
+            && stat.matches(recorded)
+        {
+            return FileDigest::Present(recorded.clone());
+        }
+        match pnpm_crypto_hash::create_hex_hash_from_file(path) {
+            Ok(mut digest) => {
+                digest.truncate(DIGEST_LEN);
+                FileDigest::Present(FileSignature {
+                    mtime_ns: stat.mtime_ns,
+                    ctime_ns: stat.ctime_ns,
+                    size: stat.size,
+                    digest,
+                })
+            }
+            Err(error) if error.kind() == io::ErrorKind::NotFound => FileDigest::Absent,
+            Err(_) => FileDigest::Unreadable,
+        }
Relevance

● Weak

A recent performance review explicitly rejected requiring benchmarks when correctness tests covered
the optimization.

PR-#16488

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires quantitative before/after measurements when a PR claims a performance
improvement. The changeset promises that repeated installs finish without reinstalling, while the
new freshness implementation performs full-file hashing when signatures are not trusted; the added
tests verify correctness but contain no timing or benchmark measurements.

.changeset/repeat-filtered-install-fast-path.md[1-5]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[107-145]
pnpm/crates/package-manager/src/optimistic_repeat_install/tests/validation.rs[59-84]
Skill: review-code

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

## Issue description
The repeat-install and dependency-status paths now hash manifests, lockfiles, and patch files when recorded filesystem signatures cannot be trusted, but the PR provides no quantitative evidence for the performance impact.

## Fix Focus Areas
- pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[107-145]
- pnpm/crates/package-manager/src/optimistic_repeat_install/tests/validation.rs[59-84]

## Recommended Fix
Add benchmark coverage for cold and warm freshness checks using realistic workspace sizes and representative lockfiles and patch files. Report multiple before/after runs with variance, comparing the previous mtime-based behavior against the new digest-based behavior, and include the results in the PR description or benchmark artifacts.

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

Dismiss ↗ | View ↗


Grey Divider

Context sources
❌ Tickets: failed to load — Ticket collection could not establish complete evidence
✅ Compliance rules (platform): 66 rules
✅ Cross-repo context — repo relationships
  Explored: repo: pnpm/update (sha: 2457663d) — View relationship
  Explored: repo: pnpm/setup (sha: a0881977) — View relationship
  Explored: repo: pnpm/exec (sha: d9dca8d2) — View relationship
Review mode: Auto: ⚖️ Balanced: Core install-freshness logic has broad correctness impact despite localized changes.

Grey Divider

Tip of the day
💡 Did you know, you can see how risky a PR is at a glance with blast radius labels

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 2c0ace0 ⚖️ Balanced

Results up to commit da1b80d 🧠 Deep


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


Remediation recommended
1. Filtered runs reparse the lockfile ✓ Resolved
Description
reached_importers loads the current lockfile to calculate a filtered selection when the wanted
lockfile is absent, but it does not pass that parsed lockfile to the subsequent checks. If a project
is unproven, the manifest check loads the same file again, and the run gate's stand-in check can
load it a third time before the command proceeds.
Code

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs[R225-227]

+            current =
+                Lockfile::load_current_from_install_state_dir(&check.config.install_state_dir)
+                    .ok()??;
Relevance

●●● Strong

Recent reviews accept avoiding repeated lockfile loads and explicitly request reusing already parsed
lockfiles.

PR-#16992
PR-#17025

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new reachability fallback parses the current lockfile, while the later manifest and run-gate
paths independently load that same file. These loads occur in one filtered freshness check when the
wanted lockfile is absent and a project needs checking.

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs[213-232]
pnpm/crates/package-manager/src/optimistic_repeat_install/manifest_agreement.rs[69-85]
pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs[218-232]

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

## Issue description
Filtered checks can parse the entire current lockfile multiple times when the wanted lockfile is missing.

## Fix Focus Areas
- pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs[221-232]
- pnpm/crates/package-manager/src/optimistic_repeat_install/manifest_agreement.rs[69-85]
- pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs[218-232]

## Recommended Fix
Load the current lockfile once per freshness check and share the parsed value with reachability, manifest agreement, and the missing-wanted-lockfile stand-in check.

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


2. Windows misses edits that restore file times ✓ Resolved
Description
FileDigests::of reuses the recorded digest whenever FileStat::matches sees the same mtime, ctime
and size. On non-Unix targets ctime_ns is always None, so only mtime and size are compared. On
Windows, a lockfile, pnpmfile or patch file rewritten with the same byte length and a restored mtime
(robocopy /COPY:T, archive extraction, touch -r) keeps its old digest. The install fast path and
the verifyDepsBeforeRun gate then report up to date, which the changeset says can no longer
happen.
Code

pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[R244-247]

+#[cfg(not(unix))]
+fn ctime_ns(_metadata: &fs::Metadata) -> Option<i64> {
+    None
+}
Relevance

●●● Strong

Recent accepted reviews prioritize detecting content changes that preserve mtimes, supporting this
cross-platform correctness gap.

PR-#14515
PR-#13916

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
On a stat match, of returns the recorded signature without reading the file (lines 128-132).
matches compares only mtime, ctime and size (224-228), and the non-Unix ctime_ns returns None
(244-247), so on Windows the inode-change-time guard is gone. Trust then depends only on the old
mtime being earlier than recorded_at_ns (191-195), and a restored mtime still is. The changeset
says edits that keep the modification time are now noticed, with no platform caveat.

pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[118-146]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[191-247]
.changeset/repeat-install-content-digests.md[1-7]

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

## Issue description
On non-Unix platforms `FileStat` has no change time (`ctime_ns` is `None`), so a file whose mtime and size were restored after an edit still matches its recorded signature. `FileDigests::of` then reuses the stale digest, and the lockfile, pnpmfile or patch edit goes unnoticed.

## Fix Focus Areas
- pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[118-158]
- pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[191-247]

## Recommended Fix
When the signature has no `ctime_ns`, treat it as untrusted in `recorded_signature`/`signature_trusted`, so the file is hashed again every time. This is cheap for patches and pnpmfiles. For the lockfile, if hashing it on every run costs too much, use the Windows change time from `GetFileInformationByHandleEx(FileBasicInfo).ChangeTime` instead. If neither is done, state the platform limit in the changeset and docs.

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


3. Validation comments describe old behavior ✓ Resolved
Description
The WorkspaceState::validation documentation explains the field by describing what pnpm v11 did
not read or write and what a state it wrote contained. Because this is migration history rather than
the current field contract, later readers must parse historical implementation details to understand
the active behavior.
Code

pnpm/crates/workspace-state/src/lib.rs[R87-88]

+    /// What the last validation proved about each project. pnpm v11 neither
+    /// reads nor writes it, so a state it wrote has none.
Relevance

●●● Strong

Recent reviews accepted rewriting comments from historical implementation narratives toward current
behavioral contracts.

PR-#14148

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed comments explicitly refer to pnpm v11's past state-writing behavior and use that
historical implementation to explain the new field. The same historical framing is repeated in the
new oracle test documentation, which confirms this is an added commenting pattern rather than
pre-existing context.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/workspace-state/src/lib.rs[87-90]
pnpm/crates/cli/tests/suite/repeat_install_oracle.rs[192-192]

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

## Issue description
The validation-field comments describe pnpm v11's historical read and write behavior instead of documenting the current contract.

## Fix Focus Areas
- pnpm/crates/workspace-state/src/lib.rs[87-90]
- pnpm/crates/cli/tests/suite/repeat_install_oracle.rs[192-192]
- pnpm/crates/cli/tests/suite/repeat_install_oracle.rs[682-684]

## Recommended Fix
Rewrite the comments to describe the current compatibility invariant directly, such as that validation is optional for backward-compatible state files and that absent records require validation before a fast path can be trusted. Move version-history and migration rationale to release or design documentation rather than inline source comments.

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



Informational
4. Content hashing lacks performance evidence 📜 Skill insight ➹ Performance
Description
FileDigests::of falls back to hashing complete lockfiles and patch files, while manifest_digest
hashes every parsed project manifest on freshness checks. Whenever cached file signatures cannot be
trusted, these reads run in install and pre-run paths, yet the PR supplies no before/after timing or
benchmark results for the added work.
Code

pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[R128-145]

+        if let Some(recorded) = self.recorded_signature(path)
+            && stat.matches(recorded)
+        {
+            return FileDigest::Present(recorded.clone());
+        }
+        match pnpm_crypto_hash::create_hex_hash_from_file(path) {
+            Ok(mut digest) => {
+                digest.truncate(DIGEST_LEN);
+                FileDigest::Present(FileSignature {
+                    mtime_ns: stat.mtime_ns,
+                    ctime_ns: stat.ctime_ns,
+                    size: stat.size,
+                    digest,
+                })
+            }
+            Err(error) if error.kind() == io::ErrorKind::NotFound => FileDigest::Absent,
+            Err(_) => FileDigest::Unreadable,
+        }
Relevance

● Weak

A recent performance review explicitly rejected requiring benchmarks when correctness tests covered
the optimization.

PR-#16488

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires quantitative before/after measurements when a PR claims a performance
improvement. The changeset promises that repeated installs finish without reinstalling, while the
new freshness implementation performs full-file hashing when signatures are not trusted; the added
tests verify correctness but contain no timing or benchmark measurements.

.changeset/repeat-filtered-install-fast-path.md[1-5]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[107-145]
pnpm/crates/package-manager/src/optimistic_repeat_install/tests/validation.rs[59-84]
Skill: review-code

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

## Issue description
The repeat-install and dependency-status paths now hash manifests, lockfiles, and patch files when recorded filesystem signatures cannot be trusted, but the PR provides no quantitative evidence for the performance impact.

## Fix Focus Areas
- pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs[107-145]
- pnpm/crates/package-manager/src/optimistic_repeat_install/tests/validation.rs[59-84]

## Recommended Fix
Add benchmark coverage for cold and warm freshness checks using realistic workspace sizes and representative lockfiles and patch files. Report multiple before/after runs with variance, comparing the previous mtime-based behavior against the new digest-based behavior, and include the results in the PR description or benchmark artifacts.

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

Dismiss ↗ | View ↗


Results up to commit 51f2516 🧠 Deep


No changes from previous review

Results up to commit 79cdfc8 ⚖️ Balanced


No changes from previous review

Grey Divider

Qodo Logo

@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to 2c0ace0

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Skip regeneration without a current lockfile

Remove the .ok_or(...) call to gracefully handle an absent current lockfile by
returning Ok(false) instead of throwing an error.

pnpm/crates/package-manager/src/optimistic_repeat_install/settle.rs [31-33]

-let Some(current) = current.get().ok_or("the current lockfile cannot be loaded")? else {
+let Some(current) = current.get() else {
     return Ok(false);
 };

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 10

__

Why: The suggestion accurately identifies and fixes a logical regression (and likely compile error) that would incorrectly return an error for dependency-less projects instead of skipping them.

High
Preserve installed-project scope after moves

Use drift.proven_dirs(&[]) instead of vouching for all projects to prevent
uninstalled projects from being marked as installed after a tree move.

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs [206-210]

-let every_project = drift.stats
-    .iter()
-    .map(|stat| stat.root_dir.to_path_buf())
-    .collect();
-record_state_at(check, state, &every_project, policy, filesystem_now);
+let vouched = drift.proven_dirs(&[]);
+record_state_at(check, state, &vouched, policy, filesystem_now);

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a logic bug where every_project incorrectly marks uninstalled projects as installed after a tree move, and provides the right fix using drift.proven_dirs.

High
Rehash files without change time

Force rehashing of files when ctime_ns is unavailable to guarantee detection of
mtime-preserving edits.

pnpm/crates/package-manager/src/optimistic_repeat_install/validation.rs [191-195]

 fn signature_trusted(signature: &FileSignature, recorded_at_ns: i64) -> bool {
-    let changed_ns = last_change_ns(signature.mtime_ns, signature.ctime_ns);
+    let Some(ctime_ns) = signature.ctime_ns else {
+        return false;
+    };
+    let changed_ns = signature.mtime_ns.max(ctime_ns);
     let window = if changed_ns % 1_000_000_000 == 0 { WHOLE_SECOND_GRANULARITY_NS } else { 0 };
     changed_ns.saturating_add(window) < recorded_at_ns
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 2

__

Why: While technically accurate about potentially missing mtime-preserving edits, returning false when ctime_ns is unavailable contradicts the author's explicit fallback logic and would severely degrade performance by completely disabling the cache on platforms where ctime cannot be read.

Low
  • Update

Previous suggestions

Suggestions up to commit 79cdfc8
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve installation proof across moves

Preserve per-project proofs after a workspace move instead of vouching for all
projects.

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs [206-210]

-let every_project = drift.stats
-    .iter()
-    .map(|stat| stat.root_dir.to_path_buf())
-    .collect();
-record_state_at(check, state, &every_project, policy, filesystem_now);
+let vouched = drift.proven_dirs(&[]);
+record_state_at(check, state, &vouched, policy, filesystem_now);
Suggestion importance[1-10]: 9

__

Why: This fixes a critical logic flaw where omitted projects could incorrectly pass the run gate after a workspace move, by properly preserving the prior per-project installation proofs.

High
Reject unrecorded pnpmfile content

Do not use mtime fallback for missing pnpmfile signatures if the state contains
validation records.

pnpm/crates/package-manager/src/optimistic_repeat_install.rs [448-455]

-// A state without validation records has no digests.
+if recorded.is_some() {
+    return Some(modified());
+}
 let mtime = file_mtime(Path::new(path)).map_or_else(|| Err(removed()), Ok);
 return match mtime {
     Err(removed) => Some(removed),
     Ok(mtime) => {
         modified_at_or_after(mtime, state.last_validated_timestamp).then(modified)
     }
 };
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a flaw where new validation states could fallback to legacy mtime-based checks for missing pnpmfiles, potentially bypassing validation.

High
Reject unrecorded patch content

Only use the mtime fallback for patch files when dealing with legacy states
lacking validation records.

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs [176-182]

-// A state without validation records has no digests, and its
-// timestamp is the only evidence there is. A patch added since changed
-// `patchedDependencies`, which the settings comparison catches.
+// Only a state without validation records can fall back to
+// its timestamp; otherwise this patch was not proven.
 (FileDigest::Present(_), None) => {
-    drift.modified |=
-        super::super::patch_modified_since(&patch, state.last_validated_timestamp);
+    drift.modified |= state.validation.is_some()
+        || super::super::patch_modified_since(
+            &patch,
+            state.last_validated_timestamp,
+        );
 }
Suggestion importance[1-10]: 9

__

Why: It fixes a correctness bug by ensuring that unrecorded patches in a modern validation state are treated as modified rather than relying on legacy mtime fallback.

High
General
Compare installed dev dependencies

Check dev dependencies in the run-gate oracle when applicable.

pnpm/crates/cli/tests/suite/repeat_install_oracle.rs [276]

-(Self::tree(workspace, selection, false), self.importers(workspace, selection))
+(
+    Self::tree(workspace, selection, !self.recorded_production_only()),
+    self.importers(workspace, selection),
+)
Suggestion importance[1-10]: 7

__

Why: Including dev dependencies in the test oracle's comparison prevents false positives where missing dev dependencies could go unnoticed.

Medium
Suggestions up to commit 51f2516
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve proof across workspace moves

Replace the collection of all drift.stats with drift.proven_dirs(&[]) to
correctly carry forward only the projects that the validation actually proves.

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs [206-210]

-let every_project = drift.stats
-    .iter()
-    .map(|stat| stat.root_dir.to_path_buf())
-    .collect();
-record_state_at(check, state, &every_project, policy, filesystem_now);
+let vouched = drift.proven_dirs(&[]);
+record_state_at(check, state, &vouched, policy, filesystem_now);
Suggestion importance[1-10]: 8

__

Why: It prevents a logical bug where uninstalled projects in a filtered install could be incorrectly marked as vouched after a workspace move, preserving accuracy in subsequent gates.

Medium
Reject unrecorded pnpmfile content

Return a modification error instead of falling back to the mtime check if a
pnpmfile is missing from the validation records.

pnpm/crates/package-manager/src/optimistic_repeat_install.rs [448-449]

+if recorded.is_some() {
+    return Some(modified());
+}
 // A state without validation records has no digests.
 let mtime = file_mtime(Path::new(path)).map_or_else(|| Err(removed()), Ok);
Suggestion importance[1-10]: 7

__

Why: It correctly identifies an edge case where a newly readable pnpmfile with an old mtime could incorrectly bypass the fast path if it was absent or unreadable during the previous install.

Medium
Reject unrecorded patch content

Consider a patch file modified if it is missing from the validation records,
rather than relying solely on its mtime.

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs [179-182]

 (FileDigest::Present(_), None) => {
-    drift.modified |=
-        super::super::patch_modified_since(&patch, state.last_validated_timestamp);
+    drift.modified |= state.validation.is_some()
+        || super::super::patch_modified_since(
+            &patch,
+            state.last_validated_timestamp,
+        );
 }
Suggestion importance[1-10]: 7

__

Why: It effectively fixes a potential correctness issue where a restored patch file with a backdated mtime might fail to trigger a required install.

Medium
Suggestions up to commit da1b80d
CategorySuggestion                                                                                                                                    Impact
Possible issue
Record state after restoring the missing lockfile

Capture the boolean returned by settle_missing_wanted_lockfile and use it in the
condition to ensure the workspace state is recorded when a missing lockfile is
restored.

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs [139-148]

 let loaded_current = if held.is_empty() {
     None
 } else {
     held_projects_match_lockfile(check, state, &held, policy.dedupe_peers)?
 };
-settle_missing_wanted_lockfile(check, policy, loaded_current)?;
-if drift.lockfile_unchanged() {
+let restored = settle_missing_wanted_lockfile(check, policy, loaded_current)?;
+if restored || drift.lockfile_unchanged() {
     let vouched = drift.proven_dirs(&held);
     record_state_at(check, state, &vouched, policy, filesystem_now);
 }
Suggestion importance[1-10]: 8

__

Why: The PR modifies settle_missing_wanted_lockfile to return a boolean indicating if it restored the lockfile, but ignores this return value in check_freshness. Using this value is critical to correctly update the workspace state when a missing lockfile is restored.

Medium

…heck

The stand-in check, the restore of a missing wanted lockfile, the patch
hash comparison, the manifest check, and the selection's reachability
each loaded node_modules/.pnpm/lock.yaml again when the wanted lockfile
was missing, as with lockfile: false. They now share one lazily loaded
copy carried by InputDrift.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 17, 2026 13:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@zkochan
zkochan merged commit 1124edb into main Oct 17, 2026
35 of 36 checks passed
@zkochan
zkochan deleted the refactor/repeat-install-state branch October 17, 2026 13:26
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 2c0ace0

zkochan added a commit that referenced this pull request Oct 29, 2026
…s in the repeat-install check (#17471)

The workspace state's validation records a digest of each project manifest,
and the next run compares it with the manifest on disk. Since #17030
the install recorded the manifests after `packageExtensions` and the
pnpmfile's `readPackage` hook, so with any hook every project looked modified.
The content check then compared the raw manifest with an importer resolved
from the hooked one and failed whenever the hook rewrote a specifier, and the
full install recorded the hooked digests again.

The fix separates the two views:

- The state records only declared manifests (read from disk, or as a
  mutating command writes them). `DeclaredManifests` carries them to every
  state writer and to the check. Nothing converts a hooked slice into one,
  so a digest can no longer come from the wrong view.
- The content check, which compares a modified manifest with the lockfile,
  now reads it as the resolver does: `packageExtensions`, then the
  pnpmfile's `readPackage` through the install's `hook_one_manifest`, then
  the overrides. Comparing the raw manifest could also report a false "up
  to date", when the raw specifier equals the locked one but the hook
  rewrites it. The pnpmfile loads lazily, so the Node worker starts only
  when a manifest changed. The check is synchronous, so it blocks on the
  hooks with `block_in_place` on the multi-thread runtime, or on a runtime
  of its own outside one, and defers to the install on a current-thread
  runtime. `ManifestHooks::InMemory` carries a caller's in-memory hooks
  (deploy, pnpr lockfiles, the Node-API binding) to the check.

pnpm v11 clones each project manifest before hooking it, so it records the
declared ones. It already runs the hooks in its own content check
(#17148), so it is not affected.

Closes #17468
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