Skip to content

feat(install): decide a repeat install from the recorded manifests - #17637

Merged
zkochan merged 12 commits into
mainfrom
fast-path-project-manifest-paths
Nov 3, 2026
Merged

zkochan merged 12 commits into
mainfrom
fast-path-project-manifest-paths

Conversation

@zkochan

@zkochan zkochan commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Summary

Phase 2 of pnpm/tasks#256. A repeat pnpm install in an up-to-date workspace no longer reads the package.json of each project whose file did not change since the last install.

Listing projects without reading them. find_workspace_projects already walked the package patterns and grouped manifest paths by directory before parsing. That walk is now find_workspace_project_manifests, and discovery reads on top of it. For a <dir>/* pattern the walk lists every manifest basename without checking which exist, so a listed directory need not hold a project.

What a record keeps. A trace of the check found that phase 1's derived facts (#17625) did not cover everything the check reads on every run. It also stats every dependency alias for dangling links, classifies every spec for local file dependencies, and reads bin. Each validation.manifestFiles record now keeps the values the check reads:

  • name, version, and bin;
  • the prod, dev, and optional dependency maps;
  • the peer dependencies, with any URL specifier replaced by *;
  • each peer's optional flag from peerDependenciesMeta;
  • directories.bin and publishConfig.directory.

No other value enters the state. The phase 1 format never shipped in a release.

The shortcut. Before discovery, the CLI fast path lists the project directories and stats each one's first existing manifest. It then needs every project to have a record whose stat still matches and is trusted. When that holds, it runs the usual check on manifests rebuilt from the records, with their recorded digests. The active project's manifest, which the command read anyway, replaces its stand-in. Otherwise it falls back to the check on the files, as before. These cases fall back:

  • a project without a usable record;
  • a different first manifest file;
  • a changed or untrusted stat;
  • a check that would write, such as a state refresh, a held project, a move, or restoring pnpm-lock.yaml. The file check writes what stand-ins cannot derive.

After the install's check on the files, any missing, field-less, or stale record is refreshed, but only when the refreshed records will be usable. A state written by an older pnpm then gets records on its next install. The run gate does not refresh records.

The run gate (phase 3) and the full Install::run path still read every manifest.

Measured on release builds of the base and this branch, medians of 150 repeat pnpm install --offline runs on one machine:

  • one project with a pnpm-workspace.yaml: 5.1 ms on the base, 4.9 ms here;
  • 300 workspace projects: 8.7 ms on the base, 7.9 ms here, with system time going from 14.0 ms to 9.0 ms.

Squash Commit Body

The repeat-install fast path read and parsed every project manifest on
every run.

find_workspace_project_manifests returns the result of discovery's
directory walk without opening any manifest, and find_workspace_projects
now reads on top of it.

The workspace state records, with each manifest's stat, the values of
the top-level fields the check reads: name, version, the dependency
maps, peerDependenciesMeta, bin, directories, and publishConfig. These
replace the derived facts recorded before, which left out the
dependency aliases the link check stats, the specs the local file
dependency scan classifies, and the bin fields.

Before discovery reads anything, the CLI fast path lists the project
directories and stats each one's first existing manifest. When every
project has a record whose stat still matches and is trusted, it runs
the usual check on manifests rebuilt from the records, with their
recorded digests. The active project's manifest, which the command read
anyway, takes the place of its stand-in. A project without a usable
record, or a check that would write the state or the wanted lockfile,
sends the install to the check on the manifest files. That check
refreshes any missing or stale record, and reads the projects the
attempt listed instead of walking the workspace again.

Part of pnpm/tasks#256.

Checklist

  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

Tests:

  • Unit tests cover stand-in rebuilding and each refusal: a missing record, a record without fields, an untrusted stat, another manifest file, a rewritten manifest, and a same-size edit with its mtime restored.
  • CLI tests cover these cases, observed through the pacquet::install debug trace:
    • an unchanged workspace decided from the records;
    • an edited manifest read again;
    • a new project;
    • a removed workspace link caught by the stand-in check;
    • a state without records gets them from one check on the files.
  • The decided run never enters discovery's read span.
  • Disabling the stat comparison makes the unit test and the edited-manifest CLI test fail. Disabling the refresh makes the refresh test fail.

No docs: the state file is internal.


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

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Repeat installs in an up-to-date workspace can reuse trusted records for unchanged project manifests without rereading those files.
    • Install checks detect edited manifests and newly added projects, and read project files when records are missing or cannot be trusted.
  • Bug Fixes
    • Missing workspace dependency links are restored during install.
    • Run commands leave missing install records untouched; a subsequent install can create or refresh them.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The repeat-install fast path can reconstruct workspace project manifests from trusted validation records. Workspace discovery lists manifest candidates separately from reading them. Tests cover unchanged and changed manifests, new projects, missing dependency links, future-dated manifests, and record refresh behavior.

Changes: Repeat-install manifest records

Layer / File(s) Summary
List workspace manifest candidates
pnpm/crates/workspace/src/*, pnpm/crates/workspace/src/projects/*, pnpm/crates/package-manager/src/install/lifecycle.rs
Workspace discovery exposes ordered manifest candidates by project root without opening manifests. Tests cover candidate ordering, invalid manifests, and project directories without manifests.
Record and reconstruct manifest fields
pnpm/crates/workspace-state/src/lib.rs, pnpm/crates/package-manager/src/optimistic_repeat_install/validation/*, pnpm/crates/package-manager/src/optimistic_repeat_install/manifest_source.rs, pnpm/crates/package-manager/src/optimistic_repeat_install/manifest_agreement.rs
Validation records store selected manifest fields. Stand-ins rebuild manifests only when recorded data and file statistics match. Manifest agreement uses a recorded digest when available.
Check records in the install fast path
pnpm/crates/package-manager/src/install/workspace_state*, pnpm/crates/package-manager/src/optimistic_repeat_install/freshness*, pnpm/crates/package-manager/src/optimistic_repeat_install.rs
The fast path checks records before file-based project discovery. Freshness checks control stand-in writes and handle the configured policy when the wanted lockfile is missing.
Verify repeat-install behavior
pnpm/crates/cli/tests/suite/*, .changeset/repeat-install-skips-unchanged-manifests.md
CLI tests cover unchanged and edited manifests, newly added projects, missing dependency links, future-dated manifests, and record refresh behavior. The changeset describes the unchanged-manifest behavior.

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant FastPath as check_from_records
  participant Workspace as find_workspace_project_manifests
  participant Records as manifest_stand_ins
  participant Check as check_repeat_install
  FastPath->>Workspace: list project manifest candidates
  Workspace-->>FastPath: return candidate paths
  FastPath->>Records: rebuild projects from validation records
  Records-->>FastPath: return projects and recorded digests or no result
  FastPath->>Check: check repeat-install state using stand-ins
Loading

Possibly related PRs

  • pnpm/pnpm#17625: Records trusted manifest file statistics used to validate stand-ins.
  • pnpm/pnpm#17487: Detects missing workspace dependency links, which this change also checks before using the fast path.
  • pnpm/pnpm#17471: Introduces DeclaredManifests, whose contract this change extends with recorded digests and stand-ins.

Suggested labels: product: pacquet

Suggested reviewers: kairosci

Merge Risk: Minimal · previous review 4758c

No actionable merge-blocking risk was established from the supplied evidence.

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

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

Share
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between a4b7c3b and 4758c32.

Files selected for processing: 3
  • pnpm/crates/cli/tests/suite/repeat_install_records.rs
  • pnpm/crates/package-manager/src/optimistic_repeat_install/tests/validation.rs
  • pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files.rs

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

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     13.6±0.55ms    27.5 MB/sec    1.10     15.0±0.90ms    25.0 MB/sec
packument/parse                                  1.00     42.9±1.85µs  1546.4 MB/sec    1.01     43.5±1.64µs  1524.0 MB/sec
tarball/download_dependency                      1.00  939.6±134.91µs     4.5 MB/sec    1.00  944.2±160.19µs     4.5 MB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00   243.0±10.01ms 65.8 KElem/sec    1.00    242.5±9.01ms 66.0 KElem/sec
version_pick/repeated_ranges_file                1.00      4.5±0.03ms  7.0 KElem/sec    1.09      4.9±0.18ms  6.4 KElem/sec
version_pick/repeated_ranges_raw                 1.00      4.6±0.11ms  6.8 KElem/sec    1.09      5.0±0.10ms  6.2 KElem/sec
version_pick/wildcard_lowest                     1.00     37.7±0.41µs 25.9 KElem/sec    1.16     43.7±5.60µs 22.4 KElem/sec
workspace_resolution/hoist_heavy                 1.00    268.7±8.41ms        ? ?/sec    1.28    343.8±9.18ms        ? ?/sec
workspace_sort/chained_projects                  1.00     14.0±1.27ms        ? ?/sec    1.55     21.7±4.45ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.49123% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.81%. Comparing base (539052b) to head (d89a3db).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...istic_repeat_install/freshness/missing_lockfile.rs 67.85% 9 Missing ⚠️
...mistic_repeat_install/validation/manifest_files.rs 96.49% 4 Missing ⚠️
...eat_install/validation/manifest_files/stand_ins.rs 97.91% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17637      +/-   ##
==========================================
+ Coverage   92.80%   92.81%   +0.01%     
==========================================
  Files        2068     2073       +5     
  Lines      267047   267326     +279     
==========================================
+ Hits       247827   248129     +302     
+ Misses      19220    19197      -23     

☔ 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 Nov 3, 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 2467.02 ms 2566.47 ms 4.0% 123.35 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1425.47 ms 1497.55 ms 5.1% 71.27 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pacquet 238.70 ms 243.06 ms 1.8% 11.94 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 280.36 ms 266.60 ms -4.9% 14.02 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 15.11 ms 15.09 ms -0.1% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 16.02 ms 15.04 ms -6.1% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 15.04 ms 19.50 ms 29.7% 2.00 ms Inconclusive (overlapping samples)
isolated-repeat-install-cold-cache-hot-store pnpr 16.38 ms 18.68 ms 14.0% 2.00 ms Inconclusive (overlapping samples)
isolated-fresh-install-cold-cache-cold-store pacquet 2582.43 ms 2602.21 ms 0.8% 129.12 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1532.16 ms 1477.24 ms -3.6% 76.61 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 605.94 ms 639.87 ms 5.6% 30.30 ms Inconclusive (overlapping samples)
isolated-fresh-install-hot-cache-hot-store pnpr 438.44 ms 411.83 ms -6.1% 21.92 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1813.06 ms 1814.81 ms 0.1% 90.65 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 363.93 ms 374.30 ms 2.8% 18.20 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 407.37 ms 422.02 ms 3.6% 20.37 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 125.69 ms 121.02 ms -3.7% 6.28 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 285.20 ms 313.73 ms 10.0% 14.26 ms Inconclusive (overlapping samples)
isolated-linked-workspace-resolve-hot-cache-offline pacquet 96.97 ms 95.68 ms -1.3% 4.85 ms Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 116.75 ms 110.17 ms -5.6% 5.84 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4727.40 ms 4565.65 ms -3.4% 236.37 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3585.28 ms 3769.21 ms 5.1% 179.26 ms Inconclusive (overlapping samples)
gvs-fresh-restore-hot-cache-hot-store pacquet 193.49 ms 190.28 ms -1.7% 9.67 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 211.04 ms 247.72 ms 17.4% 10.55 ms Inconclusive (overlapping samples)
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1447.14 ms 1432.15 ms -1.0% 72.36 ms Within tolerance
cargo-repeat-install-hot-cache-hot-store pacquet 50.88 ms 46.54 ms -8.5% 2.54 ms Within tolerance

Same-run syscall check

Each install runs 2 more times per revision, untimed, under strace --follow-forks --summary-only. A file syscall regresses when HEAD's fewest calls exceed main's most by more than 2% of main or 50 calls, whichever is larger. mkdir and mkdirat count only the calls that created a directory, since concurrent installs fail a varying number with EEXIST. A syscall whose identical runs differ by more than that tolerance is reported unstable and not gated, unless HEAD's fewest calls also exceed main's most by more than the tolerance plus that difference. Each scenario lists its largest change relative to its tolerance and every row that is not within tolerance.

Scenario Engine Syscall main calls (max) HEAD calls (min) Change Tolerance Identical-run spread Result
isolated-fresh-restore-cold-cache-cold-store pacquet readlink 15304 15307 +0.0% 306 39 Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr chmod 265 266 +0.4% 50 0 Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet statx 164 165 +0.6% 50 0 Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr statx 164 165 +0.6% 50 0 Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet statx 164 165 +0.6% 50 0 Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr statx 164 165 +0.6% 50 0 Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet readlink 16881 16442 -2.6% 337 725 Unstable (identical runs differ by 725, not gated)
isolated-fresh-install-cold-cache-cold-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet openat 3177 3185 +0.3% 63 7 Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr access 8 8 +0.0% 50 0 Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet openat 673 674 +0.1% 50 0 Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr access 11 11 +0.0% 50 0 Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr symlink 1151 1152 +0.1% 50 9 Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet access 8 8 +0.0% 50 0 Within tolerance
cargo-repeat-install-hot-cache-hot-store pacquet statx 1503 1505 +0.1% 50 0 Within tolerance

Integrated-Benchmark Report (Linux)

Commit: d89a3db7d2ee

Compared against main at: 76138ff7c2fd

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

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

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.553 ± 0.143 2.390 2.846 1.79 ± 0.13
pacquet@main 2.470 ± 0.089 2.354 2.626 1.73 ± 0.10
pnpr@HEAD 1.490 ± 0.114 1.362 1.716 1.04 ± 0.09
pnpr@main 1.429 ± 0.061 1.320 1.513 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5531478933000002,
      "stddev": 0.14320239722609804,
      "median": 2.5664741727000004,
      "user": 2.55869928,
      "system": 1.97385584,
      "min": 2.3903898862000004,
      "max": 2.8459595752
    },
    {
      "command": "pacquet@main",
      "mean": 2.4702653117000004,
      "stddev": 0.08913674968523508,
      "median": 2.4670211212,
      "user": 2.2755667799999997,
      "system": 1.80977414,
      "min": 2.3538651012000003,
      "max": 2.6256107162
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4902341924,
      "stddev": 0.1144784413829981,
      "median": 1.4975531927,
      "user": 2.1563476799999997,
      "system": 1.7519946400000002,
      "min": 1.3621952492,
      "max": 1.7164141202
    },
    {
      "command": "pnpr@main",
      "mean": 1.429259989,
      "stddev": 0.061247716794466986,
      "median": 1.4254658317,
      "user": 2.0636617800000003,
      "system": 1.73642614,
      "min": 1.3200648532,
      "max": 1.5125685072
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 243.4 ± 5.3 234.4 252.5 1.03 ± 0.05
pacquet@main 236.4 ± 10.1 217.6 246.8 1.00
pnpr@HEAD 267.4 ± 6.2 256.0 280.7 1.13 ± 0.06
pnpr@main 285.5 ± 12.8 272.3 314.1 1.21 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24340673516,
      "stddev": 0.005345330906078554,
      "median": 0.24305865226,
      "user": 0.28498021999999995,
      "system": 0.58168322,
      "min": 0.23440795426,
      "max": 0.25253114026
    },
    {
      "command": "pacquet@main",
      "mean": 0.23639766946000002,
      "stddev": 0.010116906025511874,
      "median": 0.23870425476,
      "user": 0.26078902,
      "system": 0.59094402,
      "min": 0.21757292826,
      "max": 0.24683379826000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26741593826,
      "stddev": 0.006225239734829448,
      "median": 0.26659858976,
      "user": 0.31276741999999996,
      "system": 0.6222813199999999,
      "min": 0.25603886126000003,
      "max": 0.28074997026
    },
    {
      "command": "pnpr@main",
      "mean": 0.28554770466,
      "stddev": 0.01278215862055482,
      "median": 0.28036482476,
      "user": 0.31710101999999996,
      "system": 0.6675020199999999,
      "min": 0.27228339626,
      "max": 0.31413398226
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 15.4 ± 2.4 11.1 27.1 1.03 ± 0.21
pacquet@main 15.0 ± 2.0 10.4 20.9 1.00
pnpr@HEAD 15.4 ± 2.0 11.3 24.0 1.02 ± 0.19
pnpr@main 16.2 ± 2.5 11.4 25.1 1.08 ± 0.22
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.015442930043880594,
      "stddev": 0.002367307542682369,
      "median": 0.015089980820000001,
      "user": 0.008310457910447752,
      "system": 0.008436111641791045,
      "min": 0.011082908820000001,
      "max": 0.02710831382
    },
    {
      "command": "pacquet@main",
      "mean": 0.015041596479722218,
      "stddev": 0.0019843114732984246,
      "median": 0.015105424320000001,
      "user": 0.009015935833333337,
      "system": 0.0074149423611111105,
      "min": 0.010448427820000002,
      "max": 0.02094766082
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.015416068626249998,
      "stddev": 0.0020277789908527202,
      "median": 0.01503652982,
      "user": 0.008705796249999998,
      "system": 0.00800564775,
      "min": 0.011288818820000001,
      "max": 0.02397267182
    },
    {
      "command": "pnpr@main",
      "mean": 0.01623549432299402,
      "stddev": 0.002486979335229171,
      "median": 0.01601696982,
      "user": 0.009277818203592816,
      "system": 0.008032599401197603,
      "min": 0.01140014882,
      "max": 0.02514304282
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 19.6 ± 3.1 13.6 34.5 1.27 ± 0.32
pacquet@main 15.4 ± 3.0 10.2 24.0 1.00
pnpr@HEAD 18.8 ± 2.9 12.1 25.7 1.22 ± 0.30
pnpr@main 16.8 ± 2.6 11.5 27.8 1.09 ± 0.27
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.01964260490985916,
      "stddev": 0.0031150748391864137,
      "median": 0.019503736100000002,
      "user": 0.010488485352112682,
      "system": 0.01019250422535211,
      "min": 0.013640383600000002,
      "max": 0.0345225916
    },
    {
      "command": "pacquet@main",
      "mean": 0.015419076529203544,
      "stddev": 0.0030203103193519043,
      "median": 0.015035154600000001,
      "user": 0.009189184778761057,
      "system": 0.007351355752212389,
      "min": 0.010185322600000001,
      "max": 0.023995648600000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.01878107921538462,
      "stddev": 0.002870179257906505,
      "median": 0.0186778816,
      "user": 0.01063845230769231,
      "system": 0.009208142377622377,
      "min": 0.012111869600000002,
      "max": 0.025684159600000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.016758384811267617,
      "stddev": 0.0026173982909260267,
      "median": 0.0163789976,
      "user": 0.009548034647887324,
      "system": 0.008538886478873239,
      "min": 0.0114777216,
      "max": 0.0278331666
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.599 ± 0.026 2.540 2.623 1.71 ± 0.14
pacquet@main 2.586 ± 0.031 2.541 2.646 1.70 ± 0.14
pnpr@HEAD 1.520 ± 0.122 1.401 1.760 1.00
pnpr@main 1.559 ± 0.113 1.425 1.764 1.03 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.59863600178,
      "stddev": 0.026453588080257637,
      "median": 2.6022055435800002,
      "user": 2.7160728599999997,
      "system": 1.6646710800000002,
      "min": 2.5401694700800004,
      "max": 2.62336831608
    },
    {
      "command": "pacquet@main",
      "mean": 2.5860401649800004,
      "stddev": 0.03139146051533662,
      "median": 2.5824251835800003,
      "user": 2.5688323599999996,
      "system": 1.63329138,
      "min": 2.54127947108,
      "max": 2.64593404908
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.51976629128,
      "stddev": 0.12239258372928584,
      "median": 1.47724210558,
      "user": 2.08103296,
      "system": 1.4991109799999998,
      "min": 1.40078872808,
      "max": 1.7602185370799999
    },
    {
      "command": "pnpr@main",
      "mean": 1.55888393978,
      "stddev": 0.11254834660534732,
      "median": 1.53215828358,
      "user": 2.10736016,
      "system": 1.6021292800000002,
      "min": 1.42513043508,
      "max": 1.76368382608
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 637.8 ± 34.0 582.6 706.2 1.53 ± 0.14
pacquet@main 619.8 ± 38.0 565.7 682.1 1.48 ± 0.14
pnpr@HEAD 417.9 ± 29.9 372.8 481.1 1.00
pnpr@main 450.8 ± 73.0 373.5 592.7 1.08 ± 0.19
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6378464144,
      "stddev": 0.03402690421827446,
      "median": 0.6398659022000001,
      "user": 1.00775552,
      "system": 1.09910048,
      "min": 0.5825718572,
      "max": 0.7062057332000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.6197788822,
      "stddev": 0.03800820106040181,
      "median": 0.6059394757000001,
      "user": 0.9630083199999998,
      "system": 1.1106554800000004,
      "min": 0.5657028502000001,
      "max": 0.6821403662000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.41787505220000004,
      "stddev": 0.029901342421511733,
      "median": 0.41183071920000003,
      "user": 0.42241092,
      "system": 0.7325369799999999,
      "min": 0.37281139420000003,
      "max": 0.4810978772
    },
    {
      "command": "pnpr@main",
      "mean": 0.45077469290000005,
      "stddev": 0.07304032320783237,
      "median": 0.43844267820000005,
      "user": 0.45061582000000006,
      "system": 0.7963538800000001,
      "min": 0.37348852120000003,
      "max": 0.5926786052
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.811 ± 0.031 1.751 1.861 4.91 ± 0.22
pacquet@main 1.816 ± 0.040 1.764 1.873 4.92 ± 0.23
pnpr@HEAD 0.373 ± 0.018 0.342 0.400 1.01 ± 0.07
pnpr@main 0.369 ± 0.016 0.356 0.410 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8114372838599997,
      "stddev": 0.031038797437643147,
      "median": 1.81481097896,
      "user": 1.26545556,
      "system": 1.15535742,
      "min": 1.7509330234600002,
      "max": 1.8607473384600002
    },
    {
      "command": "pacquet@main",
      "mean": 1.81590792636,
      "stddev": 0.039559557061631015,
      "median": 1.8130625444600001,
      "user": 1.2700487599999999,
      "system": 1.1371718199999998,
      "min": 1.76357469046,
      "max": 1.87342705546
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.37331747766,
      "stddev": 0.018428213861079935,
      "median": 0.37429588346000003,
      "user": 0.36661906,
      "system": 0.70962372,
      "min": 0.34215455446000004,
      "max": 0.40037273646000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.36902030236000005,
      "stddev": 0.015514644745376567,
      "median": 0.36392819446,
      "user": 0.37096396,
      "system": 0.7119487199999999,
      "min": 0.35553976346000005,
      "max": 0.40995892846000004
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 419.3 ± 27.4 364.4 462.1 3.48 ± 0.31
pacquet@main 420.0 ± 37.1 386.2 497.2 3.49 ± 0.38
pnpr@HEAD 120.5 ± 7.4 109.6 134.1 1.00
pnpr@main 125.0 ± 7.3 107.8 135.9 1.04 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.4192620638000001,
      "stddev": 0.027372786027918598,
      "median": 0.42202106110000004,
      "user": 0.43322794,
      "system": 0.5740597399999999,
      "min": 0.36444985710000005,
      "max": 0.46211220210000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.42001262720000004,
      "stddev": 0.03707810169578007,
      "median": 0.4073683991,
      "user": 0.43268233999999994,
      "system": 0.59137274,
      "min": 0.3862154621,
      "max": 0.49715929010000004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.12046899071538462,
      "stddev": 0.007419357138976967,
      "median": 0.1210162696,
      "user": 0.05599030153846153,
      "system": 0.04464204769230768,
      "min": 0.10957339410000001,
      "max": 0.1340553761
    },
    {
      "command": "pnpr@main",
      "mean": 0.1249892076652174,
      "stddev": 0.0073413288329810394,
      "median": 0.1256940501,
      "user": 0.06363894869565216,
      "system": 0.04363321826086958,
      "min": 0.10782719610000001,
      "max": 0.1359294781
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 334.5 ± 46.5 282.8 435.4 1.15 ± 0.19
pacquet@main 290.8 ± 24.2 258.3 329.0 1.00
pnpm@HEAD 6447.7 ± 894.3 5467.9 7758.4 22.17 ± 3.59
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3345348350511111,
      "stddev": 0.046542391517769774,
      "median": 0.31372910494,
      "user": 0.3754722111111111,
      "system": 0.09314371999999999,
      "min": 0.28279929494,
      "max": 0.43536395294
    },
    {
      "command": "pacquet@main",
      "mean": 0.2908313367177778,
      "stddev": 0.024245881315954024,
      "median": 0.28520039494,
      "user": 0.32139843333333334,
      "system": 0.08782160888888887,
      "min": 0.25825482794,
      "max": 0.32901597694
    },
    {
      "command": "pnpm@HEAD",
      "mean": 6.447707605273333,
      "stddev": 0.8942506214481148,
      "median": 6.11568124494,
      "user": 10.160064988888887,
      "system": 0.5485758311111112,
      "min": 5.46793455294,
      "max": 7.75838838394
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 96.8 ± 5.6 87.2 113.9 1.00 ± 0.09
pacquet@main 96.6 ± 6.3 86.4 108.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.09680079694551723,
      "stddev": 0.005628341537617539,
      "median": 0.09567625598,
      "user": 0.0930752503448276,
      "system": 0.0648983924137931,
      "min": 0.08723148898,
      "max": 0.11391436998
    },
    {
      "command": "pacquet@main",
      "mean": 0.09655392398000001,
      "stddev": 0.00625033111727841,
      "median": 0.09696507398,
      "user": 0.08859286592592593,
      "system": 0.06743588666666667,
      "min": 0.08635802198,
      "max": 0.10869463298
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 111.8 ± 9.0 97.1 132.2 1.00
pacquet@main 117.2 ± 8.6 102.4 133.6 1.05 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.11175801594413794,
      "stddev": 0.008990219629134799,
      "median": 0.11017205822000001,
      "user": 0.04188762275862068,
      "system": 0.07843773862068965,
      "min": 0.09713985822000001,
      "max": 0.13218774322
    },
    {
      "command": "pacquet@main",
      "mean": 0.11717155206615383,
      "stddev": 0.008574874549043408,
      "median": 0.11674781922000002,
      "user": 0.04279387076923077,
      "system": 0.08346686461538463,
      "min": 0.10239609122000001,
      "max": 0.13358233122
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.657 ± 0.227 4.457 5.040 1.29 ± 0.07
pacquet@main 4.723 ± 0.167 4.487 4.927 1.31 ± 0.06
pnpr@HEAD 3.802 ± 0.122 3.677 4.016 1.05 ± 0.05
pnpr@main 3.605 ± 0.110 3.490 3.827 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.6569015525,
      "stddev": 0.22679240924841204,
      "median": 4.5656486660999995,
      "user": 2.3794742199999996,
      "system": 1.66192298,
      "min": 4.4566174306,
      "max": 5.0398777256
    },
    {
      "command": "pacquet@main",
      "mean": 4.722815922700001,
      "stddev": 0.16704999237682427,
      "median": 4.7273970781,
      "user": 2.3540006200000003,
      "system": 1.6635174799999999,
      "min": 4.4870150606,
      "max": 4.9268369526
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.8015973464000004,
      "stddev": 0.12172174378948523,
      "median": 3.7692126201000002,
      "user": 2.548734819999999,
      "system": 1.76622458,
      "min": 3.6769305846,
      "max": 4.0155363886
    },
    {
      "command": "pnpr@main",
      "mean": 3.6047351686000004,
      "stddev": 0.11003202475149775,
      "median": 3.5852838416,
      "user": 2.306728819999999,
      "system": 1.5861014800000002,
      "min": 3.4898196736,
      "max": 3.8274903956
    }
  ]
}

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 194.2 ± 21.8 160.0 240.4 1.00
pacquet@main 196.5 ± 18.8 167.5 239.4 1.01 ± 0.15
pnpr@HEAD 256.6 ± 32.3 216.9 313.2 1.32 ± 0.22
pnpr@main 209.2 ± 14.2 183.0 235.1 1.08 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.19423334249333338,
      "stddev": 0.02177528498754567,
      "median": 0.19027673736000003,
      "user": 0.24200368666666666,
      "system": 0.17840528000000003,
      "min": 0.15997025536,
      "max": 0.24037351336
    },
    {
      "command": "pacquet@main",
      "mean": 0.19652937914571428,
      "stddev": 0.018754417057285196,
      "median": 0.19348512136,
      "user": 0.25266979142857143,
      "system": 0.17744775142857142,
      "min": 0.16746172536000004,
      "max": 0.23938376936000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.25659155936,
      "stddev": 0.032334504602658735,
      "median": 0.24772234286000003,
      "user": 0.2999393033333333,
      "system": 0.1917562633333333,
      "min": 0.21685523936000003,
      "max": 0.31322588036000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.20923299852666669,
      "stddev": 0.014177651280365028,
      "median": 0.21104240386,
      "user": 0.2511008866666667,
      "system": 0.17182334666666665,
      "min": 0.18300384736000003,
      "max": 0.23513590836000003
    }
  ]
}

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.436 ± 0.048 1.370 1.522 1.00
pacquet@main 1.468 ± 0.072 1.370 1.641 1.02 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.43639574452,
      "stddev": 0.0480122052153062,
      "median": 1.43214674742,
      "user": 0.85145898,
      "system": 0.32012346,
      "min": 1.37027499792,
      "max": 1.52189800792
    },
    {
      "command": "pacquet@main",
      "mean": 1.4677083027199997,
      "stddev": 0.07231091391250138,
      "median": 1.4471382474199999,
      "user": 0.90640788,
      "system": 0.32980405999999995,
      "min": 1.37012566992,
      "max": 1.64054717892
    }
  ]
}

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

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 47.1 ± 5.6 37.0 68.1 1.00
pacquet@main 50.2 ± 4.2 41.8 60.4 1.07 ± 0.16
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.047084410896666665,
      "stddev": 0.0056395125920629605,
      "median": 0.04654061528,
      "user": 0.03210632666666667,
      "system": 0.029437626666666668,
      "min": 0.03701186428,
      "max": 0.06805808528000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.05017909225014925,
      "stddev": 0.004151971129780339,
      "median": 0.050882399280000004,
      "user": 0.035607525671641785,
      "system": 0.0303583943283582,
      "min": 0.04179773328,
      "max": 0.06035124228
    }
  ]
}

@zkochan zkochan changed the title feat(workspace): list project manifest paths without reading them feat(install): decide a repeat install from the recorded manifests Nov 3, 2026
@zkochan
zkochan marked this pull request as ready for review November 3, 2026 20:17
Copilot AI balanced review requested due to automatic review settings November 3, 2026 20:17

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Skip unchanged workspace manifests on repeat installs

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Let repeat installs validate unchanged workspace projects from recorded manifest fields instead of
 rereading files.
• Fall back to file-based checks when records are untrusted or validation needs to write.
• Cover project discovery, changed manifests, new projects, and missing workspace links with tests.
Diagram

graph TD
  A["List manifest paths"] --> B["Match recorded stats"] --> C{"Records usable?"}
  C -- Yes --> D["Check stand-ins"] --> E{"Check passes?"}
  E -- Yes --> H["Finish fast path"]
  C -- No --> F["Read project files"] --> G["Existing check"] --> H
  E -- No --> F
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Maintain a separate metadata-only freshness checker
  • ➕ Could keep reconstructed manifests out of the existing checker.
  • ➖ Would duplicate dependency, link, and freshness rules.
  • ➖ Could diverge as the regular check evolves.

Recommendation: Prefer the shared checker with recorded fields and digests: it retains existing validation behavior while avoiding unchanged manifest reads. The explicit fallback for writes and uncertain records is essential because stand-ins cannot supply file-derived state.

Files changed (20) +775 / -167

Enhancement (13) +407 / -144
workspace_state.rsTry recorded manifests before reading projects +62/-32

Try recorded manifests before reading projects

• Runs a record-based repeat-install check first and retains the existing file-based check as fallback. Shares check context between both paths and supplies recorded digests for stand-ins.

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

stand_ins.rsBuild the record-based fast-path attempt +77/-0

Build the record-based fast-path attempt

• Lists candidate project manifests, constructs trusted stand-ins, and substitutes the active manifest already read by the command. Falls back when records or the stand-in check cannot decide.

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

freshness.rsDefer file-derived freshness writes +6/-39

Defer file-derived freshness writes

• Stops stand-in checks before state-refresh paths and moves missing-lockfile handling into a dedicated module.

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

missing_lockfile.rsGuard missing-lockfile restoration +48/-0

Guard missing-lockfile restoration

• Preserves the existing missing-lockfile policies while directing a stand-in check to fallback when restoration would write the wanted lockfile.

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

stand_in_writes.rsPrevent writes from stand-in checks +13/-0

Prevent writes from stand-in checks

• Adds a shared guard that rejects file-derived writes when the check is using manifest stand-ins.

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

manifest_agreement.rsUse recorded digests for stand-in manifests +7/-5

Use recorded digests for stand-in manifests

• Uses a project's recorded digest instead of hashing its reduced stand-in when evaluating manifest agreement.

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

manifest_source.rsTrack stand-ins in declared manifests +37/-6

Track stand-ins in declared manifests

• Extends DeclaredManifests with optional recorded digests and an indicator used to prevent writes during stand-in checks.

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

validation.rsExpose manifest stand-in construction +1/-0

Expose manifest stand-in construction

• Makes reconstructed manifest projects available to the install fast path through the validation module.

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

manifest_files.rsRecord fields needed by repeat-install checks +29/-35

Record fields needed by repeat-install checks

• Replaces selected derived facts with the ten top-level manifest fields read by the check. Retains stat and digest checks when recording or reusing a manifest file.

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

stand_ins.rsReconstruct manifests from trusted records +82/-0

Reconstruct manifests from trusted records

• Stats candidates in manifest precedence order and rebuilds projects only when the selected file has a matching, trusted record. Skips directories without manifests and returns recorded digests for the reconstructed projects.

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

lib.rsStore checked manifest fields in validation state +7/-14

Store checked manifest fields in validation state

• Replaces derived manifest facts with an optional map of recorded top-level fields. Records without fields remain distinguishable and cannot serve as stand-ins.

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

lib.rsExport manifest-path discovery +3/-3

Export manifest-path discovery

• Exports the project candidate-path type and the listing function for callers that do not need to read manifests.

pnpm/crates/workspace/src/lib.rs

projects.rsSeparate manifest-path listing from project reads +35/-10

Separate manifest-path listing from project reads

• Exposes the existing workspace walk as an ordered listing of directories and candidate manifest paths. Normal project discovery now reads from that listing.

pnpm/crates/workspace/src/projects.rs

Refactor (1) +16 / -4
lifecycle.rsShare workspace discovery options +16/-4

Share workspace discovery options

• Extracts the project-discovery options so manifest-path listing and normal discovery use the same patterns and ignored directories.

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

Tests (5) +347 / -19
main.rsRegister repeat-install record tests +1/-0

Register repeat-install record tests

• Includes the new CLI integration test module.

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

repeat_install_records.rsTest record-based installs and file fallbacks +178/-0

Test record-based installs and file fallbacks

• Exercises unchanged workspaces, edited manifests, newly added projects, and removed workspace links. Checks trace messages and resulting install behavior.

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

validation.rsTest recorded fields and stand-in trust +87/-19

Test recorded fields and stand-in trust

• Verifies field capture and record reuse. Adds cases for empty directories, absent or untrusted records, changed files, and a different selected manifest.

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

tests.rsRegister manifest-path listing tests +1/-0

Register manifest-path listing tests

• Adds the new workspace discovery test module.

pnpm/crates/workspace/src/projects/tests.rs

manifest_paths.rsTest unread manifest-path listings +80/-0

Test unread manifest-path listings

• Confirms listing preserves discovery order, includes wildcard-matched directories without manifests, and does not parse malformed candidates.

pnpm/crates/workspace/src/projects/tests/manifest_paths.rs

Documentation (1) +5 / -0
repeat-install-skips-unchanged-manifests.mdDocument the repeat-install performance improvement +5/-0

Document the repeat-install performance improvement

• Adds a pacquet patch changeset noting that up-to-date workspace installs no longer read unchanged project manifests.

.changeset/repeat-install-skips-unchanged-manifests.md

@qodo-code-review

qodo-code-review Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. Manifest usernames leak into state ✗ Dismissed
Description
may_hold_credential only treats text as sensitive when an @ follows a colon, so
recorded_specifier preserves username-only URL userinfo such as
file://[email protected]/pkg.tgz. A manifest containing that specifier writes the secret into
ManifestFile.fields and the workspace state, where later stand-in reconstruction exposes it to
local readers.

2. Private dependency credentials become readable ✓ Resolved

Resolving commit: fcd695c

Resolution reason
Dependency maps are now sanitized before being stored: non-file URL specifiers, including
credential-bearing HTTP and Git URLs, are replaced with "*", preventing credentials from entering
workspace state while preserving dependency aliases and non-URL specifiers.
Description
manifest_file copies complete dependency maps into ManifestFile.fields, including credentials
embedded in URL specifiers, while the workspace-state writer creates its file with umask-derived
permissions rather than the source manifest’s permissions. After validation of a project whose
package.json is private, a typical umask of 022 makes those credentials readable to other local
users through the new state file; this also occurs when lockfile writing is disabled.

3. URL peers trigger unnecessary reinstalls ✗ Dismissed
Description
peer_names replaces every URL-valued peer specifier with * instead of preserving the recorded
locator. When a workspace peer is written with a URL and the repeat-install path rebuilds a
stand-in, the freshness comparison sees * rather than the lockfile's original specifier and
rejects the otherwise reusable state, causing an unnecessary install.


Remediation recommended

4. Some local paths force full manifest reads 🐞 Bug ➹ Performance
Description
may_hold_credential treats an internal // in a local dependency path as the start of a URL
authority, so a path such as file:../packages//foo@bar leaves the manifest record without fields.
On every repeat install of that workspace, the missing fields prevent construction of the stand-ins
and send the check back to reading project manifests.
Code

pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files.rs[R239-245]

+    let in_authority = text
+        .split_once("//")
+        .is_some_and(|(_, rest)| {
+            rest.split('/')
+                .next()
+                .is_some_and(|authority| authority.contains('@'))
+        });
Relevance

●●● Strong

Concrete local-path parsing bug directly undermines the PR’s manifest-read performance goal; similar
repeat-install performance fixes were accepted.

PR-#17481
PR-#14360

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
LocalSpec::parse accepts file: paths, including an internal double slash. The new authority
search matches that slash and the later @; for a checked scheme, recorded_specifier then returns
None, which prevents the record from retaining fields. Stand-in construction requires those fields
for every listed project, and its failure makes the install use the file-based check.

pnpm/crates/local-spec/src/lib.rs[55-68]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files.rs[217-246]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files/stand_ins.rs[31-57]
pnpm/crates/package-manager/src/install/workspace_state/stand_ins.rs[34-43]

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

## Issue description
An internal double slash in a valid local dependency path can be mistaken for a URL authority, permanently disabling recorded-manifest reuse for the workspace.

## Fix Focus Areas
- pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files.rs[239-245]
- pnpm/crates/package-manager/src/optimistic_repeat_install/tests/validation.rs[360-369]

## Recommended Fix
After the scheme has been removed, inspect an authority only when the remaining text starts with `//`; do not treat a double slash inside a local path as an authority. Add a test showing that a `file:` path with an internal `//` and `@` retains usable recorded fields.

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

Dismiss ↗ | View ↗


5. Repeat-install tests miss stealth edits ✓ Resolved

Resolving commit: e580feb

Resolution reason
The commit added an assertion that the unchanged fast path does not enter project-manifest
discovery, added coverage for missing manifest records, and added a regression test for a same-size
manifest edit with its mtime restored. The implementation also refreshes records when file stat or
record data is no longer trustworthy. It is not a direct implementation because it uses tracing and
stat/ctime validation rather than the suggested filesystem-open counting seam.
Description
an_edited_manifest_is_read_again rewrites the manifest but does not preserve its original size and
timestamps, while the unchanged-workspace test observes only trace output. A same-size edit with
preserved mtime, the ctime or racy-window fallback, and filesystem-open counts therefore remain
untested.

6. Write-needing repeat installs run the check twice 🐞 Bug ➹ Performance
Description
install_already_up_to_date runs stand_ins::check_from_records through workspace discovery,
serial manifest-record checks, InputDrift::compute, and the static scans before
stand_in_writes::refuse can reject the attempt. When a lockfile, patch, pnpmfile, or
active-project stat is untrusted, or a manifest record is unusable, check_from_files repeats
discovery and the check, adding a second walk—and, for edited workspaces, a serial pass before its
parallel manifest reads.
Code

pnpm/crates/package-manager/src/install/workspace_state.rs[R126-129]

+    let project_count = match stand_ins::check_from_records(check, &context, &state) {
+        Some(project_count) => Some(project_count),
+        None => check_from_files(check, &context, state)?,
+    };
Relevance

●● Moderate

The duplicate-work concern is plausible, but no close precedent establishes acceptance of this
architectural optimization.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The record attempt lists candidate projects, and manifest_stand_ins checks their records serially,
returning None when one is unusable. In check_freshness, refusal occurs after
InputDrift::compute and the static checks; settle_proven_tree also refuses only after reading
the lockfile. InputDrift::compute hashes the lockfile when its stat is not trusted. The
file-backed fallback then calls discover_fast_path_projects and runs
check_fast_path_repeat_install with a new state, repeating the walk and check; only the lazy
wanted-lockfile parse is shared, while the fallback's manifest reads are parallel.

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs[157-170]
pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs[321-345]
pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs[57-84]
pnpm/crates/package-manager/src/install/workspace_state.rs[136-154]
pnpm/crates/package-manager/src/install/workspace_state/stand_ins.rs[44-59]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files/stand_ins.rs[31-41]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files/stand_ins.rs[68-81]
pnpm/crates/package-manager/src/install/workspace_state.rs[126-151]
pnpm/crates/workspace/src/projects.rs[181-196]

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 stand-in attempt can complete workspace discovery, serial manifest-record validation, lockfile rehashing, and static checks before it is refused or finds an unusable record. The file-backed fallback then repeats discovery and the check, adding avoidable work to installs that need a state write or contain an edited manifest.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/workspace_state.rs[126-145]
- pnpm/crates/package-manager/src/install/workspace_state/stand_ins.rs[17-59]
- pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs[157-170]
- pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files/stand_ins.rs[31-41]
- pnpm/crates/workspace/src/projects.rs[181-196]

## Recommended Fix
Before running the stand-in check, use a cheap stats-only pre-check to skip it when the lockfile, a patch, or the pnpmfile stat is not trusted, or when the active manifest's stat differs from its record. Retain the `ProjectManifestPaths` listing if record validation fails and pass it to a `read_projects`-style helper for `check_from_files` instead of walking the workspace globs again. Preserve the file-backed path's existing error handling and parallel manifest reads.

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

Dismiss ↗ | View ↗



Informational

7. Every up-to-date run deep-copies the whole state ✓ Resolved

Resolving commit: e580feb

Resolution reason
The fast-path state is now borrowed through FastPathProjects and the repeat-install checks,
replacing the per-run state.clone() with references. The fallback also accepts a borrowed state,
eliminating the unnecessary full workspace-state copy.
Description
check_from_records passes state.clone() to the check, and stand_in also clones each record's
fields map into a new PackageManifest. Records now hold every project's full dependency maps,
bin, and publishConfig, so the fast path allocates two full copies of that data on every run.

8. Windows path cases lack coverage 📜 Skill insight ▣ Testability
Description
The new workspace manifest listing and relinking tests exercise only platform-neutral path
construction and a generic link removal scenario. Windows separators and Windows-specific link
behavior are not tested, so the changed path and link handling has no explicit Windows validation.
Code

pnpm/crates/workspace/src/projects.rs[R124-127]

+pub struct ProjectManifestPaths {
+    pub root_dir: PathBuf,
+    /// The manifest paths in precedence order, never empty.
+    /// [`find_workspace_projects`] reads the first one that exists, and
Relevance

● Weak

Recent precedents rejected adding platform-specific Windows coverage when existing cross-platform
behavior was tested.

PR-#16294
PR-#16503

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR introduces PathBuf-based manifest candidates and changes workspace-link recovery, but the
added tests contain no Windows separators or Windows-specific conditional cases.

pnpm/crates/workspace/src/projects.rs[121-140]
pnpm/crates/workspace/src/projects/tests/manifest_paths.rs[21-30]
pnpm/crates/cli/tests/suite/repeat_install_records.rs[168-176]
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 PR changes workspace manifest path discovery and repeat-install workspace-link handling without adding Windows-specific regression coverage.

Fix Focus Areas
- pnpm/crates/workspace/src/projects.rs[121-140]
- pnpm/crates/workspace/src/projects/tests/manifest_paths.rs[21-80]
- pnpm/crates/cli/tests/suite/repeat_install_records.rs[168-176]

Recommended Fix
Add Windows-specific tests using backslash-separated paths or `cfg(windows)` coverage for manifest candidate discovery and workspace-link relinking. Keep the existing platform-independent cases and assert the discovered project set and recreated link on Windows.

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

Dismiss ↗ | View ↗


9. The speed claim has no measurement 📜 Skill insight ➹ Performance
Description
The changeset claims that repeat installs no longer read unchanged project manifests, presenting a
performance-related improvement without supplying a before-and-after measurement. The PR provides
behavioral tests and trace assertions but no benchmark, timing sample, or numeric I/O comparison to
quantify the claimed improvement.
Code

.changeset/repeat-install-skips-unchanged-manifests.md[5]

+`pnpm install` in a workspace that is already up to date no longer reads the `package.json` of each project whose file did not change since the last install.
Relevance

● Weak

Recent precedent rejected demanding benchmarks for an unquantified install-speed claim.

PR-#17375

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changeset states that repeat installs no longer read unchanged project manifests, but the
changed tests only inspect output strings and provide no numeric before/after result.

.changeset/repeat-install-skips-unchanged-manifests.md[1-5]
pnpm/crates/cli/tests/suite/repeat_install_records.rs[76-80]
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 PR claims reduced repeat-install manifest I/O but provides no quantitative evidence of the performance improvement.

Fix Focus Areas
- .changeset/repeat-install-skips-unchanged-manifests.md[1-5]
- pnpm/crates/cli/tests/suite/repeat_install_records.rs[59-80]

Recommended Fix
Run a reproducible repeat-install benchmark with unchanged workspaces and report numeric before-and-after timings and, where available, manifest-open counts. Include the measurement context and number of runs in the PR description or a tracked benchmark result.

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

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Compliance rules (platform): 60 rules
✅ Cross-repo context — repo relationships
✅ REVIEW.md
Review mode: Auto: ⚖️ Balanced: Downgraded extended -> standard: change is below the extended eligibility bar (hunks 3/18, lines 288/200; both must reach the floor). Router rationale: Manifest-state transformation has multiple independent security and correctness edge cases.

Grey Divider

Tip of the day
💡 Did you know, you can tweak Display settings with a live preview to see your comment before it ships

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit d89a3db

Results up to commit 87806c0 🧠 Deep


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


Remediation recommended
1. Repeat-install tests miss stealth edits ✓ Resolved

Resolving commit: e580feb

Resolution reason
The commit added an assertion that the unchanged fast path does not enter project-manifest
discovery, added coverage for missing manifest records, and added a regression test for a same-size
manifest edit with its mtime restored. The implementation also refreshes records when file stat or
record data is no longer trustworthy. It is not a direct implementation because it uses tracing and
stat/ctime validation rather than the suggested filesystem-open counting seam.
Description
an_edited_manifest_is_read_again rewrites the manifest but does not preserve its original size and
timestamps, while the unchanged-workspace test observes only trace output. A same-size edit with
preserved mtime, the ctime or racy-window fallback, and filesystem-open counts therefore remain
untested.

2. Write-needing repeat installs run the check twice 🐞 Bug ➹ Performance
Description
install_already_up_to_date runs stand_ins::check_from_records through workspace discovery,
serial manifest-record checks, InputDrift::compute, and the static scans before
stand_in_writes::refuse can reject the attempt. When a lockfile, patch, pnpmfile, or
active-project stat is untrusted, or a manifest record is unusable, check_from_files repeats
discovery and the check, adding a second walk—and, for edited workspaces, a serial pass before its
parallel manifest reads.
Code

pnpm/crates/package-manager/src/install/workspace_state.rs[R126-129]

+    let project_count = match stand_ins::check_from_records(check, &context, &state) {
+        Some(project_count) => Some(project_count),
+        None => check_from_files(check, &context, state)?,
+    };
Relevance

●● Moderate

The duplicate-work concern is plausible, but no close precedent establishes acceptance of this
architectural optimization.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The record attempt lists candidate projects, and manifest_stand_ins checks their records serially,
returning None when one is unusable. In check_freshness, refusal occurs after
InputDrift::compute and the static checks; settle_proven_tree also refuses only after reading
the lockfile. InputDrift::compute hashes the lockfile when its stat is not trusted. The
file-backed fallback then calls discover_fast_path_projects and runs
check_fast_path_repeat_install with a new state, repeating the walk and check; only the lazy
wanted-lockfile parse is shared, while the fallback's manifest reads are parallel.

pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs[157-170]
pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs[321-345]
pnpm/crates/package-manager/src/optimistic_repeat_install/freshness/drift.rs[57-84]
pnpm/crates/package-manager/src/install/workspace_state.rs[136-154]
pnpm/crates/package-manager/src/install/workspace_state/stand_ins.rs[44-59]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files/stand_ins.rs[31-41]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files/stand_ins.rs[68-81]
pnpm/crates/package-manager/src/install/workspace_state.rs[126-151]
pnpm/crates/workspace/src/projects.rs[181-196]

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 stand-in attempt can complete workspace discovery, serial manifest-record validation, lockfile rehashing, and static checks before it is refused or finds an unusable record. The file-backed fallback then repeats discovery and the check, adding avoidable work to installs that need a state write or contain an edited manifest.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install/workspace_state.rs[126-145]
- pnpm/crates/package-manager/src/install/workspace_state/stand_ins.rs[17-59]
- pnpm/crates/package-manager/src/optimistic_repeat_install/freshness.rs[157-170]
- pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files/stand_ins.rs[31-41]
- pnpm/crates/workspace/src/projects.rs[181-196]

## Recommended Fix
Before running the stand-in check, use a cheap stats-only pre-check to skip it when the lockfile, a patch, or the pnpmfile stat is not trusted, or when the active manifest's stat differs from its record. Retain the `ProjectManifestPaths` listing if record validation fails and pass it to a `read_projects`-style helper for `check_from_files` instead of walking the workspace globs again. Preserve the file-backed path's existing error handling and parallel manifest reads.

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

Dismiss ↗ | View ↗



Informational
3. Windows path cases lack coverage 📜 Skill insight ▣ Testability
Description
The new workspace manifest listing and relinking tests exercise only platform-neutral path
construction and a generic link removal scenario. Windows separators and Windows-specific link
behavior are not tested, so the changed path and link handling has no explicit Windows validation.
Code

pnpm/crates/workspace/src/projects.rs[R124-127]

+pub struct ProjectManifestPaths {
+    pub root_dir: PathBuf,
+    /// The manifest paths in precedence order, never empty.
+    /// [`find_workspace_projects`] reads the first one that exists, and
Relevance

● Weak

Recent precedents rejected adding platform-specific Windows coverage when existing cross-platform
behavior was tested.

PR-#16294
PR-#16503

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR introduces PathBuf-based manifest candidates and changes workspace-link recovery, but the
added tests contain no Windows separators or Windows-specific conditional cases.

pnpm/crates/workspace/src/projects.rs[121-140]
pnpm/crates/workspace/src/projects/tests/manifest_paths.rs[21-30]
pnpm/crates/cli/tests/suite/repeat_install_records.rs[168-176]
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 PR changes workspace manifest path discovery and repeat-install workspace-link handling without adding Windows-specific regression coverage.

Fix Focus Areas
- pnpm/crates/workspace/src/projects.rs[121-140]
- pnpm/crates/workspace/src/projects/tests/manifest_paths.rs[21-80]
- pnpm/crates/cli/tests/suite/repeat_install_records.rs[168-176]

Recommended Fix
Add Windows-specific tests using backslash-separated paths or `cfg(windows)` coverage for manifest candidate discovery and workspace-link relinking. Keep the existing platform-independent cases and assert the discovered project set and recreated link on Windows.

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

Dismiss ↗ | View ↗


4. The speed claim has no measurement 📜 Skill insight ➹ Performance
Description
The changeset claims that repeat installs no longer read unchanged project manifests, presenting a
performance-related improvement without supplying a before-and-after measurement. The PR provides
behavioral tests and trace assertions but no benchmark, timing sample, or numeric I/O comparison to
quantify the claimed improvement.
Code

.changeset/repeat-install-skips-unchanged-manifests.md[5]

+`pnpm install` in a workspace that is already up to date no longer reads the `package.json` of each project whose file did not change since the last install.
Relevance

● Weak

Recent precedent rejected demanding benchmarks for an unquantified install-speed claim.

PR-#17375

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changeset states that repeat installs no longer read unchanged project manifests, but the
changed tests only inspect output strings and provide no numeric before/after result.

.changeset/repeat-install-skips-unchanged-manifests.md[1-5]
pnpm/crates/cli/tests/suite/repeat_install_records.rs[76-80]
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 PR claims reduced repeat-install manifest I/O but provides no quantitative evidence of the performance improvement.

Fix Focus Areas
- .changeset/repeat-install-skips-unchanged-manifests.md[1-5]
- pnpm/crates/cli/tests/suite/repeat_install_records.rs[59-80]

Recommended Fix
Run a reproducible repeat-install benchmark with unchanged workspaces and report numeric before-and-after timings and, where available, manifest-open counts. Include the measurement context and number of runs in the PR description or a tracked benchmark result.

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

Dismiss ↗ | View ↗


5. Every up-to-date run deep-copies the whole state ✓ Resolved

Resolving commit: e580feb

Resolution reason
The fast-path state is now borrowed through FastPathProjects and the repeat-install checks,
replacing the per-run state.clone() with references. The fallback also accepts a borrowed state,
eliminating the unnecessary full workspace-state copy.
Description
check_from_records passes state.clone() to the check, and stand_in also clones each record's
fields map into a new PackageManifest. Records now hold every project's full dependency maps,
bin, and publishConfig, so the fast path allocates two full copies of that data on every run.

Results up to commit 6ee136b 🧠 Deep


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


Action required
1. Private dependency credentials become readable ✓ Resolved

Resolving commit: fcd695c

Resolution reason
Dependency maps are now sanitized before being stored: non-file URL specifiers, including
credential-bearing HTTP and Git URLs, are replaced with "*", preventing credentials from entering
workspace state while preserving dependency aliases and non-URL specifiers.
Description
manifest_file copies complete dependency maps into ManifestFile.fields, including credentials
embedded in URL specifiers, while the workspace-state writer creates its file with umask-derived
permissions rather than the source manifest’s permissions. After validation of a project whose
package.json is private, a typical umask of 022 makes those credentials readable to other local
users through the new state file; this also occurs when lockfile writing is disabled.

2. URL peers trigger unnecessary reinstalls ✗ Dismissed
Description
peer_names replaces every URL-valued peer specifier with * instead of preserving the recorded
locator. When a workspace peer is written with a URL and the repeat-install path rebuilds a
stand-in, the freshness comparison sees * rather than the lockfile's original specifier and
rejects the otherwise reusable state, causing an unnecessary install.

Results up to commit 4758c32 ⚖️ Balanced


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


Action required
1. Manifest usernames leak into state ✗ Dismissed
Description
may_hold_credential only treats text as sensitive when an @ follows a colon, so
recorded_specifier preserves username-only URL userinfo such as
file://[email protected]/pkg.tgz. A manifest containing that specifier writes the secret into
ManifestFile.fields and the workspace state, where later stand-in reconstruction exposes it to
local readers.

Results up to commit 39ca0dd ⚖️ Balanced


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


Remediation recommended
1. Some local paths force full manifest reads 🐞 Bug ➹ Performance
Description
may_hold_credential treats an internal // in a local dependency path as the start of a URL
authority, so a path such as file:../packages//foo@bar leaves the manifest record without fields.
On every repeat install of that workspace, the missing fields prevent construction of the stand-ins
and send the check back to reading project manifests.
Code

pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files.rs[R239-245]

+    let in_authority = text
+        .split_once("//")
+        .is_some_and(|(_, rest)| {
+            rest.split('/')
+                .next()
+                .is_some_and(|authority| authority.contains('@'))
+        });
Relevance

●●● Strong

Concrete local-path parsing bug directly undermines the PR’s manifest-read performance goal; similar
repeat-install performance fixes were accepted.

PR-#17481
PR-#14360

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
LocalSpec::parse accepts file: paths, including an internal double slash. The new authority
search matches that slash and the later @; for a checked scheme, recorded_specifier then returns
None, which prevents the record from retaining fields. Stand-in construction requires those fields
for every listed project, and its failure makes the install use the file-based check.

pnpm/crates/local-spec/src/lib.rs[55-68]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files.rs[217-246]
pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files/stand_ins.rs[31-57]
pnpm/crates/package-manager/src/install/workspace_state/stand_ins.rs[34-43]

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

## Issue description
An internal double slash in a valid local dependency path can be mistaken for a URL authority, permanently disabling recorded-manifest reuse for the workspace.

## Fix Focus Areas
- pnpm/crates/package-manager/src/optimistic_repeat_install/validation/manifest_files.rs[239-245]
- pnpm/crates/package-manager/src/optimistic_repeat_install/tests/validation.rs[360-369]

## Recommended Fix
After the scheme has been removed, inspect an authority only when the remaining text starts with `//`; do not treat a double slash inside a local path as an authority. Add a test showing that a `file:` path with an internal `//` and `@` retains usable recorded fields.

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

Dismiss ↗ | View ↗


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

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.

🟡 Changes recommended

Cached manifest data can expose private credentials, and missing change times can cause dependency changes to be missed.

7 open issues
What changed in this PR

This PR adds a record-based shortcut to the Rust CLI’s repeat-install check, avoiding reads of unchanged workspace manifests when trusted file metadata matches the saved state.

Changes:

  • Separates workspace manifest discovery from manifest reading.
  • Records manifest fields and digests for reuse, falling back to file-based checks when records are unusable or state must be written.
  • Adds discovery, validation, and CLI regression tests, plus a user-facing changeset.
File Description
pnpm/​crates/​workspace/​src/​projects/​tests/​manifest_paths.rs Tests manifest listing and precedence without parsing.
pnpm/​crates/​workspace/​src/​projects/​tests.rs Registers manifest-listing tests.
pnpm/​crates/​workspace/​src/​projects.rs Separates manifest-path discovery from reading.
pnpm/​crates/​workspace/​src/​lib.rs Exports the manifest-listing API.
pnpm/​crates/​workspace-state/​src/​lib.rs Stores checked manifest fields in validation records.
pnpm/​crates/​package-manager/​src/​optimistic_repeat_install/​validation/​manifest_files/​stand_ins.rs Rebuilds manifests from matching recorded metadata.
pnpm/​crates/​package-manager/​src/​optimistic_repeat_install/​validation/​manifest_files.rs Records fields needed by repeat-install checks.
pnpm/​crates/​package-manager/​src/​optimistic_repeat_install/​validation.rs Exposes stand-in construction internally.
pnpm/​crates/​package-manager/​src/​optimistic_repeat_install/​tests/​validation.rs Tests recorded fields and stand-in rejection cases.
pnpm/​crates/​package-manager/​src/​optimistic_repeat_install/​manifest_source.rs Associates stand-in manifests with recorded digests.
pnpm/​crates/​package-manager/​src/​optimistic_repeat_install/​manifest_agreement.rs Uses recorded digests when checking stand-ins.
pnpm/​crates/​package-manager/​src/​optimistic_repeat_install/​freshness/​stand_in_writes.rs Rejects write-requiring checks on stand-ins.
pnpm/​crates/​package-manager/​src/​optimistic_repeat_install/​freshness/​missing_lockfile.rs Extracts missing-lockfile handling and guards restoration.
pnpm/​crates/​package-manager/​src/​optimistic_repeat_install/​freshness.rs Adds fallback guards before state-writing operations.
pnpm/​crates/​package-manager/​src/​install/​workspace_state/​stand_ins.rs Attempts the record-based check before reading projects.
pnpm/​crates/​package-manager/​src/​install/​workspace_state.rs Coordinates record-based and file-based checks.
pnpm/​crates/​package-manager/​src/​install/​lifecycle.rs Shares workspace discovery options.
pnpm/​crates/​cli/​tests/​suite/​repeat_install_records.rs Covers unchanged workspaces, edits, new projects, and missing links.
pnpm/​crates/​cli/​tests/​suite/​main.rs Registers repeat-install record tests.
.changeset/​repeat-install-skips-unchanged-manifests.md Documents the repeat-install optimization.

Review effort: Balanced

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

  • Fix comments: Fix CodeRabbit comments on this PR

Copilot AI balanced review requested due to automatic review settings November 3, 2026 21:35

@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 commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Replies to the Qodo review and the benchmark comment. Fixes are in 6a47963, and e580feb moves code to stay within the file size limit.

  1. Stealth edits and open counts. Added records_cannot_stand_in_for_a_same_size_edit_with_its_mtime_restored. The unchanged-workspace CLI test now asserts that discovery's read span never runs. Counting opens needs a filesystem seam this path does not have. See the Copilot thread.
  2. The check runs twice when it would write. The undecided attempt now hands its listing to the check on the files, so the workspace is walked once. The check itself runs twice only when the records cannot decide. A check on the files then refreshes the records (records_need_refresh), so the next run decides from records again.
  3. Windows path cases. Not adding Windows-only tests. The listing and stand-ins build paths with Path::join from the walk's own results, and the CLI tests run on Windows CI. That covers the separator and link behavior through the real filesystem.
  4. No measurement. Release builds of the base and this branch, medians of 150 pnpm install --offline repeat runs on this machine:
    • one project with a pnpm-workspace.yaml: 5.1 ms on the base, 4.9 ms here;
    • 300 workspace projects: 8.7 ms on the base, 7.9 ms here, with system time going from 14.0 ms to 9.0 ms.
  5. The state is deep-copied. Fixed. The check borrows the state. Each record's fields are still copied once into its stand-in, which replaces parsing that manifest.

The CI row isolated-repeat-install-hot-cache-hot-store (12.78 ms vs 18.67 ms, marked inconclusive) measured the commit before the state clone was removed. The single-project measurement above shows no slowdown. The next benchmark run on the current head will show whether the CI row still differs.


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

@qodo-code-review

Copy link
Copy Markdown

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

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

zkochan and others added 6 commits November 3, 2026 22:41
find_workspace_projects walks the package patterns, groups the manifest
paths it finds by directory, and then parses each directory's first
existing manifest. find_workspace_project_manifests returns the result
of the walk alone, so a caller can learn the project directories and
their manifest paths without opening any manifest. Discovery now runs
the read on top of it.

A directory that a `<dir>/*` pattern matches lists every manifest
basename without a check, as the walk always did, so a listed directory
need not hold a project.

The repeat-install fast path will use this to confirm the workspace's
project set from stats alone (pnpm/tasks#256).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The repeat-install fast path read and parsed every project manifest on
every run. The workspace state now records, with each manifest's stat,
the values of the top-level fields the check reads: name, version, the
dependency maps, peerDependenciesMeta, bin, directories, and
publishConfig. These replace the derived facts recorded before, which
left out the dependency aliases the link check stats, the specs the
local file dependency scan classifies, and the bin fields.

Before discovery reads anything, the CLI fast path lists the project
directories and stats each one's first existing manifest. When every
project has a record whose stat still matches and is trusted, it runs
the usual check on manifests rebuilt from the records, with their
recorded digests. The active project's manifest, which the command read
anyway, takes the place of its stand-in. Any project without a usable
record, or a check that would refresh the state or restore the wanted
lockfile, sends the install to the check on the manifest files, which
writes what a check on stand-ins cannot derive.

Part of pnpm/tasks#256.

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

The guards that send a check on manifest stand-ins to the check on the
files move into one function in their own module, and the missing wanted
lockfile policy moves into its own module, keeping freshness.rs within
the file size limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A record keeps only `directory` of publishConfig and `bin` of
  directories, so the workspace state copies no other publishConfig
  value, such as a registry with credentials.
- A record without fields is never reused by a write.
- A check on the manifest files that finds a record missing, without
  fields, or with a changed or untrusted stat refreshes the state, so a
  state an older pnpm wrote gets records instead of reading every
  manifest on every run.
- The check borrows the workspace state, so the records attempt no
  longer copies it.
- The stand-ins stat the manifests in parallel, and a check on the files
  after an undecided attempt reads the projects that attempt listed
  instead of walking the workspace again.
- Tests cover a same-size edit with its mtime restored, the refresh,
  and that a decided run never enters discovery's read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zkochan
zkochan force-pushed the fast-path-project-manifest-paths branch from e580feb to 1acd1dc Compare November 3, 2026 21:44

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.

🔵 Needs a closer look

Unchanged uncacheable or future-dated manifests trigger workspace-wide rebuilds on every repeat install, causing avoidable filesystem work without producing usable records.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 3, 2026 23:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Multiple potential paths for exposing sensitive manifest data in workspace state warrant human security assessment.

No open issues 🎉

Review effort: Balanced

@zkochan
zkochan merged commit 1201425 into main Nov 3, 2026
64 checks passed
@zkochan
zkochan deleted the fast-path-project-manifest-paths branch November 3, 2026 23:16
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