Skip to content

perf(lockfile): record inert setting changes without resolving - #13600

Merged
zkochan merged 4 commits into
mainfrom
perf-lockfile3
Aug 6, 2026
Merged

zkochan merged 4 commits into
mainfrom
perf-lockfile3

Conversation

@zkochan

@zkochan zkochan commented Aug 3, 2026 •

Copy link
Copy Markdown
Member

Summary

Next bounded slice of the fast-path roadmap in
pnpm/pnpm#13474: the
setting-only updates stage.

Changing autoInstallPeers, dedupePeers, peersSuffixMaxLength,
excludeLinksFromLockfile, or injectWorkspacePackages forced a full
dependency resolution even when the lockfile already proved the setting had
nothing to act on. Each setting now has its own predicate, and the changed
setting is recorded on a staged lockfile that is committed only when the
predicate holds and the existing freshness / resolution validation passes:

  • the three peer settings — no package or project declares a peer dependency,
    no depPath carries a peers suffix, and no snapshot lists transitive peers;
  • excludeLinksFromLockfile — no importer entry records a link: / file:
    reference and no project depends on a directory (workspace:-protocol deps
    are recorded either way, so they don't disqualify it, while a plain range
    onto a workspace project does);
  • injectWorkspacePackages — no project depends on another workspace project
    at all, and nothing is already marked injected.

Everything else falls back to the resolver with the input lockfile untouched.
Implemented in both stacks: tryFastUpdateSettings behind the existing
coordinator in the TypeScript CLI, and fast_update_settings chained after the
importer fast path in pacquet (its candidate is validated by
check_lockfile_freshness before it replaces the loaded lockfile).

Related to pnpm/pnpm#13474.

Squash Commit Body

Changing `autoInstallPeers`, `dedupePeers`, `peersSuffixMaxLength`,
`excludeLinksFromLockfile`, or `injectWorkspacePackages` forced a full
dependency resolution even when the lockfile already proved the setting had
nothing to act on: an install with no peer dependencies anywhere, or one where
no project depends on a directory or on another workspace project.

Both stacks now stage the new `settings` block on a candidate lockfile and
commit it only when every changed setting passes its own predicate and the
candidate still satisfies the existing freshness and resolution validation.
Anything else — a peer-suffixed depPath, a package or project declaring peers,
a `link:` / `file:` / workspace dependency, an already-injected dependency —
falls back to the resolver untouched.

The predicates that decide "this setting changed" now live in one place per
stack, so the fast path and the staleness check cannot drift:
`getOutdatedLockfileSettings` (which also reports every changed field, letting
the coordinator drop its neutralize-and-recompare dance) and the comparison
helpers in pacquet's `freshness` module. As a side effect the lockfile
serializer no longer deletes `injectWorkspacePackages` out of the in-memory
lockfile's shared `settings` object while writing it.

Related to pnpm/pnpm#13474.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

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


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Performance

    • Lockfile-only setting changes can now be applied without re-resolving dependencies when the existing dependency graph is unaffected.
    • Changes involving peers, links, workspace packages, or injected dependencies continue to use full resolution when necessary.
  • Bug Fixes

    • Lockfile checks preserve the configured order of ignored optional dependency patterns.
    • Frozen installs report setting mismatches more accurately.
  • Tests

    • Added coverage for safe updates and fallback scenarios across supported lockfile settings.

Copilot AI lite review requested due to automatic review settings August 3, 2026 00:32

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.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fbc5b360-c1f3-4991-81db-88c6a8680f65

📥 Commits

Reviewing files that changed from the base of the PR and between 7be3379 and 6f2e231.

📒 Files selected for processing (1)
  • pnpm/crates/package-manager/src/fast_update_settings.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/package-manager/src/fast_update_settings.rs

📝 Walkthrough

Walkthrough

The installer now detects all lockfile setting mismatches and updates graph-independent settings without dependency resolution. Rust and TypeScript paths validate peer, link, workspace, and injection conditions. Freshness checks and tests cover safe updates and resolution fallbacks.

Changes

Lockfile settings reuse

