Skip to content

fix(config): resolve $dep-name self-references in overrides - #13404

Merged
zkochan merged 2 commits into
mainfrom
fix-13314
Jul 26, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix-13314

Conversation

@zkochan

@zkochan zkochan commented Jul 26, 2026 •

Copy link
Copy Markdown
Member

Summary

overrides values may use the $dep-name self-reference syntax — rolldown: $rolldown means "whatever specifier the root manifest declares for rolldown". pacquet copied the raw map onto Config::overrides, so the reference reached the read-package hook, pnpm-lock.yaml#overrides, and the lockfile freshness check verbatim. A lockfile written by pnpm 11 (which records the resolved specifier) then failed a frozen install:

Error: ERR_PNPM_OUTDATED_LOCKFILE
  `overrides` in the lockfile ({"is-odd": "3.0.1"}) doesn't match the
  current config ({"is-odd": "$is-odd"})

This PR resolves the references while config is read, so every consumer downstream of Config (including the .modules.yaml settings record) sees the concrete specifier, as in pnpm 11. A reference to a package that is not a direct dependency now fails with ERR_PNPM_CANNOT_RESOLVE_OVERRIDE_VERSION, and the install family warns about the deprecated syntax and points at catalogs — both matching pnpm 11's wording (getOptionsFromPnpmSettings).

The TypeScript CLI already resolves these references, so it needs no change; this is a pacquet-only fix.

Closes #13314

Squash Commit Body

An `overrides` value of `$foo` means "whatever specifier the root
manifest declares for `foo`". pacquet copied the raw map onto
`Config::overrides` instead, so the reference reached the read-package
hook, `pnpm-lock.yaml#overrides`, and the lockfile freshness check
verbatim. A lockfile written by pnpm 11 — which records the resolved
specifier — then failed a frozen install with ERR_PNPM_OUTDATED_LOCKFILE
(`overrides` in the lockfile `{"is-odd":"3.0.1"}` vs the config's
`{"is-odd":"$is-odd"}`), which is what blocked validating vitejs/vite.

Resolve the references while config is read: `pnpm-workspace.yaml` is
the only source that can set `overrides` (the global config.yaml is
stripped of the key and no `PNPM_CONFIG_*` var carries a map), and the
cascade knows the workspace root at that point, so the root manifest's
`dependencies` / `devDependencies` / `optionalDependencies` are in
reach. Every consumer downstream of `Config` — including the
`.modules.yaml` settings record — therefore sees the concrete
specifier, as it does in pnpm 11.

A reference to a package that is not a direct dependency fails with
ERR_PNPM_CANNOT_RESOLVE_OVERRIDE_VERSION, and the install family warns
about the deprecated syntax and points at catalogs, both matching
pnpm 11's wording.

TypeScript CLI: no change needed, it already resolves the references.

Closes pnpm/pnpm#13314

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 (Claude Code, claude-opus-5[1m]).


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

Summary by CodeRabbit

  • Bug Fixes

    • $dep-name override version references are now resolved using the root manifest’s direct dependencies.
    • Resolved override specifiers are written to pnpm-lock.yaml, so --frozen-lockfile installs no longer fail for these cases.
    • Invalid $... references now fail with a clearer ERR_PNPM_CANNOT_RESOLVE_OVERRIDE_VERSION message when the dependency isn’t a direct dependency.
  • Warnings

    • Deprecated $-style override version references now emit a deprecation warning pointing to the catalog: protocol, including during fast-path installs.
  • Documentation

    • Updated documented behavior and error semantics for deprecated override syntax.

An `overrides` value of `$foo` means "whatever specifier the root
manifest declares for `foo`". pacquet copied the raw map onto
`Config::overrides` instead, so the reference reached the read-package
hook, `pnpm-lock.yaml#overrides`, and the lockfile freshness check
verbatim. A lockfile written by pnpm 11 — which records the resolved
specifier — then failed a frozen install with ERR_PNPM_OUTDATED_LOCKFILE
(`overrides` in the lockfile `{"is-odd":"3.0.1"}` vs the config's
`{"is-odd":"$is-odd"}`), which is what blocked validating vitejs/vite.

Resolve the references while config is read: `pnpm-workspace.yaml` is
the only source that can set `overrides` (the global config.yaml is
stripped of the key and no `PNPM_CONFIG_*` var carries a map), and the
cascade knows the workspace root at that point, so the root manifest's
`dependencies` / `devDependencies` / `optionalDependencies` are in
reach. Every consumer downstream of `Config` — including the
`.modules.yaml` settings record — therefore sees the concrete
specifier, as it does in pnpm 11.

A reference to a package that is not a direct dependency fails with
ERR_PNPM_CANNOT_RESOLVE_OVERRIDE_VERSION, and the install family warns
about the deprecated syntax and points at catalogs, both matching
pnpm 11's wording.

TypeScript CLI: no change needed, it already resolves the references.

Closes #13314
Copilot AI review requested due to automatic review settings July 26, 2026 10:05

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 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 13a9eada-f200-4166-b06d-7ee177985de0

📥 Commits

Reviewing files that changed from the base of the PR and between 5f0d344 and acba4e1.

📒 Files selected for processing (3)
  • pnpm/crates/config/src/override_version_references.rs
  • pnpm/crates/config/src/override_version_references/tests.rs
  • pnpm/crates/config/src/workspace_yaml.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • pnpm/crates/config/src/override_version_references/tests.rs
  • pnpm/crates/config/src/workspace_yaml.rs

📝 Walkthrough

Walkthrough

This change resolves $dep-name override references from root manifest dependencies, records resolved specifiers in the lockfile, reports unresolved references with a dedicated error, and emits deprecation warnings directing users to catalogs.

Changes

Override version references

Layer / File(s) Summary
Root dependency resolution and error handling
pnpm/crates/config/..., pnpm/crates/config/Cargo.toml
Configuration resolves $dep-name values from dev, prod, and optional root dependency groups and reports dedicated errors when resolution fails.
Resolution and install coverage
pnpm/crates/config/src/override_version_references/tests.rs, pnpm/crates/cli/tests/override_version_references.rs
Tests cover replacement, unchanged values, missing or malformed manifests, lockfile output, warnings, frozen installs, and unresolved references.
Deprecation warning integration
pnpm/crates/cli/src/cli_args/..., .changeset/resolve-override-version-references.md
CLI configuration and fast-path install flows warn about deprecated $dep-name syntax and reference catalogs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Resolve override self-references against root manifest dependencies before lockfile checks [#13314] ❌ Resolution includes dev, prod, and optional dependencies but omits the required peerDependencies group.

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Deprecation warnings for $dep-name syntax (pnpm/crates/cli/src/cli_args/override_version_references.rs:1-38, pnpm/crates/cli/src/cli_args/install.rs:354, pnpm/crates/cli/src/cli_args/pipelines.rs:657) The linked issue requires resolving references before lockfile checks; warning users to migrate to catalogs is not part of that objective.

Possibly related PRs

  • pnpm/pnpm#13359: Shares the CLI warning integration points for configuration loading and the up-to-date install path.
  • pnpm/pnpm#13380: Overlaps the root manifest handling and warning paths modified by this change.

Suggested labels: 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-13314

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 $dep-name override self-references during config load (pacquet)

🐞 Bug fix 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Resolve $dep-name override values against root package.json direct dependencies.
• Fail unresolved references with ERR_PNPM_CANNOT_RESOLVE_OVERRIDE_VERSION and warn on deprecated
 $ syntax.
• Add unit and end-to-end tests to ensure lockfile overrides match resolved specifiers.
Diagram

graph TD
  WYAML[/"pnpm-workspace.yaml"/] --> CASCADE["Config cascade"] --> RESOLVER["Resolve $ refs"] --> CFG["Config (resolved overrides)"] --> INSTALL["Install family"] --> LOCK[/"pnpm-lock.yaml"/]
  ROOTPKG[/"Root package.json"/] --> RESOLVER
  INSTALL --> REPORT["Reporter (warn deprecated $)"]

  subgraph Legend
    direction LR
    _file[/"File"/] ~~~ _proc["Process/module"] ~~~ _decision{"Decision/error"}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Resolve `$dep-name` only when writing/comparing lockfile
  • ➕ Avoids changing Config::overrides semantics; resolution becomes a lockfile-only concern
  • ➕ Limits the blast radius to freshness checks and lockfile serialization
  • ➖ Multiple downstream consumers still see unresolved values (read-package hook, settings record, etc.)
  • ➖ Duplicates resolution logic in each place that needs concrete specifiers
  • ➖ Easier to reintroduce mismatches between config and lockfile outputs
2. Preserve both raw + resolved overrides in Config
  • ➕ Keeps provenance while still providing a canonical resolved view
  • ➕ Could support future UX around migrations/deprecations
  • ➖ More state to maintain and validate; higher cognitive and API complexity
  • ➖ Requires updating many call sites to choose the correct view
  • ➖ Not clearly needed given explicit_settings already preserves raw input

Recommendation: Resolve references during config read (current PR) is the best tradeoff: there is a single point in the pipeline that both (a) knows the workspace root and (b) produces the canonical Config consumed everywhere. This matches pnpm 11 behavior, eliminates lockfile freshness mismatches, and still preserves the original user input via explicit_settings for deprecation warnings.

Files changed (12) +372 / -5

Enhancement (4) +45 / -2
cli_args.rsRegister CLI module for override-reference warnings +1/-0

Register CLI module for override-reference warnings

• Adds the 'override_version_references' module to the CLI args module list so its warning helper can be used by install-related commands.

pnpm/crates/cli/src/cli_args.rs

install.rsWarn on deprecated '$' override references in install fast-path +4/-2

Warn on deprecated '$' override references in install fast-path

• Invokes the new warning helper after config root discovery on the up-to-date fast path. Ensures users get the same deprecation warning even when install short-circuits.

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

override_version_references.rsAdd global warning for deprecated '$' override reference syntax +38/-0

Add global warning for deprecated '$' override reference syntax

• Implements a helper that inspects 'Config::explicit_settings' to find selectors whose override value started with '$'. Emits a single pnpm-11-style warning per command suggesting catalogs.

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

pipelines.rsEmit deprecated override-reference warning in install family pipeline +2/-0

Emit deprecated override-reference warning in install family pipeline

• Hooks the warning helper into shared install-family config derivation (install/dedupe/prune paths). Ensures the warning appears early and consistently across command variants.

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

Bug fix (3) +79 / -3
lib.rsResolve override '$dep-name' references as part of config cascade +11/-0

Resolve override '$dep-name' references as part of config cascade

• After applying workspace YAML settings, resolves any '$dep-name' values in 'Config::overrides' against the workspace root manifest. Ensures all downstream consumers of 'Config' operate on concrete specifiers.

pnpm/crates/config/src/lib.rs

override_version_references.rsImplement '$dep-name' override resolver against root direct dependencies +57/-0

Implement '$dep-name' override resolver against root direct dependencies

• Introduces a resolver that replaces '$name' values in the overrides map with the matching specifier from root dependencies/devDependencies/optionalDependencies (excluding peers). Returns a typed workspace-yaml load error when a reference cannot be resolved.

pnpm/crates/config/src/override_version_references.rs

workspace_yaml.rsAdd error code for unresolvable override version references +11/-3

Add error code for unresolvable override version references

• Defines 'CannotResolveOverrideVersion' with diagnostic code 'ERR_PNPM_CANNOT_RESOLVE_OVERRIDE_VERSION' and pnpm-11-compatible error wording. Updates comments to reflect that resolution happens later once the workspace root is known.

pnpm/crates/config/src/workspace_yaml.rs

Tests (2) +241 / -0
override_version_references.rsE2E tests: resolved overrides in lockfile + frozen install compatibility +113/-0

E2E tests: resolved overrides in lockfile + frozen install compatibility

• Adds end-to-end tests verifying that an '$dep-name' override resolves to the root dependency specifier and is recorded in 'pnpm-lock.yaml'. Also tests that referencing a non-direct dependency fails with 'ERR_PNPM_CANNOT_RESOLVE_OVERRIDE_VERSION' and that the deprecated syntax warning is printed.

pnpm/crates/cli/tests/override_version_references.rs

tests.rsUnit tests for override '$dep-name' reference resolution rules +128/-0

Unit tests for override '$dep-name' reference resolution rules

• Adds unit tests covering successful resolution across dependency groups, leaving non-references unchanged, and error cases (missing root manifest or missing direct dependency / peer-only dependency). Confirms error formatting matches expected messaging.

pnpm/crates/config/src/override_version_references/tests.rs

Documentation (1) +5 / -0
resolve-override-version-references.mdDocument override '$dep-name' reference resolution behavior +5/-0

Document override '$dep-name' reference resolution behavior

• Adds a changeset describing that '$dep-name' self-references in 'overrides' are resolved against root direct dependencies. Documents the new error code for unresolvable references and the deprecation warning pointing to catalogs.

.changeset/resolve-override-version-references.md

Other (2) +2 / -0
Cargo.lockLockfile update for new config dependency +1/-0

Lockfile update for new config dependency

• Updates the workspace lockfile to include 'pacquet-package-manifest' as a dependency of 'pacquet-config'. Ensures builds are reproducible after adding the new crate dependency.

Cargo.lock

Cargo.tomlAdd manifest-reader dependency to config crate +1/-0

Add manifest-reader dependency to config crate

• Adds 'pacquet-package-manifest' as a dependency so config loading can read the workspace root 'package.json' and extract direct dependency specifiers for reference resolution.

pnpm/crates/config/Cargo.toml

@greptile-apps

greptile-apps Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

The previously reported loss of root-manifest diagnostics is fixed by distinguishing a missing manifest from read or parse failures and propagating the latter through ReadRootManifest; no blocking failure remains.

Reviews (2): Last reviewed commit: "fix(config): report an unreadable root m..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
lockfile/parse_pnpm_lock       1.01     11.6±0.07ms    32.3 MB/sec    1.00     11.5±0.10ms    32.5 MB/sec
packument/parse                1.00     38.1±0.36µs  1742.4 MB/sec    1.06     40.4±0.12µs  1642.0 MB/sec
tarball/download_dependency    1.00      2.3±0.07ms  1914.1 KB/sec    1.00      2.3±0.05ms  1914.5 KB/sec

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (2) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Remediation recommended

1. Unsanitized manifest error text 🐞 Bug ⛨ Security ⭐ New
Description
The new ReadRootManifest diagnostic formats the underlying PackageManifestError verbatim, which
includes the filesystem path via path.display(); a workspace path containing control characters can
therefore be embedded into the rendered error output. This enables terminal/control-sequence
injection in error logs when the root package.json is unreadable or malformed and overrides contain
$dep-name references.
Code

pnpm/crates/config/src/workspace_yaml.rs[R751-758]

+    /// The root manifest a `$dep-name` self-reference in `overrides`
+    /// resolves against exists but could not be read or parsed.
+    /// Boxed so the returned `Result` stays small.
+    #[display("Failed to read the root package.json: {source}")]
+    ReadRootManifest {
+        #[error(source)]
+        source: Box<pacquet_package_manifest::PackageManifestError>,
+    },
Relevance

⭐⭐⭐ High

Recent accepted PRs require stripping control characters from untrusted strings in user-facing
diagnostics/logs.

PR-#13287
PR-#13230
PR-#13371

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
ReadRootManifest’s Display includes {source} directly, and the wrapped PackageManifestError::Parse
Display includes path.display(), so the workspace path can flow into the user-visible error
string; the installed report handler shown in-repo does not sanitize messages before delegating
rendering.

pnpm/crates/config/src/workspace_yaml.rs[751-758]
pnpm/crates/config/src/override_version_references.rs[38-43]
pnpm/crates/package-manifest/src/lib.rs[21-28]
pnpm/crates/diagnostics/src/collapsed_chain.rs[25-43]
PR-#13287

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

### Issue description
`LoadWorkspaceYamlError::ReadRootManifest` renders `{source}` directly in its display string. Because the wrapped `PackageManifestError` includes `path.display()` in its own `Display`, a workspace directory name containing control characters (e.g., ANSI escapes) can inject terminal control sequences into pnpm’s error output when `package.json` cannot be read/parsed.

### Issue Context
This is a defense-in-depth issue consistent with prior hardening work (control-char stripping before terminal output). The repo already has sanitization helpers, but this new error path does not apply them.

### Fix Focus Areas
- pnpm/crates/config/src/workspace_yaml.rs[751-758]
- pnpm/crates/config/src/override_version_references.rs[38-43]

Suggested approach: implement a small, shared “strip control chars” helper in a non-CLI crate (e.g., diagnostics/config) and apply it when formatting `ReadRootManifest` (or sanitize the path within `PackageManifestError`’s `Display`). Add a regression test that constructs a temp dir with control characters in its name (platform-permitting) and asserts the rendered error string has them removed.

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


2. Override warning not sanitized 🐞 Bug ⛨ Security
Description
warn_deprecated_override_version_references() and the ERR_PNPM_CANNOT_RESOLVE_OVERRIDE_VERSION
(CannotResolveOverrideVersion) diagnostic render override selector/spec strings taken from
repo-controlled pnpm-workspace.yaml without stripping control characters, enabling terminal
escape/control-sequence injection in local terminals and CI logs. This can spoof or obscure
warning/error output (e.g., rewriting lines with \r, injecting ANSI sequences).
Code

pnpm/crates/cli/src/cli_args/override_version_references.rs[R21-37]

+    let selectors = overrides
+        .iter()
+        .filter(|(_, spec)| spec.as_str().is_some_and(|spec| spec.starts_with('$')))
+        .map(|(selector, _)| selector.as_str())
+        .collect::<Vec<_>>();
+    if selectors.is_empty() {
+        return;
+    }
+    emit(&LogEvent::Global(GlobalLog {
+        level: LogLevel::Warn,
+        message: format!(
+            "The \"$\" version reference syntax in overrides is deprecated (used by: {}). \
+             Define the version in a catalog and reference it with the \"catalog:\" protocol \
+             instead. See https://pnpm.io/catalogs",
+            selectors.join(", "),
+        ),
+    }));
Relevance

⭐⭐⭐ High

Repo has accepted sanitizing untrusted CLI output to prevent terminal escape/control-sequence
injection.

PR-#13287
PR-#13230

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The warning path constructs its message from raw selector strings derived from workspace overrides
(Config::explicit_settings["overrides"]) and does not apply the existing CLI sanitize_inline()
helper that is intended to strip control characters before terminal output; the review guidance
treats workspace config as attacker-controlled and prior fixes in this area required sanitizing
untrusted strings before emitting messages. In the error path, LoadWorkspaceYamlError’s
CannotResolveOverrideVersion diagnostic prints spec and dependency_name directly, and these
fields are populated in resolve_version_references() from the override value (and its $-stripped
tail); because the miette report handler renders diagnostics via to_string() without sanitizing
control characters, any embedded escapes in these repo-controlled strings can reach stderr
unmodified.

pnpm/crates/cli/src/cli_args/override_version_references.rs[16-37]
pnpm/crates/cli/src/cli_args/sanitize.rs[17-24]
REVIEW_GUIDE.md[30-46]
pnpm/crates/config/src/workspace_yaml.rs[751-757]
pnpm/crates/config/src/override_version_references.rs[34-52]
pnpm/crates/diagnostics/src/collapsed_chain.rs[69-87]
PR-#13287

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

## Issue description
Warnings and diagnostics currently interpolate override selector/spec strings coming from repository-controlled workspace overrides directly into terminal/log output without removing control characters/ANSI escapes. This allows terminal escape/control-sequence injection that can spoof, hide, or rewrite CLI warnings/errors in local terminals and CI logs.

## Issue Context
- `warn_deprecated_override_version_references()` formats `selectors.join(", ")` directly into a warning message, where selectors originate from workspace config (`Config::explicit_settings["overrides"]`).
- The codebase already provides a CLI sanitization helper (`sanitize_inline`) meant for single-line fields to strip all control characters; this warning should sanitize each selector (or otherwise ensure equivalent stripping) before output.
- The `CannotResolveOverrideVersion` (`ERR_PNPM_CANNOT_RESOLVE_OVERRIDE_VERSION`) diagnostic displays `{spec}` and `{dependency_name}` verbatim; these strings are derived from workspace overrides and may contain escaped control characters (e.g. `"\u001b[31m"`).
- miette diagnostic rendering does not automatically sanitize `Display` strings, so sanitization must happen before constructing the diagnostic fields or at an output boundary that reliably covers all diagnostics.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/override_version_references.rs[21-37]
- pnpm/crates/config/src/override_version_references.rs[30-52]
- pnpm/crates/config/src/workspace_yaml.rs[751-757]

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


3. Missing mirrored TypeScript tests 📘 Rule violation ▣ Testability
Description
This PR adds Rust coverage for $dep-name override self-references, but there is no corresponding
TypeScript test covering the same behavior. This violates the requirement to mirror cross-stack
behavior tests, increasing the risk of pnpm/pacquet drift going unnoticed.
Code

pnpm/crates/cli/tests/override_version_references.rs[R1-5]

+//! `$dep-name` self-references in `overrides` end to end: the reference
+//! resolves against the root manifest's direct dependencies, and the
+//! resolved specifier — not the raw `$dep-name` — is what the lockfile
+//! records and what a later frozen install compares against.
+
Relevance

⭐⭐ Medium

Team values Rust/TS parity, but mirrored test enforcement is inconsistent; TS already implements
behavior.

PR-#13074
PR-#13203

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2255044 requires that cross-stack behavior scenarios have mirrored automated tests
in both Rust and TypeScript. This PR adds Rust tests for $dep-name override reference behavior,
while TypeScript contains the implementation but its test file does not include coverage for that
scenario.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm/crates/cli/tests/override_version_references.rs[1-113]
pnpm11/config/reader/src/getOptionsFromRootManifest.ts[40-60]
pnpm11/config/reader/src/getOptionsFromRootManifest.ts[251-279]
pnpm11/config/reader/test/getOptionsFromRootManifest.test.ts[1-127]

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

## Issue description
Rust now has end-to-end tests asserting `$dep-name` override self-reference resolution and the associated warning/error behavior, but the TypeScript stack lacks an equivalent automated test for the same scenario.

## Issue Context
TypeScript implements this behavior in `getOptionsFromPnpmSettings()` (including warning text and the `CANNOT_RESOLVE_OVERRIDE_VERSION` error), but the current Jest tests for that module don't cover `$dep-name` override references.

## Fix Focus Areas
- pnpm11/config/reader/test/getOptionsFromRootManifest.test.ts[1-127]
- pnpm11/config/reader/src/getOptionsFromRootManifest.ts[40-72]
- pnpm/crates/cli/tests/override_version_references.rs[1-113]

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



Informational

4. pnpm missing in changeset 📘 Rule violation § Compliance
Description
The new changeset omits a pnpm entry, violating the requirement to explicitly declare the pnpm
package and bump type. This can break release tooling expectations and makes the versioning intent
ambiguous.
Code

.changeset/resolve-override-version-references.md[R1-3]

+---
+"pacquet": patch
+---
Relevance

⭐ Low

Prior identical requests to add pnpm to pacquet-only changesets were rejected.

PR-#12981
PR-#13347

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires changesets to include an explicit pnpm entry with a valid bump
type. The added changeset front-matter only declares pacquet and omits pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/resolve-override-version-references.md[1-3]

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 changeset front-matter is missing a `pnpm` entry. The compliance checklist requires every changeset to explicitly declare the `pnpm` package and a valid bump type.

## Issue Context
This PR adds `.changeset/resolve-override-version-references.md` but only lists `pacquet`.

## Fix Focus Areas
- .changeset/resolve-override-version-references.md[1-3]

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


Grey Divider

Previous review results

Review updated until commit acba4e1

Results up to commit 5f0d344 ⚖️ Balanced


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


Remediation recommended
1. Override warning not sanitized 🐞 Bug ⛨ Security
Description
warn_deprecated_override_version_references() and the ERR_PNPM_CANNOT_RESOLVE_OVERRIDE_VERSION
(CannotResolveOverrideVersion) diagnostic render override selector/spec strings taken from
repo-controlled pnpm-workspace.yaml without stripping control characters, enabling terminal
escape/control-sequence injection in local terminals and CI logs. This can spoof or obscure
warning/error output (e.g., rewriting lines with \r, injecting ANSI sequences).
Code

pnpm/crates/cli/src/cli_args/override_version_references.rs[R21-37]

+    let selectors = overrides
+        .iter()
+        .filter(|(_, spec)| spec.as_str().is_some_and(|spec| spec.starts_with('$')))
+        .map(|(selector, _)| selector.as_str())
+        .collect::<Vec<_>>();
+    if selectors.is_empty() {
+        return;
+    }
+    emit(&LogEvent::Global(GlobalLog {
+        level: LogLevel::Warn,
+        message: format!(
+            "The \"$\" version reference syntax in overrides is deprecated (used by: {}). \
+             Define the version in a catalog and reference it with the \"catalog:\" protocol \
+             instead. See https://pnpm.io/catalogs",
+            selectors.join(", "),
+        ),
+    }));
Relevance

⭐⭐⭐ High

Repo has accepted sanitizing untrusted CLI output to prevent terminal escape/control-sequence
injection.

PR-#13287
PR-#13230

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The warning path constructs its message from raw selector strings derived from workspace overrides
(Config::explicit_settings["overrides"]) and does not apply the existing CLI sanitize_inline()
helper that is intended to strip control characters before terminal output; the review guidance
treats workspace config as attacker-controlled and prior fixes in this area required sanitizing
untrusted strings before emitting messages. In the error path, LoadWorkspaceYamlError’s
CannotResolveOverrideVersion diagnostic prints spec and dependency_name directly, and these
fields are populated in resolve_version_references() from the override value (and its $-stripped
tail); because the miette report handler renders diagnostics via to_string() without sanitizing
control characters, any embedded escapes in these repo-controlled strings can reach stderr
unmodified.

pnpm/crates/cli/src/cli_args/override_version_references.rs[16-37]
pnpm/crates/cli/src/cli_args/sanitize.rs[17-24]
REVIEW_GUIDE.md[30-46]
pnpm/crates/config/src/workspace_yaml.rs[751-757]
pnpm/crates/config/src/override_version_references.rs[34-52]
pnpm/crates/diagnostics/src/collapsed_chain.rs[69-87]
PR-#13287

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

## Issue description
Warnings and diagnostics currently interpolate override selector/spec strings coming from repository-controlled workspace overrides directly into terminal/log output without removing control characters/ANSI escapes. This allows terminal escape/control-sequence injection that can spoof, hide, or rewrite CLI warnings/errors in local terminals and CI logs.

## Issue Context
- `warn_deprecated_override_version_references()` formats `selectors.join(", ")` directly into a warning message, where selectors originate from workspace config (`Config::explicit_settings["overrides"]`).
- The codebase already provides a CLI sanitization helper (`sanitize_inline`) meant for single-line fields to strip all control characters; this warning should sanitize each selector (or otherwise ensure equivalent stripping) before output.
- The `CannotResolveOverrideVersion` (`ERR_PNPM_CANNOT_RESOLVE_OVERRIDE_VERSION`) diagnostic displays `{spec}` and `{dependency_name}` verbatim; these strings are derived from workspace overrides and may contain escaped control characters (e.g. `"\u001b[31m"`).
- miette diagnostic rendering does not automatically sanitize `Display` strings, so sanitization must happen before constructing the diagnostic fields or at an output boundary that reliably covers all diagnostics.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/override_version_references.rs[21-37]
- pnpm/crates/config/src/override_version_references.rs[30-52]
- pnpm/crates/config/src/workspace_yaml.rs[751-757]

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


2. Missing mirrored TypeScript tests 📘 Rule violation ▣ Testability
Description
This PR adds Rust coverage for $dep-name override self-references, but there is no corresponding
TypeScript test covering the same behavior. This violates the requirement to mirror cross-stack
behavior tests, increasing the risk of pnpm/pacquet drift going unnoticed.
Code

pnpm/crates/cli/tests/override_version_references.rs[R1-5]

+//! `$dep-name` self-references in `overrides` end to end: the reference
+//! resolves against the root manifest's direct dependencies, and the
+//! resolved specifier — not the raw `$dep-name` — is what the lockfile
+//! records and what a later frozen install compares against.
+
Relevance

⭐⭐ Medium

Team values Rust/TS parity, but mirrored test enforcement is inconsistent; TS already implements
behavior.

PR-#13074
PR-#13203

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2255044 requires that cross-stack behavior scenarios have mirrored automated tests
in both Rust and TypeScript. This PR adds Rust tests for $dep-name override reference behavior,
while TypeScript contains the implementation but its test file does not include coverage for that
scenario.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm/crates/cli/tests/override_version_references.rs[1-113]
pnpm11/config/reader/src/getOptionsFromRootManifest.ts[40-60]
pnpm11/config/reader/src/getOptionsFromRootManifest.ts[251-279]
pnpm11/config/reader/test/getOptionsFromRootManifest.test.ts[1-127]

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

## Issue description
Rust now has end-to-end tests asserting `$dep-name` override self-reference resolution and the associated warning/error behavior, but the TypeScript stack lacks an equivalent automated test for the same scenario.

## Issue Context
TypeScript implements this behavior in `getOptionsFromPnpmSettings()` (including warning text and the `CANNOT_RESOLVE_OVERRIDE_VERSION` error), but the current Jest tests for that module don't cover `$dep-name` override references.

## Fix Focus Areas
- pnpm11/config/reader/test/getOptionsFromRootManifest.test.ts[1-127]
- pnpm11/config/reader/src/getOptionsFromRootManifest.ts[40-72]
- pnpm/crates/cli/tests/override_version_references.rs[1-113]

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



Informational
3. pnpm missing in changeset 📘 Rule violation § Compliance
Description
The new changeset omits a pnpm entry, violating the requirement to explicitly declare the pnpm
package and bump type. This can break release tooling expectations and makes the versioning intent
ambiguous.
Code

.changeset/resolve-override-version-references.md[R1-3]

+---
+"pacquet": patch
+---
Relevance

⭐ Low

Prior identical requests to add pnpm to pacquet-only changesets were rejected.

PR-#12981
PR-#13347

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires changesets to include an explicit pnpm entry with a valid bump
type. The added changeset front-matter only declares pacquet and omits pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/resolve-override-version-references.md[1-3]

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 changeset front-matter is missing a `pnpm` entry. The compliance checklist requires every changeset to explicitly declare the `pnpm` package and a valid bump type.

## Issue Context
This PR adds `.changeset/resolve-override-version-references.md` but only lists `pacquet`.

## Fix Focus Areas
- .changeset/resolve-override-version-references.md[1-3]

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


Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

…ides

`$dep-name` resolution treated every failure to read the root
package.json as "no dependencies declared", so a malformed manifest
surfaced as a missing-dependency error pointing at the override rather
than at the file to fix. Only a missing manifest means "no
dependencies"; a read or parse failure now propagates, matching pnpm 11
(`safeReadProjectManifestOnly` swallows only
ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND).
@codecov-commenter

codecov-commenter commented Jul 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.54%. Comparing base (b9df82e) to head (acba4e1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13404   +/-   ##
=======================================
  Coverage   87.53%   87.54%           
=======================================
  Files         542      544    +2     
  Lines       93294    93349   +55     
=======================================
+ Hits        81665    81722   +57     
+ Misses      11629    11627    -2     

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

@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 `@pnpm/crates/config/src/override_version_references.rs`:
- Around line 18-22: Allow peer dependencies as override-reference sources by
adding DependencyGroup::Peer to REFERENCEABLE_GROUPS and updating its
documentation. In pnpm/crates/config/src/override_version_references/tests.rs
lines 70-91, change the peer-dependency case to assert successful resolution and
retain a separate failure case for a non-direct dependency.
- Around line 27-41: Update resolve_version_references to distinguish a missing
root package.json from failures returned by PackageManifest::from_path: preserve
the empty-dependencies behavior only when the manifest is absent, and propagate
other read, parse, or folder errors through the manifest-specific
LoadWorkspaceYamlError variant. Add coverage for a malformed root manifest and
verify it reports the manifest-specific error instead of
ERR_PNPM_CANNOT_RESOLVE_OVERRIDE_VERSION.
🪄 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: dea1818f-e37c-4d13-b626-26b789860d19

📥 Commits

Reviewing files that changed from the base of the PR and between b9df82e and 5f0d344.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
📒 Files selected for processing (11)
  • .changeset/resolve-override-version-references.md
  • pnpm/crates/cli/src/cli_args.rs
  • pnpm/crates/cli/src/cli_args/install.rs
  • pnpm/crates/cli/src/cli_args/override_version_references.rs
  • pnpm/crates/cli/src/cli_args/pipelines.rs
  • pnpm/crates/cli/tests/override_version_references.rs
  • pnpm/crates/config/Cargo.toml
  • pnpm/crates/config/src/lib.rs
  • pnpm/crates/config/src/override_version_references.rs
  • pnpm/crates/config/src/override_version_references/tests.rs
  • pnpm/crates/config/src/workspace_yaml.rs

Copilot AI review requested due to automatic review settings July 26, 2026 10:12

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 acba4e1

@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 added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: acba4e106e45

Each scenario reports direct installs and pnpr installs. 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.535 ± 0.183 2.348 2.765 1.75 ± 0.17
pacquet@main 2.567 ± 0.150 2.334 2.765 1.77 ± 0.15
pnpr@HEAD 1.452 ± 0.094 1.336 1.645 1.00
pnpr@main 1.542 ± 0.123 1.360 1.738 1.06 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5347009369199998,
      "stddev": 0.18301549598437167,
      "median": 2.43746074862,
      "user": 1.47395934,
      "system": 1.27998494,
      "min": 2.3483971326199997,
      "max": 2.7646288746199996,
      "times": [
        2.3819963886199997,
        2.3483971326199997,
        2.7646288746199996,
        2.73803173062,
        2.39509267462,
        2.76200925762,
        2.38852147262,
        2.70779452962,
        2.47982882262,
        2.38070848562
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5668774874199998,
      "stddev": 0.1496381458435189,
      "median": 2.62003868412,
      "user": 1.4498801399999999,
      "system": 1.24858674,
      "min": 2.33442037762,
      "max": 2.76463446662,
      "times": [
        2.76463446662,
        2.64760773662,
        2.64705810262,
        2.33442037762,
        2.6392538926199998,
        2.3662392896199997,
        2.60082347562,
        2.73584901062,
        2.47202705662,
        2.46086146562
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.45238200852,
      "stddev": 0.09359881159939618,
      "median": 1.4508927311200002,
      "user": 1.00025944,
      "system": 1.11112734,
      "min": 1.33567325362,
      "max": 1.64462405162,
      "times": [
        1.5367174376200001,
        1.43764786662,
        1.64462405162,
        1.39056143762,
        1.38865060262,
        1.49172976662,
        1.46413759562,
        1.48363849362,
        1.35043957962,
        1.33567325362
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.54215773012,
      "stddev": 0.12331381455723839,
      "median": 1.54793944412,
      "user": 1.0049600399999998,
      "system": 1.13003154,
      "min": 1.3596980766200002,
      "max": 1.73797980362,
      "times": [
        1.3596980766200002,
        1.50805163562,
        1.36209811962,
        1.59822974262,
        1.73797980362,
        1.53159609562,
        1.4655454546200002,
        1.56428279262,
        1.64424191462,
        1.64985366562
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 252.2 ± 8.1 244.6 269.3 1.00
pacquet@main 254.8 ± 5.6 249.4 264.9 1.01 ± 0.04
pnpr@HEAD 268.3 ± 9.8 256.1 285.7 1.06 ± 0.05
pnpr@main 269.4 ± 5.8 260.5 277.8 1.07 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25224311879999994,
      "stddev": 0.008069737429723431,
      "median": 0.24915611860000003,
      "user": 0.19623105999999998,
      "system": 0.5065620399999999,
      "min": 0.24456717060000002,
      "max": 0.2693341186,
      "times": [
        0.24456717060000002,
        0.26236243859999997,
        0.2528486416,
        0.2555931616,
        0.24745571060000002,
        0.24944879860000002,
        0.24886343860000001,
        0.24644878760000002,
        0.2455089216,
        0.2693341186
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.2548254249,
      "stddev": 0.0056014523843993,
      "median": 0.2540483366,
      "user": 0.20040275999999996,
      "system": 0.51555414,
      "min": 0.2493909706,
      "max": 0.2648646536,
      "times": [
        0.2509133726,
        0.2540241416,
        0.2541614796,
        0.2565542476,
        0.2648646536,
        0.26413448159999997,
        0.2540725316,
        0.2504024526,
        0.2493909706,
        0.2497359176
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2683074113,
      "stddev": 0.009778959092439442,
      "median": 0.2673275036,
      "user": 0.21160646,
      "system": 0.52516754,
      "min": 0.2560952256,
      "max": 0.2857115216,
      "times": [
        0.2857115216,
        0.2790505076,
        0.2580369566,
        0.2627711376,
        0.2598754136,
        0.2560952256,
        0.2645177706,
        0.2762308556,
        0.2701372366,
        0.2706474876
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.2694225426,
      "stddev": 0.005837652819906868,
      "median": 0.2695944871,
      "user": 0.20358906000000002,
      "system": 0.54085924,
      "min": 0.2604612616,
      "max": 0.2777611846,
      "times": [
        0.2777611846,
        0.2775449986,
        0.27178642659999996,
        0.2604612616,
        0.2623123706,
        0.27116471859999997,
        0.2663425256,
        0.2725975806,
        0.2680242556,
        0.2662301036
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.762 ± 0.019 2.740 2.790 1.78 ± 0.13
pacquet@main 2.750 ± 0.012 2.729 2.774 1.77 ± 0.13
pnpr@HEAD 1.554 ± 0.112 1.422 1.736 1.00
pnpr@main 1.624 ± 0.135 1.426 1.813 1.05 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7624677816000003,
      "stddev": 0.019049437826674155,
      "median": 2.7672053387,
      "user": 1.67709924,
      "system": 1.3010117399999996,
      "min": 2.7403233537,
      "max": 2.7902801697000004,
      "times": [
        2.7433328397000003,
        2.7437482307,
        2.7404948867,
        2.7403233537,
        2.7734236197,
        2.7802844347,
        2.7609870577,
        2.7902801697000004,
        2.7769159527,
        2.7748872707000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.7504209111,
      "stddev": 0.012130003404120408,
      "median": 2.7493382561999997,
      "user": 1.6457132399999999,
      "system": 1.30193244,
      "min": 2.7290151467,
      "max": 2.7736958737,
      "times": [
        2.7476914807,
        2.7527863057000004,
        2.7495961607,
        2.7490803517,
        2.7572626637,
        2.7599712127,
        2.7736958737,
        2.7290151467,
        2.7377064667,
        2.7474034487
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5538440903000001,
      "stddev": 0.11185838081218959,
      "median": 1.5330589492000002,
      "user": 1.01276744,
      "system": 1.11651394,
      "min": 1.4215662017000001,
      "max": 1.7359136697,
      "times": [
        1.5486805227000002,
        1.6606770587000002,
        1.4215662017000001,
        1.4421776907000001,
        1.5174373757000001,
        1.4307226157000001,
        1.5084259627,
        1.7359136697,
        1.6905950447000002,
        1.5822447607
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6239799045,
      "stddev": 0.1353965087035559,
      "median": 1.5867721377000001,
      "user": 1.00011844,
      "system": 1.1444630400000002,
      "min": 1.4256734297000002,
      "max": 1.8127351087,
      "times": [
        1.7911645677,
        1.5574697377,
        1.7661539407000002,
        1.6160745377,
        1.6927190647,
        1.8127351087,
        1.5574040437,
        1.4760147357000002,
        1.5443898787,
        1.4256734297000002
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 589.2 ± 8.7 578.6 607.7 1.97 ± 0.04
pacquet@main 569.6 ± 14.2 553.4 601.6 1.90 ± 0.06
pnpr@HEAD 309.6 ± 6.6 303.2 327.0 1.03 ± 0.03
pnpr@main 299.4 ± 4.8 289.8 307.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.58916781028,
      "stddev": 0.008686984835405915,
      "median": 0.58840951438,
      "user": 0.7150603200000001,
      "system": 0.64091634,
      "min": 0.57857602688,
      "max": 0.60766209188,
      "times": [
        0.59064761988,
        0.58341098188,
        0.59852974088,
        0.58653009288,
        0.59028893588,
        0.60766209188,
        0.58214610488,
        0.59109994988,
        0.58278655788,
        0.57857602688
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.5695725282799999,
      "stddev": 0.014176225545657284,
      "median": 0.56793646938,
      "user": 0.6822189200000001,
      "system": 0.6699027399999999,
      "min": 0.55341508688,
      "max": 0.60162654088,
      "times": [
        0.56525071788,
        0.5716924918799999,
        0.57444563488,
        0.57062222088,
        0.58059593188,
        0.60162654088,
        0.5622857958799999,
        0.55437241488,
        0.55341508688,
        0.56141844688
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30955972258000003,
      "stddev": 0.006613715857179816,
      "median": 0.30793262938,
      "user": 0.19553061999999996,
      "system": 0.5431231399999998,
      "min": 0.30315088888,
      "max": 0.32704739288,
      "times": [
        0.30648614588,
        0.30943693088,
        0.30604315288,
        0.30315088888,
        0.30848210688,
        0.30608210688000004,
        0.31218487488,
        0.30930047388000004,
        0.32704739288,
        0.30738315188000004
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.29939774197999997,
      "stddev": 0.0048416005758273924,
      "median": 0.30062101538,
      "user": 0.20756401999999996,
      "system": 0.5055120399999999,
      "min": 0.28981186388,
      "max": 0.30740636588000003,
      "times": [
        0.29765014288,
        0.30154225688,
        0.29698031488000004,
        0.30099388588000003,
        0.30116399588000003,
        0.30740636588000003,
        0.28981186388,
        0.29491493388,
        0.30326551488000003,
        0.30024814488
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.901 ± 0.011 1.888 1.916 6.44 ± 0.28
pacquet@main 1.892 ± 0.010 1.879 1.917 6.41 ± 0.28
pnpr@HEAD 0.295 ± 0.013 0.279 0.316 1.00
pnpr@main 0.302 ± 0.007 0.292 0.312 1.02 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.9011037598400005,
      "stddev": 0.01050638448574059,
      "median": 1.9003509022400003,
      "user": 0.9030205600000001,
      "system": 0.7624598,
      "min": 1.8882788927400003,
      "max": 1.9155969457400002,
      "times": [
        1.9155969457400002,
        1.8882788927400003,
        1.90751409774,
        1.9136489647400001,
        1.9037033067400002,
        1.89341311074,
        1.91117082874,
        1.8887221857400003,
        1.8969984977400003,
        1.8919907677400003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.89169676564,
      "stddev": 0.010437597577077722,
      "median": 1.89095191974,
      "user": 0.9189827600000001,
      "system": 0.7356185,
      "min": 1.8794580577400002,
      "max": 1.9171989257400002,
      "times": [
        1.9171989257400002,
        1.8948385387400002,
        1.8940130267400002,
        1.8794580577400002,
        1.8858488857400002,
        1.88165526574,
        1.8873512887400001,
        1.8946998277400002,
        1.8916828377400001,
        1.89022100174
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29528824154,
      "stddev": 0.012706648143186833,
      "median": 0.29845259224,
      "user": 0.19753905999999996,
      "system": 0.5024276999999999,
      "min": 0.27926385374,
      "max": 0.31568900074,
      "times": [
        0.27926385374,
        0.27946017274,
        0.29685006074000003,
        0.31568900074,
        0.30005512374,
        0.30087389174,
        0.30077248074,
        0.31010991674,
        0.28292370074,
        0.28688421374
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30241055914000003,
      "stddev": 0.0069696381198661355,
      "median": 0.30071146624,
      "user": 0.19427856000000002,
      "system": 0.5301636999999999,
      "min": 0.29179293774000004,
      "max": 0.31159919474000003,
      "times": [
        0.29856565374,
        0.30285727874,
        0.29638160974,
        0.29812796274000003,
        0.31129275974000004,
        0.29179293774000004,
        0.31083860574,
        0.29831956174,
        0.30433002674,
        0.31159919474000003
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 351.9 ± 11.4 340.7 376.0 4.12 ± 0.17
pacquet@main 353.9 ± 11.6 345.2 374.0 4.15 ± 0.17
pnpr@HEAD 86.6 ± 1.8 82.0 89.6 1.01 ± 0.03
pnpr@main 85.3 ± 2.1 81.5 88.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.35186243886,
      "stddev": 0.011404126926504317,
      "median": 0.34879705906,
      "user": 0.35322738,
      "system": 0.04523362,
      "min": 0.34066413256000005,
      "max": 0.37602452856000007,
      "times": [
        0.37602452856000007,
        0.34392697356,
        0.34066413256000005,
        0.34500078156,
        0.34122529856000006,
        0.35561346056000004,
        0.35259333656,
        0.35745215456000007,
        0.34333177556000005,
        0.36279194656
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.35385204676000004,
      "stddev": 0.011552784903387566,
      "median": 0.34798971706000004,
      "user": 0.34774368,
      "system": 0.053925420000000016,
      "min": 0.34519432556,
      "max": 0.37402288756,
      "times": [
        0.34552917356000007,
        0.34855386656000004,
        0.34519432556,
        0.37402288756,
        0.34774888456,
        0.34724914456000006,
        0.34579179656000003,
        0.34823054956000005,
        0.36370548356000004,
        0.37249435556000005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08657484871625001,
      "stddev": 0.001765885598329818,
      "median": 0.08704717856000001,
      "user": 0.02052102375,
      "system": 0.00832105,
      "min": 0.08199139556000001,
      "max": 0.08961492756,
      "times": [
        0.08731463555999999,
        0.08481108156,
        0.08305403055999999,
        0.08694760656,
        0.08317169256000001,
        0.08685587456000002,
        0.08199139556000001,
        0.08493827056,
        0.08616349256,
        0.08886527956000001,
        0.08650568556000002,
        0.08794331656000001,
        0.08760299756,
        0.08666911256000001,
        0.08961492756,
        0.08638801556,
        0.08836679256000002,
        0.08540267356,
        0.08767059456000001,
        0.08672746256,
        0.08734169656000002,
        0.08765616756,
        0.08726286756000001,
        0.08729029056000001,
        0.08784769656,
        0.08638590156,
        0.08288401156,
        0.08708569556000001,
        0.08800780756000001,
        0.08751069456000002,
        0.08700866156,
        0.08710872956000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08531821274181818,
      "stddev": 0.0021229750618317503,
      "median": 0.08613705356000001,
      "user": 0.021219513333333336,
      "system": 0.007278332727272727,
      "min": 0.08149919956000001,
      "max": 0.08800471256,
      "times": [
        0.08613705356000001,
        0.08149919956000001,
        0.08453095656000001,
        0.08695310655999999,
        0.08711496056000001,
        0.08714196156000001,
        0.08746210356,
        0.08720009056,
        0.08307584256,
        0.08643574456,
        0.08233534955999999,
        0.08510134756000001,
        0.08701388056,
        0.08787074056,
        0.08556080056000001,
        0.08191673456000001,
        0.08288341956,
        0.08690179056,
        0.08791481256,
        0.08786413756,
        0.08562235656,
        0.08296286956000001,
        0.08426548655999999,
        0.08631239356,
        0.08712381656000001,
        0.08615414456,
        0.08402132856,
        0.08682920356000001,
        0.08800471256,
        0.08267517956,
        0.08162711956000002,
        0.08228144956,
        0.08470692656
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.571 ± 0.135 4.412 4.777 1.29 ± 0.05
pacquet@main 4.565 ± 0.164 4.428 4.809 1.29 ± 0.06
pnpr@HEAD 3.546 ± 0.109 3.440 3.799 1.00
pnpr@main 3.593 ± 0.122 3.444 3.836 1.01 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.570656720840001,
      "stddev": 0.13496305665968034,
      "median": 4.56789071774,
      "user": 1.65328972,
      "system": 1.3447572,
      "min": 4.41174409774,
      "max": 4.777082028740001,
      "times": [
        4.6417969267400006,
        4.7297669227400005,
        4.62725374274,
        4.6691812957400005,
        4.4226528827400005,
        4.50852769274,
        4.41174409774,
        4.777082028740001,
        4.42604700974,
        4.4925146087400005
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.56539304014,
      "stddev": 0.1636292426042076,
      "median": 4.48672647324,
      "user": 1.6812345200000003,
      "system": 1.3384813999999998,
      "min": 4.42763811874,
      "max": 4.80900561574,
      "times": [
        4.51896517274,
        4.45241848574,
        4.42763811874,
        4.80394618774,
        4.780274003740001,
        4.52387024774,
        4.45448777374,
        4.44313926174,
        4.80900561574,
        4.44018553374
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5459993879400002,
      "stddev": 0.10906594873126099,
      "median": 3.50173358924,
      "user": 1.1481257200000001,
      "system": 1.2304742,
      "min": 3.43969321974,
      "max": 3.79918656774,
      "times": [
        3.55021838174,
        3.43969321974,
        3.4884005187400002,
        3.49633092874,
        3.49358657274,
        3.6098753837400004,
        3.5071362497400003,
        3.79918656774,
        3.44456637474,
        3.63099968174
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.59315135804,
      "stddev": 0.12177484073834038,
      "median": 3.58330055624,
      "user": 1.1266847199999999,
      "system": 1.2380635000000002,
      "min": 3.44384031974,
      "max": 3.83571907374,
      "times": [
        3.48694939274,
        3.4727373417400003,
        3.44384031974,
        3.52095692574,
        3.63038261274,
        3.6086742477400002,
        3.66723508974,
        3.83571907374,
        3.55792686474,
        3.7070917117400004
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13404
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,740.32 ms
(+0.14%)Baseline: 2,736.62 ms
3,283.95 ms
(83.45%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,888.28 ms
(-0.23%)Baseline: 1,892.62 ms
2,271.14 ms
(83.14%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
578.58 ms
(+0.43%)Baseline: 576.09 ms
691.30 ms
(83.69%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
340.66 ms
(-2.87%)Baseline: 350.74 ms
420.88 ms
(80.94%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,348.40 ms
(-0.46%)Baseline: 2,359.15 ms
2,830.98 ms
(82.95%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,411.74 ms
(-0.26%)Baseline: 4,423.27 ms
5,307.93 ms
(83.12%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
244.57 ms
(-1.13%)Baseline: 247.37 ms
296.84 ms
(82.39%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13404
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

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

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,421.57 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
279.26 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
303.15 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
81.99 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,335.67 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,439.69 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
256.10 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit 5de55a1 into main Jul 26, 2026
39 checks passed
@zkochan
zkochan deleted the fix-13314 branch July 26, 2026 14:42
kairosci added a commit to kairosci/pnpm that referenced this pull request Jul 27, 2026
…3404)

An `overrides` value of `$foo` means "whatever specifier the root
manifest declares for `foo`". pacquet copied the raw map onto
`Config::overrides` instead, so the reference reached the read-package
hook, `pnpm-lock.yaml#overrides`, and the lockfile freshness check
verbatim. A lockfile written by pnpm 11 — which records the resolved
specifier — then failed a frozen install with ERR_PNPM_OUTDATED_LOCKFILE
(`overrides` in the lockfile `{"is-odd":"3.0.1"}` vs the config's
`{"is-odd":"$is-odd"}`), which is what blocked validating vitejs/vite.

Resolve the references while config is read: `pnpm-workspace.yaml` is
the only source that can set `overrides` (the global config.yaml is
stripped of the key and no `PNPM_CONFIG_*` var carries a map), and the
cascade knows the workspace root at that point, so the root manifest's
`dependencies` / `devDependencies` / `optionalDependencies` are in
reach. Every consumer downstream of `Config` — including the
`.modules.yaml` settings record — therefore sees the concrete
specifier, as it does in pnpm 11.

A reference to a package that is not a direct dependency fails with
ERR_PNPM_CANNOT_RESOLVE_OVERRIDE_VERSION, and the install family warns
about the deprecated syntax and points at catalogs, both matching
pnpm 11's wording.

TypeScript CLI: no change needed, it already resolves the references.

Closes pnpm#13314
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 12 does not resolve $dependency self-references in overrides

3 participants