Skip to content

fix(cargo): resolve patched and replaced workspaces - #14955

Merged
zkochan merged 6 commits into
mainfrom
fix-14950
Sep 16, 2026
Merged

zkochan merged 6 commits into
mainfrom
fix-14950

Conversation

@zkochan

@zkochan zkochan commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Resolve root Cargo.toml [patch] and [replace] overrides through the existing isolated Cargo fallback. This lets pnpm generate missing Cargo.lock files and edit crate dependencies in patched workspaces, preserving Cargo package identities and Git revision pins.

The change applies only to pnpm v12. The Cargo integration does not exist in v11. Custom cargo.indexUrl resolution remains unsupported by the fallback; existing-lock installs remain supported, and the limitation is documented.

Closes #14950.

The matching website update is pnpm/pnpm.io#931, kept as a draft until this change is released. Empty override tables continue using native or pnpr resolution.

Coverage and Windows CI exposed equal-timestamp collisions in freshness-check fixtures. A shared fixture helper now keeps manifests older than the lockfile and the lockfile older than validation, including on filesystems with whole-second precision. The catalog regression seeds every file with an equal whole-second timestamp.

Cargo lockfile resolution also applies the Git fetcher's supported protocol policy to transitive dependencies, preserving configured bans and narrower inherited allowlists. The regression reproduces helper execution from a path patch outside the workspace. Path-only resolution is also tested without Git on PATH. Cargo command-line Git fetching honors repository-local protocol bans. Usage details live in the companion website PR; repository READMEs are unchanged.

Rebased onto main at 91887267f5.

Validation: just ready passed, including 11,353 Rust tests, workspace checks, formatting, and linting. Test fixtures used a dedicated /var/tmp directory because /tmp hit its quota.

Squash Commit Body

Cargo metadata without dependencies does not expose root source overrides.
Route workspaces with entries in patch or replace tables to the isolated
Cargo resolver before attempting native or pnpr resolution. Validate declared Git
override transports using the same policy as direct Git dependencies.
Constrain Cargo Git fetching to supported protocols before transitive
dependencies can execute helpers. Share the Git protocol policy while
preserving configured bans and narrower inherited allowlists.

Reuse the existing resolver isolation and native dependency-edit transaction.
Cover path and pinned Git patches, missing-lock generation, adding a registry
crate to an existing patched lock, revision changes with managed sources,
frozen behavior, rollback, checkout helper isolation, and offline Cargo
validation. Also verify legacy path replacement package identities.

Share timestamp ordering across freshness-check fixtures after coverage
and Windows CI exposed equal manifest and lockfile timestamp collisions.
Seed the catalog regression with equal whole-second file timestamps.

The fallback still requires the default cargo.indexUrl. The companion
website PR documents this limit and Cargo configuration and offline behavior.

Closes pnpm/pnpm#14950.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version.
  • Added a changeset if this PR changes any published package.
  • Added or updated tests.
  • Updated the documentation if needed.

Written by an agent (Codex, GPT-5).

Summary by CodeRabbit

  • New Features

    • Cargo lockfiles now preserve and resolve [patch] and [replace] overrides from manifests.
    • Git dependency resolution now honors configured transport policies consistently for dependencies and submodules.
  • Bug Fixes

    • Unsupported Git transports are rejected with clear errors during dependency resolution.
    • Cargo installations more reliably handle patched Git and path dependencies, including offline and frozen workflows.
    • Optimistic repeat-install checks more accurately detect changes using file timestamps.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview 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: Advanced

Run ID: e71ed704-4de2-4f20-87f9-8f18df1fb43a

📥 Commits

Reviewing files that changed from the base of the PR and between 1dacde1 and 911e4b0.

📒 Files selected for processing (3)
  • pnpm/crates/cli/src/cargo_deps/resolution.rs
  • pnpm/crates/cli/tests/suite/cargo_git_install.rs
  • pnpm/crates/git-fetcher/src/protocols.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Cargo now resolves root [patch] and [replace] overrides through Cargo, validates Git transports, and preserves lockfile behavior. Git protocol policy handling moved to a dedicated module. Optimistic repeat-install tests now control manifest and validation timestamps.

Changes

Cargo source override resolution

Layer / File(s) Summary
Override detection and Cargo dispatch
pnpm/crates/cli/src/cargo_deps/lockfile.rs, pnpm/crates/cli/src/cargo_deps/resolution.rs, pnpm/crates/cli/src/cargo_deps/resolution/tests.rs
[patch] and [replace] entries are detected and validated. Matching workspaces use Cargo resolution and receive the computed Git protocol policy.
Git protocol policy handling
pnpm/crates/git-fetcher/src/{fetcher.rs,lib.rs,protocols.rs}, pnpm/crates/git-fetcher/src/{fetcher/tests/submodules.rs,protocols/tests.rs}
Git protocol policy logic moves to protocols.rs. Git configuration, environment allowlists, and submodule restrictions are combined and tested.
Patched workspace regression coverage
pnpm/crates/cli/tests/suite/cargo_git_install.rs, pnpm/crates/cli/tests/suite/cargo_install.rs, .changeset/cargo-source-overrides.md
Tests cover patched Git and path dependencies, lockfile updates, rollback, legacy replacements, blocked transitive Git helpers, and the documented changeset.

Optimistic install timestamp tests

Layer / File(s) Summary
Validated-file timestamp helper
pnpm/crates/package-manager/src/optimistic_repeat_install/tests.rs
Adds backdate_validated_files, which places workspace manifests before validation timestamps.
Optimistic install fixture updates
pnpm/crates/package-manager/src/optimistic_repeat_install/tests/*
Optimistic repeat-install tests use the validated-file helper. Catalog tests also set explicit lockfile, manifest, and workspace-state timestamps.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant pnpm_lockfile
  participant resolution
  participant git_fetcher
  participant Cargo
  pnpm_lockfile->>resolution: detect Cargo source overrides
  resolution->>git_fetcher: validate Git transport policy
  resolution->>Cargo: set GIT_ALLOW_PROTOCOL and resolve lockfile
  Cargo-->>pnpm_lockfile: return generated or updated Cargo.lock
Loading

Assessment Against Linked Issues

Objective Addressed Explanation
Support path and Git [patch] overrides when generating or updating Cargo.lock [#14950] ✅
Preserve patched package identity, Git revisions, frozen behavior, rollback, and offline validation [#14950] ✅
Support legacy [replace] entries or document their limitation [#14950] ✅

Out-of-scope changes

Code Change Explanation
Optimistic repeat-install timestamp helper and fixture changes (pnpm/crates/package-manager/src/optimistic_repeat_install/tests.rs, pnpm/crates/package-manager/src/optimistic_repeat_install/tests/*) These changes are unrelated to the linked Cargo lockfile and patched-workspace objectives.

Merge Risk: ⚪ Minimal · up to 911e4

The Cargo override and Git protocol changes include coverage for the stated resolution, rollback, offline, and protocol-restriction behaviors. No merge-blocking risk is currently identified.

✨ 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-14950

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

Resolve Cargo source overrides through isolated Cargo

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Resolve root Cargo patch and replace overrides through the isolated Cargo fallback.
• Preserve package identities, Git revision pins, transactional rollback, and frozen-lock behavior.
• Document registry limitations and cover path, Git, replacement, offline, and editing workflows.
Diagram

graph TD
  A["Install request"] --> B["Lockfile coordinator"] --> C{"Lock available?"}
  C -->|Existing| G["Cargo.lock"]
  C -->|Missing| D{"Override or Git?"}
  D -->|Yes| E["Isolated Cargo"] --> G
  D -->|No| F["pnpr or native"] --> G
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Always resolve with Cargo
  • ➕ Eliminates resolution-strategy detection
  • ➕ Guarantees native Cargo semantics for every workspace
  • ➖ Bypasses pnpr and the existing lightweight registry resolver
  • ➖ Likely increases resolution cost
  • ➖ Would unnecessarily restrict custom cargo.indexUrl support
2. Extend the native resolver
  • ➕ Retains pnpr and custom registry compatibility
  • ➕ Avoids invoking Cargo for source overrides
  • ➖ Requires independently reproducing Cargo patch and replacement semantics
  • ➖ Raises correctness risk for package identities and Git revisions
  • ➖ Duplicates mature behavior already provided by isolated Cargo

Recommendation: The PR's selective fallback is the best approach. Cargo metadata without dependencies cannot expose source-override effects, while manifest detection provides a narrow routing signal and reuses the existing isolated Cargo transaction. Always using Cargo would regress unaffected resolution paths, and extending the native resolver would duplicate complex Cargo semantics.

Files changed (7) +344 / -167

Bug fix (2) +36 / -31
lockfile.rsRoute source overrides to isolated Cargo resolution +3/-29

Route source overrides to isolated Cargo resolution

• Replaces rejection of patched and replaced workspaces with source-override detection. Missing lockfiles now use isolated Cargo when either root overrides or Git dependencies are present, while existing and frozen-lock behavior remains unchanged.

pnpm/crates/cli/src/cargo_deps/lockfile.rs

resolution.rsDetect and validate Cargo source overrides +33/-2

Detect and validate Cargo source overrides

• Parses the root Cargo.toml for patch and replace tables, validates Git override transports, and exposes override detection to lockfile routing. It also broadens resolver diagnostics to cover both Git dependencies and source overrides.

pnpm/crates/cli/src/cargo_deps/resolution.rs

Tests (3) +289 / -136
tests.rsTest override detection and transport validation +26/-0

Test override detection and transport validation

• Adds unit coverage for path patches, Git patches, legacy replacements, unaffected workspaces, and rejection of unsupported Git transports before Cargo executes.

pnpm/crates/cli/src/cargo_deps/resolution/tests.rs

cargo_git_install.rsExpand Cargo fallback integration coverage +262/-135

Expand Cargo fallback integration coverage

• Extends Git resolution scenarios to path and Git patches and adds coverage for lockfile generation, frozen installs, revision updates, dependency edits, rollback, helper isolation, replacement identities, and offline Cargo validation.

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

cargo_install.rsExpect custom registry fallback limitation +1/-1

Expect custom registry fallback limitation

• Updates the patched-workspace failure assertion to verify that missing-lock resolution reports the default cargo.indexUrl requirement instead of rejecting patch tables outright.

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

Documentation (2) +19 / -0
cargo-source-overrides.mdPublish Cargo source override support +5/-0

Publish Cargo source override support

• Adds a patch changeset announcing Cargo.lock generation and dependency editing for path and Git patch or replacement overrides.

.changeset/cargo-source-overrides.md

README.mdDocument Cargo override resolution constraints +14/-0

Document Cargo override resolution constraints

• Documents root patch and replacement support, pinned Git behavior, the default cargo.indexUrl requirement, audited checkout configuration, offline caching, and frozen-lock behavior.

pnpm/README.md

@qodo-code-review

qodo-code-review Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. Local Git bans are ignored ✓ Resolved 🔗 Cross-repo conflict ⛨ Security
Description
resolution_command asks read_allowed_git_protocols to inspect the toolchain sysroot, so `git
config` cannot discover stricter protocol bans stored in the workspace repository's local Git
configuration. When a user relies on pnpm.io's documented policy, a patched workspace can still
fetch a supported transport such as file or https that the repository explicitly configured as
never.
Code

pnpm/crates/cli/src/cargo_deps/resolution.rs[98]

+    let protocols = pnpm_git_fetcher::read_allowed_git_protocols(&sysroot)
Relevance

●●● Strong

Using sysroot omits repository-local Git policy, violating documented security behavior and
weakening the transport restriction.

PR-#14947

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The Cargo caller supplies sysroot to the policy reader, and the reader executes git config using
that directory, so workspace-local Git configuration is outside discovery. The companion pnpm.io
documentation explicitly promises that stricter Git protocol configuration is preserved.

pnpm/crates/cli/src/cargo_deps/resolution.rs[78-101]
pnpm/crates/git-fetcher/src/protocols.rs[30-42]
External repo: pnpm/pnpm.io, docs/cargo.md [93-95]

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

## Issue description
Cargo lockfile resolution reads Git protocol policies from the toolchain sysroot, bypassing stricter repository-local policies even though pnpm.io says those policies are preserved.

## Fix Focus Areas
- pnpm/crates/cli/src/cargo_deps/resolution.rs[98-101]
- pnpm/crates/git-fetcher/src/protocols.rs[30-42]

## Recommended Fix
Call `read_allowed_git_protocols` with the workspace root while keeping the Cargo subprocess working directory at the isolated sysroot. Add coverage with a workspace-local `protocol.<scheme>.allow=never` setting and verify the resulting Cargo allowlist excludes that scheme.

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


2. Path-only overrides now require Git ✓ Resolved 🐞 Bug ≡ Correctness
Description
resolution_command unconditionally calls read_allowed_git_protocols, whose exec_git_with
invocation returns GitNotFound when no git executable is available. This aborts missing-lock
installs for path-only [patch] and [replace] workspaces before Cargo runs, even though those
local overrides require only Cargo and filesystem access.
Code

pnpm/crates/cli/src/cargo_deps/resolution.rs[R98-101]

+    let protocols = pnpm_git_fetcher::read_allowed_git_protocols(&sysroot)
+        .into_diagnostic()
+        .wrap_err("read Cargo Git transport policy")?;
+    command.env("GIT_ALLOW_PROTOCOL", protocols);
Relevance

●●● Strong

Path-only overrides should not invoke Git; this is a direct correctness regression in the new
unconditional policy lookup.

PR-#14947

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Source overrides are routed to resolve_with_cargo regardless of whether they are Git or path
overrides, and command construction now always calls read_allowed_git_protocols. That helper
always starts git config; exec_git_with maps an absent executable to GitNotFound, so Cargo is
never launched in a Git-free environment.

pnpm/crates/cli/src/cargo_deps/lockfile.rs[147-150]
pnpm/crates/cli/src/cargo_deps/resolution.rs[33-44]
pnpm/crates/git-fetcher/src/protocols.rs[33-35]
pnpm/crates/git-fetcher/src/fetcher.rs[469-498]

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

## Issue description
Cargo lockfile resolution now invokes `git config` unconditionally, causing path-only source overrides to fail when Git is not installed even though Cargo can resolve them locally.

## Fix Focus Areas
- pnpm/crates/cli/src/cargo_deps/resolution.rs[98-101]
- pnpm/crates/git-fetcher/src/protocols.rs[33-42]

## Recommended Fix
Treat `GitNotFound` as the no-command-line-Git case rather than aborting resolution: avoid setting the derived environment policy and allow Cargo to proceed, while preserving the filtered allowlist whenever Git is available. If Cargo is configured to use command-line Git and later needs it, Cargo will fail naturally, while path-only and libgit2-backed resolution remain usable.

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


3. Patched crates can run Git helpers ✓ Resolved 🐞 Bug ⛨ Security
Description
has_source_overrides validates git only on values directly inside the root override table, so a
path override's own manifest can carry an unchecked helper transport into cargo generate-lockfile.
When an attacker-controlled patched crate declares an ext Git dependency and the user's Cargo and
Git configuration enables command-line fetching and that protocol, lockfile generation invokes the
helper before parse_lockfile reaches validate_transport, allowing commands to run with the
user's privileges.
Code

pnpm/crates/cli/src/cargo_deps/resolution.rs[R36-38]

+    for dependency in overrides.values() {
+        let Some(url) = dependency.get("git").and_then(toml::Value::as_str) else { continue };
+        let source = format!("git+{url}")
Relevance

●●● Strong

Recent accepted precedent flags Cargo resolution executing repository-controlled helpers; this is
the same security boundary and unresolved transport path.

PR-#14947

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new detector reads only the root Cargo.toml and validates only direct values in its patch and
replace tables. A path override still selects the Cargo fallback, whose subprocess runs before the
resulting lockfile is parsed and passed through the normal Git transport validator; the repository's
Git fetcher tests explicitly demonstrate that an ext transport executes a shell helper unless an
environment allowlist overrides user Git configuration.

pnpm/crates/cli/src/cargo_deps/resolution.rs[15-44]
pnpm/crates/cargo-resolver/src/metadata.rs[12-26]
pnpm/crates/cli/src/cargo_deps/lockfile.rs[146-150]
pnpm/crates/cli/src/cargo_deps/resolution.rs[60-69]
pnpm/crates/cli/src/cargo_deps.rs[335-344]
pnpm/crates/cli/src/cargo_deps/git.rs[74-95]
pnpm/crates/git-fetcher/src/fetcher/tests/submodules.rs[24-32]
pnpm/crates/git-fetcher/src/fetcher.rs[481-486]

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

## Issue description
Source-override detection validates only Git URLs written directly in the root override table. Git dependencies discovered later inside patched packages can therefore reach Cargo's external Git client before pnpm validates the generated lockfile.

## Fix Focus Areas
- pnpm/crates/cli/src/cargo_deps/resolution.rs[34-44]
- pnpm/crates/cli/src/cargo_deps/resolution.rs[78-106]
- pnpm/crates/cli/tests/suite/cargo_git_install.rs[320-353]

## Recommended Fix
Constrain the `cargo generate-lockfile` subprocess to pnpm's supported Git protocol allowlist even when user configuration enables command-line Git fetching. Apply an environment-level allowlist that cannot be widened by user protocol settings, reuse the git fetcher's existing allowlist behavior where possible, and add a regression fixture whose path-patched crate declares an `ext` Git dependency and asserts that its helper never executes.

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



Remediation recommended

4. Git crates fail without Git 🔗 Cross-repo conflict ≡ Correctness ⭐ New
Description
read_allowed_git_protocols converts GitNotFound into an empty GIT_ALLOW_PROTOCOL, which
prevents Cargo's built-in Git client from resolving even supported Git sources. The pnpm.io Cargo
guide advertises Git dependencies and overrides over five supported protocols without requiring a
Git executable, so documented missing-lock generation fails when git is absent from PATH.
Code

pnpm/crates/git-fetcher/src/protocols.rs[R36-38]

+    let policies = match read_protocol_policies(Path::new("git"), Some(cwd)) {
+        Ok(policies) => policies,
+        Err(GitFetcherError::GitNotFound) => return Ok(String::new()),
Relevance

●● Moderate

Security-focused protocol restrictions were accepted, but no close precedent resolves missing-Git
Cargo compatibility.

PR-#14954

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR explicitly returns an empty protocol allowlist when the Git executable cannot be found, while
the companion website says Git crates and overrides can be resolved and lists permitted protocols
without documenting that executable prerequisite.

pnpm/crates/git-fetcher/src/protocols.rs[30-40]
External repo: pnpm/pnpm.io, docs/cargo.md [70-95]

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

## Issue description
When Git is unavailable, pnpm intentionally supplies an empty protocol allowlist and therefore cannot resolve Git-sourced crates, even though Cargo itself can fetch them without the Git executable. The companion pnpm.io documentation currently advertises Git dependency and source-override resolution without this prerequisite.

## Fix Focus Areas
- pnpm/crates/git-fetcher/src/protocols.rs[33-40]
- docs/cargo.md[70-95]

## Recommended Fix
Update the companion pnpm.io Cargo guide to state that generating a lockfile containing Git dependencies or Git source overrides requires `git` on `PATH`. Clarify that path-only overrides remain supported without Git and that existing lockfiles remain installable under the documented conditions.

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


5. The catalog test no longer exercises its timestamp collision 🐞 Bug ⚙ Maintainability
Description
The catalog test sets the manifest, lockfile, and workspace state to the same whole-second mtime,
then immediately calls backdate_validated_files, which rewrites every file under the workspace to
older timestamps. The subsequent freshness check therefore runs against the helper's reordered
mtimes rather than the intended equal-mtime case, leaving the reported collision regression
untested.
Code

pnpm/crates/package-manager/src/optimistic_repeat_install/tests/catalogs.rs[R87-91]

+    const WHOLE_SECOND_MS: i64 = 1_700_000_000_000;
+    set_mtime_ms(&dir.path().join(Lockfile::FILE_NAME), WHOLE_SECOND_MS);
+    set_mtime_ms(manifest.path(), WHOLE_SECOND_MS);
+    set_mtime_ms(&config.modules_dir.join(WORKSPACE_STATE_FILENAME), WHOLE_SECOND_MS);
+    write_state(dir.path(), backdate_validated_files(dir.path()), settings, projects);
Relevance

●●● Strong

Accepted collision-focused timestamp fixes are valued; this test currently overwrites equal mtimes
before checking freshness.

PR-#13916

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test explicitly assigns all three relevant files the same WHOLE_SECOND_MS value, but
backdate_validated_files calls backdate_existing_files, which rewrites every regular file under
the workspace, and then rewrites package manifests again. Thus the equal timestamps do not survive
until check_optimistic_repeat_install is called.

pnpm/crates/package-manager/src/optimistic_repeat_install/tests/catalogs.rs[87-99]
pnpm/crates/package-manager/src/optimistic_repeat_install/tests.rs[229-243]
pnpm/crates/testing-utils/src/fs.rs[140-159]

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 regression seeds equal whole-second mtimes on the manifest, lockfile, and workspace state, but then calls `backdate_validated_files`, which rewrites those files and removes the collision before the assertion runs. This means the test does not verify the whole-second timestamp behavior it was added to cover.

## Fix Focus Areas
- pnpm/crates/package-manager/src/optimistic_repeat_install/tests/catalogs.rs[87-91]
- pnpm/crates/package-manager/src/optimistic_repeat_install/tests.rs[229-243]

## Recommended Fix
Arrange the fixture setup so the equal whole-second mtimes are applied after validation state is written, or otherwise avoid calling `backdate_validated_files` after seeding the collision. Ensure the recorded validation timestamp and the manifest, lockfile, and workspace-state mtimes retain the intended collision while the test still reaches the catalog-resolution branch.

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


6. Cargo users receive conflicting guidance 🔗 Cross-repo conflict ≡ Correctness
Description
pnpm/README.md now says pnpm can generate a lockfile for root [patch] and [replace] overrides,
while pnpm.io still says these overrides cannot be resolved from scratch. This contradiction reaches
users consulting the canonical Cargo documentation whenever they need to install an override-based
workspace without an existing lockfile.
Code

pnpm/README.md[R15-16]

+With `cargo.enabled: true`, pnpm resolves root Cargo.toml `[patch]` and
+`[replace]` overrides when generating Cargo.lock or editing crate dependencies.
Relevance

●●● Strong

Public documentation should not contradict canonical Cargo guidance about unsupported fresh
resolution with custom registries.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR documentation and implementation explicitly enable lockfile generation through Cargo for
source overrides, whereas pnpm.io says these workspaces cannot be resolved from scratch and must
commit a lockfile.

pnpm/README.md[13-25]
pnpm/crates/cli/src/cargo_deps/lockfile.rs[146-150]
External repo: pnpm/pnpm.io, docs/cargo.md [76-83]

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 newly documented Cargo source-override behavior conflicts with the canonical pnpm.io documentation, which still requires a pre-existing lockfile.

## Fix Focus Areas
- pnpm/README.md[15-19]
- /cross_repos/pnpm.io/docs/cargo.md[76-83]

## Recommended Fix
Coordinate a pnpm.io update that states pnpm v12 can generate Cargo.lock for root path or Git `[patch]` and `[replace]` overrides. Document the same default `cargo.indexUrl`, offline-cache, and frozen-lockfile limitations described in the updated README.

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


View medium (1)
7. Empty overrides block custom registries ✓ Resolved 🐞 Bug ≡ Correctness
Description
has_source_overrides returns true whenever the manifest contains a patch or replace key, even
when its override tables contain no dependency entries. A missing-lock install with an empty
override table is therefore routed away from pnpr or local resolution, and a custom cargo.indexUrl
reaches the fallback's unconditional rejection instead of resolving normally.
Code

pnpm/crates/cli/src/cargo_deps/resolution.rs[30]

+    Ok(document.contains_key("patch") || document.contains_key("replace"))
Relevance

●●● Strong

Empty override tables should not trigger the Cargo fallback or unnecessarily reject custom
registries.

PR-#14947

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new predicate uses only top-level key presence, while the caller immediately chooses Cargo
whenever it returns true. That bypasses the existing pnpr/local resolver, and resolve_with_cargo
rejects every non-default index before starting resolution; prepare_workspace shows this path is
used to obtain each missing workspace lockfile.

pnpm/crates/cli/src/cargo_deps/resolution.rs[15-30]
pnpm/crates/cli/src/cargo_deps/lockfile.rs[146-158]
pnpm/crates/cli/src/cargo_deps/resolution.rs[46-56]
pnpm/crates/cli/src/cargo_deps.rs[184-201]

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

## Issue description
Empty `[patch]`, `[patch.<source>]`, and `[replace]` tables are classified as active source overrides. This needlessly invokes Cargo and prevents missing-lock resolution when a custom Cargo index is configured.

## Fix Focus Areas
- pnpm/crates/cli/src/cargo_deps/resolution.rs[23-30]
- pnpm/crates/cli/src/cargo_deps/resolution/tests.rs[81-92]

## Recommended Fix
Return true only when `[patch]` contains at least one dependency entry under a source table or `[replace]` contains at least one replacement entry. Add unit cases proving empty override tables return false while populated path and Git overrides remain detected.

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


Grey Divider

Context sources
✅ Compliance rules (platform): 37 rules
✅ Cross-repo context — repo relationships
  Explored: repo: pnpm/node-semver-rs (sha: 1ae976a0)
  Explored: repo: pnpm/pnpm.io (branch: docs-cargo-source-overrides-14950, sha: bf2237b9)
Review mode: ⚖️ Balanced: The push changes Cargo Git protocol enforcement and fallback behavior in runtime Rust code, creating meaningful security and resolution risks, but is localized enough for a single thorough review.

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 911e4b0

Results up to commit 7beb078 ⚖️ Balanced


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


Remediation recommended
1. Empty overrides block custom registries ✓ Resolved 🐞 Bug ≡ Correctness
Description
has_source_overrides returns true whenever the manifest contains a patch or replace key, even
when its override tables contain no dependency entries. A missing-lock install with an empty
override table is therefore routed away from pnpr or local resolution, and a custom cargo.indexUrl
reaches the fallback's unconditional rejection instead of resolving normally.
Code

pnpm/crates/cli/src/cargo_deps/resolution.rs[30]

+    Ok(document.contains_key("patch") || document.contains_key("replace"))
Relevance

●●● Strong

Empty override tables should not trigger the Cargo fallback or unnecessarily reject custom
registries.

PR-#14947

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new predicate uses only top-level key presence, while the caller immediately chooses Cargo
whenever it returns true. That bypasses the existing pnpr/local resolver, and resolve_with_cargo
rejects every non-default index before starting resolution; prepare_workspace shows this path is
used to obtain each missing workspace lockfile.

pnpm/crates/cli/src/cargo_deps/resolution.rs[15-30]
pnpm/crates/cli/src/cargo_deps/lockfile.rs[146-158]
pnpm/crates/cli/src/cargo_deps/resolution.rs[46-56]
pnpm/crates/cli/src/cargo_deps.rs[184-201]

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

## Issue description
Empty `[patch]`, `[patch.<source>]`, and `[replace]` tables are classified as active source overrides. This needlessly invokes Cargo and prevents missing-lock resolution when a custom Cargo index is configured.

## Fix Focus Areas
- pnpm/crates/cli/src/cargo_deps/resolution.rs[23-30]
- pnpm/crates/cli/src/cargo_deps/resolution/tests.rs[81-92]

## Recommended Fix
Return true only when `[patch]` contains at least one dependency entry under a source table or `[replace]` contains at least one replacement entry. Add unit cases proving empty override tables return false while populated path and Git overrides remain detected.

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


2. Cargo users receive conflicting guidance 🔗 Cross-repo conflict ≡ Correctness
Description
pnpm/README.md now says pnpm can generate a lockfile for root [patch] and [replace] overrides,
while pnpm.io still says these overrides cannot be resolved from scratch. This contradiction reaches
users consulting the canonical Cargo documentation whenever they need to install an override-based
workspace without an existing lockfile.
Code

pnpm/README.md[R15-16]

+With `cargo.enabled: true`, pnpm resolves root Cargo.toml `[patch]` and
+`[replace]` overrides when generating Cargo.lock or editing crate dependencies.
Relevance

●●● Strong

Public documentation should not contradict canonical Cargo guidance about unsupported fresh
resolution with custom registries.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR documentation and implementation explicitly enable lockfile generation through Cargo for
source overrides, whereas pnpm.io says these workspaces cannot be resolved from scratch and must
commit a lockfile.

pnpm/README.md[13-25]
pnpm/crates/cli/src/cargo_deps/lockfile.rs[146-150]
External repo: pnpm/pnpm.io, docs/cargo.md [76-83]

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 newly documented Cargo source-override behavior conflicts with the canonical pnpm.io documentation, which still requires a pre-existing lockfile.

## Fix Focus Areas
- pnpm/README.md[15-19]
- /cross_repos/pnpm.io/docs/cargo.md[76-83]

## Recommended Fix
Coordinate a pnpm.io update that states pnpm v12 can generate Cargo.lock for root path or Git `[patch]` and `[replace]` overrides. Document the same default `cargo.indexUrl`, offline-cache, and frozen-lockfile limitations described in the updated README.

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


Results up to commit 5e18bbe 🚀 Fast


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


Remediation recommended
1. The catalog test no longer exercises its timestamp collision 🐞 Bug ⚙ Maintainability
Description
The catalog test sets the manifest, lockfile, and workspace state to the same whole-second mtime,
then immediately calls backdate_validated_files, which rewrites every file under the workspace to
older timestamps. The subsequent freshness check therefore runs against the helper's reordered
mtimes rather than the intended equal-mtime case, leaving the reported collision regression
untested.
Code

pnpm/crates/package-manager/src/optimistic_repeat_install/tests/catalogs.rs[R87-91]

+    const WHOLE_SECOND_MS: i64 = 1_700_000_000_000;
+    set_mtime_ms(&dir.path().join(Lockfile::FILE_NAME), WHOLE_SECOND_MS);
+    set_mtime_ms(manifest.path(), WHOLE_SECOND_MS);
+    set_mtime_ms(&config.modules_dir.join(WORKSPACE_STATE_FILENAME), WHOLE_SECOND_MS);
+    write_state(dir.path(), backdate_validated_files(dir.path()), settings, projects);
Relevance

●●● Strong

Accepted collision-focused timestamp fixes are valued; this test currently overwrites equal mtimes
before checking freshness.

PR-#13916

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test explicitly assigns all three relevant files the same WHOLE_SECOND_MS value, but
backdate_validated_files calls backdate_existing_files, which rewrites every regular file under
the workspace, and then rewrites package manifests again. Thus the equal timestamps do not survive
until check_optimistic_repeat_install is called.

pnpm/crates/package-manager/src/optimistic_repeat_install/tests/catalogs.rs[87-99]
pnpm/crates/package-manager/src/optimistic_repeat_install/tests.rs[229-243]
pnpm/crates/testing-utils/src/fs.rs[140-159]

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 regression seeds equal whole-second mtimes on the manifest, lockfile, and workspace state, but then calls `backdate_validated_files`, which rewrites those files and removes the collision before the assertion runs. This means the test does not verify the whole-second timestamp behavior it was added to cover.

## Fix Focus Areas
- pnpm/crates/package-manager/src/optimistic_repeat_install/tests/catalogs.rs[87-91]
- pnpm/crates/package-manager/src/optimistic_repeat_install/tests.rs[229-243]

## Recommended Fix
Arrange the fixture setup so the equal whole-second mtimes are applied after validation state is written, or otherwise avoid calling `backdate_validated_files` after seeding the collision. Ensure the recorded validation timestamp and the manifest, lockfile, and workspace-state mtimes retain the intended collision while the test still reaches the catalog-resolution branch.

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


Results up to commit 49216af 🧠 Deep


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


Action required
1. Patched crates can run Git helpers ✓ Resolved 🐞 Bug ⛨ Security
Description
has_source_overrides validates git only on values directly inside the root override table, so a
path override's own manifest can carry an unchecked helper transport into cargo generate-lockfile.
When an attacker-controlled patched crate declares an ext Git dependency and the user's Cargo and
Git configuration enables command-line fetching and that protocol, lockfile generation invokes the
helper before parse_lockfile reaches validate_transport, allowing commands to run with the
user's privileges.
Code

pnpm/crates/cli/src/cargo_deps/resolution.rs[R36-38]

+    for dependency in overrides.values() {
+        let Some(url) = dependency.get("git").and_then(toml::Value::as_str) else { continue };
+        let source = format!("git+{url}")
Relevance

●●● Strong

Recent accepted precedent flags Cargo resolution executing repository-controlled helpers; this is
the same security boundary and unresolved transport path.

PR-#14947

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new detector reads only the root Cargo.toml and validates only direct values in its patch and
replace tables. A path override still selects the Cargo fallback, whose subprocess runs before the
resulting lockfile is parsed and passed through the normal Git transport validator; the repository's
Git fetcher tests explicitly demonstrate that an ext transport executes a shell helper unless an
environment allowlist overrides user Git configuration.

pnpm/crates/cli/src/cargo_deps/resolution.rs[15-44]
pnpm/crates/cargo-resolver/src/metadata.rs[12-26]
pnpm/crates/cli/src/cargo_deps/lockfile.rs[146-150]
pnpm/crates/cli/src/cargo_deps/resolution.rs[60-69]
pnpm/crates/cli/src/cargo_deps.rs[335-344]
pnpm/crates/cli/src/cargo_deps/git.rs[74-95]
pnpm/crates/git-fetcher/src/fetcher/tests/submodules.rs[24-32]
pnpm/crates/git-fetcher/src/fetcher.rs[481-486]

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

## Issue description
Source-override detection validates only Git URLs written directly in the root override table. Git dependencies discovered later inside patched packages can therefore reach Cargo's external Git client before pnpm validates the generated lockfile.

## Fix Focus Areas
- pnpm/crates/cli/src/cargo_deps/resolution.rs[34-44]
- pnpm/crates/cli/src/cargo_deps/resolution.rs[78-106]
- pnpm/crates/cli/tests/suite/cargo_git_install.rs[320-353]

## Recommended Fix
Constrain the `cargo generate-lockfile` subprocess to pnpm's supported Git protocol allowlist even when user configuration enables command-line Git fetching. Apply an environment-level allowlist that cannot be widened by user protocol settings, reuse the git fetcher's existing allowlist behavior where possible, and add a regression fixture whose path-patched crate declares an `ext` Git dependency and asserts that its helper never executes.

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


Results up to commit 1dacde1 ⚖️ Balanced


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


Action required
1. Path-only overrides now require Git ✓ Resolved 🐞 Bug ≡ Correctness
Description
resolution_command unconditionally calls read_allowed_git_protocols, whose exec_git_with
invocation returns GitNotFound when no git executable is available. This aborts missing-lock
installs for path-only [patch] and [replace] workspaces before Cargo runs, even though those
local overrides require only Cargo and filesystem access.
Code

pnpm/crates/cli/src/cargo_deps/resolution.rs[R98-101]

+    let protocols = pnpm_git_fetcher::read_allowed_git_protocols(&sysroot)
+        .into_diagnostic()
+        .wrap_err("read Cargo Git transport policy")?;
+    command.env("GIT_ALLOW_PROTOCOL", protocols);
Relevance

●●● Strong

Path-only overrides should not invoke Git; this is a direct correctness regression in the new
unconditional policy lookup.

PR-#14947

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Source overrides are routed to resolve_with_cargo regardless of whether they are Git or path
overrides, and command construction now always calls read_allowed_git_protocols. That helper
always starts git config; exec_git_with maps an absent executable to GitNotFound, so Cargo is
never launched in a Git-free environment.

pnpm/crates/cli/src/cargo_deps/lockfile.rs[147-150]
pnpm/crates/cli/src/cargo_deps/resolution.rs[33-44]
pnpm/crates/git-fetcher/src/protocols.rs[33-35]
pnpm/crates/git-fetcher/src/fetcher.rs[469-498]

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

## Issue description
Cargo lockfile resolution now invokes `git config` unconditionally, causing path-only source overrides to fail when Git is not installed even though Cargo can resolve them locally.

## Fix Focus Areas
- pnpm/crates/cli/src/cargo_deps/resolution.rs[98-101]
- pnpm/crates/git-fetcher/src/protocols.rs[33-42]

## Recommended Fix
Treat `GitNotFound` as the no-command-line-Git case rather than aborting resolution: avoid setting the derived environment policy and allow Cargo to proceed, while preserving the filtered allowlist whenever Git is available. If Cargo is configured to use command-line Git and later needs it, Cargo will fail naturally, while path-only and libgit2-backed resolution remain usable.

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


2. Local Git bans are ignored ✓ Resolved 🔗 Cross-repo conflict ⛨ Security
Description
resolution_command asks read_allowed_git_protocols to inspect the toolchain sysroot, so `git
config` cannot discover stricter protocol bans stored in the workspace repository's local Git
configuration. When a user relies on pnpm.io's documented policy, a patched workspace can still
fetch a supported transport such as file or https that the repository explicitly configured as
never.
Code

pnpm/crates/cli/src/cargo_deps/resolution.rs[98]

+    let protocols = pnpm_git_fetcher::read_allowed_git_protocols(&sysroot)
Relevance

●●● Strong

Using sysroot omits repository-local Git policy, violating documented security behavior and
weakening the transport restriction.

PR-#14947

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The Cargo caller supplies sysroot to the policy reader, and the reader executes git config using
that directory, so workspace-local Git configuration is outside discovery. The companion pnpm.io
documentation explicitly promises that stricter Git protocol configuration is preserved.

pnpm/crates/cli/src/cargo_deps/resolution.rs[78-101]
pnpm/crates/git-fetcher/src/protocols.rs[30-42]
External repo: pnpm/pnpm.io, docs/cargo.md [93-95]

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

## Issue description
Cargo lockfile resolution reads Git protocol policies from the toolchain sysroot, bypassing stricter repository-local policies even though pnpm.io says those policies are preserved.

## Fix Focus Areas
- pnpm/crates/cli/src/cargo_deps/resolution.rs[98-101]
- pnpm/crates/git-fetcher/src/protocols.rs[30-42]

## Recommended Fix
Call `read_allowed_git_protocols` with the workspace root while keeping the Cargo subprocess working directory at the isolated sysroot. Add coverage with a workspace-local `protocol.<scheme>.allow=never` setting and verify the resulting Cargo allowlist excludes that scheme.

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


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@greptile-apps

greptile-apps Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable correctness, security, or repository-rule violations remain.

Reviews (7) · Last reviewed commit: "fix(cargo): preserve git resolution rest..."

greptile-apps[bot]
greptile-apps Bot previously approved these changes Sep 16, 2026
@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.02     13.9±0.21ms    27.0 MB/sec    1.00     13.6±0.34ms    27.6 MB/sec
packument/parse                                  1.02     44.4±0.94µs  1493.7 MB/sec    1.00     43.6±0.39µs  1520.1 MB/sec
tarball/download_dependency                      1.00      4.8±0.35ms   896.4 KB/sec    1.18      5.7±0.34ms   762.4 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    243.7±6.25ms 65.7 KElem/sec    1.01    247.0±7.08ms 64.8 KElem/sec
workspace_resolution/hoist_heavy                 1.01    297.1±2.39ms        ? ?/sec    1.00   295.0±12.36ms        ? ?/sec
workspace_sort/chained_projects                  1.13     19.1±2.15ms        ? ?/sec    1.00     17.0±1.50ms        ? ?/sec

@greptile-apps
greptile-apps Bot dismissed their stale review September 16, 2026 10:44

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@zkochan

zkochan commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Addressed Qodo's findings:

  • Commit d2d94e2 detects overrides only when a patch source table or the replacement table contains entries. Added regression cases for empty [patch], source, and [replace] tables. just ready passed all 11,335 tests, and all push hooks passed.
  • Opened docs: describe cargo source override resolution pnpm.io#931 to align the canonical Cargo guide with this implementation. Its site build and security checks passed. It remains a draft until this change lands and is released.

Written by an agent (Codex, GPT-5).

@qodo-code-review

Copy link
Copy Markdown

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

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

greptile-apps[bot]
greptile-apps Bot previously approved these changes Sep 16, 2026
@zkochan

zkochan commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

Please review the current head, d2d94e2. The initial review still shows the earlier commit as in progress. The empty-override finding has been fixed, all 11,335 local tests and push hooks passed, and the matching documentation update is in pnpm/pnpm.io#931.


Written by an agent (Codex, GPT-5).

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 911e4b0b3f90

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked-workspace scenario compares current Rust against main Rust. 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.453 ± 0.143 2.251 2.735 1.72 ± 0.19
pacquet@main 2.398 ± 0.142 2.254 2.581 1.68 ± 0.18
pnpr@HEAD 1.428 ± 0.131 1.313 1.663 1.00
pnpr@main 1.465 ± 0.116 1.288 1.668 1.03 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.45332645484,
      "stddev": 0.14333345945217635,
      "median": 2.4311147799399997,
      "user": 1.43826406,
      "system": 1.61215802,
      "min": 2.2508469834400002,
      "max": 2.73469342744
    },
    {
      "command": "pacquet@main",
      "mean": 2.39776744804,
      "stddev": 0.1420889313897531,
      "median": 2.35337094844,
      "user": 1.3161818600000001,
      "system": 1.4354859199999999,
      "min": 2.25373065544,
      "max": 2.58082653044
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4275221988400002,
      "stddev": 0.1308849608796056,
      "median": 1.36197705994,
      "user": 1.14627476,
      "system": 1.36060882,
      "min": 1.31283851644,
      "max": 1.66300288744
    },
    {
      "command": "pnpr@main",
      "mean": 1.4653634200399999,
      "stddev": 0.11617434743259035,
      "median": 1.44126655344,
      "user": 1.1291647599999999,
      "system": 1.2032812199999998,
      "min": 1.28764536044,
      "max": 1.66753385944
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 209.2 ± 9.0 193.5 218.4 1.00
pacquet@main 209.6 ± 12.2 191.4 229.1 1.00 ± 0.07
pnpr@HEAD 229.6 ± 17.5 208.6 269.8 1.10 ± 0.10
pnpr@main 227.4 ± 6.1 216.9 234.7 1.09 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.20922866416,
      "stddev": 0.008997798909257315,
      "median": 0.21393448116000002,
      "user": 0.23160178,
      "system": 0.51080714,
      "min": 0.19347679366,
      "max": 0.21836107766
    },
    {
      "command": "pacquet@main",
      "mean": 0.20960088016,
      "stddev": 0.012166642874378035,
      "median": 0.20891350466000003,
      "user": 0.21713658000000002,
      "system": 0.52385704,
      "min": 0.19141739866000002,
      "max": 0.22908156566
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.22956091196,
      "stddev": 0.01746556388488595,
      "median": 0.22730657466,
      "user": 0.25014618,
      "system": 0.5118237400000001,
      "min": 0.20859092466,
      "max": 0.26978251966
    },
    {
      "command": "pnpr@main",
      "mean": 0.22743684595999997,
      "stddev": 0.006089591496813615,
      "median": 0.22610534866,
      "user": 0.24476388,
      "system": 0.5300275400000001,
      "min": 0.21686527166000003,
      "max": 0.23470858466000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 6.6 ± 0.5 5.8 8.9 1.05 ± 0.10
pacquet@main 6.6 ± 0.7 5.5 9.4 1.05 ± 0.13
pnpr@HEAD 6.3 ± 0.4 5.6 8.1 1.00
pnpr@main 11.6 ± 2.5 5.9 17.8 1.85 ± 0.42
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.006598710234394306,
      "stddev": 0.000467998804116637,
      "median": 0.006525552080000001,
      "user": 0.004161848978622325,
      "system": 0.002828969263657956,
      "min": 0.0057664110800000005,
      "max": 0.008935366080000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.006593765406424866,
      "stddev": 0.000683640123018204,
      "median": 0.006411774080000001,
      "user": 0.00391391896373057,
      "system": 0.003059194715025906,
      "min": 0.0055487120800000005,
      "max": 0.009389296080000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.006261074871666676,
      "stddev": 0.00038894662965798877,
      "median": 0.0062111690800000004,
      "user": 0.0038517610714285714,
      "system": 0.002798205952380952,
      "min": 0.005587275080000001,
      "max": 0.008128916080000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.011554389558494627,
      "stddev": 0.002534697079298364,
      "median": 0.011689394080000002,
      "user": 0.006565689354838712,
      "system": 0.00557251268817204,
      "min": 0.005941809080000001,
      "max": 0.01778916908
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 8.2 ± 1.9 6.0 17.5 1.41 ± 0.34
pacquet@main 5.8 ± 0.3 5.2 7.6 1.00
pnpr@HEAD 6.2 ± 0.7 5.3 9.1 1.06 ± 0.13
pnpr@main 6.2 ± 0.5 5.3 8.8 1.07 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.008173224903188402,
      "stddev": 0.00192331667514395,
      "median": 0.007785185780000001,
      "user": 0.004765958260869566,
      "system": 0.0039998333333333335,
      "min": 0.005983520280000001,
      "max": 0.01753087928
    },
    {
      "command": "pacquet@main",
      "mean": 0.005782759081652894,
      "stddev": 0.0002927771307367924,
      "median": 0.0057886442800000005,
      "user": 0.003491890358126721,
      "system": 0.002726163911845729,
      "min": 0.005172859280000001,
      "max": 0.00758189928
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.006153706522937856,
      "stddev": 0.0007073518198213622,
      "median": 0.005932138280000001,
      "user": 0.003961237514124294,
      "system": 0.0026547132768361585,
      "min": 0.005264811280000001,
      "max": 0.00913713728
    },
    {
      "command": "pnpr@main",
      "mean": 0.006160908331630437,
      "stddev": 0.0005344292369398335,
      "median": 0.006067076780000001,
      "user": 0.0038642518478260862,
      "system": 0.0028025258152173937,
      "min": 0.0053168482800000005,
      "max": 0.008785848280000001
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.541 ± 0.044 2.481 2.604 1.59 ± 0.13
pacquet@main 2.679 ± 0.018 2.652 2.716 1.68 ± 0.13
pnpr@HEAD 1.599 ± 0.126 1.493 1.813 1.00
pnpr@main 1.657 ± 0.140 1.466 1.868 1.04 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.54064042972,
      "stddev": 0.044029952272140724,
      "median": 2.5331771432199996,
      "user": 2.2130229999999997,
      "system": 1.84451614,
      "min": 2.48128732022,
      "max": 2.6039748112199996
    },
    {
      "command": "pacquet@main",
      "mean": 2.6789811750199997,
      "stddev": 0.017985227022303926,
      "median": 2.6770741877199997,
      "user": 2.6924132,
      "system": 2.28835524,
      "min": 2.6515916532199997,
      "max": 2.71641524222
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5991918756199999,
      "stddev": 0.1259337080559727,
      "median": 1.55481760572,
      "user": 1.8707954999999998,
      "system": 1.8211586400000002,
      "min": 1.4933992012200001,
      "max": 1.81324844522
    },
    {
      "command": "pnpr@main",
      "mean": 1.65706346212,
      "stddev": 0.14026159874507904,
      "median": 1.68186507122,
      "user": 1.8458257999999996,
      "system": 1.8157599400000002,
      "min": 1.46568960222,
      "max": 1.8683654382200001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 479.4 ± 83.1 357.2 570.9 1.78 ± 0.31
pacquet@main 332.8 ± 18.0 306.5 359.1 1.24 ± 0.07
pnpr@HEAD 270.0 ± 8.9 258.9 283.1 1.00 ± 0.03
pnpr@main 269.4 ± 2.6 264.8 272.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.47936269368000006,
      "stddev": 0.0830629778468312,
      "median": 0.48836959818000003,
      "user": 0.75250546,
      "system": 1.04549674,
      "min": 0.35720110118000004,
      "max": 0.57089105918
    },
    {
      "command": "pacquet@main",
      "mean": 0.33278318677999996,
      "stddev": 0.017976759999756838,
      "median": 0.33286901168000005,
      "user": 0.5226538599999999,
      "system": 0.73812854,
      "min": 0.30650894718,
      "max": 0.35912371918
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26996159358000005,
      "stddev": 0.008921598395736485,
      "median": 0.27045827168000003,
      "user": 0.20684435999999998,
      "system": 0.49280013999999994,
      "min": 0.25893134018,
      "max": 0.28313545718
    },
    {
      "command": "pnpr@main",
      "mean": 0.26941867828,
      "stddev": 0.002601939420420912,
      "median": 0.26948165618,
      "user": 0.21123306,
      "system": 0.52532194,
      "min": 0.26477474218,
      "max": 0.27265386118
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.571 ± 0.017 1.553 1.611 5.26 ± 0.12
pacquet@main 1.558 ± 0.018 1.519 1.582 5.22 ± 0.12
pnpr@HEAD 0.300 ± 0.009 0.286 0.315 1.00 ± 0.04
pnpr@main 0.298 ± 0.006 0.287 0.307 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.5705751870800002,
      "stddev": 0.016938898441953357,
      "median": 1.56808996228,
      "user": 0.8604094,
      "system": 1.01964682,
      "min": 1.55290424678,
      "max": 1.61078586578
    },
    {
      "command": "pacquet@main",
      "mean": 1.55801603338,
      "stddev": 0.018469201395132143,
      "median": 1.5555627412800002,
      "user": 0.8330037999999998,
      "system": 0.99133232,
      "min": 1.51903370178,
      "max": 1.58236215278
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29953750147999997,
      "stddev": 0.009350629371668709,
      "median": 0.29726656728,
      "user": 0.23861179999999999,
      "system": 0.6149559199999999,
      "min": 0.28645598278,
      "max": 0.31466647678
    },
    {
      "command": "pnpr@main",
      "mean": 0.29849262938,
      "stddev": 0.006063106599746397,
      "median": 0.29893087378,
      "user": 0.2482179,
      "system": 0.5993540199999999,
      "min": 0.28650794278,
      "max": 0.30728469678
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 189.7 ± 12.7 175.2 223.7 1.99 ± 0.29
pacquet@main 186.4 ± 12.6 176.5 226.8 1.95 ± 0.28
pnpr@HEAD 95.5 ± 12.2 86.0 124.0 1.00
pnpr@main 111.7 ± 4.7 104.7 122.3 1.17 ± 0.16
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.18974471353333336,
      "stddev": 0.012662037210408043,
      "median": 0.1853773664,
      "user": 0.19162283333333333,
      "system": 0.06594376666666665,
      "min": 0.17520286940000002,
      "max": 0.2236508624
    },
    {
      "command": "pacquet@main",
      "mean": 0.18643530479999998,
      "stddev": 0.012636743592161846,
      "median": 0.1824304064,
      "user": 0.19213963333333337,
      "system": 0.06569016666666666,
      "min": 0.1765365744,
      "max": 0.2268192674
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09546663882424242,
      "stddev": 0.012211506742393467,
      "median": 0.0879690224,
      "user": 0.03452608787878788,
      "system": 0.013956181818181815,
      "min": 0.0859552264,
      "max": 0.1240419834
    },
    {
      "command": "pnpr@main",
      "mean": 0.11167556664999999,
      "stddev": 0.004733071163716139,
      "median": 0.1118922469,
      "user": 0.047734425,
      "system": 0.019002416666666664,
      "min": 0.1047320704,
      "max": 0.12233860740000001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 602.9 ± 57.4 531.1 689.2 1.02 ± 0.16
pacquet@main 589.2 ± 70.4 500.6 707.5 1.00
pnpm@HEAD 2998.2 ± 100.7 2869.7 3188.8 5.09 ± 0.63
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6029247314666668,
      "stddev": 0.05741399499780069,
      "median": 0.6021266238,
      "user": 0.6316972222222224,
      "system": 0.14210204888888886,
      "min": 0.5311323908000001,
      "max": 0.6891772428
    },
    {
      "command": "pacquet@main",
      "mean": 0.5892448755777777,
      "stddev": 0.07041609870286285,
      "median": 0.5892037668000001,
      "user": 0.6172461111111112,
      "system": 0.1346674933333333,
      "min": 0.5006294488,
      "max": 0.7075233998
    },
    {
      "command": "pnpm@HEAD",
      "mean": 2.9981739676888886,
      "stddev": 0.10072411865450633,
      "median": 2.9642364528000003,
      "user": 4.704371222222222,
      "system": 0.2299463822222222,
      "min": 2.8697115748,
      "max": 3.1887772288000003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 164.3 ± 3.1 159.1 171.2 1.00
pacquet@main 236.0 ± 58.2 159.3 317.2 1.44 ± 0.36
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.16431697250352942,
      "stddev": 0.0031380869160922958,
      "median": 0.16341575168,
      "user": 0.12611003529411763,
      "system": 0.07250043411764705,
      "min": 0.15910289368,
      "max": 0.17120383068
    },
    {
      "command": "pacquet@main",
      "mean": 0.23604993997411766,
      "stddev": 0.05823687961895982,
      "median": 0.26493665568,
      "user": 0.17144838823529412,
      "system": 0.11797984588235293,
      "min": 0.15931323468,
      "max": 0.31716431068
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.441 ± 0.137 4.301 4.756 1.29 ± 0.05
pacquet@main 4.402 ± 0.145 4.282 4.682 1.28 ± 0.06
pnpr@HEAD 3.528 ± 0.102 3.367 3.684 1.02 ± 0.04
pnpr@main 3.445 ± 0.099 3.347 3.640 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.440806199640001,
      "stddev": 0.13688335748235833,
      "median": 4.41045339604,
      "user": 1.6209272599999998,
      "system": 1.7231908,
      "min": 4.30110992954,
      "max": 4.75608747354
    },
    {
      "command": "pacquet@main",
      "mean": 4.40168320254,
      "stddev": 0.14488831922272852,
      "median": 4.33872983854,
      "user": 1.38317516,
      "system": 1.5952560999999998,
      "min": 4.28173642654,
      "max": 4.68239962254
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5283848089400003,
      "stddev": 0.10164441827463827,
      "median": 3.5050841100400003,
      "user": 1.3639983599999996,
      "system": 1.4170235000000002,
      "min": 3.3672049795400003,
      "max": 3.68442501654
    },
    {
      "command": "pnpr@main",
      "mean": 3.4453131263400003,
      "stddev": 0.09928387421112338,
      "median": 3.39662558954,
      "user": 1.35119866,
      "system": 1.4670862,
      "min": 3.34693897854,
      "max": 3.63969230054
    }
  ]
}

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

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 111.5 ± 9.2 101.3 135.5 1.02 ± 0.10
pacquet@main 109.6 ± 5.1 100.4 121.8 1.00
pnpr@HEAD 118.6 ± 5.0 112.1 132.2 1.08 ± 0.07
pnpr@main 116.7 ± 5.4 111.1 128.8 1.06 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.11148267590000001,
      "stddev": 0.009224291600514871,
      "median": 0.1080153883,
      "user": 0.1364165,
      "system": 0.1201708,
      "min": 0.1013007463,
      "max": 0.1354929903
    },
    {
      "command": "pacquet@main",
      "mean": 0.10963491368095239,
      "stddev": 0.005143253849049105,
      "median": 0.10992787130000001,
      "user": 0.13939654761904766,
      "system": 0.12515251428571428,
      "min": 0.1004070983,
      "max": 0.1217764653
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.11856501670909093,
      "stddev": 0.004951428897088865,
      "median": 0.11736423330000001,
      "user": 0.1397505,
      "system": 0.1275187090909091,
      "min": 0.1121329923,
      "max": 0.1321571833
    },
    {
      "command": "pnpr@main",
      "mean": 0.11669887806190476,
      "stddev": 0.005407785962084848,
      "median": 0.1150286723,
      "user": 0.1396629761904762,
      "system": 0.12184313333333333,
      "min": 0.1110503193,
      "max": 0.1288111983
    }
  ]
}

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/14955
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
gvs-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
101.30 ms
(-9.99%)Baseline: 112.54 ms
135.05 ms
(75.01%)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,481.29 ms
(+0.74%)Baseline: 2,463.10 ms
2,955.72 ms
(83.95%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,552.90 ms
(-0.46%)Baseline: 1,560.11 ms
1,872.13 ms
(82.95%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
357.20 ms
(-3.11%)Baseline: 368.65 ms
442.38 ms
(80.75%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
175.20 ms
(-9.54%)Baseline: 193.68 ms
232.42 ms
(75.38%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,250.85 ms
(-0.88%)Baseline: 2,270.74 ms
2,724.89 ms
(82.60%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,301.11 ms
(-0.66%)Baseline: 4,329.49 ms
5,195.38 ms
(82.79%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
193.48 ms
(-13.52%)Baseline: 223.73 ms
268.48 ms
(72.06%)
isolated-linker.linked-workspace-resolve.hot-cache.offline📈 view plot
🚷 view threshold
159.10 ms
(-7.97%)Baseline: 172.88 ms
207.46 ms
(76.69%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
531.13 ms
(-4.44%)Baseline: 555.82 ms
666.99 ms
(79.63%)
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
🚷 view threshold
5.98 ms
(-7.20%)Baseline: 6.45 ms
7.74 ms
(77.33%)
isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
🚷 view threshold
5.77 ms
(-16.25%)Baseline: 6.89 ms
8.26 ms
(69.79%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/14955
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)
gvs-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
112.13 ms
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,493.40 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
286.46 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
258.93 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
85.96 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,312.84 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,367.20 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
208.59 ms
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
5.26 ms
isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
5.59 ms
🐰 View full continuous benchmarking report in Bencher

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Sep 16, 2026
@greptile-apps
greptile-apps Bot dismissed their stale review September 16, 2026 11:03

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@zkochan

zkochan commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Fixed the coverage CI failure in commit 325d6cf. The catalog fixture assigned equal timestamps to its manifest and lockfile. When those timestamps landed on a whole second, the freshness check correctly required a loaded lockfile. I reproduced that failure with deterministic timestamps, then gave the manifest, lockfile, and validation distinct whole-second timestamps. All five catalog tests and all 11,335 tests in just ready pass. The required push hooks also passed.


Written by an agent (Codex, GPT-5).

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 325d6cf

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

git status --short
git diff --stat HEAD^ HEAD
git diff --find-renames -- pnpm/crates/cli/src/cargo_deps/lockfile.rs pnpm/crates/cli/src/cargo_deps/resolution.rs pnpm/crates/cli/src/cargo_deps/resolution/tests.rs pnpm/crates/cli/tests/suite/cargo_git_install.rs pnpm/crates/cli/tests/suite/cargo_install.rs pnpm/README.md .changeset/cargo-source-overrides.md

ast-grep outline pnpm/crates/cli/src/cargo_deps/resolution.rs --items all
ast-grep outline pnpm/crates/cli/src/cargo_deps/lockfile.rs --items all

rg -n -C 5 'has_source_overrides|has_override_sources|resolve_with_cargo|read_or_resolve_lockfile|cargo\.indexUrl|source overrides' \
  pnpm/crates/cli/src/cargo_deps/resolution.rs \
  pnpm/crates/cli/src/cargo_deps/lockfile.rs \
  pnpm/crates/cli/src/cargo_deps/resolution/tests.rs \
  pnpm/crates/cli/tests/suite/cargo_git_install.rs \
  pnpm/crates/cli/tests/suite/cargo_install.rs \
  pnpm/README.md

git diff --check HEAD^ HEAD

Length of output: 14185


🏁 Script executed:

#!/bin/bash
set -euo pipefail

gh pr view 14955 --repo pnpm/pnpm --json baseRefOid,headRefOid,commits,files --jq '{baseRefOid, headRefOid, commits: [.commits[] | {oid, messageHeadline}], files: [.files[] | .path]}'

base=$(gh pr view 14955 --repo pnpm/pnpm --json baseRefOid --jq .baseRefOid)
git diff --check "$base"...HEAD
git diff --find-renames --unified=50 "$base"...HEAD -- \
  pnpm/crates/cli/src/cargo_deps/lockfile.rs \
  pnpm/crates/cli/src/cargo_deps/resolution.rs \
  pnpm/crates/cli/src/cargo_deps/resolution/tests.rs \
  pnpm/crates/cli/tests/suite/cargo_git_install.rs \
  pnpm/crates/cli/tests/suite/cargo_install.rs \
  pnpm/README.md \
  .changeset/cargo-source-overrides.md

sed -n '1,190p' pnpm/crates/cli/src/cargo_deps/resolution.rs
sed -n '122,170p' pnpm/crates/cli/src/cargo_deps/lockfile.rs
sed -n '55,115p' pnpm/crates/cli/src/cargo_deps/resolution/tests.rs

rg -n -C 4 'patch|replace|frozen|rollback|revision|custom.*index|index_url|Cargo.lock' \
  pnpm/crates/cli/tests/suite/cargo_git_install.rs \
  pnpm/crates/cli/tests/suite/cargo_install.rs

Length of output: 95235


🏁 Script executed:

#!/bin/bash
set -euo pipefail

git show --check --format=fuller 325d6cf20627375125b0cee03abb5c872f91e7bd
git show --format= --unified=70 325d6cf20627375125b0cee03abb5c872f91e7bd -- pnpm/crates/package-manager/src/optimistic_repeat_install/tests/catalogs.rs

rg -n -C 12 'read_or_resolve_lockfile\s*\(' pnpm/crates/cli/src
rg -n -C 12 'CargoLockfilePolicy|cargo_lock_path|Cargo\.lock' pnpm/crates/cli/src/cargo_deps pnpm/crates/cli/src | head -n 500

git diff --numstat 3f7d4c04c83f693b13a97642760c395467f4e945...HEAD
git diff --check 3f7d4c04c83f693b13a97642760c395467f4e945...HEAD

Length of output: 54430


@zkochan I completed the review of the current PR head 325d6cf20627375125b0cee03abb5c872f91e7bd.

I found no issues in the reviewed changes.

The empty [patch], source, and [replace] tables now keep the native or pnpr resolution path. Non-empty override tables use Cargo resolution. The existing Cargo.lock path remains unchanged. The tests cover the required patch, replacement, frozen-lockfile, rollback, revision, and helper-isolation cases.

I did not run repository tests in this environment.

You are interacting with an AI system.

greptile-apps[bot]
greptile-apps Bot previously approved these changes Sep 16, 2026
@codecov-commenter

codecov-commenter commented Sep 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.09091% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.00%. Comparing base (9188726) to head (911e4b0).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/git-fetcher/src/protocols.rs 98.52% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14955      +/-   ##
==========================================
+ Coverage   90.98%   91.00%   +0.02%     
==========================================
  Files        1275     1276       +1     
  Lines      171006   171079      +73     
==========================================
+ Hits       155583   155687     +104     
+ Misses      15423    15392      -31     

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

@greptile-apps
greptile-apps Bot dismissed their stale review September 16, 2026 11:26

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@zkochan

zkochan commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Windows CI exposed the same manifest/lockfile timestamp collision in a second freshness fixture. Commit 5e18bbe shares timestamp ordering across the optimistic-repeat-install fixtures: manifests are older than the wanted lockfile, and the lockfile is older than validation. Validation stays in the past so later fixture rewrites are still detected. The catalog regression seeds all its files with an equal whole-second timestamp.

All 98 freshness-related tests, all 11,335 tests in just ready, and the required push hooks pass. CI is rerunning on this commit.


Written by an agent (Codex, GPT-5).

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 5e18bbe

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

greptile-apps[bot]
greptile-apps Bot previously approved these changes Sep 16, 2026
Route root source overrides through the isolated Cargo fallback because
nodeps metadata omits their effect on the dependency graph. Validate Git
override transports before resolution and preserve the existing edit
transaction and frozen-lock behavior.

Cover path and pinned Git patches, lockfile generation and dependency
edits, revision changes, rollback, helper isolation, offline validation,
and legacy replacement identities. Document the custom-registry limit.

Closes #14950.
Only route to Cargo when patch source tables or the replace table contain
entries. Empty tables do not affect the graph and should retain native
and pnpr resolution, including support for a custom Cargo index.

Add regression cases for empty patch, source, and replacement tables.
Give the registry-catalog fixture distinct whole-second timestamps for the
manifest, wanted lockfile, and workspace validation. Equal whole-second
manifest and lockfile times correctly require a content check, which the
fixture cannot perform without a loaded lockfile.

Reproduced the coverage CI failure with equal deterministic timestamps,
then verified the corrected fixture and all catalog tests.
Coverage and Windows CI exposed fixtures with identical manifest and
wanted-lockfile timestamps. Whole-second mtimes correctly require a
content check when those timestamps match, but these fixtures do not
provide a loaded lockfile.

Share timestamp ordering across the optimistic-repeat-install fixtures.
Backdate manifests by an additional second while keeping the lockfile
and validation in the past, so later fixture rewrites still count as
changes. Seed the catalog regression with equal whole-second timestamps.
@greptile-apps
greptile-apps Bot dismissed their stale review September 16, 2026 11:43

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@zkochan

zkochan commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Rebased onto the latest fetched main, 9188726, and force-pushed with lease. The Cargo Git test conflict preserves main’s recursive-submodule tests alongside the expanded source-override coverage. All 11,348 tests in just ready and the required push hooks pass. GitHub reports the PR as mergeable.


Written by an agent (Codex, GPT-5).

greptile-apps[bot]
greptile-apps Bot previously approved these changes Sep 16, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 49216af

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

Patched crates outside the workspace inventory can declare Git sources
that metadata discovery does not validate. With Cargo command-line Git
fetching and an enabled helper protocol, resolution can execute a helper
before the generated lockfile reaches transport validation.

Apply the Git fetcher supported protocol policy to Cargo subprocesses.
Reuse the allowlist filter and configured policies, preserving configured
bans and narrower inherited allowlists. Keep top-level user protocol
semantics while retaining recursive submodule restrictions.

Reproduce helper execution from an external path patch and verify the
helper is blocked before execution. Keep usage guidance in the companion
website PR and remove the added repository README section.
@greptile-apps
greptile-apps Bot dismissed their stale review September 16, 2026 12:27

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

greptile-apps[bot]
greptile-apps Bot previously approved these changes Sep 16, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 1dacde1

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

Return an empty Git protocol allowlist when the Git binary is absent.
Cargo can still generate a lockfile for path-only overrides, and any Git
client reached through Cargo home configuration remains blocked.

Read Git protocol settings from the workspace while keeping the Cargo
subprocess isolated in the toolchain directory. This preserves local
repository bans without loading checkout Cargo executable helpers.

Reproduce both review findings and verify path-only generation without
Git, an offline locked Cargo check, and a local file transport ban.
@greptile-apps
greptile-apps Bot dismissed their stale review September 16, 2026 12:44

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 911e4b0

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@zkochan

zkochan commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Checked the remaining findings on 911e4b0b3f:

  • “Git crates fail without Git”: the empty GIT_ALLOW_PROTOCOL restricts command-line Git, not Cargo's built-in client. I verified this with a fresh Cargo home, a local Git dependency, PATH containing only the Rust toolchain, no Git executable, and GIT_ALLOW_PROTOCOL='': cargo generate-lockfile succeeded. Cargo documents the built-in/CLI distinction in its Git authentication guide. The companion website paragraph already qualifies the protocol policy with “When Cargo uses command-line Git fetching”. Adding a blanket Git executable prerequisite would be inaccurate.
  • The catalog test checks fixture normalization when all input mtimes land on a whole second. Its call to backdate_validated_files is intentional: the helper must produce a manifest older than the wanted lockfile and validation. Without the helper's manifest adjustment, the freshness assertion fails for this deterministic input. Equal manifest/lockfile timestamps are deliberately rejected by production freshness logic when the lockfile is not loaded; this test must not change that behavior.
  • The README finding refers to removed content. Neither README differs from main. The Cargo guide update is prepared in docs: describe cargo source override resolution pnpm.io#931, kept as a draft until the implementation ships.

Written by an agent (Codex, GPT-5).

@zkochan
zkochan merged commit 1ae18de into main Sep 16, 2026
56 checks passed
@zkochan
zkochan deleted the fix-14950 branch September 16, 2026 13:04
u9g pushed a commit to u9g/pnpm that referenced this pull request Sep 25, 2026
Cargo metadata without dependencies does not expose root source overrides.
Route workspaces with entries in patch or replace tables to the isolated
Cargo resolver before attempting native or pnpr resolution. Validate declared Git
override transports using the same policy as direct Git dependencies.
Constrain Cargo Git fetching to supported protocols before transitive
dependencies can execute helpers. Share the Git protocol policy while
preserving configured bans and narrower inherited allowlists.

Reuse the existing resolver isolation and native dependency-edit transaction.
Cover path and pinned Git patches, missing-lock generation, adding a registry
crate to an existing patched lock, revision changes with managed sources,
frozen behavior, rollback, checkout helper isolation, and offline Cargo
validation. Also verify legacy path replacement package identities.

Share timestamp ordering across freshness-check fixtures after coverage
and Windows CI exposed equal manifest and lockfile timestamp collisions.
Seed the catalog regression with equal whole-second file timestamps.

The fallback still requires the default cargo.indexUrl. The companion
website PR documents this limit and Cargo configuration and offline behavior.

Closes pnpm#14950.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm v12: Cargo lockfile generation and add reject patched workspaces (Tauri, Turborepo, Oxc, GitButler, Readest)

2 participants