Skip to content

perf: reuse lockfile for compatible dependency ranges - #13477

Merged
zkochan merged 6 commits into
mainfrom
fix-13474
Jul 29, 2026
Merged

zkochan merged 6 commits into
mainfrom
fix-13474

Conversation

@zkochan

@zkochan zkochan commented Jul 28, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Reuse the locked version when a direct dependency or catalog range changes but still accepts that version, avoiding a dependency-graph resolution.
  • Support dependencies, devDependencies, and optionalDependencies; retain the normal resolution fallback for incompatible ranges, non-semver specs, dependency-group changes, and other resolution-sensitive edits.
  • Remove stale, unreferenced catalog snapshots without resolving, while requiring every referenced catalog entry to have a matching configured entry and lockfile snapshot.
  • Apply the same behavior to the TypeScript CLI and Rust pnpm implementation, with transactional validation before committing a fast lockfile update.
  • Add unit and integration coverage, including peer-bearing packages, simultaneous settings drift, and an unavailable registry to prove compatible updates make zero package requests.

This implements the first conservative dependency-range optimizations from pnpm/pnpm#13474. The broader fast-path roadmap remains a design task.

Squash Commit Body

Direct dependency and catalog range edits currently force the dependency graph
to be resolved even when every locked version remains valid.

Add transactional fast paths that rewrite only compatible importer specifiers
or catalog snapshots, then validate importer state and lockfile resolutions
before committing them. Stale catalog snapshots may be removed when no
importer references them. Ambiguous or resolution-sensitive cases continue
through the normal resolver.

Implement the same conservative rules in the TypeScript CLI and Rust pnpm
implementation. Tests cover compatible and incompatible direct and catalog
ranges, stale and missing snapshots, simultaneous settings changes, atomic
rollback, malformed versions, peer-bearing packages, and operation while the
registry is unavailable.

Related to pnpm/pnpm#13474.

Checklist

  • 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 (Codex, GPT-5).

Summary by CodeRabbit

  • Performance
    • Installs are faster by retaining compatible lockfile catalog snapshots and skipping unnecessary dependency graph resolution.
    • Fresh-lockfile installs now also benefit from safe fast-updates to keep lockfile changes minimal.
  • New Features
    • Fast lockfile updates can now reconcile catalogs, overrides, and importer specifiers when compatibility checks pass.
  • Bug Fixes
    • If catalog snapshots are missing, malformed, excluded by updated ranges, or incompatible (including when registries are unreachable), pnpm correctly falls back to normal resolution.
  • Tests
    • Added integration/unit coverage for reuse vs. fallback scenarios.

Copilot AI review requested due to automatic review settings July 28, 2026 22:43

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 Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

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

Use the following commands to manage reviews:

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

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Compatible catalog and dependency range changes now update lockfile specifiers while retaining locked versions when semver checks pass. TypeScript and Rust install paths validate candidates, preserve referenced snapshots, remove stale ones, and fall back to resolution when reuse is unsupported.

Changes

Lockfile fast-update reuse

Layer / File(s) Summary
TypeScript unified fast-update flow
pnpm11/installing/deps-installer/src/install/index.ts, pnpm11/installing/deps-installer/src/install/tryFastUpdate*.ts
Coordinates transactional catalog, importer, and override updates with candidate validation before mutating the lockfile.
TypeScript fast-update validation
pnpm11/installing/deps-installer/test/install/catalogFastUpdate.ts
Tests compatible reuse, fallback resolution, snapshot lifecycle, rollback, malformed versions, and package requests.
Rust importer fast-update path
pnpm/crates/package-manager/src/fast_update_importers*, pnpm/crates/package-manager/src/install.rs, pnpm/crates/package-manager/src/lib.rs
Updates compatible importer specifiers and persists fast-updated lockfiles during installation.
Rust catalog compatibility logic
pnpm/crates/package-manager/src/fast_update_catalogs*
Validates catalog snapshots and ranges, preserves referenced entries, removes stale entries, and reports unsupported updates.
Rust reuse integration
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs, pnpm/crates/cli/tests/lockfile_resolution_reuse.rs, .changeset/fast-catalog-ranges.md
Uses compatible catalog updates as resolution reuse seeds and verifies reuse without registry access.

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

Sequence Diagram(s)

sequenceDiagram
  participant ProjectInstall
  participant FastUpdateCoordinator
  participant CatalogOrImporterUpdater
  participant LockfileVerifier
  participant Resolver
  ProjectInstall->>FastUpdateCoordinator: detect compatible lockfile change
  FastUpdateCoordinator->>CatalogOrImporterUpdater: update candidate specifiers
  CatalogOrImporterUpdater-->>FastUpdateCoordinator: updated candidate or rejection
  FastUpdateCoordinator->>LockfileVerifier: validate candidate
  LockfileVerifier-->>FastUpdateCoordinator: validation result
  FastUpdateCoordinator->>Resolver: reuse locked resolution when valid
  Resolver-->>ProjectInstall: complete install without re-resolution
Loading

Possibly related issues

Possibly related PRs

  • pnpm/pnpm#13464 — Directly overlaps with the unified lockfile fast-update flow and override fast-path integration.

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 fix-13474

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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Reuse lockfiles for compatible catalog range changes

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Reuse locked catalog versions when updated semver ranges remain compatible.
• Remove unreferenced catalog snapshots while preserving resolver fallback for unsafe changes.
• Apply transactional validation and no-request coverage across TypeScript and Rust installers.
Diagram

graph TD
  A["Catalog edit"] --> B["Installer paths"] --> C{"Fast path safe"} -->|Yes| D["Candidate lockfile"] --> E{"Validation passes"} -->|Yes| F["Reuse snapshots"]
  C -->|No| G["Normal resolver"]
  E -->|No| G
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Optimize inside the normal resolver
  • ➕ Keeps all dependency decisions in one resolution pipeline.
  • ➕ Could eventually support a broader range of catalog changes.
  • ➖ May still initialize resolution or registry access before discovering reuse.
  • ➖ Expands the correctness surface beyond this conservative optimization.
  • ➖ Makes proving a no-request path more difficult.
2. Mutate the active lockfile directly
  • ➕ Avoids cloning the lockfile candidate.
  • ➕ Uses less temporary memory for large lockfiles.
  • ➖ Requires complex rollback after importer or resolution validation fails.
  • ➖ Risks exposing partially rewritten catalog snapshots to later installation stages.

Recommendation: Keep the transactional pre-resolution fast path. It provides the intended no-request optimization while isolating speculative changes, validating lockfile consistency before commit, and conservatively falling back for ambiguous cases. Broader reuse should remain a separate design effort rather than weakening these safety gates.

Files changed (10) +701 / -47

Enhancement (5) +229 / -47
fast_update_catalogs.rsImplement conservative Rust catalog snapshot rewrites +93/-0

Implement conservative Rust catalog snapshot rewrites

• Introduces the Rust catalog fast path, retaining locked versions accepted by updated semver ranges and removing unreferenced stale snapshots. It rejects malformed versions, incompatible ranges, referenced removals, and catalog-backed overrides so they fall back to resolution.

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

install_with_fresh_lockfile.rsSeed Rust installs from compatible catalog updates +23/-3

Seed Rust installs from compatible catalog updates

• Integrates catalog fast updates into lockfile reuse selection and coordinates them with override reuse. Candidate lockfiles are only used when package extensions and overrides remain compatible; unsupported cases continue through normal resolution.

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

lib.rsRegister the Rust catalog fast-update module +1/-0

Register the Rust catalog fast-update module

• Adds the new catalog fast-update module to the package manager crate.

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

index.tsGeneralize transactional fast lockfile updates +58/-44

Generalize transactional fast lockfile updates

• Extends the TypeScript install fast path to catalog setting changes and routes catalog or override rewrites through shared candidate validation. It verifies importer freshness and lockfile resolutions before committing, while excluding catalog-backed override combinations.

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

tryFastUpdateCatalogs.tsRewrite compatible TypeScript catalog snapshots +54/-0

Rewrite compatible TypeScript catalog snapshots

• Adds catalog snapshot rewriting based on semver compatibility while preserving locked versions. It prunes unreferenced stale entries and declines catalog-backed overrides or unsafe changes for later validation and resolver fallback.

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

Refactor (1) +19 / -0
tryFastUpdateLockfile.tsAdd transactional lockfile update helper +19/-0

Add transactional lockfile update helper

• Clones the wanted lockfile, applies a speculative update, validates freshness and resolutions, and only then commits the candidate. Failed updates leave the original lockfile unchanged.

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

Tests (3) +446 / -0
lockfile_resolution_reuse.rsVerify Rust catalog reuse without registry access +59/-0

Verify Rust catalog reuse without registry access

• Adds an integration test for a peer-bearing catalog dependency whose range changes compatibly. The second install uses an unavailable registry and confirms the locked snapshot and version are retained.

pnpm/crates/cli/tests/lockfile_resolution_reuse.rs

tests.rsCover Rust catalog fast-path safety rules +172/-0

Cover Rust catalog fast-path safety rules

• Tests compatible and incompatible range changes, malformed locked versions, unchanged catalogs with catalog-backed overrides, and referenced versus unreferenced snapshot removals.

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

catalogFastUpdate.tsTest TypeScript catalog reuse and rollback behavior +215/-0

Test TypeScript catalog reuse and rollback behavior

• Adds install and unit coverage for compatible no-request reuse, incompatible resolver fallback, stale snapshot handling, malformed versions, and atomic rollback after candidate validation failure.

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

Documentation (1) +7 / -0
fast-catalog-ranges.mdDocument compatible catalog range lockfile reuse +7/-0

Document compatible catalog range lockfile reuse

• Adds patch release notes for the dependency installer, pnpm, and pacquet packages. The note explains that compatible catalog edits retain locked versions without re-resolving the graph.

.changeset/fast-catalog-ranges.md

@greptile-apps

greptile-apps Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 3/5

The PR is not yet safe to merge because catalog cleanup can still remove a snapshot referenced through catalog:default.

When the default catalog remains present but a referenced alias is removed, preliminary validation succeeds against the existing snapshot; cleanup then compares the importer only with catalog:, misses its equivalent catalog:default reference, and commits a lockfile without the required snapshot.

Files Needing Attention: pnpm/crates/package-manager/src/fast_update_catalogs.rs

Reviews (6): Last reviewed commit: "test: cover forced resolution after fast..." | Re-trigger Greptile

@qodo-code-review

qodo-code-review Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (4) 📘 Rule violations (11) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Remediation recommended

1. TypeScript lacks refresh-hook parity test 📘 Rule violation ▣ Testability ⭐ New
Description
The Rust test now covers a compatible direct-range edit combined with shouldRefreshResolution, but
the TypeScript integration suite has no mirrored scenario proving the fast path yields to that hook.
This leaves cross-stack resolution behavior unverified.
Code

pnpm/crates/cli/tests/custom_resolvers.rs[R104-116]

+    fs::write(
+        workspace.join("package.json"),
+        serde_json::json!({
+            "dependencies": {
+                "@pnpm.e2e/dep-of-pkg-with-1-dep": ">=100.0.0 <101",
+            },
+        })
+        .to_string(),
+    )
+    .expect("update dependency range");
+
+    // Second install: the changed range still accepts the locked version,
+    // so without the hook the install would keep that resolution.
Relevance

⭐⭐⭐ High

Cross-stack parity requests and targeted missing-behavior tests have strong accepted precedent.

PR-#13074
PR-#12878

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 2255044 requires equivalent tests for cross-stack behavior. The changed Rust setup
creates the compatible-range fast-path condition, while the existing TypeScript custom-resolver
integration coverage only tests ordinary and unchanged subsequent installs and does not combine a
range edit with shouldRefreshResolution.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm/crates/cli/tests/custom_resolvers.rs[104-133]
pnpm11/installing/deps-installer/test/install/customResolvers.ts[51-114]

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

## Issue description
Add a TypeScript integration test mirroring the Rust scenario where a compatible dependency-range change would qualify for lockfile reuse, but `shouldRefreshResolution` forces re-resolution.

## Issue Context
The Rust test updates the manifest range while retaining compatibility with the locked version. The TypeScript test should assert that the refresh hook still runs, the custom resolution is selected, and the updated specifier is written to the lockfile.

## Fix Focus Areas
- pnpm11/installing/deps-installer/test/install/customResolvers.ts[1-114]

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


2. Rust lacks rollback parity test 📘 Rule violation ▣ Testability
Description
The new TypeScript test verifies that a compatible update queued before an incompatible update is
rolled back atomically, but the Rust test only covers a single incompatible dependency.
Transactional importer fallback parity is therefore not tested in both stacks.
Code

pnpm11/installing/deps-installer/test/install/catalogFastUpdate.ts[R70-73]

+  expect(lockfile.importers['.' as ProjectId].specifiers).toStrictEqual({
+    bar: '^1.0.0',
+    foo: '^1.0.0',
+  })
Relevance

⭐⭐⭐ High

Team accepts Rust/TypeScript parity fixes and targeted Rust coverage for parallel implementations.

PR-#13464
PR-#13132

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The TypeScript test supplies both a compatible foo update and incompatible bar update, then
asserts both original specifiers remain. The Rust counterpart supplies only one incompatible
dependency and does not exercise rollback after a compatible update has already been considered.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm11/installing/deps-installer/test/install/catalogFastUpdate.ts[44-73]
pnpm/crates/package-manager/src/fast_update_importers/tests.rs[48-52]

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

## Issue description
Add a Rust test for a manifest containing an earlier compatible dependency update followed by an incompatible update, and assert that no importer specifier is changed.

## Issue Context
The TypeScript test now proves transactional rollback for mixed compatible and incompatible direct dependency edits. The Rust test currently verifies only rejection of one incompatible range, so it does not prove equivalent atomic behavior.

## Fix Focus Areas
- pnpm/crates/package-manager/src/fast_update_importers/tests.rs[48-52]
- pnpm11/installing/deps-installer/test/install/catalogFastUpdate.ts[44-73]

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


3. Rust lacks combined-change test 📘 Rule violation ▣ Testability
Description
The TypeScript suite verifies that simultaneous catalog and override changes fall back to
resolution, but no equivalent Rust test covers this cross-stack behavior. This leaves pnpm/pacquet
fallback parity unverified.
Code

pnpm11/installing/deps-installer/test/install/catalogFastUpdate.ts[R148-190]

+test('simultaneous catalog and override changes fall back to resolution', async () => {
+  prepareEmpty()
+  const manifest: ProjectManifest = {
+    dependencies: {
+      '@pnpm.e2e/parent-of-pkg-with-1-dep': 'catalog:',
+    },
+  }
+  const options = testDefaults({
+    catalogs: {
+      default: {
+        '@pnpm.e2e/parent-of-pkg-with-1-dep': '^1.0.0',
+      },
+    },
+    overrides: {
+      '@pnpm.e2e/pkg-with-1-dep': '100.0.0',
+    },
+  })
+
+  await mutateModulesInSingleProject({
+    manifest,
+    mutation: 'install',
+    rootDir: process.cwd() as ProjectRootDir,
+  }, options)
+
+  const requestedPackages = trackRequestedPackages(options.storeController)
+  options.catalogs = {
+    default: {
+      '@pnpm.e2e/parent-of-pkg-with-1-dep': '>=1 <2',
+    },
+  }
+  options.overrides = {
+    '@pnpm.e2e/pkg-with-1-dep': '100.1.0',
+  }
+
+  await mutateModulesInSingleProject({
+    manifest,
+    mutation: 'install',
+    rootDir: process.cwd() as ProjectRootDir,
+  }, options)
+
+  expect(requestedPackages.length).toBeGreaterThan(0)
+})
+
Relevance

⭐⭐⭐ High

Team accepts Rust/TypeScript parity fixes and focused Rust fast-path coverage.

PR-#13464
PR-#12878

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2255044 requires equivalent automated scenarios in both stacks. The cited
TypeScript test explicitly exercises simultaneous catalog and override changes, while the Rust
catalog fast-path tests contain no corresponding combined-change scenario.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm11/installing/deps-installer/test/install/catalogFastUpdate.ts[148-190]
pnpm/crates/package-manager/src/fast_update_catalogs.rs[69-70]

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

## Issue description
Add Rust coverage mirroring the TypeScript scenario where simultaneous catalog and override changes must fall back to normal resolution.

## Issue Context
Both implementations change catalog and override fast-path selection, but only the TypeScript suite verifies this combined-change case. The Rust test should use equivalent inputs and assert that resolution occurs rather than committing a fast lockfile update.

## Fix Focus Areas
- pnpm/crates/cli/tests/lockfile_resolution_reuse.rs[83-140]
- pnpm11/installing/deps-installer/test/install/catalogFastUpdate.ts[148-190]

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


View more (6)
4. Missing TypeScript snapshot test 📘 Rule violation ▣ Testability
Description
The new Rust test verifies that configured catalogs cannot use the fast path without existing
lockfile snapshots, but no TypeScript test covers the equivalent scenario. This leaves cross-stack
fallback parity unverified.
Code

pnpm/crates/package-manager/src/fast_update_catalogs/tests.rs[R126-143]

+#[test]
+fn configured_catalogs_require_existing_lockfile_snapshots() {
+    let lockfile = lockfile(
+        r"
+lockfileVersion: '9.0'
+importers:
+  .: {}
+",
+    );
+    let catalogs =
+        Catalogs::from([("default".to_string(), [("foo".to_string(), "^1".to_string())].into())]);
+
+    assert!(matches!(
+        try_fast_update_catalogs(&lockfile, &catalogs, false),
+        FastCatalogUpdate::Unsupported
+    ));
+}
+
Relevance

⭐⭐⭐ High

Explicit cross-stack rule and accepted parity precedents strongly support adding the mirrored
TypeScript regression test.

PR-#13464
PR-#13081

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 2255044 requires equivalent automated coverage in both stacks for shared behavior. The cited
Rust test establishes the no-snapshot fallback contract, while the TypeScript catalog fast-update
suite contains no corresponding test for configured catalogs with an absent lockfile.catalogs
value.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm/crates/package-manager/src/fast_update_catalogs/tests.rs[126-143]

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

## Issue description
Add a TypeScript test mirroring the Rust case where catalogs are configured but the lockfile contains no catalog snapshots.

## Issue Context
Both implementations must reject the fast path and fall back to normal resolution for this input. The Rust behavior is tested, but the TypeScript catalog fast-update suite has no equivalent scenario.

## Fix Focus Areas
- pnpm11/installing/deps-installer/test/install/catalogFastUpdate.ts[117-140]

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


5. Unused catalogs disable reuse 🐞 Bug ➹ Performance
Description
When lockfile.catalogs is absent, any non-empty catalog configuration is marked unsupported even
though unused catalog entries are intentionally omitted from lockfiles. Installs that otherwise
qualify for lockfile reuse therefore discard the reuse seed and unnecessarily rerun dependency
resolution.
Code

pnpm/crates/package-manager/src/fast_update_catalogs.rs[R18-21]

+        return if catalogs.is_empty() {
+            FastCatalogUpdate::Unchanged
+        } else {
+            FastCatalogUpdate::Unsupported
Relevance

⭐⭐⭐ High

Closely matches accepted fixes preventing valid lockfile fast paths from unnecessarily falling back
to resolution.

PR-#13081
PR-#13464

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Lockfile generation emits catalog snapshots only for importer specifiers using catalog:, so
configured but unused catalogs legitimately produce no snapshot. The freshness checker also
considers an absent snapshot current, while Unsupported maps to catalogs_match = false and
prevents the wanted lockfile from being supplied as the resolver reuse seed.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs[227-254]
pnpm/crates/lockfile/src/freshness.rs[494-505]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1393-1397]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1454-1488]

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

## Issue description
A lockfile without catalog snapshots can be valid when configured catalog entries are not referenced by any importer. Treating every non-empty catalog configuration as unsupported disables lockfile reuse and causes unnecessary resolution.

## Issue Context
Catalog snapshots are generated only for importer dependencies using the catalog protocol. Return `Unchanged` when there are no snapshots and no importer catalog references; retain `Unsupported` for a missing snapshot that is actually referenced. Replace the current test that expects all configured catalogs to require snapshots with coverage for both referenced and unreferenced cases.

## Fix Focus Areas
- pnpm/crates/package-manager/src/fast_update_catalogs.rs[17-22]
- pnpm/crates/package-manager/src/fast_update_catalogs/tests.rs[126-143]

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


6. Catalog updates commit partial state 📘 Rule violation ⌂ Architecture
Description
When one snapshot is compatible and another has invalid or incompatible semver, the TypeScript
helper retains the unsupported entry but can still return success and commit a partial rewrite. Rust
aborts the entire fast path, so pnpm and pacquet can produce different lockfiles and fallback
behavior for the same catalog edit.
Code

pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts[R28-36]

+        if (
+          semver.valid(entry.version) == null ||
+          semver.validRange(specifier) == null ||
+          !semver.satisfies(entry.version, specifier)
+        ) {
+          return [[alias, entry]]
+        }
+        changed = true
+        return [[alias, { specifier, version: entry.version }]]
Relevance

⭐⭐⭐ High

Directly violates stated transactional, cross-stack behavior; analogous fast-path correctness fixes
were accepted.

PR-#13464

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 713428 requires matching user-visible lockfile behavior. TypeScript returns the original entry
for an unsupported range and can subsequently return true, whereas Rust immediately returns
Unsupported, proving the implementations are not transactional under the same mixed-entry input.

Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts[17-44]
pnpm/crates/package-manager/src/fast_update_catalogs.rs[38-45]

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

## Issue description
Make the TypeScript catalog fast path transactional when any changed catalog entry has malformed or incompatible semver.

## Issue Context
The Rust implementation returns `FastCatalogUpdate::Unsupported` immediately, while the TypeScript implementation retains an unsupported entry and may still commit other compatible changes.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts[17-44]
- pnpm11/installing/deps-installer/test/install/catalogFastUpdate.ts[142-205]

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


7. Warm installs clone lockfiles 🐞 Bug ➹ Performance
Description
try_fast_update_importers clones the entire lockfile before detecting any changed specifier,
although it is invoked on every eligible prefer-frozen full install. Unchanged warm installs
therefore copy all package and snapshot maps, adding O(lockfile-size) CPU and peak-memory overhead
to a hot path.
Code

pnpm/crates/package-manager/src/fast_update_importers.rs[10]

+    let mut candidate = lockfile.clone();
Relevance

⭐⭐ Medium

Hot-path optimization precedent is mixed; similar eager-work and cloning suggestions were rejected.

PR-#13170
PR-#13173

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The install path calls try_fast_update_importers whenever the broad install gates pass, with no
preceding change check. The helper immediately clones Lockfile, whose cloned fields include the
complete packages and snapshots maps, and only later returns a candidate when changed is true.

pnpm/crates/package-manager/src/install.rs[1229-1259]
pnpm/crates/package-manager/src/fast_update_importers.rs[6-37]
pnpm/crates/lockfile/src/lib.rs[89-92]
pnpm/crates/lockfile/src/lib.rs[159-176]

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 importer fast path eagerly clones the complete lockfile before determining whether any manifest specifier changed. This adds size-dependent allocation and copying to eligible unchanged warm installs.

## Issue Context
The caller invokes this helper for non-frozen, non-dry-run, prefer-frozen full installs without first checking for manifest drift. `Lockfile::clone` includes the package and snapshot graphs, so large projects pay this cost even when the helper ultimately returns `None`.

## Fix Focus Areas
- pnpm/crates/package-manager/src/fast_update_importers.rs[6-37]
- pnpm/crates/package-manager/src/install.rs[1229-1259]

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


8. Catalog validates wrong version 🐞 Bug ≡ Correctness
Description
The fast path validates the new range against the catalog snapshot's entry.version, without
proving that it matches every referencing importer's locked dependency. A stale or hand-edited
snapshot can therefore retain an importer version outside the updated catalog range while
incorrectly proceeding through the headless path.
Code

pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts[R29-31]

+          semver.valid(entry.version) == null ||
+          semver.validRange(specifier) == null ||
+          !semver.satisfies(entry.version, specifier)
Relevance

⭐⭐ Medium

Potential stale-lockfile inconsistency is plausible, but no close precedent confirms
importer-version validation is required.

PR-#13464

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Catalog snapshots are generated from resolved direct-dependency versions, establishing the expected
relationship, but the new updater trusts the snapshot value alone. The subsequent freshness check
validates catalog specifiers and manifest/importer agreement without comparing catalog snapshot
versions to importer dependency versions, so it cannot catch this inconsistency.

pnpm11/installing/deps-resolver/src/getCatalogSnapshots.ts[13-24]
pnpm11/lockfile/verification/src/allProjectsAreUpToDate.ts[29-68]
pnpm11/installing/deps-installer/src/install/index.ts[733-778]

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 catalog fast path checks the catalog snapshot's recorded version rather than the versions that referencing importers will actually install. An inconsistent lockfile can therefore pass the compatible-range check while retaining an out-of-range dependency.

## Issue Context
Catalog snapshot versions are normally derived from resolved importer dependencies, but loaded lockfiles are untrusted and that relationship is not validated by `allProjectsAreUpToDate`. Conservatively reject the fast path if any referencing importer version is missing, malformed, inconsistent with the snapshot, or outside the new range.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts[28-36]
- pnpm11/lockfile/verification/src/allProjectsAreUpToDate.ts[29-68]
- pnpm11/installing/deps-installer/test/install/catalogFastUpdate.ts[90-205]

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


9. Entire lockfile cloned 🐞 Bug ➹ Performance
Description
tryFastUpdateLockfile deep-clones the complete package and snapshot graph even when a catalog
update only changes catalogs; the override updater also already constructs and commits a separate
transactional lockfile. This adds avoidable O(lockfile-size) time and peak memory to the fast paths,
which is significant for the repository's documented 2,000–3,000-package workloads.
Code

pnpm11/installing/deps-installer/src/install/tryFastUpdateLockfile.ts[12]

+  const candidate = clone(lockfile)
Relevance

⭐⭐ Medium

Performance concern is plausible, but cloning provides transactionality and historical optimization
feedback is mixed.

PR-#12762
PR-#12876

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The wrapper clones the whole LockfileObject before dispatching either updater. The catalog updater
mutates only catalogs, while the override updater independently creates updatedLockfile,
validates it, and commits selected fields, demonstrating that cloning the original full graph is
redundant in both cases.

pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts[17-44]
pnpm11/installing/deps-installer/src/install/tryFastUpdateOverrides.ts[79-110]
pnpm11/installing/deps-installer/src/install/index.ts[745-774]

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 generic transaction wrapper deep-clones every lockfile field, including the complete package and snapshot graph, before attempting catalog or override updates. Catalog updates only need copy-on-write catalog state, while the override updater already builds a separate updated lockfile before committing.

## Issue Context
Preserve transactional rollback without cloning unchanged graph data. A catalog candidate can shallow-copy the lockfile and clone only catalogs; the override path can return its already-constructed candidate or otherwise avoid the redundant outer clone.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/tryFastUpdateLockfile.ts[4-18]
- pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts[17-44]
- pnpm11/installing/deps-installer/src/install/tryFastUpdateOverrides.ts[79-110]
- pnpm11/installing/deps-installer/src/install/index.ts[745-774]

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



Informational

10. specifiers misses trailing comma 📘 Rule violation ⚙ Maintainability
Description
The final member of the multi-line update type lacks a trailing comma, violating the required
TypeScript style for multi-line type definitions.
Code

pnpm11/installing/deps-installer/src/install/tryFastUpdateImporters.ts[30]

+    specifiers: Record<string, string>
Relevance

⭐ Low

Same-folder trailing-comma request was explicitly rejected one day earlier.

PR-#13464

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires the final item in a multi-line TypeScript type definition to end with a
trailing comma, while specifiers: Record<string, string> does not.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/installing/deps-installer/src/install/tryFastUpdateImporters.ts[27-31]

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 multi-line update type omits a trailing comma after its final `specifiers` member.

## Issue Context
PR Compliance ID 713434 requires trailing commas in multi-line TypeScript type definitions and collections.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/tryFastUpdateImporters.ts[27-31]

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


11. tryFastUpdateImporters missing comma 📘 Rule violation ⚙ Maintainability
Description
The multi-line parameter list omits a trailing comma after projects: Project[], violating the
required TypeScript collection and construct style.
Code

pnpm11/installing/deps-installer/src/install/tryFastUpdateImporters.ts[25]

+  projects: Project[]
Relevance

⭐ Low

Same trailing-comma request in this folder was explicitly rejected.

PR-#13464

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713434 requires trailing commas in multi-line TypeScript parameter lists. The final
projects parameter has no trailing comma.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/installing/deps-installer/src/install/tryFastUpdateImporters.ts[23-26]

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

## Issue description
Add the required trailing comma to the multi-line `tryFastUpdateImporters` parameter list.

## Issue Context
Multi-line TypeScript parameter lists must terminate their final parameter with a comma.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/tryFastUpdateImporters.ts[23-26]

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


12. hasChangedProjectSpecifiers missing comma 📘 Rule violation ⚙ Maintainability
Description
The multi-line parameter list omits a trailing comma after projects: Project[], violating the
required TypeScript collection and construct style.
Code

pnpm11/installing/deps-installer/src/install/tryFastUpdateImporters.ts[13]

+  projects: Project[]
Relevance

⭐ Low

Same trailing-comma request in this folder was explicitly rejected.

PR-#13464

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713434 requires trailing commas in multi-line TypeScript parameter lists. The final
projects parameter has no trailing comma.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/installing/deps-installer/src/install/tryFastUpdateImporters.ts[11-14]

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

## Issue description
Add the required trailing comma to the multi-line `hasChangedProjectSpecifiers` parameter list.

## Issue Context
Multi-line TypeScript parameter lists must terminate their final parameter with a comma.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/tryFastUpdateImporters.ts[11-14]

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


View more (3)
13. tryFastUpdateCatalogs lacks trailing comma 📘 Rule violation ⚙ Maintainability
Description
The new multi-line tryFastUpdateCatalogs parameter list does not place a trailing comma after its
final opts parameter.
Code

pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts[11]

+  }
Relevance

⭐ Low

Exact same-folder trailing-comma suggestion was rejected in recent PR.

PR-#13464

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The final opts parameter ends at line 11 without a comma before the closing parenthesis, contrary
to rule 713434.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts[6-12]

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

## Issue description
Add the required trailing comma to the multi-line `tryFastUpdateCatalogs` parameter list.

## Issue Context
Rule 713434 requires trailing commas in multi-line TypeScript parameter lists.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts[6-12]

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


14. tryFastUpdateLockfile lacks trailing comma 📘 Rule violation ⚙ Maintainability
Description
The new multi-line tryFastUpdateLockfile parameter list does not place a trailing comma after its
final opts parameter.
Code

pnpm11/installing/deps-installer/src/install/tryFastUpdateLockfile.ts[10]

+  }
Relevance

⭐ Low

Exact same-folder trailing-comma suggestion was rejected in recent PR.

PR-#13464

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The final opts parameter ends at line 10 without a comma before the closing parenthesis, violating
rule 713434.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/installing/deps-installer/src/install/tryFastUpdateLockfile.ts[4-11]

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

## Issue description
Add the required trailing comma to the multi-line `tryFastUpdateLockfile` parameter list.

## Issue Context
Rule 713434 requires trailing commas in multi-line TypeScript parameter lists.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/tryFastUpdateLockfile.ts[4-11]

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


15. catalogEntryIsReferenced lacks trailing comma 📘 Rule violation ⚙ Maintainability
Description
The new multi-line catalogEntryIsReferenced parameter list omits the required trailing comma after
alias.
Code

pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts[50]

+  alias: string
Relevance

⭐ Low

Exact same-folder trailing-comma suggestion was rejected in recent PR.

PR-#13464

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The final parameter alias: string has no trailing comma before the closing parenthesis.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts[47-51]

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

## Issue description
Add a trailing comma after the final `alias` parameter.

## Issue Context
The function uses a multi-line TypeScript parameter list covered by rule 713434.

## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts[47-51]

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


Grey Divider

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

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.

@github-actions

github-actions Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     12.8±0.82ms    29.2 MB/sec    1.00     12.8±0.70ms    29.2 MB/sec
packument/parse                                  1.01     38.8±1.48µs  1708.5 MB/sec    1.00     38.3±0.66µs  1729.8 MB/sec
tarball/download_dependency                      1.00      2.5±0.21ms  1743.5 KB/sec    1.05      2.6±0.17ms  1666.4 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    194.8±5.15ms 82.1 KElem/sec    1.07   208.9±14.47ms 76.6 KElem/sec

Copilot AI review requested due to automatic review settings July 28, 2026 22:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 078e10b

@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: 2

🤖 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 `@pnpm11/installing/deps-installer/src/install/index.ts`:
- Around line 718-780: The fast-update flow must not clear locked drift when
both catalogs and overrides changed. Update the logic around onlyChangedSetting,
outdatedLockfileSettingName, and the tryFastUpdateLockfile callback to detect
simultaneous catalog and override changes, then either apply both
tryFastUpdateCatalogs and tryFastUpdateOverrides updates with validation or
bypass the fast path so full resolution handles the changes.

In `@pnpm11/installing/deps-installer/src/install/tryFastUpdateLockfile.ts`:
- Around line 12-19: Update tryFastUpdateLockfile so failures from
opts.verifyLockfile?.(candidate) are caught and treated as candidate rollback by
returning false only for the known verification error codes raised by
verifyLockfileResolutions; rethrow all other errors. Keep candidate assignment
to lockfile and the existing update/isLockfileUpToDate failure behavior
unchanged.
🪄 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: 1893f020-8c46-4fdc-b2d5-c7c315aa0fb4

📥 Commits

Reviewing files that changed from the base of the PR and between 2b03cea and 55ab7bd.

📒 Files selected for processing (10)
  • .changeset/fast-catalog-ranges.md
  • pnpm/crates/cli/tests/lockfile_resolution_reuse.rs
  • pnpm/crates/package-manager/src/fast_update_catalogs.rs
  • pnpm/crates/package-manager/src/fast_update_catalogs/tests.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/lib.rs
  • pnpm11/installing/deps-installer/src/install/index.ts
  • pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts
  • pnpm11/installing/deps-installer/src/install/tryFastUpdateLockfile.ts
  • pnpm11/installing/deps-installer/test/install/catalogFastUpdate.ts

@codecov-commenter

codecov-commenter commented Jul 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.42268% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.76%. Comparing base (2b03cea) to head (93f299b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...crates/package-manager/src/fast_update_catalogs.rs 94.79% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13477      +/-   ##
==========================================
+ Coverage   87.74%   87.76%   +0.02%     
==========================================
  Files         547      549       +2     
  Lines       95265    95452     +187     
==========================================
+ Hits        83589    83777     +188     
+ Misses      11676    11675       -1     

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

Copilot AI review requested due to automatic review settings July 28, 2026 23:14

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.

@zkochan zkochan changed the title perf: reuse lockfile for compatible catalog ranges perf: reuse lockfile for compatible dependency ranges Jul 28, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 9cbcad5

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts (1)

39-47: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Force fallback when any catalog snapshot is incompatible.

An invalid or incompatible entry is retained and processing continues. If another entry is compatible, changed becomes true and the function returns true, skipping resolution while the incompatible entry remains locked to its old range/version. Track validation failure and return false before assigning lockfile.catalogs; add a mixed-entry regression case. As per path instructions, “incompatible/ambiguous cases must fall back.”

🤖 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/tryFastUpdateCatalogs.ts` around
lines 39 - 47, Update the catalog snapshot validation flow around semver.valid,
semver.validRange, and semver.satisfies so any invalid or incompatible entry
marks the overall operation as needing fallback. Before assigning
lockfile.catalogs, return false whenever such a validation failure occurred,
even if another entry set changed to true; add a regression case covering mixed
compatible and incompatible entries.

Source: Path instructions

pnpm/crates/cli/tests/lockfile_resolution_reuse.rs (1)

130-137: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert that the catalog update skipped resolution.

This test can pass after a fresh resolve that reuses the same locked version. Capture the command result and assert the same “resolution step is skipped” signal used by the importer-range test.

Proposed fix
-pacquet_at(&workspace).with_arg("install").assert().success();
+let assert = pacquet_at(&workspace).with_arg("install").assert().success();
+assert!(
+    String::from_utf8_lossy(&assert.get_output().stdout)
+        .contains("Lockfile is up to date, resolution step is skipped"),
+);

As per path instructions, regression tests must prove whether resolution requests are skipped or triggered.

🤖 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 130 - 137,
Update the test around the install invocation in the lockfile reuse scenario to
capture the command result, then assert the established “resolution step
skipped” signal used by the importer-range test. Keep the existing catalog entry
assertions, ensuring the regression test verifies resolution was skipped rather
than merely observing the reused version.

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.

Inline comments:
In `@pnpm/crates/package-manager/src/install.rs`:
- Around line 2502-2508: Restrict the save branch containing
lockfile_synthesized_from_current, lockfile_was_fast_updated, and
updated.save_to_path to executions that remain on the frozen path, such as by
requiring take_frozen_path. Do not save the speculative lockfile candidate when
checksum updates or a custom resolver force normal resolution; allow the fresh
resolver to persist its own result.

In `@pnpm11/installing/deps-installer/src/install/tryFastUpdateImporters.ts`:
- Around line 28-46: The tryFastUpdateImporters flow currently mutates
importer.specifiers before all aliases validate, so a later failure leaves
partial changes. In
pnpm11/installing/deps-installer/src/install/tryFastUpdateImporters.ts:28-46,
stage compatible updates separately and apply them only after every project and
alias succeeds; failed validation must leave the lockfile unchanged. In
pnpm11/installing/deps-installer/test/install/catalogFastUpdate.ts:44-68, add a
compatible alias followed by an incompatible alias and assert both original
specifiers remain unchanged.

---

Outside diff comments:
In `@pnpm/crates/cli/tests/lockfile_resolution_reuse.rs`:
- Around line 130-137: Update the test around the install invocation in the
lockfile reuse scenario to capture the command result, then assert the
established “resolution step skipped” signal used by the importer-range test.
Keep the existing catalog entry assertions, ensuring the regression test
verifies resolution was skipped rather than merely observing the reused version.

In `@pnpm11/installing/deps-installer/src/install/tryFastUpdateCatalogs.ts`:
- Around line 39-47: Update the catalog snapshot validation flow around
semver.valid, semver.validRange, and semver.satisfies so any invalid or
incompatible entry marks the overall operation as needing fallback. Before
assigning lockfile.catalogs, return false whenever such a validation failure
occurred, even if another entry set changed to true; add a regression case
covering mixed compatible and incompatible entries.
🪄 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: efe5db53-8970-4a44-9fbf-a750d308e9b6

📥 Commits

Reviewing files that changed from the base of the PR and between 078e10b and 9cbcad5.

📒 Files selected for processing (12)
  • .changeset/fast-catalog-ranges.md
  • pnpm/crates/cli/tests/lockfile_resolution_reuse.rs
  • pnpm/crates/package-manager/src/fast_update_catalogs.rs
  • pnpm/crates/package-manager/src/fast_update_catalogs/tests.rs
  • pnpm/crates/package-manager/src/fast_update_importers.rs
  • pnpm/crates/package-manager/src/fast_update_importers/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/tryFastUpdateCatalogs.ts
  • pnpm11/installing/deps-installer/src/install/tryFastUpdateImporters.ts
  • pnpm11/installing/deps-installer/test/install/catalogFastUpdate.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • .changeset/fast-catalog-ranges.md
  • pnpm/crates/package-manager/src/fast_update_catalogs/tests.rs
  • pnpm11/installing/deps-installer/src/install/index.ts

Copilot AI review requested due to automatic review settings July 28, 2026 23:26
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