Layer / File(s) Summary
Settings comparison contracts
pnpm/crates/lockfile/src/freshness.rs, pnpm11/lockfile/settings-checker/*, pnpm11/lockfile/fs/src/lockfileFormatConverters.ts
Reusable helpers report setting mismatches with consistent defaults. Optional dependency comparison preserves input order.
Rust fast-update engine
pnpm/crates/package-manager/src/fast_update_settings.rs, pnpm/crates/package-manager/src/fast_update_settings/tests.rs
The Rust path updates safe settings without resolution and rejects changes that can affect peers, links, workspace dependencies, or injections.
Rust freshness integration
pnpm/crates/package-manager/src/install/lockfile_freshness.rs, pnpm/crates/package-manager/src/install/run.rs, pnpm/crates/cli/tests/lockfile_resolution_reuse.rs
Freshness checks add settings candidates and pass project manifests to fast updates. Integration tests verify dedupePeers behavior.
TypeScript fast-update integration
pnpm11/installing/deps-installer/src/install/*, pnpm11/installing/deps-installer/test/install/settingsFastUpdate.ts
The TypeScript installer applies safe settings-only updates. Tests cover peer, link, workspace, injection, and dedupePeers cases.
Release metadata
.changeset/*
Changesets record lockfile setting reuse and optional-dependency ordering changes.

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

Sequence Diagram(s)

sequenceDiagram
  participant Install
  participant SettingsChecker
  participant FastUpdate
  participant Lockfile
  participant Resolver
  Install->>SettingsChecker: Compare lockfile settings
  SettingsChecker-->>Install: Return changed fields
  Install->>FastUpdate: Validate graph independence
  alt Settings are safe
    FastUpdate->>Lockfile: Copy updated settings
    FastUpdate-->>Install: Complete without resolution
  else Settings may affect graph
    FastUpdate-->>Install: Reject fast update
    Install->>Resolver: Resolve dependencies
    Resolver-->>Install: Write resolved lockfile
  end
Loading

Possibly related issues

Possibly related PRs

  • pnpm/pnpm#12083 — Modifies lockfile-setting comparison and peer-related resolution behavior.
  • pnpm/pnpm#12315 — Modifies lockfile freshness checks and fast-path resolution.
  • pnpm/pnpm#13492 — Relates directly to dedupePeers lockfile-setting handling.

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

Suggested reviewers: copilot

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf-lockfile3

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.

@greptile-apps

greptile-apps Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains in the eligible follow-up review scope.

Reviews (3): Last reviewed commit: "docs(package-manager): disambiguate the ..." | Re-trigger Greptile

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

perf(lockfile): skip resolution for inert peer/link/inject setting changes

✨ Enhancement 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Adds a fast path that records autoInstallPeers, dedupePeers, peersSuffixMaxLength,
 excludeLinksFromLockfile, or injectWorkspacePackages changes on the lockfile without triggering
 a full dependency resolution.
• Each setting gets its own predicate (no peer deps, no directory/link deps, no workspace/injected
 deps) proving the lockfile's graph is unaffected; the candidate is only committed after passing
 existing freshness validation.
• Implements the fast path in both stacks: tryFastUpdateSettings in the TypeScript CLI (chained
 into the existing tryFastUpdateLockfile coordinator) and
 fast_update_settings::try_fast_update_settings in pacquet (chained after the importer fast path,
 validated by check_lockfile_freshness).
• Consolidates the "did this setting change" logic into shared predicate helpers
 (getOutdatedLockfileSettings in TS, comparison helpers in Rust's freshness module) so the fast
 path and staleness checks cannot drift.
• Adds unit tests and Rust CLI integration tests covering both the fast-path success cases and the
 fallback-to-resolution cases; includes a changeset documenting the behavior change.
Diagram

graph TD
  A["Install command"] --> B{"Setting changed?"}
  B -->|no| F["Full resolution"]
  B -->|yes| C{"Predicate holds?\n(no peers/links/inject)"}
  C -->|no| F
  C -->|yes| D["Stage settings on\ncandidate lockfile"]
  D --> E{"Freshness check\npasses?"}
  E -->|no| F
  E -->|yes| G["Commit lockfile\n(no resolution)"]
  F --> H["pnpm-lock.yaml"]
  G --> H
Loading
High-Level Assessment

The PR's approach—per-setting predicates that prove the recorded graph cannot be affected by the changed setting, gated behind existing freshness validation—is the right strategy given the precedent set by earlier fast-path PRs (catalogs, overrides, importers) in this series. Duplicating logic across the TypeScript and Rust stacks is necessary since they are separate runtimes with no shared code, and centralizing the 'did this setting change' predicates in one place per stack (as done here) directly addresses the drift risk that plagued the prior single-return implementation. No materially better alternative was identified.

Files changed (13) +1234 / -82

Enhancement (5) +479 / -69
fast_update_settings.rsImplement Rust fast path for inert lockfile setting changes +224/-0

Implement Rust fast path for inert lockfile setting changes

• Adds try_fast_update_settings which detects which settings changed and validates, per setting, that the lockfile's recorded graph has no peer/directory/workspace dependencies affected before staging the new settings block.

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

install.rsChain settings fast path into the lockfile fast-update coordinator +22/-8

Chain settings fast path into the lockfile fast-update coordinator

• Renames the importer-only fast update path to a general lockfile fast-update path and chains try_fast_update_settings after try_fast_update_importers, passing project manifests through the new options struct.

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

index.tsWire tryFastUpdateSettings into the TypeScript install coordinator +34/-33

Wire tryFastUpdateSettings into the TypeScript install coordinator

• Replaces the single-change getOutdatedLockfileSetting lookup with getOutdatedLockfileSettings reporting every changed field, and dispatches to tryFastUpdateSettings when only settings fields changed, dropping the previous neutralize-and-recompare logic.

pnpm11/installing/deps-installer/src/install/index.ts

tryFastUpdateSettings.tsImplement TypeScript fast path for inert lockfile setting changes +142/-0

Implement TypeScript fast path for inert lockfile setting changes

• Adds tryFastUpdateSettings with per-setting predicates mirroring the Rust implementation for peer, link, and injection settings, mutating the lockfile settings block only when every changed setting is proven safe.

pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts

getOutdatedLockfileSetting.tsAdd getOutdatedLockfileSettings generator reporting all changed fields +57/-28

Add getOutdatedLockfileSettings generator reporting all changed fields

• Introduces a shared generator-based implementation yielding every changed field, keeping getOutdatedLockfileSetting as a thin wrapper returning just the first match, and exports LockfileSettingsInput and DEFAULT_PEERS_SUFFIX_MAX_LENGTH for reuse.

pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts

Refactor (2) +52 / -12
freshness.rsExtract shared setting-changed predicates in freshness checks +51/-11

Extract shared setting-changed predicates in freshness checks

• Refactors inline comparisons for autoInstallPeers, dedupePeers, excludeLinksFromLockfile, peersSuffixMaxLength, and injectWorkspacePackages into standalone public helper functions reused by the new fast path.

pnpm/crates/lockfile/src/freshness.rs

lockfileFormatConverters.tsUse omit instead of delete for injectWorkspacePackages +1/-1

Use omit instead of delete for injectWorkspacePackages

• Switches from mutating delete to the existing omit helper for consistency when stripping a false injectWorkspacePackages setting during lockfile file conversion.

pnpm11/lockfile/fs/src/lockfileFormatConverters.ts

Tests (3) +686 / -0
lockfile_resolution_reuse.rsAdd integration tests for setting-only fast path in pacquet CLI +104/-0

Add integration tests for setting-only fast path in pacquet CLI

• Adds end-to-end tests verifying that a peer setting change on a peerless lockfile skips resolution, and that the same change falls back to resolution when the lockfile records peers.

pnpm/crates/cli/tests/lockfile_resolution_reuse.rs

tests.rsUnit tests for Rust setting fast-path predicates +290/-0

Unit tests for Rust setting fast-path predicates

• Covers success and fallback scenarios for all five settings, including peer-suffixed depPaths, link/file/workspace dependencies, and already-injected dependencies.

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

settingsFastUpdate.tsAdd unit and e2e tests for TypeScript settings fast path +292/-0

Add unit and e2e tests for TypeScript settings fast path

• Adds parametrized unit tests for each setting's predicate plus end-to-end tests confirming dedupePeers toggles skip or trigger resolution appropriately using a dead registry to detect any network fetch attempt.

pnpm11/installing/deps-installer/test/install/settingsFastUpdate.ts

Documentation (1) +9 / -0
inert-lockfile-setting-updates.mdAdd changeset for inert setting fast path +9/-0

Add changeset for inert setting fast path

• Documents the new behavior for pnpm users: setting changes that cannot affect the resolved graph are recorded without a full resolution.

.changeset/inert-lockfile-setting-updates.md

Other (2) +8 / -1
lib.rsRegister the new fast_update_settings module +1/-0

Register the new fast_update_settings module

• Adds the fast_update_settings module declaration to the crate.

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

index.tsExport new settings-checker types and functions +7/-1

Export new settings-checker types and functions

• Exports ChangedSettingsField, DEFAULT_PEERS_SUFFIX_MAX_LENGTH, and getOutdatedLockfileSettings from the package's public entry point.

pnpm11/lockfile/settings-checker/src/index.ts

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Brittle YAML appends 🐞 Bug ⚙ Maintainability ⭐ New
Description
The new Rust E2E tests modify pnpm-workspace.yaml by raw string concatenation without ensuring a
trailing newline or guarding against duplicate top-level keys, making the tests sensitive to future
harness/YAML formatting changes. This can turn a harmless fixture change into invalid YAML and a
hard-to-debug test failure.
Code

pnpm/crates/cli/tests/lockfile_resolution_reuse.rs[R739-742]

+    fs::write(
+        &workspace_yaml_path,
+        format!("{workspace_yaml}trustLockfile: true\nfetchRetries: 0\nfetchTimeout: 1000\n"),
+    )
Relevance

●●● Strong

Multiple recent PRs accepted making pnpm-workspace.yaml appends newline-safe / using append helper
to avoid brittle YAML.

PR-#13386
PR-#13511
PR-#13563

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new tests append settings by concatenating to the raw YAML string, which assumes the file
already ends with a newline and that the appended keys are not already present. The repo already
provides append_workspace_yaml_key, which explicitly adds a trailing newline and asserts against
duplicate keys, indicating this brittleness is a known hazard in this test suite.

pnpm/crates/cli/tests/lockfile_resolution_reuse.rs[736-748]
pnpm/crates/cli/tests/_utils/mod.rs[79-96]
PR-#13386

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 tests append YAML fragments via `format!("{workspace_yaml}...")`. This is less robust than the test utilities’ `append_workspace_yaml_key`, which (a) ensures the file ends with `\n` before appending and (b) asserts the key doesn’t already exist (pnpm rejects duplicate top-level mapping keys).

### Issue Context
This is test-only, but it increases brittleness: a future change to the harness that writes `pnpm-workspace.yaml` without a trailing newline or already includes one of these keys can cause invalid YAML or duplicate-key rejection.

### Fix Focus Areas
- pnpm/crates/cli/tests/lockfile_resolution_reuse.rs[736-748]
- pnpm/crates/cli/tests/lockfile_resolution_reuse.rs[792-804]

### Suggested change
Replace the direct `fs::write(... format!("{yaml}key: value\n"))` appends with the existing helper(s) from `pnpm/crates/cli/tests/_utils/mod.rs`, e.g.:
- `append_workspace_yaml_key(&workspace, "trustLockfile", "true")`
- `append_workspace_yaml_key(&workspace, "fetchRetries", 0)`
- `append_workspace_yaml_key(&workspace, "fetchTimeout", 1000)`
- `append_workspace_yaml_key(&workspace, "dedupePeers", "true")`

(Or reuse another existing structured helper if there’s a more appropriate one.)

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



Informational

2. Repeated TS lockfile scans 🐞 Bug ➹ Performance
Description
tryFastUpdateSettings evaluates a full predicate once per changed setting via
changedSettings.every(...), so toggling multiple settings can repeatedly walk lockfile.packages
and re-run parseDepPath on every depPath. This can erase some of the intended fast-path win for
large lockfiles.
Code

pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[R33-35]

+  if (opts.changedSettings.length === 0) return false
+  if (!opts.changedSettings.every((setting) => settingCannotAffectLockfile(setting, lockfile, opts))) {
+    return false
Relevance

● Weak

Repository history shows repeated rejection of perf refactors on fast paths as “unnecessary” (PR
#13477).

PR-#13477

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The implementation uses .every() over settings, and the peer predicate traverses all packages and
calls dp.parseDepPath per entry; with multiple peer settings changed, those scans repeat.

pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[29-56]
pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[64-71]

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

### Issue description
`tryFastUpdateSettings()` loops over `changedSettings` with `.every()`. For multiple changed settings in the same group, it repeats the same expensive scans (notably `hasNoPeerDependencies()` which parses every depPath).

### Issue Context
This is on a fast-update path meant to avoid resolution; repeated full scans reduce its benefit and scale poorly with lockfile size.

### Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[29-71]
- pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[73-130]

### Suggested change
1. Pre-classify `opts.changedSettings` into groups:
  - peer group: autoInstallPeers/dedupePeers/peersSuffixMaxLength
  - link group: excludeLinksFromLockfile
  - inject group: injectWorkspacePackages
2. Compute each group predicate once (e.g. `peerless = hasNoPeerDependencies(...)`) and reuse it.
3. Short-circuit quickly if any required predicate is false.
4. Keep the final `lockfile.settings = { ...opts.settings }` mutation only after all checks pass (as today).

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


3. Missing trailing comma in params 📘 Rule violation ⚙ Maintainability
Description
Multi-line TypeScript parameter lists in the lockfile settings checker and newly added fast-update
helper functions omit trailing commas, violating the required formatting rule. This inconsistency
can increase diff noise and lead to noisier future edits.
Code

pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts[R38-41]

export function getOutdatedLockfileSetting (
+  lockfile: LockfileObject,
+  settings: LockfileSettingsInput
+): ChangedField | null {
Relevance

● Weak

Trailing-comma style enforcement has been repeatedly rejected (PR #13477, #13289, #12872).

PR-#13477
PR-#13289
PR-#12872

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713434 mandates trailing commas in multi-line TypeScript constructs, including
function parameter lists. The cited code shows multiple multi-line function signatures where the
last parameter line is not followed by a trailing comma, including getOutdatedLockfileSetting (and
getOutdatedLockfileSettings, plus the generator signature) in getOutdatedLockfileSetting.ts and
settingCannotAffectLockfile (and similar helpers below) in tryFastUpdateSettings.ts,
demonstrating the style violation in both areas.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts[38-41]
pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[41-44]

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

## Issue description
TypeScript multi-line function parameter lists are missing trailing commas in both the lockfile settings checker and the fast update settings helpers, violating the required formatting rule.

## Issue Context
Compliance (PR Compliance ID 713434) requires trailing commas in multi-line TypeScript constructs (including parameter lists) to keep formatting consistent and minimize diff churn/noise.

## Fix Focus Areas
- pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts[38-76]
- pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[41-118]

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


4. Eager drift scan regression 🐞 Bug ➹ Performance
Description
mutateModules now always calls getOutdatedLockfileSettings, materializing every drift check
(deep equality + sorting) even though it typically only needs the first mismatch. This adds
avoidable CPU/allocation overhead on the main install hot path when a mismatch occurs early (large
lockfiles/workspaces pay the most).
Code

pnpm11/installing/deps-installer/src/install/index.ts[R691-694]

+      changedLockfileSettings = getOutdatedLockfileSettings(ctx.wantedLockfile, {
        ...lockfileSettings,
        overrides: overridesMap,
      })
-      if (frozenLockfile && outdatedLockfileSettingName != null) {
-        throw new LockfileConfigMismatchError(outdatedLockfileSettingName!)
Relevance

● Weak

Team often rejects TS hot-path micro-optimizations (e.g., avoid deep clone rejected in PR #13477).

PR-#13477

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
mutateModules eagerly computes the full list of mismatches and then immediately derives the first
mismatch from index 0, while the settings-checker module explicitly exposes a cheaper first-mismatch
API and an all-mismatches API that materializes the full generator (including deep equality and
sorts).

pnpm11/installing/deps-installer/src/install/index.ts[673-742]
pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts[38-59]
pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts[61-113]

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

### Issue description
`mutateModules` currently calls `getOutdatedLockfileSettings()` unconditionally, which fully evaluates the drift generator (including deep equality checks and `.sort()` calls) even when only the first mismatch is needed for control flow.

### Issue Context
`@pnpm/lockfile.settings-checker` now provides both:
- `getOutdatedLockfileSetting()` (first mismatch; documented as cheaper)
- `getOutdatedLockfileSettings()` (all mismatches)

`mutateModules` uses the first mismatch for `outdatedLockfileSettingName`, but only needs the *full list* in limited cases (e.g. to decide whether **all** mismatches are `settings.*`, or to verify “only one field changed” for fast-update eligibility).

### Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/index.ts[673-763]
- pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts[38-113]

### Suggested change
1. Call `getOutdatedLockfileSetting()` first to get `firstMismatch`.
2. Only call `getOutdatedLockfileSettings()` when you truly need the complete list (e.g., when `firstMismatch` is `catalogs`/`overrides`/`settings.*` and you are about to attempt the fast-update path, or when you need to compute `onlyLockfileSettingsChanged`).
3. Keep behavior identical for frozen installs (still throw on the first mismatch).

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


View more (1)
5. Repeated Rust lockfile scans 🐞 Bug ➹ Performance
Description
try_fast_update_settings recomputes expensive predicates once per changed setting (e.g. peerless
checks can traverse the lockfile multiple times) and also builds workspace_package_names even when
no workspace-related setting changed. This multiplies O(n) walks on large lockfiles when multiple
settings drift together.
Code

pnpm/crates/package-manager/src/fast_update_settings.rs[R52-55]

+    let workspace_package_names = workspace_package_names(manifests);
+    if !changed.iter().all(|setting| {
+        setting_cannot_affect_lockfile(*setting, lockfile, manifests, &workspace_package_names)
+    }) {
Relevance

● Weak

Similar “avoid eager/duplicate workspace scan” perf suggestions were rejected (PR #13424, #13173).

PR-#13424
PR-#13173

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The implementation always computes workspace_package_names and then calls
setting_cannot_affect_lockfile for each changed setting; the match arms route multiple peer
settings to the same has_no_peer_dependencies scan and linked/injectable settings to their own
scans, which can repeat for multiple changed settings.

pnpm/crates/package-manager/src/fast_update_settings.rs[43-61]
pnpm/crates/package-manager/src/fast_update_settings.rs[95-112]
pnpm/crates/package-manager/src/fast_update_settings.rs[114-175]

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

### Issue description
`try_fast_update_settings()` iterates over `changed` and calls `setting_cannot_affect_lockfile()` for each entry. When multiple settings in the same group change (e.g. multiple peer settings), the same full-lockfile scans are repeated. It also always computes `workspace_package_names`, even if only peer settings changed.

### Issue Context
This code runs on a fast path meant to avoid full resolution, so redundant O(n) work on large lockfiles can noticeably reduce the benefit.

### Fix Focus Areas
- pnpm/crates/package-manager/src/fast_update_settings.rs[43-61]
- pnpm/crates/package-manager/src/fast_update_settings.rs[95-175]

### Suggested change
1. Determine which predicate groups are needed from `changed` (peer vs linked vs injectable).
2. Compute each expensive predicate at most once (e.g. `peerless = has_no_peer_dependencies(...)`), then validate all settings in that group against the cached result.
3. Only build `workspace_package_names(manifests)` when a linked/injectable predicate is needed.
4. Optional: if both linked and injectable are needed, consider sharing common sub-results like `has_directory_reference` checks.

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


To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Previous review results

Review updated until commit 6f2e231

Results up to commit 28939ab ⚖️ Balanced


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


Informational
1. Repeated TS lockfile scans 🐞 Bug ➹ Performance
Description
tryFastUpdateSettings evaluates a full predicate once per changed setting via
changedSettings.every(...), so toggling multiple settings can repeatedly walk lockfile.packages
and re-run parseDepPath on every depPath. This can erase some of the intended fast-path win for
large lockfiles.
Code

pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[R33-35]

+  if (opts.changedSettings.length === 0) return false
+  if (!opts.changedSettings.every((setting) => settingCannotAffectLockfile(setting, lockfile, opts))) {
+    return false
Relevance

● Weak

Repository history shows repeated rejection of perf refactors on fast paths as “unnecessary” (PR
#13477).

PR-#13477

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The implementation uses .every() over settings, and the peer predicate traverses all packages and
calls dp.parseDepPath per entry; with multiple peer settings changed, those scans repeat.

pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[29-56]
pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[64-71]

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

### Issue description
`tryFastUpdateSettings()` loops over `changedSettings` with `.every()`. For multiple changed settings in the same group, it repeats the same expensive scans (notably `hasNoPeerDependencies()` which parses every depPath).

### Issue Context
This is on a fast-update path meant to avoid resolution; repeated full scans reduce its benefit and scale poorly with lockfile size.

### Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[29-71]
- pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[73-130]

### Suggested change
1. Pre-classify `opts.changedSettings` into groups:
  - peer group: autoInstallPeers/dedupePeers/peersSuffixMaxLength
  - link group: excludeLinksFromLockfile
  - inject group: injectWorkspacePackages
2. Compute each group predicate once (e.g. `peerless = hasNoPeerDependencies(...)`) and reuse it.
3. Short-circuit quickly if any required predicate is false.
4. Keep the final `lockfile.settings = { ...opts.settings }` mutation only after all checks pass (as today).

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


2. Missing trailing comma in params 📘 Rule violation ⚙ Maintainability
Description
Multi-line TypeScript parameter lists in the lockfile settings checker and newly added fast-update
helper functions omit trailing commas, violating the required formatting rule. This inconsistency
can increase diff noise and lead to noisier future edits.
Code

pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts[R38-41]

export function getOutdatedLockfileSetting (
+  lockfile: LockfileObject,
+  settings: LockfileSettingsInput
+): ChangedField | null {
Relevance

● Weak

Trailing-comma style enforcement has been repeatedly rejected (PR #13477, #13289, #12872).

PR-#13477
PR-#13289
PR-#12872

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713434 mandates trailing commas in multi-line TypeScript constructs, including
function parameter lists. The cited code shows multiple multi-line function signatures where the
last parameter line is not followed by a trailing comma, including getOutdatedLockfileSetting (and
getOutdatedLockfileSettings, plus the generator signature) in getOutdatedLockfileSetting.ts and
settingCannotAffectLockfile (and similar helpers below) in tryFastUpdateSettings.ts,
demonstrating the style violation in both areas.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts[38-41]
pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[41-44]

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

## Issue description
TypeScript multi-line function parameter lists are missing trailing commas in both the lockfile settings checker and the fast update settings helpers, violating the required formatting rule.

## Issue Context
Compliance (PR Compliance ID 713434) requires trailing commas in multi-line TypeScript constructs (including parameter lists) to keep formatting consistent and minimize diff churn/noise.

## Fix Focus Areas
- pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts[38-76]
- pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts[41-118]

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


3. Eager drift scan regression 🐞 Bug ➹ Performance
Description
mutateModules now always calls getOutdatedLockfileSettings, materializing every drift check
(deep equality + sorting) even though it typically only needs the first mismatch. This adds
avoidable CPU/allocation overhead on the main install hot path when a mismatch occurs early (large
lockfiles/workspaces pay the most).
Code

pnpm11/installing/deps-installer/src/install/index.ts[R691-694]

+      changedLockfileSettings = getOutdatedLockfileSettings(ctx.wantedLockfile, {
        ...lockfileSettings,
        overrides: overridesMap,
      })
-      if (frozenLockfile && outdatedLockfileSettingName != null) {
-        throw new LockfileConfigMismatchError(outdatedLockfileSettingName!)
Relevance

● Weak

Team often rejects TS hot-path micro-optimizations (e.g., avoid deep clone rejected in PR #13477).

PR-#13477

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
mutateModules eagerly computes the full list of mismatches and then immediately derives the first
mismatch from index 0, while the settings-checker module explicitly exposes a cheaper first-mismatch
API and an all-mismatches API that materializes the full generator (including deep equality and
sorts).

pnpm11/installing/deps-installer/src/install/index.ts[673-742]
pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts[38-59]
pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts[61-113]

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

### Issue description
`mutateModules` currently calls `getOutdatedLockfileSettings()` unconditionally, which fully evaluates the drift generator (including deep equality checks and `.sort()` calls) even when only the first mismatch is needed for control flow.

### Issue Context
`@pnpm/lockfile.settings-checker` now provides both:
- `getOutdatedLockfileSetting()` (first mismatch; documented as cheaper)
- `getOutdatedLockfileSettings()` (all mismatches)

`mutateModules` uses the first mismatch for `outdatedLockfileSettingName`, but only needs the *full list* in limited cases (e.g. to decide whether **all** mismatches are `settings.*`, or to verify “only one field changed” for fast-update eligibility).

### Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/index.ts[673-763]
- pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts[38-113]

### Suggested change
1. Call `getOutdatedLockfileSetting()` first to get `firstMismatch`.
2. Only call `getOutdatedLockfileSettings()` when you truly need the complete list (e.g., when `firstMismatch` is `catalogs`/`overrides`/`settings.*` and you are about to attempt the fast-update path, or when you need to compute `onlyLockfileSettingsChanged`).
3. Keep behavior identical for frozen installs (still throw on the first mismatch).

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


View more (1)
4. Repeated Rust lockfile scans 🐞 Bug ➹ Performance
Description
try_fast_update_settings recomputes expensive predicates once per changed setting (e.g. peerless
checks can traverse the lockfile multiple times) and also builds workspace_package_names even when
no workspace-related setting changed. This multiplies O(n) walks on large lockfiles when multiple
settings drift together.
Code

pnpm/crates/package-manager/src/fast_update_settings.rs[R52-55]

+    let workspace_package_names = workspace_package_names(manifests);
+    if !changed.iter().all(|setting| {
+        setting_cannot_affect_lockfile(*setting, lockfile, manifests, &workspace_package_names)
+    }) {
Relevance

● Weak

Similar “avoid eager/duplicate workspace scan” perf suggestions were rejected (PR #13424, #13173).

PR-#13424
PR-#13173

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The implementation always computes workspace_package_names and then calls
setting_cannot_affect_lockfile for each changed setting; the match arms route multiple peer
settings to the same has_no_peer_dependencies scan and linked/injectable settings to their own
scans, which can repeat for multiple changed settings.

pnpm/crates/package-manager/src/fast_update_settings.rs[43-61]
pnpm/crates/package-manager/src/fast_update_settings.rs[95-112]
pnpm/crates/package-manager/src/fast_update_settings.rs[114-175]

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

### Issue description
`try_fast_update_settings()` iterates over `changed` and calls `setting_cannot_affect_lockfile()` for each entry. When multiple settings in the same group change (e.g. multiple peer settings), the same full-lockfile scans are repeated. It also always computes `workspace_package_names`, even if only peer settings changed.

### Issue Context
This code runs on a fast path meant to avoid full resolution, so redundant O(n) work on large lockfiles can noticeably reduce the benefit.

### Fix Focus Areas
- pnpm/crates/package-manager/src/fast_update_settings.rs[43-61]
- pnpm/crates/package-manager/src/fast_update_settings.rs[95-175]

### Suggested change
1. Determine which predicate groups are needed from `changed` (peer vs linked vs injectable).
2. Compute each expensive predicate at most once (e.g. `peerless = has_no_peer_dependencies(...)`), then validate all settings in that group against the cached result.
3. Only build `workspace_package_names(manifests)` when a linked/injectable predicate is needed.
4. Optional: if both linked and injectable are needed, consider sharing common sub-results like `has_directory_reference` checks.

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


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.

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

Actionable comments posted: 3

🧹 Nitpick comments (10)
pnpm/crates/package-manager/src/fast_update_settings.rs (1)

52-52: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

workspace_package_names runs even when no changed setting needs it.

The three peer settings never read workspace_package_names. A peer-only change still pays a full pass over every manifest and allocates a HashSet<String>. Build it lazily, only when ExcludeLinksFromLockfile or InjectWorkspacePackages is in changed.

♻️ Proposed lazy construction
-    let workspace_package_names = workspace_package_names(manifests);
+    let needs_workspace_names = changed.iter().any(|setting| {
+        matches!(
+            setting,
+            ChangedSetting::ExcludeLinksFromLockfile | ChangedSetting::InjectWorkspacePackages
+        )
+    });
+    let workspace_package_names =
+        if needs_workspace_names { workspace_package_names(manifests) } else { HashSet::new() };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/package-manager/src/fast_update_settings.rs` at line 52, Update
the settings-update flow around workspace_package_names(manifests) to construct
the HashSet lazily only when changed contains ExcludeLinksFromLockfile or
InjectWorkspacePackages. Ensure peer-only changes avoid calling
workspace_package_names and allocating the set, while both dependent setting
paths reuse the lazily created value.
pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts (1)

140-142: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Reuse the shared emptiness check.

isEmpty reimplements a helper the repo already gets from ramda, which getOutdatedLockfileSetting.ts and lockfileFormatConverters.ts both import. Import it instead of adding a local copy.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts` around
lines 140 - 142, Remove the local isEmpty function and import the shared isEmpty
helper from ramda in tryFastUpdateSettings.ts, matching the existing usage in
getOutdatedLockfileSetting.ts and lockfileFormatConverters.ts. Update callers to
use the imported helper without changing behavior.
pnpm11/installing/deps-installer/test/install/settingsFastUpdate.ts (3)

250-263: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Cover the empty changedSettings guard.

updateOptions defaults changedSettings to [], and tryFastUpdateSettings returns false for that input at line 33. No test exercises the default, so the guard is unverified. Add one assertion that an empty changedSettings returns false and leaves lockfile.settings untouched.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/installing/deps-installer/test/install/settingsFastUpdate.ts` around
lines 250 - 263, The test helper updateOptions defaults changedSettings to an
empty array, but this guard is unverified. Add a test assertion invoking
tryFastUpdateSettings with the default updateOptions result that expects false
and confirms lockfile.settings remains unchanged.

219-220: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the settings block before reading through it.

project.readLockfile().settings.dedupePeers throws a TypeError when settings is absent. A regression that stops writing the settings block then reports "Cannot read properties of undefined" instead of naming the failed expectation. Read the lockfile once and assert on the settings object.

💚 Proposed test fix
   expect(requestedPackages).toStrictEqual([])
-  expect(project.readLockfile().settings.dedupePeers).toBe(true)
+  expect(project.readLockfile().settings).toMatchObject({ dedupePeers: true })
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/installing/deps-installer/test/install/settingsFastUpdate.ts` around
lines 219 - 220, Update the test around requestedPackages to read
project.readLockfile() once, assert that its settings object exists before
accessing dedupePeers, then verify settings.dedupePeers is true. This should
make a missing settings block fail at the settings assertion rather than
throwing during property access.

177-193: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add a regression test for an alias declared in two dependency groups.

manifestDependencies in tryFastUpdateSettings.ts merges devDependencies, dependencies, and optionalDependencies into one object, so a duplicate alias keeps only the last specifier. A manifest with devDependencies: { bar: 'link:../bar' } and dependencies: { bar: '^1.0.0' } must still make settings.excludeLinksFromLockfile fall back. No test covers that shape today.

Add the case together with the fix proposed on pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/installing/deps-installer/test/install/settingsFastUpdate.ts` around
lines 177 - 193, Add a regression case alongside the existing
tryFastUpdateSettings tests with the same alias declared in devDependencies and
dependencies using different specifiers, and assert the operation returns false
while lockfile.settings remains undefined. Update tryFastUpdateSettings so
manifestDependencies preserves and evaluates every dependency-group declaration
for duplicate aliases, ensuring an unsafe link causes
settings.excludeLinksFromLockfile to fall back.
pnpm/crates/package-manager/src/install.rs (1)

2672-2712: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The two fast paths cannot compose, and the doc comment does not say so.

try_fast_update_importers(...).or_else(...) runs the settings path only against the original lockfile, never against the importer candidate. If a compatible range change and an inert setting change arrive together, the importer path returns Some, check_lockfile_freshness then fails on the still-stale settings, and the whole fast update is discarded. The behavior is safe — the original lockfile is untouched and the resolver runs — but it is the one case a reader would expect to be handled. State the either/or explicitly.

📝 Proposed doc clarification
 /// affect the recorded graph. The candidate only replaces the loaded
 /// lockfile once it passes every freshness gate, so a handler that
 /// rewrites too much falls back to the resolver instead of committing.
+///
+/// The two handlers are alternatives, not stages: the settings handler
+/// reads the loaded lockfile, not the importer candidate. A run with
+/// both kinds of drift therefore falls back to the resolver.
 async fn try_fast_update_lockfile(opts: FastUpdateLockfileOptions<'_, '_>) -> Option<Lockfile> {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/package-manager/src/install.rs` around lines 2672 - 2712, Clarify
the doc comment for try_fast_update_lockfile to explicitly state that the
fast-update paths are mutually exclusive: it attempts either the importer
rewrite or the settings rewrite, not a composition of both. Preserve the
existing or_else behavior and fallback to full resolution when the selected
candidate fails freshness checks.
pnpm/crates/lockfile/src/freshness.rs (1)

497-541: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Helper naming mixes two contracts.

auto_install_peers_changed and exclude_links_from_lockfile_changed return "changed", while recorded_dedupe_peers, recorded_peers_suffix_max_length, and recorded_inject_workspace_packages return the recorded value. The asymmetry is intentional: the first two only compare when the lockfile records a settings block, and the last three normalize an absent value to a default. That reason is not stated in the shared doc comment. State it once so a caller does not assume a missing *_changed helper for the other three settings.

📝 Proposed doc clarification
 /// This and its four peers below are the single definition of "this
 /// lockfile setting changed", shared with the fast path that records a
 /// provably inert setting change without re-resolving.
+///
+/// Two shapes exist on purpose. `autoInstallPeers` and
+/// `excludeLinksFromLockfile` compare only when the lockfile records a
+/// `settings` block, so they expose a `*_changed` predicate. The other
+/// three normalize an absent value to a default, so they expose the
+/// recorded value and the caller compares it.
 #[must_use]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/lockfile/src/freshness.rs` around lines 497 - 541, Clarify the
shared documentation above auto_install_peers_changed to explicitly state that
the first two helpers return whether a recorded setting differs, while the
remaining three return normalized recorded values because absent settings use
defaults; note that this intentional asymmetry means no *_changed helper exists
for the latter settings.
pnpm/crates/cli/tests/lockfile_resolution_reuse.rs (1)

596-628: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the duplicated fixture setup.

Lines 596-628 and 652-683 are the same block apart from the dependency name: write package.json, append trustLockfile/fetchRetries/fetchTimeout, run the first install, append dedupePeers: true, then rewrite .npmrc with a dead registry. Extract one helper taking the dependency specifier so the two tests differ only in the fixture and the assertion.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/cli/tests/lockfile_resolution_reuse.rs` around lines 596 - 628,
Extract the repeated fixture setup around the package.json write, workspace
configuration updates, initial install, and dead-registry .npmrc rewrite into a
shared helper accepting the dependency specifier. Update both affected tests to
call this helper so each test retains only its dependency-specific fixture input
and assertion, preserving the existing setup behavior.
pnpm/crates/package-manager/src/fast_update_settings/tests.rs (1)

278-290: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add the two default-normalization cases.

reports_no_update_when_the_settings_match covers an exact match only. Two normalization paths decide whether changed_settings fires at all, and neither is exercised:

  1. A lockfile with no settings: block. auto_install_peers_changed(None, _) returns false, so a flipped autoInstallPeers is invisible and no candidate is produced. That is deliberate parity with the freshness gate, and a test would pin it.
  2. peers_suffix_max_length: Some(1000) recorded against None in the new settings. recorded_peers_suffix_max_length normalizes both to the default, so this must report no change.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/package-manager/src/fast_update_settings/tests.rs` around lines
278 - 290, Add tests alongside reports_no_update_when_the_settings_match
covering both normalization paths: a lockfile without a settings block with
flipped autoInstallPeers that produces no candidate, and recorded
peers_suffix_max_length set to Some(1000) versus new settings None that also
produces no change. Reuse the existing manifest, lockfile, recorded settings,
and try_fast_update_settings helpers while asserting the result is None.
pnpm11/installing/deps-installer/src/install/index.ts (1)

741-753: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

The settings-only path is blocked by an unrelated catalog condition.

Line 753 requires changedSetting === 'catalogs' || !overridesUseCatalogs. When only settings changed, changedSetting holds a settings.* field, so the fast update is refused whenever any override uses a catalog: specifier. That guard exists for the overrides handler, which re-resolves overrides and therefore must see catalog-resolved specifiers. tryFastUpdateSettings reads no overrides and no catalogs, so the condition does not apply to it. The result is a silent fallback to full resolution in workspaces that use catalog overrides.

Also, onlyChangedSetting now means "the update handler can run", not "one setting changed". Rename it to match.

🐛 Proposed fix
-      const onlyChangedSetting = onlyLockfileSettingsChanged || changedLockfileSettings.length <= 1
+      const canRunFastUpdateHandler = onlyLockfileSettingsChanged || changedLockfileSettings.length <= 1
       const isLockfileUpToDate = (lockfile: LockfileObject) => allProjectsAreUpToDate(Object.values(ctx.projects), {
@@
       if (
-        onlyChangedSetting &&
-        (changedSetting === 'catalogs' || !overridesUseCatalogs) &&
+        canRunFastUpdateHandler &&
+        (onlyLockfileSettingsChanged || changedSetting === 'catalogs' || !overridesUseCatalogs) &&
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/installing/deps-installer/src/install/index.ts` around lines 741 -
753, Update the fast-update branching around `onlyChangedSetting` and
`isLockfileUpToDate` so the settings-only handler `tryFastUpdateSettings` is not
gated by `changedSetting === 'catalogs' || !overridesUseCatalogs`; retain that
catalog guard only for the overrides handler that resolves catalog specifiers.
Rename `onlyChangedSetting` to reflect that it indicates the eligible update
handler can run, and preserve the existing catalog behavior for non-settings
updates.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm/crates/cli/tests/lockfile_resolution_reuse.rs`:
- Around line 675-690: In
peer_setting_change_falls_back_when_the_lockfile_records_peers, remove the
dead_registry URL rewrite before the second
pacquet_at(&workspace).with_arg("install") invocation. Keep the mocked registry
live so metadata for `@pnpm.e2e/has-optional-peer-with-peer` can be rechecked,
while preserving the existing assertion that the “Lockfile is up to date,
resolution step is skipped” message is absent.

In `@pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts`:
- Around line 132-138: Update manifestDependencies to return every dependency
entry from devDependencies, dependencies, and optionalDependencies without
merging them into one object, preserving duplicate aliases with each group’s
specifier. Keep the existing [string, string] return shape and ensure
hasNoLinkedDependencies receives all entries, matching the Rust
manifest.dependencies(DEPENDENCY_GROUPS) behavior.

In `@pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts`:
- Around line 86-88: Update the ignoredOptionalDependencies comparison in
getOutdatedLockfileSettings to sort copied arrays rather than mutating
lockfile.ignoredOptionalDependencies or ignoredOptionalDependencies; preserve
the existing nullish-empty-array handling and equality behavior.

---

Nitpick comments:
In `@pnpm/crates/cli/tests/lockfile_resolution_reuse.rs`:
- Around line 596-628: Extract the repeated fixture setup around the
package.json write, workspace configuration updates, initial install, and
dead-registry .npmrc rewrite into a shared helper accepting the dependency
specifier. Update both affected tests to call this helper so each test retains
only its dependency-specific fixture input and assertion, preserving the
existing setup behavior.

In `@pnpm/crates/lockfile/src/freshness.rs`:
- Around line 497-541: Clarify the shared documentation above
auto_install_peers_changed to explicitly state that the first two helpers return
whether a recorded setting differs, while the remaining three return normalized
recorded values because absent settings use defaults; note that this intentional
asymmetry means no *_changed helper exists for the latter settings.

In `@pnpm/crates/package-manager/src/fast_update_settings.rs`:
- Line 52: Update the settings-update flow around
workspace_package_names(manifests) to construct the HashSet lazily only when
changed contains ExcludeLinksFromLockfile or InjectWorkspacePackages. Ensure
peer-only changes avoid calling workspace_package_names and allocating the set,
while both dependent setting paths reuse the lazily created value.

In `@pnpm/crates/package-manager/src/fast_update_settings/tests.rs`:
- Around line 278-290: Add tests alongside
reports_no_update_when_the_settings_match covering both normalization paths: a
lockfile without a settings block with flipped autoInstallPeers that produces no
candidate, and recorded peers_suffix_max_length set to Some(1000) versus new
settings None that also produces no change. Reuse the existing manifest,
lockfile, recorded settings, and try_fast_update_settings helpers while
asserting the result is None.

In `@pnpm/crates/package-manager/src/install.rs`:
- Around line 2672-2712: Clarify the doc comment for try_fast_update_lockfile to
explicitly state that the fast-update paths are mutually exclusive: it attempts
either the importer rewrite or the settings rewrite, not a composition of both.
Preserve the existing or_else behavior and fallback to full resolution when the
selected candidate fails freshness checks.

In `@pnpm11/installing/deps-installer/src/install/index.ts`:
- Around line 741-753: Update the fast-update branching around
`onlyChangedSetting` and `isLockfileUpToDate` so the settings-only handler
`tryFastUpdateSettings` is not gated by `changedSetting === 'catalogs' ||
!overridesUseCatalogs`; retain that catalog guard only for the overrides handler
that resolves catalog specifiers. Rename `onlyChangedSetting` to reflect that it
indicates the eligible update handler can run, and preserve the existing catalog
behavior for non-settings updates.

In `@pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts`:
- Around line 140-142: Remove the local isEmpty function and import the shared
isEmpty helper from ramda in tryFastUpdateSettings.ts, matching the existing
usage in getOutdatedLockfileSetting.ts and lockfileFormatConverters.ts. Update
callers to use the imported helper without changing behavior.

In `@pnpm11/installing/deps-installer/test/install/settingsFastUpdate.ts`:
- Around line 250-263: The test helper updateOptions defaults changedSettings to
an empty array, but this guard is unverified. Add a test assertion invoking
tryFastUpdateSettings with the default updateOptions result that expects false
and confirms lockfile.settings remains unchanged.
- Around line 219-220: Update the test around requestedPackages to read
project.readLockfile() once, assert that its settings object exists before
accessing dedupePeers, then verify settings.dedupePeers is true. This should
make a missing settings block fail at the settings assertion rather than
throwing during property access.
- Around line 177-193: Add a regression case alongside the existing
tryFastUpdateSettings tests with the same alias declared in devDependencies and
dependencies using different specifiers, and assert the operation returns false
while lockfile.settings remains undefined. Update tryFastUpdateSettings so
manifestDependencies preserves and evaluates every dependency-group declaration
for duplicate aliases, ensuring an unsafe link causes
settings.excludeLinksFromLockfile to fall back.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: af1aaa6a-d38b-43cb-9f60-6075382964f5

📥 Commits

Reviewing files that changed from the base of the PR and between 641ccd3 and 28939ab.

📒 Files selected for processing (13)
  • .changeset/inert-lockfile-setting-updates.md
  • pnpm/crates/cli/tests/lockfile_resolution_reuse.rs
  • pnpm/crates/lockfile/src/freshness.rs
  • pnpm/crates/package-manager/src/fast_update_settings.rs
  • pnpm/crates/package-manager/src/fast_update_settings/tests.rs
  • pnpm/crates/package-manager/src/install.rs
  • pnpm/crates/package-manager/src/lib.rs
  • pnpm11/installing/deps-installer/src/install/index.ts
  • pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts
  • pnpm11/installing/deps-installer/test/install/settingsFastUpdate.ts
  • pnpm11/lockfile/fs/src/lockfileFormatConverters.ts
  • pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts
  • pnpm11/lockfile/settings-checker/src/index.ts

@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.02     12.1±0.25ms    31.0 MB/sec    1.00     11.8±0.34ms    31.6 MB/sec
packument/parse                                  1.03     38.8±0.38µs  1711.4 MB/sec    1.00     37.7±0.25µs  1758.1 MB/sec
tarball/download_dependency                      1.00      2.3±0.15ms  1908.1 KB/sec    1.11      2.5±0.19ms  1721.0 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00   197.2±10.11ms 81.1 KElem/sec    1.07   211.0±13.70ms 75.8 KElem/sec
workspace_resolution/hoist_heavy                 1.07   325.1±34.89ms        ? ?/sec    1.00   302.5±26.41ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Aug 3, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13600      +/-   ##
==========================================
+ Coverage   88.13%   88.15%   +0.01%     
==========================================
  Files         611      612       +1     
  Lines       99274    99579     +305     
==========================================
+ Hits        87495    87780     +285     
- Misses      11779    11799      +20     

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

@blacksmith-sh

This comment has been minimized.

@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 7be3379610a1

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.646 ± 0.134 2.418 2.811 1.71 ± 0.20
pacquet@main 2.648 ± 0.170 2.430 2.882 1.72 ± 0.21
pnpr@HEAD 1.582 ± 0.168 1.402 1.839 1.03 ± 0.15
pnpr@main 1.543 ± 0.159 1.392 1.792 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6456976078600003,
      "stddev": 0.13412384843309186,
      "median": 2.7056099063600003,
      "user": 1.8105180399999998,
      "system": 1.45511642,
      "min": 2.4175750913600003,
      "max": 2.8112406893600004,
      "times": [
        2.4175750913600003,
        2.69342682236,
        2.72717201736,
        2.8112406893600004,
        2.7505904233600003,
        2.7177929903600004,
        2.5364950593600004,
        2.54280079436,
        2.49892091436,
        2.76096127636
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.64768664206,
      "stddev": 0.17016351619680173,
      "median": 2.6785565708600005,
      "user": 1.95348814,
      "system": 1.5039898199999997,
      "min": 2.4299629563600003,
      "max": 2.8818181783600005,
      "times": [
        2.6920527233600002,
        2.71950101136,
        2.4885466553600004,
        2.84011518336,
        2.6650604183600004,
        2.46444966536,
        2.4299629563600003,
        2.8135439923600005,
        2.8818181783600005,
        2.4818156363600004
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5819891827600001,
      "stddev": 0.1679074728365715,
      "median": 1.55038961386,
      "user": 1.2628683399999998,
      "system": 1.31509932,
      "min": 1.40217072836,
      "max": 1.8393409173600002,
      "times": [
        1.41176674536,
        1.4163760623600001,
        1.8393409173600002,
        1.4551029583600001,
        1.40217072836,
        1.66322675936,
        1.76578020736,
        1.60814728936,
        1.49263193836,
        1.76534822136
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5433358120599998,
      "stddev": 0.15895091920790008,
      "median": 1.48283613486,
      "user": 1.2516179400000003,
      "system": 1.32140412,
      "min": 1.39175575436,
      "max": 1.79226373036,
      "times": [
        1.39175575436,
        1.61802477836,
        1.39654670336,
        1.48309742936,
        1.79226373036,
        1.48257484036,
        1.39691870636,
        1.66666303836,
        1.42346398636,
        1.78204915336
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 295.6 ± 10.0 280.1 310.1 1.04 ± 0.07
pacquet@main 284.6 ± 15.3 253.7 306.5 1.00
pnpr@HEAD 298.9 ± 10.6 281.2 312.8 1.05 ± 0.07
pnpr@main 300.5 ± 10.1 281.3 314.9 1.06 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.29562228644000005,
      "stddev": 0.010005966584734781,
      "median": 0.2946956016400001,
      "user": 0.22350854,
      "system": 0.5999013200000001,
      "min": 0.28013173414000003,
      "max": 0.31009366514000003,
      "times": [
        0.31009366514000003,
        0.29501818714000005,
        0.30486204214000007,
        0.28694425814,
        0.29437301614000005,
        0.28529096114,
        0.30870927614000004,
        0.29305626514000005,
        0.28013173414000003,
        0.29774345914000006
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.28462014644000005,
      "stddev": 0.015348070923340016,
      "median": 0.28642158864,
      "user": 0.24192043999999996,
      "system": 0.56919842,
      "min": 0.25373394314000003,
      "max": 0.30648582314000006,
      "times": [
        0.26667036714000003,
        0.28617691614,
        0.28535390914000003,
        0.25373394314000003,
        0.28103306914000004,
        0.28817772114000006,
        0.28666626114000004,
        0.28977401914000006,
        0.30212943514,
        0.30648582314000006
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29891320874000005,
      "stddev": 0.010555205574879902,
      "median": 0.29889473214000006,
      "user": 0.25110924,
      "system": 0.5481172200000001,
      "min": 0.28120194814000005,
      "max": 0.31282021114,
      "times": [
        0.31107832714000005,
        0.30993921314000006,
        0.30197319814000007,
        0.29388910114000005,
        0.28120194814000005,
        0.29405952214000003,
        0.28638110214000007,
        0.30122250914000004,
        0.31282021114,
        0.29656695514000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30045005404,
      "stddev": 0.010104322048257121,
      "median": 0.30197165064000003,
      "user": 0.24295483999999995,
      "system": 0.58441792,
      "min": 0.28131829814000003,
      "max": 0.31486133114000003,
      "times": [
        0.31486133114000003,
        0.29854902314000004,
        0.29334348914,
        0.30020335114,
        0.30957141714,
        0.30728877014000006,
        0.30606728114000004,
        0.30373995014000005,
        0.28955762914000005,
        0.28131829814000003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.675 ± 0.025 2.650 2.710 1.69 ± 0.14
pacquet@main 2.679 ± 0.031 2.629 2.719 1.70 ± 0.14
pnpr@HEAD 1.579 ± 0.131 1.454 1.817 1.00
pnpr@main 1.600 ± 0.158 1.458 1.893 1.01 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.67453689714,
      "stddev": 0.02504961963556431,
      "median": 2.66328723634,
      "user": 1.66789204,
      "system": 1.4492446399999999,
      "min": 2.64979074684,
      "max": 2.70990660984,
      "times": [
        2.68609198284,
        2.6577006538399996,
        2.6510162878399997,
        2.7078662048399997,
        2.7045465958399997,
        2.65187541684,
        2.70990660984,
        2.64979074684,
        2.65906307284,
        2.66751139984
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.6792536611399997,
      "stddev": 0.031018758797604795,
      "median": 2.66998676984,
      "user": 1.7044325400000002,
      "system": 1.4485684399999998,
      "min": 2.6290211868399997,
      "max": 2.71932316984,
      "times": [
        2.66709450984,
        2.6290211868399997,
        2.71822317684,
        2.67287902984,
        2.65856985984,
        2.71932316984,
        2.65597430184,
        2.69159023784,
        2.66278680884,
        2.71707432984
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.57858894104,
      "stddev": 0.1308400136859533,
      "median": 1.5430513648400002,
      "user": 1.09334544,
      "system": 1.18653094,
      "min": 1.4542029248400001,
      "max": 1.81690579984,
      "times": [
        1.4542029248400001,
        1.7810194408400002,
        1.5848565378400001,
        1.4581234338400002,
        1.48969039884,
        1.50767602384,
        1.6364061818400002,
        1.81690579984,
        1.47858196284,
        1.57842670584
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.60012947504,
      "stddev": 0.15808117157355084,
      "median": 1.53721516234,
      "user": 1.11988244,
      "system": 1.2102572399999998,
      "min": 1.4578546948400002,
      "max": 1.8929366858400003,
      "times": [
        1.47855566284,
        1.8929366858400003,
        1.7348829728400001,
        1.5405661668400001,
        1.53386415784,
        1.5173042648400001,
        1.4578546948400002,
        1.8242880858400001,
        1.5599412338400003,
        1.4611008248400001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 429.1 ± 29.5 387.8 479.0 1.39 ± 0.10
pacquet@main 400.6 ± 16.9 366.9 426.1 1.29 ± 0.07
pnpr@HEAD 309.7 ± 9.1 293.1 320.7 1.00
pnpr@main 319.3 ± 33.6 293.9 386.0 1.03 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.42907730712000003,
      "stddev": 0.029482517329347206,
      "median": 0.42711043562000006,
      "user": 0.5599601799999999,
      "system": 0.71939374,
      "min": 0.38777123962000004,
      "max": 0.47897560162,
      "times": [
        0.46091914362,
        0.43133658762000004,
        0.44095516062,
        0.45169998762,
        0.47897560162,
        0.41791171262000004,
        0.42288428362,
        0.39818262562,
        0.38777123962000004,
        0.40013672862000005
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.40064322512000006,
      "stddev": 0.01694577990617853,
      "median": 0.40019650162000003,
      "user": 0.5320635799999999,
      "system": 0.6869614399999999,
      "min": 0.36693909162000005,
      "max": 0.42614616362,
      "times": [
        0.40371578862,
        0.40777837462000005,
        0.39869671862,
        0.39373256462,
        0.36693909162000005,
        0.38641978962,
        0.42261075662,
        0.42614616362,
        0.40086426662,
        0.39952873662000005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30966532431999994,
      "stddev": 0.009130229525242629,
      "median": 0.31190094862,
      "user": 0.20785258,
      "system": 0.52785514,
      "min": 0.29306573462,
      "max": 0.32072497662,
      "times": [
        0.29306573462,
        0.29773279662,
        0.30365305362,
        0.31458499362000003,
        0.31167819662,
        0.31655782062000004,
        0.30751618162,
        0.31212370062,
        0.32072497662,
        0.31901578862
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.31927053082,
      "stddev": 0.0336339123626865,
      "median": 0.30544254762,
      "user": 0.19920098,
      "system": 0.54632584,
      "min": 0.29389627762000003,
      "max": 0.38604817562000004,
      "times": [
        0.30521333762,
        0.31364765862,
        0.29560964362000003,
        0.38604817562000004,
        0.37809711162000004,
        0.30222100862,
        0.30408525162,
        0.30567175762000004,
        0.30821508562,
        0.29389627762000003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.808 ± 0.045 1.752 1.864 6.01 ± 0.24
pacquet@main 1.754 ± 0.014 1.731 1.775 5.83 ± 0.19
pnpr@HEAD 0.316 ± 0.006 0.310 0.329 1.05 ± 0.04
pnpr@main 0.301 ± 0.009 0.287 0.315 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8084646466000003,
      "stddev": 0.04549863322436167,
      "median": 1.7930379683,
      "user": 0.8331705999999999,
      "system": 0.8133148799999999,
      "min": 1.7523587303000001,
      "max": 1.8643970233,
      "times": [
        1.7523587303000001,
        1.7721176333000002,
        1.8587165423,
        1.8498241633,
        1.8643970233,
        1.7934641963,
        1.8642317403000002,
        1.7926117403,
        1.7660966163,
        1.7708280803
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.7543256242000003,
      "stddev": 0.01361536986266094,
      "median": 1.7548412158,
      "user": 0.7694848000000001,
      "system": 0.7663144799999999,
      "min": 1.7306656293000002,
      "max": 1.7745215973000001,
      "times": [
        1.7549474503,
        1.7661910053,
        1.7547349813,
        1.7745215973000001,
        1.7560409453,
        1.7504365783,
        1.7680671093,
        1.7519491633,
        1.7357017823,
        1.7306656293000002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3164765566,
      "stddev": 0.006109581354590091,
      "median": 0.3147658473,
      "user": 0.1998401,
      "system": 0.5508246799999998,
      "min": 0.3095545693,
      "max": 0.3291622973,
      "times": [
        0.3136412813,
        0.31208526430000005,
        0.31086487230000004,
        0.3095545693,
        0.31273999430000005,
        0.32294420730000006,
        0.31589041330000006,
        0.31896856530000006,
        0.3291622973,
        0.31891410130000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3007764164000001,
      "stddev": 0.009374656993809256,
      "median": 0.29910232180000007,
      "user": 0.1908154,
      "system": 0.5126133799999999,
      "min": 0.28670584130000004,
      "max": 0.31456925030000005,
      "times": [
        0.29900718630000006,
        0.29857091030000005,
        0.2883500043,
        0.2963468463,
        0.28670584130000004,
        0.2991974573,
        0.30307778830000004,
        0.3093697093,
        0.31456925030000005,
        0.31256917030000003
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 184.3 ± 7.0 177.8 202.7 2.04 ± 0.10
pacquet@main 190.2 ± 5.6 181.6 201.6 2.11 ± 0.09
pnpr@HEAD 90.4 ± 2.6 85.8 96.9 1.00
pnpr@main 90.5 ± 1.9 86.6 94.2 1.00 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.18428508824,
      "stddev": 0.00697745702824952,
      "median": 0.18091534624000002,
      "user": 0.16901589,
      "system": 0.07014460749999998,
      "min": 0.17777188624,
      "max": 0.20269170724000002,
      "times": [
        0.18103891524000001,
        0.18079177724000003,
        0.18337898924,
        0.18004959024000003,
        0.17978255524000003,
        0.17780554924000003,
        0.17777188624,
        0.18484576624000001,
        0.18526893924,
        0.18029352224000003,
        0.17957651424,
        0.18035238424000002,
        0.19504252524000001,
        0.20269170724000002,
        0.19226600524,
        0.18760478524000002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.1902376015971429,
      "stddev": 0.005553639829078079,
      "median": 0.19011732924000002,
      "user": 0.17780235428571428,
      "system": 0.06851727714285713,
      "min": 0.18158882824000003,
      "max": 0.20162131024000002,
      "times": [
        0.19791662124000003,
        0.19253526524000003,
        0.18916478924000002,
        0.19514150324,
        0.19032757324000002,
        0.19085557324000002,
        0.20162131024000002,
        0.18729783224000002,
        0.18990708524000002,
        0.18241635424000002,
        0.19218523224000003,
        0.18158882824000003,
        0.18590522324000003,
        0.18646323124000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09037076496727273,
      "stddev": 0.002617479327404652,
      "median": 0.09050967024,
      "user": 0.02216289757575757,
      "system": 0.010953770909090908,
      "min": 0.08582620724000001,
      "max": 0.09693791024000001,
      "times": [
        0.08595376024,
        0.08966630224,
        0.09530138024,
        0.09220563324,
        0.08986061124,
        0.08762087824,
        0.08864164324,
        0.08582620724000001,
        0.09050967024,
        0.08777782524,
        0.08791737024,
        0.09129540024,
        0.09195021124,
        0.09247136824,
        0.09150339424000001,
        0.09089429924,
        0.09357651124000001,
        0.09186233424,
        0.09000076624,
        0.09693791024000001,
        0.08788591024,
        0.09149331524,
        0.09173049424,
        0.09367955724,
        0.09222360824,
        0.09103244224,
        0.09000684824,
        0.08860862824,
        0.09204615224,
        0.09014809624,
        0.08664765524,
        0.08662332724,
        0.08833573224
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.09048935317548386,
      "stddev": 0.0018980945846216399,
      "median": 0.09037116824000001,
      "user": 0.022487656129032255,
      "system": 0.010444774838709677,
      "min": 0.08661151624,
      "max": 0.09415253324,
      "times": [
        0.09158557024,
        0.09244743324,
        0.09008742124,
        0.09205747324,
        0.09258797924,
        0.09092402624,
        0.09209196924,
        0.09037116824000001,
        0.08840427224,
        0.09165492124,
        0.09118368824,
        0.09415253324,
        0.08929560124000001,
        0.09131146024,
        0.08723857324,
        0.09122750124000001,
        0.08887152724,
        0.08968317624,
        0.08875455624,
        0.08977735424,
        0.08729881824,
        0.08661151624,
        0.09328185424,
        0.09275403324,
        0.08936972224,
        0.08954336124000001,
        0.09036381424,
        0.09202826824,
        0.09017852324,
        0.08773277024000001,
        0.09229906124000001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 905.8 ± 187.8 652.2 1131.5 1.00
pacquet@main 950.2 ± 252.9 632.0 1330.2 1.05 ± 0.35
pnpm@HEAD 3522.1 ± 280.9 3174.0 3952.6 3.89 ± 0.86
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.9057797755711111,
      "stddev": 0.18776787532736652,
      "median": 0.86553462546,
      "user": 0.8521353466666666,
      "system": 0.18099285555555555,
      "min": 0.65220142146,
      "max": 1.13150354046,
      "times": [
        1.13150354046,
        0.80126273746,
        1.1226139484600002,
        0.65220142146,
        1.0958405154600002,
        0.86553462546,
        0.80804348346,
        0.6758871454600001,
        0.9991305624600001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.9502405686822222,
      "stddev": 0.25285010914036543,
      "median": 0.8802322114600001,
      "user": 0.87112568,
      "system": 0.20986774444444445,
      "min": 0.63196568346,
      "max": 1.3302046234600002,
      "times": [
        1.3302046234600002,
        0.86315471546,
        0.63196568346,
        0.8802322114600001,
        1.10859280546,
        0.73047118846,
        1.29497309546,
        1.00366084546,
        0.7089099494600001
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.5220913171266677,
      "stddev": 0.28091825315005525,
      "median": 3.62639433046,
      "user": 5.405131791111112,
      "system": 0.3195197444444445,
      "min": 3.17395018246,
      "max": 3.95261610946,
      "times": [
        3.75516843146,
        3.31109928146,
        3.69825060546,
        3.95261610946,
        3.6846844944600003,
        3.62639433046,
        3.3103169294600003,
        3.17395018246,
        3.18634148946
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.633 ± 0.152 4.487 4.891 1.30 ± 0.06
pacquet@main 4.583 ± 0.132 4.488 4.888 1.28 ± 0.06
pnpr@HEAD 3.574 ± 0.128 3.473 3.809 1.00
pnpr@main 3.624 ± 0.093 3.482 3.787 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.632609884300001,
      "stddev": 0.15213746896229055,
      "median": 4.5646772986,
      "user": 1.9685165999999998,
      "system": 1.44904394,
      "min": 4.4870115856,
      "max": 4.891237037600001,
      "times": [
        4.5127723556,
        4.4870115856,
        4.5295652506,
        4.840802997600001,
        4.5115602806,
        4.7993608296,
        4.5561212886,
        4.891237037600001,
        4.6244339086,
        4.573233308600001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.5834205934000005,
      "stddev": 0.13169282813125002,
      "median": 4.5240009371,
      "user": 1.9821528999999998,
      "system": 1.4855580399999997,
      "min": 4.4877247456000005,
      "max": 4.8883331376,
      "times": [
        4.561875912600001,
        4.5062930026000005,
        4.4981950496000005,
        4.8883331376,
        4.5166842176,
        4.7510685266,
        4.4877247456000005,
        4.579970005600001,
        4.512743679600001,
        4.531317656600001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5739148192,
      "stddev": 0.1281710865595391,
      "median": 3.5134676856000002,
      "user": 1.2690579000000002,
      "system": 1.2998615399999998,
      "min": 3.4729069726,
      "max": 3.8093066086,
      "times": [
        3.8093066086,
        3.4856440576,
        3.4833280116,
        3.6468348066,
        3.4932447926,
        3.4729069726,
        3.4887972496,
        3.7847388476,
        3.5336905786,
        3.5406562666
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.6236275416,
      "stddev": 0.09330757552029495,
      "median": 3.6387949645999997,
      "user": 1.3088016000000002,
      "system": 1.2628657399999998,
      "min": 3.4817342566,
      "max": 3.7870838596,
      "times": [
        3.5619599766,
        3.6995659266,
        3.5482365685999997,
        3.6837838636,
        3.5246079336,
        3.4817342566,
        3.6440744796,
        3.6717131016,
        3.7870838596,
        3.6335154496
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13600
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,649.79 ms
(-3.33%)Baseline: 2,741.17 ms
3,289.41 ms
(80.56%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,752.36 ms
(-4.39%)Baseline: 1,832.91 ms
2,199.49 ms
(79.67%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
387.77 ms
(-18.19%)Baseline: 474.01 ms
568.81 ms
(68.17%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
177.77 ms
(-18.46%)Baseline: 218.02 ms
261.63 ms
(67.95%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,417.58 ms
(-2.44%)Baseline: 2,478.02 ms
2,973.62 ms
(81.30%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,487.01 ms
(-0.78%)Baseline: 4,522.42 ms
5,426.91 ms
(82.68%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
280.13 ms
(-8.70%)Baseline: 306.81 ms
368.18 ms
(76.09%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
652.20 ms
(-11.84%)Baseline: 739.76 ms
887.71 ms
(73.47%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13600
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,454.20 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
309.55 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
293.07 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
85.83 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,402.17 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,472.91 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
281.20 ms
🐰 View full continuous benchmarking report in Bencher

zkochan added 3 commits August 6, 2026 12:45
Changing `autoInstallPeers`, `dedupePeers`, `peersSuffixMaxLength`,
`excludeLinksFromLockfile`, or `injectWorkspacePackages` forced a full
dependency resolution even when the lockfile already proved the setting
had nothing to act on: an install with no peer dependencies anywhere,
or one where no project depends on a directory or on another workspace
project.

Both stacks now stage the new `settings` block on a candidate lockfile
and commit it only when every changed setting passes its own predicate
and the candidate still satisfies the existing freshness and resolution
validation. Anything else — a peer-suffixed depPath, a package or
project declaring peers, a `link:` / `file:` / workspace dependency, an
already-injected dependency — falls back to the resolver untouched.

The predicates that decide "this setting changed" now live in one place
per stack, so the fast path and the staleness check cannot drift:
`getOutdatedLockfileSettings` (which also reports every changed field,
letting the coordinator drop its neutralize-and-recompare dance) and
the comparison helpers in pacquet's `freshness` module.

Continues #13474.
`manifestDependencies` merged the three dependency groups into one
object, so an alias declared in two groups kept only one specifier. A
`link:` dependency shadowed by a plain range under the same alias then
looked like a registry dependency, and `excludeLinksFromLockfile` or
`injectWorkspacePackages` took the fast path over a graph the setting
does affect. Return every entry, matching pacquet's
`manifest.dependencies(DEPENDENCY_GROUPS)`.

Comparing `ignoredOptionalDependencies` sorted both the recorded and the
configured arrays in place. The configured array feeds `createMatcher`,
which is order-sensitive: sorting moves an `!` exclusion ahead of the
pattern it excludes from and inverts which optional dependencies are
ignored. Compare copies instead. pacquet already clones before sorting,
so this only affects the TypeScript CLI.

Keep the mocked registry reachable in the resolution-fallback test. The
install under test has to resolve, so pointing it at a dead registry
only asserted that the resolve happened to be satisfiable offline.

Reported by CodeRabbit on #13600.
Copilot AI review requested due to automatic review settings August 6, 2026 11: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.

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

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 7be3379

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

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

🧹 Nitpick comments (1)
pnpm11/lockfile/settings-checker/test/getOutdatedLockfileSettings.test.ts (1)

13-32: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Cover reordered negated patterns.

The order-independent test uses only literal package names. The later comment states that ignoredOptionalDependencies supports order-sensitive ! patterns. Add a case that compares ['*', '!foo'] with ['!foo', '*'] and asserts an ignoredOptionalDependencies mismatch. Otherwise, the suite can pass while a semantically different matcher is treated as equal.

If order-only changes are intentionally equivalent for freshness, add an integration assertion that proves the resolver produces the same lockfile graph.

Based on path instructions, unsafe setting combinations require meaningful regression coverage.

Proposed regression case
+test('ignoredOptionalDependencies reports reordered patterns', () => {
+  const lockfile = emptyLockfile({ ignoredOptionalDependencies: ['*', '!foo'] })
+
+  expect(getOutdatedLockfileSettings(lockfile, { ignoredOptionalDependencies: ['!foo', '*'] }))
+    .toContain('ignoredOptionalDependencies')
+})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm11/lockfile/settings-checker/test/getOutdatedLockfileSettings.test.ts`
around lines 13 - 32, Add a regression test alongside the existing
ignoredOptionalDependencies tests that compares recorded ['*', '!foo'] against
configured ['!foo', '*'] and asserts getOutdatedLockfileSettings reports an
ignoredOptionalDependencies mismatch. Preserve the existing order-preservation
test and avoid changing order-sensitivity behavior unless adding integration
coverage proves both configurations resolve to the same lockfile graph.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pnpm11/lockfile/settings-checker/test/getOutdatedLockfileSettings.test.ts`:
- Around line 13-32: Add a regression test alongside the existing
ignoredOptionalDependencies tests that compares recorded ['*', '!foo'] against
configured ['!foo', '*'] and asserts getOutdatedLockfileSettings reports an
ignoredOptionalDependencies mismatch. Preserve the existing order-preservation
test and avoid changing order-sensitivity behavior unless adding integration
coverage proves both configurations resolve to the same lockfile graph.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f44e0b89-55fc-4b0c-963d-79716fd3ae34

📥 Commits

Reviewing files that changed from the base of the PR and between f31c7ca and 7be3379.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (18)
  • .changeset/ignored-optional-dependencies-order-preserved.md
  • .changeset/inert-lockfile-setting-updates.md
  • pnpm/crates/cli/tests/lockfile_resolution_reuse.rs
  • pnpm/crates/lockfile/src/freshness.rs
  • pnpm/crates/package-manager/src/fast_update_settings.rs
  • pnpm/crates/package-manager/src/fast_update_settings/tests.rs
  • pnpm/crates/package-manager/src/install/lockfile_freshness.rs
  • pnpm/crates/package-manager/src/install/run.rs
  • pnpm/crates/package-manager/src/lib.rs
  • pnpm11/installing/deps-installer/src/install/index.ts
  • pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts
  • pnpm11/installing/deps-installer/test/install/settingsFastUpdate.ts
  • pnpm11/lockfile/fs/src/lockfileFormatConverters.ts
  • pnpm11/lockfile/settings-checker/package.json
  • pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts
  • pnpm11/lockfile/settings-checker/src/index.ts
  • pnpm11/lockfile/settings-checker/test/getOutdatedLockfileSettings.test.ts
  • pnpm11/lockfile/settings-checker/test/tsconfig.json
🚧 Files skipped from review as they are similar to previous changes (12)
  • pnpm11/lockfile/fs/src/lockfileFormatConverters.ts
  • .changeset/inert-lockfile-setting-updates.md
  • pnpm/crates/package-manager/src/lib.rs
  • pnpm11/lockfile/settings-checker/src/index.ts
  • pnpm/crates/package-manager/src/fast_update_settings/tests.rs
  • pnpm/crates/lockfile/src/freshness.rs
  • pnpm/crates/package-manager/src/fast_update_settings.rs
  • pnpm11/installing/deps-installer/src/install/index.ts
  • pnpm11/lockfile/settings-checker/src/getOutdatedLockfileSetting.ts
  • pnpm11/installing/deps-installer/test/install/settingsFastUpdate.ts
  • pnpm/crates/cli/tests/lockfile_resolution_reuse.rs
  • pnpm11/installing/deps-installer/src/install/tryFastUpdateSettings.ts

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 6, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Aug 8, 2026
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants