Skip to content

fix(resolver): targeted updates resolve exactly like a fresh install - #12558

Merged
zkochan merged 21 commits into
pnpm:mainfrom
aqeelat:fix-update-preferred-version-downgrade
Jul 4, 2026
Merged

zkochan merged 21 commits into
pnpm:mainfrom
aqeelat:fix-update-preferred-version-downgrade

Conversation

@aqeelat

@aqeelat aqeelat commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Redefines the update contract so that pnpm up <pkg> produces exactly the lockfile a fresh install of the same manifests would (equivalently: delete the target's lockfile entries and run pnpm install). Three cases are fixed under that principle:

case symptom fix
Targeted package should update The target's own lockfile pins (and, before this PR's final revision, an over-broad bypass) made update results diverge from install updateRequested makes the picker ignore only the target's lockfile-derived pins; manifest pins, down-chain propagated versions, and range/tag selectors (audit-fix penalties) keep applying, so updates never install duplicates a reinstall would not reproduce
Unrelated packages should stay pinned Any update disabled lockfile-derived preferredVersions, allowing unrelated open ranges to re-resolve Always seed preferredVersions from the lockfile; caller-supplied preferred versions (audit-fix penalties) merge over the seed instead of replacing it
Requested version on a transitive dep pnpm update <dep>@<version> silently ignored <version> when <dep> is only a transitive dependency (#12744) Warn that the version part is ignored (an update cannot produce a resolution no install reproduces) and recommend a pnpm.overrides entry, which is the mechanism that does pin transitive dependencies

When a preferred version legitimately holds the update target below the newest version its range admits (e.g. a sibling's pin in the fresh-install resolution), pnpm now prints a warning recommending an override — a warning rather than an error so existing scripts keep passing.

All three fixes are implemented in both the TypeScript CLI and pacquet. On the pacquet side the picker needs no selector stripping at all: UpdateSeedPolicy already withholds the target's lockfile pins at seed-build time, which is the same semantics; update_requested there only gates the held-back-update warning.

Relationship to #12752

#12752 (by m2na7, credited via Co-authored-by) was folded into this PR because the two changes interact. Its approach — injecting the requested version of a transitive-only update into preferredVersions — was ultimately replaced by the warning above: under the update-matches-install contract there is no install that produces the requested version for a transitive dep, so synthesizing a temporary preference would create a lockfile that the next fresh install silently undoes. Its regression tests (including the prototype-pollution guard for crafted package names) are retained, updated to the final behavior, and its seed-merge insight survives in the install layer (interaction 2 above).

What's preserved

  • Install-time dedup, now also for the targeted package. A fresh install dedupes a caret consumer onto a manifest exact pin or a version propagated down the dependency chain; updates now do the same instead of installing a duplicate.
  • pnpm audit --fix penalties. Vulnerability penalties are range selectors with negative weight; they keep applying even to the targeted package, and the held-back warning's baseline includes them, so it never recommends a version the penalties avoid.
  • Lockfile consistency. Update results equal fresh-install results by construction; the fresh-install behavior of the test topologies was verified empirically against the registry mock.

Closes #10662.
Closes #12744.

Squash Commit Body

fix(resolver): targeted updates resolve exactly like a fresh install

Contract: `pnpm up <pkg>` produces the same lockfile a fresh install
of the same manifests would (equivalently: delete the target's
lockfile entries and run `pnpm install`).

pnpm (TypeScript):
- Thread a per-wanted-dependency `updateRequested` flag (true only for
  packages matching the user's update target) from the deps-resolver
  through requestPackage to the npm picker.
- At the picker, `stripLockfileVersionPins` subtracts
  EXISTING_VERSION_SELECTOR_WEIGHT from the target's version-type
  selectors (the lockfile seed's contribution, which is added onto
  manifest entries pinning the same version) and drops a selector only
  when nothing remains. Manifest pins, down-chain propagated versions,
  and range/tag selectors (audit-fix penalties) keep applying.
- Always seed `preferredVersions` from the lockfile, also during
  update mutations (pnpm/pnpm#10662); caller-supplied preferred
  versions (audit-fix penalties) merge over the seed per package name
  on a null-prototype target.
- New held-back-update warning at both npm picker entry points: when
  `updateRequested` and a kept preferred selector steers the pick
  below what the non-pin selectors alone would choose, warn once per
  (name, picked, preferred) recommending a pnpm.overrides entry.
- `pnpm update <dep>@<version>` for a transitive-only <dep> warns that
  the version part is ignored and recommends an override
  (pnpm/pnpm#12744).

pacquet (same behavior):
- The picker strips nothing: UpdateSeedPolicy::DropOnly already
  withholds the target's lockfile pins from the preferred-versions
  seed. `update_requested` (derived per wanted dependency via
  `is_update_target`, matching npm-alias and jsr real names) gates the
  held-back-update warning emitted by `warn_once_on_held_back_update`,
  with the same message as the TypeScript side.
- `pacquet update <pkg>@<version>` on a transitive-only package warns
  that the version part is ignored, mirroring the TypeScript wording.

Coverage: resolver-level tests in both stacks assert that the
lockfile-pin strip lets the target move, that manifest pins,
propagated versions, combined manifest+lockfile entries (manifest
weight preserved), and audit penalties keep steering, and e2e tests
assert the same-chain and importer-pin topologies dedupe under update
exactly as a fresh install does (fresh-install behavior verified
empirically against the registry mock). The transitive-version update
resolves to highest-in-range with the override recommendation, and
crafted package names (`[email protected]`) cannot pollute
Object.prototype.

Closes pnpm/pnpm#10662.
Closes pnpm/pnpm#12744.

Co-authored-by: Minha Kang <[email protected]>

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust pacquet/ port, or the description notes what still needs porting. Targeted-bump direction and jsr folding are in both stacks; the unrelated-stays-pinned direction is TS-only (pacquet already correct via UpdateSeedPolicy::DropOnly(names) — see Summary).
  • 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. Two changesets: update-requested-bypass-preferred.md (targeted-bump direction) and fix-update-unrelated-bumps.md (unrelated-stays-pinned).
  • Added or updated tests. Resolver-level regression tests cover both the bypass-fires and dedup-still-fires cases across TS and pacquet. The unrelated-stays-pinned direction is a one-line install-layer change; coverage rationale in the squash body.
  • Updated the documentation if needed. No user-facing CLI surface change; behavior brings up -r closer to install for these two cases.

Written by an agent (opencode, glm-5.2).

Summary by CodeRabbit

  • Bug Fixes
    • Fixed pnpm up -r <pkg> so updating one package no longer downgrades unrelated packages due to unrelated exact preferred versions.
    • Targeted updates now bypass only exact preferred-version pins for the selected package, while preserving range/tag steering and vulnerability-avoidance behavior.
    • Preferred-version seeding during update/install is now consistent with the lockfile/workspace, even when projects include updates.
  • Tests
    • Added regression tests covering targeted update behavior across npm and named-registry resolution, plus correct propagation through dependency resolution and installation.
  • Chores
    • Updated .gitignore for additional generated pnpm compile output directories.

@aqeelat
aqeelat requested a review from zkochan as a code owner June 21, 2026 16:34
@coderabbitai

coderabbitai Bot commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

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

Use the following commands to manage reviews:

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

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds updateRequested to shared resolver contracts, threads it through dependency resolution, changes npm selector handling for targeted updates, and updates lockfile seeding, regression tests, release notes, and ignore rules.

Changes

updateRequested flag — contracts, resolution, propagation, and tests

Layer / File(s) Summary
Resolver contracts
pnpm11/resolving/resolver-base/src/index.ts, pnpm11/store/controller-types/src/index.ts, pacquet/crates/resolving-resolver-base/src/resolve.rs
Adds updateRequested to shared resolver option types and adds selector_type() on VersionSelectorEntry.
Npm selector handling
pnpm11/resolving/npm-resolver/src/index.ts, pacquet/crates/resolving-npm-resolver/src/npm_resolver.rs, pacquet/crates/resolving-npm-resolver/src/named_registry_resolver.rs, pacquet/crates/resolving-npm-resolver/src/preferred_overlay.rs
Builds preferred selector sets from overlays or stored preferences, strips exact-version pins when updateRequested is true, and passes the resulting selectors into npm and named-registry package picking.
Pacquet update bypass propagation
pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs, pnpm11/installing/deps-resolver/src/resolveDependencies.ts
Computes per-wanted bypass decisions from UpdateReuseScope, recovers real package names from wanted dependencies, reuses subtrees with the updated exclusion check, and forwards updateRequested into package requests.
Install preferred-version seeding
pnpm11/installing/deps-installer/src/install/index.ts
Always seeds preferred versions from the lockfile during updates.
Regression coverage
pnpm11/installing/deps-installer/test/install/update.ts, pnpm11/installing/deps-resolver/test/resolveDependencyTree.test.ts, pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree/tests.rs, pnpm11/resolving/npm-resolver/test/index.ts, pnpm11/resolving/npm-resolver/test/resolveNamedRegistry.test.ts, pacquet/crates/resolving-npm-resolver/src/named_registry_resolver/tests.rs
Adds tests for targeted pin bypassing, preserving non-version selectors, update propagation through dependency resolution, real package-name recovery, and end-to-end updateMatching behavior.
Changeset and ignore rules
.changeset/update-requested-bypass-preferred.md, .changeset/fix-update-unrelated-bumps.md, .gitignore
Updates release notes and ignores pnpm-generated typecheck output paths.

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

Assessment against linked issues

Objective Addressed Explanation
[#10662] pnpm up -r <package> should not update unrelated packages with compatible newer versions; targeted updates should preserve locked versions for unrelated consumers while allowing the requested package to update ✅

Possibly related issues

Possibly related PRs

  • pnpm/pnpm#12357: Also changes how resolve_dependency_tree.rs applies preferred-version overlays during reuse and resolution.

Suggested reviewers: zkochan

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Fix pnpm up targeted package downgrades by bypassing preferred versions
🐞 Bug fix 🧪 Tests ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

Description

• Prevent pnpm up -r  from downgrading the explicitly targeted package.
• Thread a per-package updateRequested signal through TS and Rust resolvers.
• Add regression tests and ignore new build artifacts in .gitignore.
Diagram

graph TD
  user(("User: pnpm up -r <pkg>")) --> tsDeps["TS deps-resolver"] --> tsNpm["TS npm-resolver"] --> picker["Registry picker (skip preferred when updateRequested)"] --> registry{{"Registry"}}
  user --> rsDeps["pacquet deps tree"] --> rsNpm["pacquet npm resolver"] --> picker

  subgraph Legend
    direction LR
    _actor(("Actor")) ~~~ _proc["Process"] ~~~ _ext{{"External"}}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Disable preferred versions whenever `update` is enabled
  • ➕ Simpler flag surface area (no new option).
  • ➕ Eliminates all preferred-version bias during updates.
  • ➖ Breaks install-time dedup and reuse for unrelated packages re-resolved during updates.
  • ➖ Changes behavior much more broadly than the reported downgrade bug.
2. Stop propagating preferred versions for the update target during tree walk
  • ➕ Keeps picker interface unchanged (no new option).
  • ➕ Localizes the fix to propagation logic.
  • ➖ Harder to reason about because propagation has other valid use-cases.
  • ➖ More risk of regressions in overlay/dedup behavior across depths and importers.

Recommendation: Current approach is the best tradeoff: a per-package updateRequested signal is explicit, minimizes behavioral change, and fixes the targeted-package downgrade while preserving preferred-version dedup for unrelated resolutions.

Files changed (11) +130 / -8

Enhancement (3) +24 / -0
resolve.rsAdd 'update_requested' to pacquet ResolveOptions +8/-0

Add 'update_requested' to pacquet ResolveOptions

• Introduces a documented 'update_requested' boolean distinct from broad update behavior, enabling targeted bypass of preferred versions without forcing unrelated upgrades.

pacquet/crates/resolving-resolver-base/src/resolve.rs

index.tsExpose 'updateRequested' on resolver-base ResolveOptions +8/-0

Expose 'updateRequested' on resolver-base ResolveOptions

• Adds documented optional 'updateRequested' to resolver-base option types so downstream resolvers can distinguish targeted updates from incidental re-resolutions.

pnpm11/resolving/resolver-base/src/index.ts

index.tsExpose 'updateRequested' on store RequestPackageOptions +8/-0

Expose 'updateRequested' on store RequestPackageOptions

• Adds documented optional 'updateRequested' to the store controller request options, enabling end-to-end propagation from deps-resolver to npm resolver.

pnpm11/store/controller-types/src/index.ts

Bug fix (5) +38 / -8
resolve_dependency_tree.rsCompute 'update_requested' per wanted dependency during tree resolve +24/-0

Compute 'update_requested' per wanted dependency during tree resolve

• Sets 'opts.update_requested' only for dependencies whose alias matches the update exclusion scope, cloning options only when needed. This ensures only targeted update packages bypass preferred-version bias downstream.

pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs

named_registry_resolver.rsBypass preferred-version selectors for targeted updates (named registries) +5/-3

Bypass preferred-version selectors for targeted updates (named registries)

• Skips 'preferred_version_selectors' when 'opts.update_requested' is true, preventing targeted updates from being pinned to sibling-propagated older versions.

pacquet/crates/resolving-npm-resolver/src/named_registry_resolver.rs

npm_resolver.rsBypass preferred-version selectors for targeted updates (npm) +5/-3

Bypass preferred-version selectors for targeted updates (npm)

• Gates 'preferred_version_selectors' on 'opts.update_requested' so the picker does not honor preferred versions when the user explicitly targets a package for update.

pacquet/crates/resolving-npm-resolver/src/npm_resolver.rs

resolveDependencies.tsThread 'updateRequested' into store request and preferred-version normalization +1/-0

Thread 'updateRequested' into store request and preferred-version normalization

• Computes 'updateRequested' per dependency based on update depth and 'updateMatching', then passes it through to 'requestPackage'. Also ensures single 'preferredVersion' is ignored for targeted updates.

pnpm11/installing/deps-resolver/src/resolveDependencies.ts

index.tsSkip preferredVersionSelectors in npm picker when 'updateRequested' +3/-2

Skip preferredVersionSelectors in npm picker when 'updateRequested'

• Extends 'ResolveFromNpmOptions' with 'updateRequested' and uses it to omit 'preferredVersionSelectors' at both npm and simple-registry picker call sites (covers jsr and named registries).

pnpm11/resolving/npm-resolver/src/index.ts

Tests (1) +59 / -0
index.tsAdd regression tests for targeted-update preferred-version bypass +59/-0

Add regression tests for targeted-update preferred-version bypass

• Adds a test ensuring 'updateRequested: true' ignores preferred versions and picks latest, plus a companion test ensuring normal installs still honor preferred versions for dedup.

pnpm11/resolving/npm-resolver/test/index.ts

Documentation (1) +9 / -0
update-requested-bypass-preferred.mdAdd changeset documenting targeted-update downgrade fix +9/-0

Add changeset documenting targeted-update downgrade fix

• Adds a patch-level changeset describing the 'pnpm up -r <pkg>' downgrade scenario and the new 'updateRequested'-based bypass of preferred version selectors.

.changeset/update-requested-bypass-preferred.md

Other (1)
.gitignoreIgnore pnpm build artifacts ('__typecheck__/', '/pnpm/') +0/-0

Ignore pnpm build artifacts ('typecheck/', '/pnpm/')

• Updates repository ignore rules to exclude tsgo typecheck output and pnpm shim layout artifacts produced by compile workflows.

.gitignore

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 21, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. Selector proto pollution 🐞 Bug ⛨ Security
Description
stripLockfileVersionPins() (and the same pattern in warnOnceOnHeldBackUpdate()) constructs
VersionSelectors via {} and assigns attacker-controlled selector keys into it, so a selector
like __proto__ can mutate the object’s prototype and corrupt resolution or crash targeted updates.
This reintroduces the prototype-pollution hazard the PR explicitly addresses for preferred-version
maps.
Code

pnpm11/resolving/npm-resolver/src/index.ts[R334-346]

+function stripLockfileVersionPins (selectors?: VersionSelectors): VersionSelectors | undefined {
+  if (selectors == null) return undefined
+  let kept: VersionSelectors | undefined
+  for (const [selector, value] of Object.entries(selectors)) {
+    let keptValue = value
+    if (typeof value !== 'string' && value.selectorType === 'version' && value.weight >= EXISTING_VERSION_SELECTOR_WEIGHT) {
+      const manifestWeight = value.weight - EXISTING_VERSION_SELECTOR_WEIGHT
+      if (manifestWeight <= 0) continue
+      keptValue = { selectorType: 'version', weight: manifestWeight }
+    }
+    kept ??= {}
+    kept[selector] = keptValue
+  }
Evidence
The repo explicitly documents preferred-version structures as attacker-controlled and fixes
__proto__ prototype-pollution by using null-prototype objects; however, the new targeted-update
helpers rebuild selector maps with plain objects and assign selector keys directly, recreating the
same __proto__ hazard on the updateRequested path.

pnpm11/resolving/npm-resolver/src/index.ts[334-346]
pnpm11/resolving/npm-resolver/src/index.ts[377-382]
pnpm11/lockfile/preferred-versions/src/index.ts[18-22]
.changeset/preferred-versions-proto-pollution.md[7-7]
pnpm11/lockfile/preferred-versions/test/index.ts[31-52]

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

## Issue description
`stripLockfileVersionPins()` and `warnOnceOnHeldBackUpdate()` rebuild `VersionSelectors` using plain `{}` and then assign selector keys (originating from manifests/lockfiles) via `obj[key] = ...`. If a selector key is `__proto__`, this can trigger prototype mutation on a normal object, reintroducing prototype-pollution risk on the `updateRequested` path.
## Issue Context
This PR already treats preferred-version maps as attacker-controlled and switches them to null-prototype objects elsewhere; these two new helper paths should follow the same rule.
## Fix Focus Areas
- pnpm11/resolving/npm-resolver/src/index.ts[334-346]
- pnpm11/resolving/npm-resolver/src/index.ts[367-382]

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


2. PreferredVersions proto pollution 🐞 Bug ⛨ Security
Description
_installInContext() now always calls getPreferredVersionsFromLockfileAndManifests(), whose
internal accumulators are plain {} keyed by manifest/lockfile package names; a dependency name
like __proto__ can redirect writes into Object.prototype during seeding, corrupting process-wide
behavior. This becomes reachable even when opts.preferredVersions is provided (e.g. `pnpm audit
--fix` penalties), because the seed is now always computed.
Code

pnpm11/installing/deps-installer/src/install/index.ts[R1510-1516]

+  const preferredVersions: PreferredVersions = Object.assign(
+    Object.create(null),
+    getPreferredVersionsFromLockfileAndManifests(ctx.wantedLockfile.packages, Object.values(ctx.projects).map(({ manifest }) => manifest))
)
+  for (const [pkgName, selectors] of Object.entries(opts.preferredVersions ?? {})) {
+    preferredVersions[pkgName] = { ...preferredVersions[pkgName], ...selectors }
+  }
Evidence
The install layer now always computes the preferredVersions seed from lockfile+manifests before
merging caller-supplied preferredVersions. The seeding helper constructs its maps with plain objects
and indexes them by package name, which the repo treats as attacker-controlled; using {} with a
key like __proto__ risks prototype access/pollution during construction (the repo uses
null-prototype records elsewhere specifically to prevent this class).

pnpm11/installing/deps-installer/src/install/index.ts[1497-1516]
pnpm11/lockfile/preferred-versions/src/index.ts[13-33]
pnpm11/lockfile/preferred-versions/src/index.ts[35-76]
pnpm11/deps/compliance/audit/src/lockfileToAuditIndex.ts[51-55]

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

## Issue description
`getPreferredVersionsFromLockfileAndManifests()` builds `PreferredVersions` using plain objects (`{}`) and indexes them with attacker-controlled package names from manifests/lockfiles. Special keys like `__proto__` / `constructor` can trigger prototype accessor behavior on normal objects, leading to prototype pollution or corruption while the seed is being constructed.
This PR makes the helper run unconditionally (even when the caller supplies `opts.preferredVersions`), so the vulnerable construction path is exercised in more update/audit flows.
## Issue Context
- `_installInContext()` now always seeds from `getPreferredVersionsFromLockfileAndManifests(...)` and then merges `opts.preferredVersions`.
- The helper currently initializes accumulators with `{}` and performs lookups/assignments with dynamic keys derived from manifests and lockfile snapshots.
## Fix Focus Areas
- pnpm11/installing/deps-installer/src/install/index.ts[1497-1516]
- pnpm11/lockfile/preferred-versions/src/index.ts[13-76]
## What to change
1. In `pnpm11/lockfile/preferred-versions/src/index.ts`, change all records keyed by package name to null-prototype objects:
- `const preferredVersions: PreferredVersions = Object.create(null)`
- When creating per-package selector maps, use `Object.create(null)` as well (nested null-proto), e.g. `preferredVersions[name] ??= Object.create(null)`.
2. In `addPreferredVersionsFromLockfile()`, change `uniqueNameVersions` from `{}` to `Object.create(null)` for the same reason.
3. Ensure any dynamic assignment into these structures cannot invoke `__proto__` setters by virtue of having an object prototype.
4. Add/adjust a regression test demonstrating that a manifest/lockfile containing a dependency named `__proto__` (or similar) does not mutate `Object.prototype` and does not throw during preferred-version seeding.

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


3. Audit-fix misses npm aliases 🐞 Bug ⛨ Security
Description
When infoFromLockfile is missing, resolveDependenciesOfDependency() falls back to calling
updateMatching() with wantedDependency.alias; for npm: alias deps (e.g. foo@npm:bar@^4) the
alias differs from the real package name, so createVulnerabilityUpdateMatching() may not mark the
vulnerable package as an update target. This can leave updateRequested=false, keeping
lockfile-derived preferred-version pins in effect and potentially preventing pnpm audit --fix from
updating the vulnerable package.
Code

pnpm11/installing/deps-resolver/src/resolveDependencies.ts[R902-910]

+      (extendedWantedDep.infoFromLockfile?.name != null
+        ? options.updateMatching(extendedWantedDep.infoFromLockfile.name, extendedWantedDep.infoFromLockfile.version)
+        // A changed specifier forgets the edge's lockfile reference before
+        // resolution (e.g. `pnpm audit --fix` widening a vulnerable pin), so
+        // the target would otherwise lose its updateRequested status — and
+        // keep its seeded lockfile pins — at the very moment it is being
+        // updated. Fall back to matching by the wanted alias.
+        : Boolean(extendedWantedDep.wantedDependency.alias) &&
+          options.updateMatching(extendedWantedDep.wantedDependency.alias!, undefined))
Evidence
The new fallback uses wantedDependency.alias for version-less matching, but the vulnerability
matcher’s version-less path checks membership in a set of *real* package names;
parseBareSpecifier() shows that for npm: aliases the real name is parsed from the specifier (not
the alias), so alias-based matching can miss the vulnerable package and prevent updateRequested
from enabling lockfile-pin bypass.

pnpm11/installing/deps-resolver/src/resolveDependencies.ts[898-910]
pnpm11/installing/commands/src/installDeps.ts[619-624]
pnpm11/resolving/npm-resolver/src/parseBareSpecifier.ts[15-40]
pnpm11/installing/deps-resolver/src/wantedDepIsLocallyAvailable.ts[1-18]
pnpm11/resolving/npm-resolver/src/index.ts[315-322]

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

## Issue description
`resolveDependenciesOfDependency()` falls back to `updateMatching(alias, undefined)` when `infoFromLockfile` is absent. For `npm:` aliases, the alias can differ from the real package name, so name-only vulnerability matching can miss the target and fail to set `updateRequested`, leaving lockfile pins in place.
## Issue Context
- `createVulnerabilityUpdateMatching()` treats `version===undefined` as “match by package name only”, using vulnerability map keys.
- `parseBareSpecifier()` already knows how to derive the real package name for `npm:` specifiers (including `npm:<name>@<range>` and `npm:<range>`).
- The deps-resolver already imports/uses `parseBareSpecifier()` elsewhere (`wantedDepIsLocallyAvailable.ts`).
## Fix Focus Areas
- pnpm11/installing/deps-resolver/src/resolveDependencies.ts[898-910]
## Suggested change
In the `infoFromLockfile`-missing branch, derive the match name from `wantedDependency.bareSpecifier` using `parseBareSpecifier(bareSpecifier, alias, ctx.defaultTag, ctx.registries.default)` and pass `spec.name` (when available) to `updateMatching(..., undefined)`; only fall back to `alias` when parsing fails.
Pseudo-shape:

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


View more (6)
4. Transitive update version ignored 📎 Requirement gap ≡ Correctness
Description
pnpm update @ (and pacquet update @) now explicitly ignores the requested `` when the package is
only transitive, leaving the lockfile resolved to a different version. This violates the requirement
that transitive-only updates honor an explicit requested version when it is resolvable.
Code

pnpm11/installing/commands/src/installDeps.ts[R600-605]

+function warnAboutIgnoredVersionsOfIndirectUpdateSpecs (updateSpecs: string[]): void {
+  for (const spec of updateSpecs) {
+    const { pattern, versionSpec } = parseUpdateParam(spec)
+    if (versionSpec == null) continue
+    globalWarn(`"${pattern}" is not a direct dependency, so the requested version "${versionSpec}" is ignored — "${pattern}" is updated to what a fresh install would resolve. To force a version of a transitive dependency, add an override: { "pnpm": { "overrides": { "${pattern}": "${versionSpec}" } } }`)
+  }
Evidence
PR Compliance ID 1 requires that specifying an explicit version for a transitive-only dependency
updates the lockfile to that version when resolvable. The new code in both pnpm (TS) and pacquet
(Rust) instead warns that the version is ignored for transitive-only dependencies and does not apply
it, and the added tests assert that the lockfile does not contain the requested version.

pnpm up &lt;pkg&gt;@&lt;version&gt; must update transitive dependencies to the specified version
pnpm11/installing/commands/src/installDeps.ts[592-605]
pacquet/crates/package-manager/src/update.rs[375-391]
pnpm11/installing/commands/test/update/update.ts[142-175]
pacquet/crates/cli/tests/update.rs[208-248]

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 current implementation intentionally ignores `<version>` for transitive-only selectors (it only warns). Compliance requires that `pnpm up/update <pkg>@<version>` updates the lockfile to the requested version for transitive-only packages when resolvable.
## Issue Context
- TypeScript path: `warnAboutIgnoredVersionsOfIndirectUpdateSpecs()` emits a warning stating the requested version is ignored.
- Rust pacquet path: `Update<'_>` emits an analogous warning and proceeds without applying the requested version.
## Fix Focus Areas
- pnpm11/installing/commands/src/installDeps.ts[592-605]
- pacquet/crates/package-manager/src/update.rs[375-391]
- pnpm11/installing/commands/test/update/update.ts[142-175]
- pacquet/crates/cli/tests/update.rs[208-248]

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


5. npm: range-only misparsed 🐞 Bug ≡ Correctness
Description
In pacquet, real_package_name_of() returns the range string as the “real package name” for npm:
range-only specifiers (e.g. npm:^1.0.0), so should_bypass_preferred() won’t mark such targeted
updates as update_requested and preferred-version pins can still hold the target below latest.
Code

pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[R2199-2212]

+    let bare = wanted.bare_specifier.as_deref()?;
+    if let Some(rest) = bare.strip_prefix("npm:") {
+        // Npm-alias: parse the real name out of `bare_specifier`
+        // because `wanted.alias` keeps the local install name. Split
+        // at the last `@` to separate the real name from the version
+        // range. When there is no `@`, the whole `rest` is the name
+        // (default-tag form `npm:bar`).
+        let last_at = rest.bytes().enumerate().rev().find_map(|(i, b)| (b == b'@').then_some(i));
+        let name = match last_at {
+            Some(idx) if idx >= 1 => &rest[..idx],
+            _ => rest,
+        };
+        return (!name.is_empty()).then_some(Cow::Borrowed(name));
+    }
Evidence
pacquet’s npm bare-specifier parser explicitly treats npm: as “name = alias”, but the new
real_package_name_of() helper lacks that branch and will return the range itself as the name,
preventing update-target matching for this valid spec form.

pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[2184-2228]
pacquet/crates/resolving-npm-resolver/src/parse_bare_specifier.rs[42-69]

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

## Issue description
`real_package_name_of()` parses `bare_specifier` beginning with `npm:` by splitting on the last `@` and treating the prefix as the package name. This fails for the supported `npm:<range>` form (where the dependency key/alias is the package name and the value is only a range), causing the function to return the range string as the name. As a result, update targeting misses and `update_requested` won’t be set for that dependency.
### Issue Context
The npm resolver’s `parse_bare_specifier()` already supports `npm:<range>` by using the alias as the package name when the `npm:` body parses as a semver range.
### Fix Focus Areas
- pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[2199-2228]
### Suggested fix
In the `npm:` branch of `real_package_name_of()`:
1. If `wanted.alias` is present/non-empty AND `rest` parses as a semver range (`node_semver::Range::parse(rest).is_ok()`), return the alias as the real package name.
2. Otherwise, fall back to the existing split-at-last-`@` logic.
3. Add/extend a unit test for `real_package_name_of(wanted(alias="foo", bare_specifier="npm:^1.0.0")) == Some("foo")`.

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


6. Vuln selectors bypassed ✓ Resolved 🐞 Bug ⛨ Security
Description
When updateRequested is true, the npm resolver sets preferredVersionSelectors to undefined,
which drops vulnerability-avoidance selectors that pnpm encodes in preferredVersions
(negative-weight range selectors). With packageVulnerabilityAudit enabled, updateMatching
targets vulnerable packages for update, so this change can cause resolution to pick a
still-vulnerable highest-in-range version instead of the intended non-vulnerable one.
Code

pnpm11/resolving/npm-resolver/src/index.ts[R502-508]

publishedByExclude: opts.publishedByExclude,
authHeaderValue,
dryRun: opts.dryRun === true,
-      preferredVersionSelectors: opts.preferredVersions?.[spec.name],
+      preferredVersionSelectors: opts.updateRequested ? undefined : opts.preferredVersions?.[spec.name],
registry,
includeLatestTag: opts.update === 'latest',
updateChecksums: opts.updateChecksums,
Evidence
The resolver bypass is keyed solely on updateRequested and unconditionally removes
preferredVersionSelectors. Separately, packageVulnerabilityAudit uses preferredVersions as a
mechanism to penalize vulnerable ranges and sets updateMatching to target vulnerable packages,
which causes updateRequested to become true for those packages—meaning the vulnerability penalties
are dropped exactly for the packages that need them.

pnpm11/resolving/npm-resolver/src/index.ts[496-510]
pnpm11/resolving/npm-resolver/src/index.ts[734-746]
pnpm11/installing/commands/src/installDeps.ts[341-375]
pnpm11/installing/commands/src/installDeps.ts[444-448]
pnpm11/installing/commands/src/installDeps.ts[589-616]
pnpm11/installing/deps-resolver/src/resolveDependencies.ts[888-929]
pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[154-207]

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

## Issue description
`updateRequested` currently disables *all* `preferredVersionSelectors` for the targeted package. This also disables vulnerability-avoidance selectors produced by `packageVulnerabilityAudit` (which are implemented via `preferredVersions` using negative-weight `range` selectors), potentially allowing a targeted update to resolve to a vulnerable version.
## Issue Context
- `packageVulnerabilityAudit` sets `preferredVersions` to vulnerability penalties and sets `updateMatching` to target vulnerable packages.
- `resolveDependencies.ts` computes `updateRequested` based on `updateMatching` and threads it through to `requestPackage`.
- The npm resolver uses `updateRequested` to drop `preferredVersionSelectors` entirely.
## Fix Focus Areas
- pnpm11/resolving/npm-resolver/src/index.ts[496-510]
- pnpm11/resolving/npm-resolver/src/index.ts[734-746]
## Suggested fix
Instead of setting `preferredVersionSelectors` to `undefined` when `updateRequested` is true, **filter selectors to remove only propagated version pins** (entries whose value is `'version'` / selectorType `version`), while preserving `range` selectors (e.g. vulnerability penalties) and other non-pin selectors.
For example:
- Add a helper `stripVersionPins(selectors?: VersionSelectors): VersionSelectors | undefined` that removes entries representing exact-version pin preferences.
- Use it like:
- `preferredVersionSelectors: opts.updateRequested ? stripVersionPins(opts.preferredVersions?.[spec.name]) : opts.preferredVersions?.[spec.name]`
- Apply in both `resolveNpm` and `pickFromSimpleRegistry` entry points.

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


7. Missing pnpm up -r regression ✓ Resolved 📎 Requirement gap ⚙ Maintainability
Description
The added tests only validate preferredVersionSelectors behavior in resolveFromNpm, but do not
reproduce/assert the lockfile-level scenario where pnpm up -r  must not upgrade unrelated
compatible dependencies. This leaves the main reported class of regression (unrelated upgrades
during targeted recursive update) uncovered by automated tests.
Code

pnpm11/resolving/npm-resolver/test/index.ts[R513-570]

+test('ignore the preferred version when updateRequested is true (targeted update must not be pulled down by sibling propagation)', async () => {
+  // Regression test for the form-data downgrade: when the user runs
+  // `pnpm up -r <pkg>`, the targeted package's resolution must not be
+  // pinned to an older sibling-resolved version via preferredVersionSelectors.
+  // The resolver receives updateRequested=true only for packages matching
+  // the user's update target, so unrelated re-resolutions keep deduping.
+  getMockAgent().get(registries.default.replace(/\/$/, ''))
+    .intercept({ path: '/is-positive', method: 'GET' })
+    .reply(200, {
+      ...isPositiveMeta,
+      'dist-tags': { latest: '3.1.0' },
+    })
+
+  const { resolveFromNpm } = createResolveFromNpm({
+    storeDir: temporaryDirectory(),
+    cacheDir: temporaryDirectory(),
+    registries,
+  })
+  const resolveResult = await resolveFromNpm({
+    alias: 'is-positive',
+    bareSpecifier: '^3.0.0',
+  }, {
+    preferredVersions: {
+      'is-positive': { '3.0.0': 'version' },
+    },
+    updateRequested: true,
+  })
+  expect(resolveResult!.id).toBe('[email protected]')
+})
+
+test('still honor the preferred version when updateRequested is false (dedup during plain install)', async () => {
+  // Companion to the test above: the new flag must not regress normal
+  // install-time dedup. With updateRequested unset/false, a preferred
+  // version inside the wanted range continues to win over latest so
+  // pnpm avoids creating a duplicate.
+  getMockAgent().get(registries.default.replace(/\/$/, ''))
+    .intercept({ path: '/is-positive', method: 'GET' })
+    .reply(200, {
+      ...isPositiveMeta,
+      'dist-tags': { latest: '3.1.0' },
+    })
+
+  const { resolveFromNpm } = createResolveFromNpm({
+    storeDir: temporaryDirectory(),
+    cacheDir: temporaryDirectory(),
+    registries,
+  })
+  const resolveResult = await resolveFromNpm({
+    alias: 'is-positive',
+    bareSpecifier: '^3.0.0',
+  }, {
+    preferredVersions: {
+      'is-positive': { '3.0.0': 'version' },
+    },
+    updateRequested: false,
+  })
+  expect(resolveResult!.id).toBe('[email protected]')
+})
Evidence
Compliance rule 3 requires a regression test that runs a targeted recursive update and verifies
unrelated packages remain unchanged in the lockfile. The newly added tests in
pnpm11/resolving/npm-resolver/test/index.ts only assert version picking for a single package under
updateRequested and do not exercise pnpm up -r  or lockfile stability for unrelated
dependencies.

Regression test coverage: reproduce and prevent unrelated upgrades on targeted recursive update
pnpm11/resolving/npm-resolver/test/index.ts[513-570]

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

## Issue description
PR Compliance ID 3 requires an automated regression that reproduces a targeted recursive update (`pnpm up -r <pkg>`) and asserts that unrelated compatible dependencies do **not** change in `pnpm-lock.yaml`. The current new tests only cover resolver-level preferred-version selection and do not validate the end-to-end lockfile outcome.
## Issue Context
The reported bug class involves workspace resolution and lockfile behavior (unrelated packages changing during a targeted update). A unit test around `resolveFromNpm()` does not ensure unrelated packages remain pinned across the full update flow.
## Fix Focus Areas
- pnpm11/resolving/npm-resolver/test/index.ts[513-570]
- pnpm11/installing/deps-resolver/test/resolveDependencyTree.test.ts[1-80]

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


8. Update target never detected ✓ Resolved 🐞 Bug ≡ Correctness
Description
real_package_name_of() returns None for ordinary dependencies whose bare_specifier is a
semver/range (e.g. ^1.0.0), so resolve_wanted_cached() computes update_requested=false even
for the user’s targeted update package. As a result, the npm picker continues honoring
preferred_version_selectors, which can pick a lower preferred version over the highest satisfying
version and reintroduce the targeted-package downgrade.
Code

pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[R2213-2226]

+fn real_package_name_of(wanted: &WantedDependency) -> Option<String> {
+    let bare = wanted.bare_specifier.as_deref()?;
+    let rest = bare.strip_prefix("npm:")?;
+    // Mirror `parse_bare_specifier`'s npm-alias branch: split at the
+    // last `@` to separate the real name from the version range. When
+    // there is no `@`, the whole `rest` is the name (default-tag form
+    // `npm:bar`).
+    let last_at = rest.bytes().enumerate().rev().find_map(|(i, b)| (b == b'@').then_some(i));
+    let name = match last_at {
+        Some(idx) if idx >= 1 => &rest[..idx],
+        _ => rest,
+    };
+    (!name.is_empty()).then(|| name.to_string())
+}
Evidence
resolve_wanted_cached() uses real_package_name_of() to decide update_requested, but
real_package_name_of() currently early-returns None unless the specifier starts with npm:. In
pacquet’s parser, typical dependencies produce a plain semver/range bare specifier (no npm:
prefix), so update targeting won’t activate. The npm picker explicitly prefers versions from
preferred_version_selectors (potentially choosing a lower preferred version instead of the max
satisfying version), so failing to set update_requested defeats the intended bypass.

pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[1823-1852]
pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[2213-2226]
pacquet/crates/resolving-parse-wanted-dependency/src/lib.rs[18-27]
pacquet/crates/resolving-parse-wanted-dependency/src/lib.rs[38-46]
pacquet/crates/resolving-npm-resolver/src/npm_resolver.rs[332-376]
pacquet/crates/resolving-npm-resolver/src/pick_package_from_meta.rs[292-318]

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

## Issue description
In pacquet, `update_requested` is derived from `real_package_name_of(wanted)`, but `real_package_name_of()` only handles `npm:` alias specifiers. For normal dependencies (the common case), it returns `None`, causing `update_requested` to remain `false` even when the dependency is the user’s update target.
### Issue Context
- `update_requested` is supposed to disable `preferred_version_selectors` for the targeted package so sibling-propagated preferred versions can’t pull the target down.
- `parse_wanted_dependency` produces `bare_specifier` values like `"1.2.3"` / `"^1.0.0"` for standard deps, not `"npm:..."`.
### Fix Focus Areas
- pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[2213-2226]
### Suggested change
Update `real_package_name_of()` to:
1) If `bare_specifier` starts with `"npm:"`, parse and return the *real* name as it does today.
2) Otherwise, return `wanted.alias.clone()` (including when `bare_specifier` is `None`, e.g. default-tag forms).
This makes `update_requested` work for the standard dependency forms while keeping the npm-alias special case correct.

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


9. Alias update misdetected ✓ Resolved 🐞 Bug ≡ Correctness
Description
In pacquet, resolve_wanted_cached() sets update_requested based on wanted.alias, but npm-alias
dependencies keep alias as the install name (e.g. foo@npm:bar@^4 has alias foo), while update
targeting is keyed by real package name. This can leave update_requested false for a targeted
update of the underlying package, so the npm picker still applies preferred-version propagation and
may pick an older sibling-propagated version instead of the intended update.
Code

pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[R1831-1835]

+    let opts = if let Some(alias) = wanted.alias.as_deref() {
+        let pkg_name = pacquet_lockfile::PkgName::from_str(alias).ok();
+        let update_requested = pkg_name
+            .as_ref()
+            .is_some_and(|n| update_excludes(&ctx.workspace.update_reuse_scope, n));
Evidence
The new logic derives update_requested from wanted.alias, but alias is documented as the local
install name even for npm-alias deps; meanwhile update targeting is keyed by package name.
Therefore, for npm-alias dependencies, the computed update_requested may not reflect whether the
*real* package name is being updated, so preferred-version propagation is not bypassed when it
should be.

pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[1824-1845]
pacquet/crates/resolving-resolver-base/src/resolve.rs[67-92]
pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs[188-214]

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

## Issue description
`update_requested` is computed from `wanted.alias` (install alias), but npm-alias dependencies encode the *real* package name in the `bare_specifier` (e.g. `npm:bar@^4`) while keeping `alias` as the local name (`foo`). If update targeting is keyed by real package name, this prevents `update_requested` from being set for aliased packages, so preferred-version selectors are not bypassed for the true update target.
### Issue Context
- `WantedDependency.alias` is explicitly documented as the local install name even for npm-alias dependencies.
- Update targeting in pacquet is documented as keyed by *package name*.
### Fix Focus Areas
- pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[1824-1845]
### Suggested approach
In `resolve_wanted_cached()`, when computing `update_requested`, derive the candidate package name from:
1) the real npm-alias target when `wanted.bare_specifier` starts with `"npm:"` (parse the name portion and `PkgName::from_str` it), otherwise
2) fall back to `wanted.alias`.
Then call `update_excludes(...)` using the real-name candidate so `update_requested` aligns with update targeting for npm-alias deps.

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



Remediation recommended

10. Global warn-once mutex 🐞 Bug ➹ Performance
Description
pacquet’s held-back-update warning deduplicates via a process-global LazyLock>>, which shares
warning state across resolver instances and introduces a contended blocking mutex in an async
resolver path. This is likely fine for short-lived CLI runs but is an avoidable scalability/design
footgun for long-lived/library or highly-parallel resolution scenarios.
Code

pacquet/crates/resolving-npm-resolver/src/preferred_overlay.rs[R34-93]

+/// Bounds the held-back-update warn-once set; far above what one update
+/// run realistically warns about. Oldest entries are evicted first via
+/// ordered eviction with `shift_remove_index(0)`.
+const MAX_WARNED_HELD_BACK: usize = 1024;
+static WARNED_HELD_BACK: std::sync::LazyLock<Mutex<indexmap::IndexSet<String>>> =
+    std::sync::LazyLock::new(|| Mutex::new(indexmap::IndexSet::new()));
+
+/// During a targeted update the picker still honors the preferred
+/// versions a fresh install would apply (manifest pins and versions
+/// propagated down the dependency chain), so the target can
+/// legitimately settle below the highest version its range admits.
+/// Surface that once per `(name, range, picked, preferred)`: reaching
+/// the newer version everywhere is an override's job, not an update's.
+///
+/// The baseline for "held back" is the pick with only the non-pin
+/// selectors applied — `range`/`tag` selectors such as the
+/// `pnpm audit --fix` vulnerability penalties steer the baseline too,
+/// so the warning never recommends a version those selectors avoid.
+///
+/// The recommended override is scoped to the declared range being
+/// resolved (`name@<range>`), so applying it can never violate any
+/// consumer's range: only declarations of exactly this range match the
+/// selector, and the recommended version satisfies it by construction.
+pub(crate) fn warn_once_on_held_back_update(
+    opts: &ResolveOptions,
+    spec: &RegistryPackageSpec,
+    selectors: Option<&VersionSelectors>,
+    meta: &Package,
+    picked_version: &str,
+) {
+    if !opts.update_requested || spec.spec_type != RegistryPackageSpecType::Range {
+        return;
+    }
+    let Some(selectors) = selectors else { return };
+    let non_pin_selectors: VersionSelectors = selectors
+        .iter()
+        .filter(|(_, entry)| entry.selector_type() != VersionSelectorType::Version)
+        .map(|(selector, entry)| (selector.clone(), entry.clone()))
+        .collect();
+    let Some(preferred) = pick_version_by_version_range(&PickVersionByVersionRangeOptions {
+        meta,
+        version_range: &spec.fetch_spec,
+        preferred_version_selectors: (!non_pin_selectors.is_empty()).then_some(&non_pin_selectors),
+        published_by: None,
+    }) else {
+        return;
+    };
+    if preferred == picked_version {
+        return;
+    }
+    let key = format!("{}@{}:{picked_version}<{preferred}", spec.name, spec.fetch_spec);
+    let mut warned = WARNED_HELD_BACK.lock().unwrap_or_else(std::sync::PoisonError::into_inner);
+    if warned.contains(&key) {
+        return;
+    }
+    if warned.len() >= MAX_WARNED_HELD_BACK {
+        warned.shift_remove_index(0);
+    }
+    warned.insert(key);
+    tracing::warn!(
Evidence
pacquet introduces a global WARNED_HELD_BACK guarded by a Mutex and uses it on every warning
emission. The TS side demonstrates the same feature implemented with per-resolver state
(warnedHeldBackUpdates: new Set()), avoiding process-global coupling.

pacquet/crates/resolving-npm-resolver/src/preferred_overlay.rs[34-93]
pnpm11/resolving/npm-resolver/src/index.ts[263-281]

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 held-back-update warning uses a process-global mutex-protected set for warn-once dedupe. This introduces shared global state and a contended lock inside the resolver execution path.
### Issue Context
The TypeScript implementation keeps the analogous warn-once set on the resolver context (per resolver instance), which avoids global cross-talk and avoids global locking.
### Fix Focus Areas
- pacquet/crates/resolving-npm-resolver/src/preferred_overlay.rs[34-93]
### Suggested fix
Move the warned-set into a per-resolver/per-run structure (e.g., carried on `ResolveOptions`, the resolver struct, or an explicit context object) and pass it into `warn_once_on_held_back_update`. This eliminates global state and lets the caller control lifecycle/reset behavior. If you keep an eviction policy, prefer an O(1) data structure for oldest-entry eviction to avoid `shift_remove_index(0)` shifting costs.

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


11. Policy-unsafe held-back warning 🐞 Bug ◔ Observability
Description
In pnpm’s TS resolver, warnOnceOnHeldBackUpdate recomputes the “preferred” baseline using the
unfiltered packument, so under time-based/minimum-release-age filtering it can treat a
policy-blocked version as the one the user should override to. This makes the warning misleading
because the suggested override may still be impossible to realize with the active publishedBy/policy
constraints.
Code

pnpm11/resolving/npm-resolver/src/index.ts[R369-395]

+function warnOnceOnHeldBackUpdate (
+  ctx: Pick<ResolveFromNpmContext, 'warnedHeldBackUpdates'>,
+  opts: Pick<ResolveFromNpmOptions, 'updateRequested' | 'preferredVersions'>,
+  spec: RegistryPackageSpec,
+  meta: PackageMeta,
+  pickedVersion: string
+): void {
+  if (!opts.updateRequested || spec.type !== 'range') return
+  const selectors = preferredVersionSelectorsFor(opts, spec.name)
+  if (selectors == null) return
+  let nonPinSelectors: VersionSelectors | undefined
+  for (const [selector, value] of Object.entries(selectors)) {
+    if ((typeof value === 'string' ? value : value.selectorType) === 'version') continue
+    // Null-prototype for the same reason as in `stripLockfileVersionPins`.
+    nonPinSelectors ??= Object.create(null) as VersionSelectors
+    nonPinSelectors[selector] = value
+  }
+  const preferred = pickVersionByVersionRange({
+    meta,
+    versionRange: spec.fetchSpec,
+    preferredVersionSelectors: nonPinSelectors,
+  })
+  if (preferred == null || preferred === pickedVersion) return
+  const key = `${spec.name}@${spec.fetchSpec}:${pickedVersion}<${preferred}`
+  if (ctx.warnedHeldBackUpdates.has(key)) return
+  ctx.warnedHeldBackUpdates.add(key)
+  globalWarn(`"${spec.name}@${spec.fetchSpec}" was updated to ${pickedVersion}, not ${preferred}, to match the version preferred by your manifests and already installed dependencies. To use ${preferred}, add an override to pnpm-workspace.yaml: overrides: { "${spec.name}@${spec.fetchSpec}": "${preferred}" }`)
Evidence
The resolver pick is policy-aware via publishedBy, but the warning baseline recomputation uses the
unfiltered metadata object and does not apply the same filtering, so it can compute a “preferred”
version that the real picker would have excluded.

pnpm11/resolving/npm-resolver/src/index.ts[598-613]
pnpm11/resolving/npm-resolver/src/index.ts[701-702]
pnpm11/resolving/npm-resolver/src/index.ts[369-395]
pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[37-60]
pnpm11/resolving/npm-resolver/src/pickPackage.ts[199-206]
pnpm11/resolving/npm-resolver/src/pickPackage.ts[450-453]

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

## Issue description
`warnOnceOnHeldBackUpdate()` recomputes a baseline “preferred” version via `pickVersionByVersionRange({ meta, ... })` using the **unfiltered** `meta` returned by `pickPackage`, while the actual pick path can apply `publishedBy`/release-age constraints. This can cause the warning to recommend an override to a version that the resolver would not select (or even consider eligible) under the active policy.
### Issue Context
- `resolveNpm()` passes `opts.publishedBy` / `opts.publishedByExclude` into `ctx.pickPackage(...)`, so the actual resolution can be policy-filtered.
- `warnOnceOnHeldBackUpdate()` is called after the pick and receives `meta` that may still include versions excluded by policy.
### Fix Focus Areas
- pnpm11/resolving/npm-resolver/src/index.ts[369-396]
- pnpm11/resolving/npm-resolver/src/index.ts[598-613]
- pnpm11/resolving/npm-resolver/src/index.ts[701-702]
- pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[37-60]
- pnpm11/resolving/npm-resolver/src/pickPackage.ts[199-206]
- pnpm11/resolving/npm-resolver/src/pickPackage.ts[450-453]
### Implementation notes
One of the following approaches would make the warning consistent with actual picks:
1) **Filter the meta before computing the baseline** when `opts.publishedBy` is set (and `meta.time` is available), using the same filtering logic as the pick path, then run `pickVersionByVersionRange` on the filtered meta; or
2) Change `pickPackage()` (or `ctx.pickPackage`) to also return the **effective meta view** used for picking under `publishedBy` constraints, and feed that into `warnOnceOnHeldBackUpdate`; or
3) If policy-filtering cannot be applied (e.g. missing `time`), **skip the held-back baseline recomputation** to avoid emitting a misleading recommendation.
Keep the warning’s baseline aligned with the resolver’s actual candidate set, so the suggested override is actionable under the same policy constraints.

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


12. Warns during --latest 🐞 Bug ≡ Correctness
Description
In pnpm’s TS resolver, warnOnceOnHeldBackUpdate() can run during pnpm up --latest because it only
checks updateRequested and spec.type === 'range' and ignores opts.update === 'latest'. In
--latest mode the picker intentionally considers the latest dist-tag (possibly outside the
range), so the warning can incorrectly claim the update was “held back” and recommend an override
when behavior is expected.
Code

pnpm11/resolving/npm-resolver/src/index.ts[R374-376]

+  if (!opts.updateRequested || spec.type !== 'range') return
+  const selectors = preferredVersionSelectorsFor(opts, spec.name)
+  if (selectors == null) return
Evidence
The resolver enables includeLatestTag when opts.update === 'latest', which changes picking
semantics to compare the in-range pick with the latest dist-tag; the warning logic does not
account for this mode and is still eligible to run for range specs.

pnpm11/resolving/npm-resolver/src/index.ts[367-392]
pnpm11/resolving/npm-resolver/src/index.ts[595-609]
pnpm11/resolving/npm-resolver/src/index.ts[830-861]
pnpm11/resolving/npm-resolver/src/pickPackage.ts[92-103]

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 held-back-update warning is intended for range-respecting targeted updates, but it can also trigger when `opts.update === 'latest'` because the warning doesn’t check the update mode.
### Issue Context
When `opts.update === 'latest'`, `pickPackage()` is called with `includeLatestTag: true`, so the picker may intentionally choose the `latest` dist-tag version even if it is outside the declared semver range. The warning’s baseline recomputation does not model this behavior, so it can warn in valid `--latest` runs.
### Fix Focus Areas
- pnpm11/resolving/npm-resolver/src/index.ts[367-393]
- pnpm11/resolving/npm-resolver/src/index.ts[595-610]
- pnpm11/resolving/npm-resolver/src/index.ts[830-861]
### Suggested fix
- Change `warnOnceOnHeldBackUpdate`’s `opts` type to include `update` (or accept full `ResolveFromNpmOptions`).
- Add a guard like `if (opts.update === 'latest') return;` so the warning only applies to range-respecting updates.

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


View more (1)
13. Unnecessary baseline repick 🐞 Bug ➹ Performance
Description
warnOnceOnHeldBackUpdate() always recomputes a baseline via pickVersionByVersionRange() even
when there are no version-type preferred selectors, adding an avoidable extra metadata scan/semver
selection on the targeted-update resolve hot path.
Code

pnpm11/resolving/npm-resolver/src/index.ts[R367-388]

+function warnOnceOnHeldBackUpdate (
+  ctx: Pick<ResolveFromNpmContext, 'warnedHeldBackUpdates'>,
+  opts: Pick<ResolveFromNpmOptions, 'updateRequested' | 'preferredVersions'>,
+  spec: RegistryPackageSpec,
+  meta: PackageMeta,
+  pickedVersion: string
+): void {
+  if (!opts.updateRequested || spec.type !== 'range') return
+  const selectors = preferredVersionSelectorsFor(opts, spec.name)
+  if (selectors == null) return
+  let nonPinSelectors: VersionSelectors | undefined
+  for (const [selector, value] of Object.entries(selectors)) {
+    if ((typeof value === 'string' ? value : value.selectorType) === 'version') continue
+    nonPinSelectors ??= {}
+    nonPinSelectors[selector] = value
+  }
+  const preferred = pickVersionByVersionRange({
+    meta,
+    versionRange: spec.fetchSpec,
+    preferredVersionSelectors: nonPinSelectors,
+  })
+  if (preferred == null || preferred === pickedVersion) return
Evidence
The warning path always calls pickVersionByVersionRange() after filtering selectors, and that
function iterates Object.keys(meta.versions) and runs semver selection logic, so doing it when no
version pins exist is pure overhead.

pnpm11/resolving/npm-resolver/src/index.ts[315-393]
pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[172-207]

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

## Issue description
`warnOnceOnHeldBackUpdate()` is meant to warn only when **version pins** (manifest pins / propagated exact versions) hold the target below what the non-pin selectors would pick. Today it will still build `nonPinSelectors` and call `pickVersionByVersionRange()` even when *no* `version`-type selectors exist, where the baseline cannot differ from the actual pick.
### Issue Context
This warning runs during targeted updates (`updateRequested`), and `pickVersionByVersionRange()` can iterate many versions and run semver selection; doing that work redundantly can add noticeable CPU time when the update target appears many times.
### Fix Focus Areas
- pnpm11/resolving/npm-resolver/src/index.ts[367-392]
- pnpm11/resolving/npm-resolver/src/pickPackageFromMeta.ts[172-207]
### Suggested fix
While filtering selectors, track whether any selector is of type `version`. If none are, return early (no warning possible) without calling `pickVersionByVersionRange()`.

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


Grey Divider

Qodo Logo

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jun 21, 2026
@codecov-commenter

codecov-commenter commented Jun 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.65625% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.07%. Comparing base (ce5d5a5) to head (9e1b81c).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...es/resolving-npm-resolver/src/preferred_overlay.rs 92.10% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12558      +/-   ##
==========================================
- Coverage   85.62%   85.07%   -0.56%     
==========================================
  Files         413      415       +2     
  Lines       64343    65531    +1188     
==========================================
+ Hits        55093    55749     +656     
- Misses       9250     9782     +532     

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

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 967fe74

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 14597ce

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

🤖 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 `@pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs`:
- Around line 2213-2226: The real_package_name_of function currently only
handles npm-alias dependencies (those with the "npm:" prefix) but fails for
plain dependencies like "foo@^1.0". When strip_prefix returns None for a plain
dependency, the function should fall back to returning wanted.alias instead of
continuing with the current logic. Modify the function to check if the
bare_specifier contains an "npm:" prefix, and if not, return wanted.alias
directly as the real package name, since the doc comment confirms that for plain
deps, the real name is just wanted.alias.
🪄 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: d5a43bb3-3af3-4b65-b76c-ed9c145d62be

📥 Commits

Reviewing files that changed from the base of the PR and between 967fe74 and 14597ce.

📒 Files selected for processing (1)
  • pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 14597ce

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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

@github-actions

github-actions Bot commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 9e1b81c6c5c6

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.725 ± 0.141 3.592 3.993 1.81 ± 0.11
pacquet@main 3.774 ± 0.155 3.603 4.013 1.83 ± 0.12
pnpr@HEAD 2.061 ± 0.101 1.931 2.265 1.00
pnpr@main 2.113 ± 0.128 1.946 2.304 1.02 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.7246608341600003,
      "stddev": 0.1413476162543192,
      "median": 3.6936887975599997,
      "user": 3.6314598600000005,
      "system": 3.31275064,
      "min": 3.5920496630599996,
      "max": 3.99267119706,
      "times": [
        3.7084784380599998,
        3.99267119706,
        3.60288112706,
        3.6788991570599996,
        3.7215013670599997,
        3.93323800206,
        3.5920496630599996,
        3.62063784306,
        3.79157988906,
        3.60467165806
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.7736063234599997,
      "stddev": 0.1554930969427297,
      "median": 3.72446619956,
      "user": 3.63038906,
      "system": 3.2825523399999996,
      "min": 3.60297294806,
      "max": 4.01344600106,
      "times": [
        3.89356138206,
        3.62142474806,
        3.75419748706,
        3.87829433306,
        4.01344600106,
        3.98283444106,
        3.63794603206,
        3.69473491206,
        3.60297294806,
        3.65665095006
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.0612072767600003,
      "stddev": 0.10109192813474265,
      "median": 2.0373949935599995,
      "user": 2.72377386,
      "system": 2.8905569399999997,
      "min": 1.93094209306,
      "max": 2.26504542506,
      "times": [
        2.0771813250599998,
        1.93094209306,
        2.0160667550599998,
        1.9495641430600001,
        2.13558053406,
        2.26504542506,
        2.03917992306,
        2.15631354706,
        2.0356100640599997,
        2.00658895806
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.11257380156,
      "stddev": 0.12791401200244656,
      "median": 2.1029812675599997,
      "user": 2.7405535599999995,
      "system": 2.86263344,
      "min": 1.94556165606,
      "max": 2.3035358480599997,
      "times": [
        2.1661562110599997,
        1.99985305706,
        2.2161403950599996,
        1.94556165606,
        2.0238690620599997,
        2.04488172306,
        1.98913212806,
        2.27552712306,
        2.16108081206,
        2.3035358480599997
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 643.2 ± 6.1 630.9 649.5 1.00
pacquet@main 649.9 ± 36.2 612.7 727.1 1.01 ± 0.06
pnpr@HEAD 716.6 ± 50.5 682.0 857.6 1.11 ± 0.08
pnpr@main 685.2 ± 12.2 661.7 699.4 1.07 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6432221237600001,
      "stddev": 0.00606261116951773,
      "median": 0.6449747596600001,
      "user": 0.38356344,
      "system": 1.31634674,
      "min": 0.63090664216,
      "max": 0.64952163616,
      "times": [
        0.64952163616,
        0.6447209341600001,
        0.64931593316,
        0.63900464416,
        0.6359434461600001,
        0.6470536651600001,
        0.6442000531600001,
        0.64522858516,
        0.6463256981600001,
        0.63090664216
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.64992375246,
      "stddev": 0.03617550731575041,
      "median": 0.64295270616,
      "user": 0.37260374,
      "system": 1.3154927400000003,
      "min": 0.6127498611600001,
      "max": 0.7270844831600001,
      "times": [
        0.6418891791600001,
        0.61938881516,
        0.6127498611600001,
        0.6511332641600001,
        0.6497267131600001,
        0.61776608316,
        0.63824622616,
        0.64401623316,
        0.7270844831600001,
        0.69723666616
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.7165955367600001,
      "stddev": 0.05047376638906819,
      "median": 0.70269024616,
      "user": 0.4044834399999999,
      "system": 1.3540593399999998,
      "min": 0.6820169151600001,
      "max": 0.8575931401600001,
      "times": [
        0.6992500941600001,
        0.6820169151600001,
        0.70653923616,
        0.71190903216,
        0.70283189116,
        0.68938501316,
        0.69936279716,
        0.8575931401600001,
        0.71451864716,
        0.7025486011600001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6851919167600001,
      "stddev": 0.012194666727259176,
      "median": 0.68900372666,
      "user": 0.39208504,
      "system": 1.34093114,
      "min": 0.6616861351600001,
      "max": 0.69938462416,
      "times": [
        0.69567526516,
        0.68641380716,
        0.6616861351600001,
        0.6853688011600001,
        0.6768844661600001,
        0.69298017416,
        0.6915936461600001,
        0.69938462416,
        0.6925125951600001,
        0.6694196531600001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.191 ± 0.030 4.143 4.235 2.00 ± 0.13
pacquet@main 4.197 ± 0.029 4.141 4.239 2.00 ± 0.13
pnpr@HEAD 2.100 ± 0.133 1.964 2.401 1.00
pnpr@main 2.185 ± 0.157 2.026 2.476 1.04 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.19087040094,
      "stddev": 0.02979444097484045,
      "median": 4.189701530740001,
      "user": 3.8026526399999994,
      "system": 3.27924328,
      "min": 4.14304652624,
      "max": 4.23524670624,
      "times": [
        4.156063260240001,
        4.167661245240001,
        4.20854535324,
        4.23524670624,
        4.14304652624,
        4.2017213922400005,
        4.230044776240001,
        4.18949550324,
        4.189907558240001,
        4.18697168824
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.197200707240001,
      "stddev": 0.029221173191613353,
      "median": 4.19740371924,
      "user": 3.7753069399999992,
      "system": 3.28793858,
      "min": 4.14066493424,
      "max": 4.239380225240001,
      "times": [
        4.2071600592400005,
        4.239380225240001,
        4.19663766624,
        4.1989170622400005,
        4.166816193240001,
        4.19816977224,
        4.19440636724,
        4.192051660240001,
        4.14066493424,
        4.237803132240001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.0997359499400003,
      "stddev": 0.13320936603279712,
      "median": 2.07485739074,
      "user": 2.5641078399999997,
      "system": 2.8100061800000002,
      "min": 1.9638266962400002,
      "max": 2.40058860024,
      "times": [
        2.02803596324,
        2.1703762362399996,
        2.06906757724,
        2.08064720424,
        1.9815169592400002,
        2.1875032762399997,
        1.97392371124,
        2.14187327524,
        2.40058860024,
        1.9638266962400002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.18486803304,
      "stddev": 0.15747450519189865,
      "median": 2.1388556117399995,
      "user": 2.5609335399999997,
      "system": 2.7857392800000005,
      "min": 2.02576343324,
      "max": 2.4763505922399998,
      "times": [
        2.0997601912399997,
        2.0740777102399997,
        2.04987871824,
        2.31024613224,
        2.4763505922399998,
        2.1779510322399998,
        2.20022104624,
        2.3861412992399997,
        2.04829017524,
        2.02576343324
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.367 ± 0.006 1.357 1.376 2.08 ± 0.09
pacquet@main 1.344 ± 0.014 1.325 1.369 2.04 ± 0.09
pnpr@HEAD 0.670 ± 0.041 0.644 0.785 1.02 ± 0.08
pnpr@main 0.658 ± 0.027 0.638 0.733 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.3674657685599998,
      "stddev": 0.0064020247084026535,
      "median": 1.3685669947599999,
      "user": 1.34993514,
      "system": 1.71739192,
      "min": 1.35735361076,
      "max": 1.37551656376,
      "times": [
        1.36976965676,
        1.35735361076,
        1.36442660176,
        1.36964657676,
        1.37551656376,
        1.36064009576,
        1.3674874127599999,
        1.36111836176,
        1.37369625876,
        1.37500254676
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.34420980196,
      "stddev": 0.014047279689980183,
      "median": 1.34646956976,
      "user": 1.2963967399999998,
      "system": 1.7014382199999996,
      "min": 1.3248971457599998,
      "max": 1.36899370676,
      "times": [
        1.34545818676,
        1.34748095276,
        1.36899370676,
        1.35233806076,
        1.3310696017599999,
        1.35770737176,
        1.33073138776,
        1.35069355276,
        1.3248971457599998,
        1.33272805276
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.6697719189600002,
      "stddev": 0.04086806318362009,
      "median": 0.65832224376,
      "user": 0.34643503999999997,
      "system": 1.27411552,
      "min": 0.6436913617600001,
      "max": 0.78472725876,
      "times": [
        0.6598468997600001,
        0.6436913617600001,
        0.65949425776,
        0.65715022976,
        0.78472725876,
        0.65628353776,
        0.66659973776,
        0.6551539777600001,
        0.66290462376,
        0.6518673047600001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6575524184600001,
      "stddev": 0.027380004779573263,
      "median": 0.6518776702600001,
      "user": 0.33985273999999993,
      "system": 1.26578272,
      "min": 0.6383659787600001,
      "max": 0.7328555517600001,
      "times": [
        0.6396732887600001,
        0.6546215697600001,
        0.6491337707600001,
        0.6433728967600001,
        0.6383659787600001,
        0.64724782276,
        0.6567990787600001,
        0.7328555517600001,
        0.6567110797600001,
        0.6567431467600001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.038 ± 0.048 2.999 3.152 4.64 ± 0.11
pacquet@main 3.039 ± 0.032 2.991 3.080 4.64 ± 0.10
pnpr@HEAD 0.660 ± 0.010 0.646 0.674 1.01 ± 0.02
pnpr@main 0.655 ± 0.012 0.641 0.680 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.0379021092599996,
      "stddev": 0.04801095384740627,
      "median": 3.02238226476,
      "user": 1.77275806,
      "system": 2.0008987599999997,
      "min": 2.99946986526,
      "max": 3.15228198726,
      "times": [
        3.04578110726,
        3.00757579826,
        2.99946986526,
        3.0049384672599997,
        3.04270025326,
        3.00295974926,
        3.0371887312599997,
        3.15228198726,
        3.0055156252599997,
        3.08060950826
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.03873861996,
      "stddev": 0.0315467777302544,
      "median": 3.03179269576,
      "user": 1.7321957600000002,
      "system": 2.0349439599999997,
      "min": 2.99089168026,
      "max": 3.0801738202599998,
      "times": [
        3.01679755426,
        3.0799099442599998,
        2.99089168026,
        3.0801738202599998,
        3.02872715726,
        3.06282495326,
        3.02237935026,
        3.06531910026,
        3.00550440526,
        3.0348582342599997
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.65968629656,
      "stddev": 0.01008373991773447,
      "median": 0.65905324026,
      "user": 0.34939606,
      "system": 1.2609610600000003,
      "min": 0.6455293682600001,
      "max": 0.67440460426,
      "times": [
        0.65776979826,
        0.65079700226,
        0.67440460426,
        0.6603366822600001,
        0.67217264726,
        0.64918686426,
        0.66908662826,
        0.65336508926,
        0.6455293682600001,
        0.66421428126
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6546763072600001,
      "stddev": 0.01244834605671281,
      "median": 0.65193842776,
      "user": 0.32973936000000004,
      "system": 1.26189036,
      "min": 0.64072478526,
      "max": 0.67989959326,
      "times": [
        0.66341332726,
        0.6553937172600001,
        0.64609541526,
        0.64072478526,
        0.64848313826,
        0.6664179572600001,
        0.65718014526,
        0.64091361826,
        0.67989959326,
        0.64824137526
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 641.4 ± 13.0 622.9 673.7 5.98 ± 0.12
pacquet@main 641.4 ± 13.0 627.8 672.0 5.98 ± 0.12
pnpr@HEAD 107.2 ± 0.3 106.6 108.0 1.00
pnpr@main 107.2 ± 0.3 106.5 107.6 1.00 ± 0.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.64138592506,
      "stddev": 0.01302149363832944,
      "median": 0.6391970812600001,
      "user": 0.5956248399999999,
      "system": 0.15549252,
      "min": 0.6229394222600001,
      "max": 0.67368245926,
      "times": [
        0.64053888126,
        0.6370206942600001,
        0.6455919292600001,
        0.6229394222600001,
        0.63781587326,
        0.63291621026,
        0.63785528126,
        0.6412381582600001,
        0.6442603412600001,
        0.67368245926
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6413510436600001,
      "stddev": 0.013005213884198877,
      "median": 0.63870946526,
      "user": 0.59453784,
      "system": 0.15877791999999996,
      "min": 0.62776365426,
      "max": 0.6720424512600001,
      "times": [
        0.6352267152600001,
        0.64224699626,
        0.64659692526,
        0.62968657126,
        0.6319066762600001,
        0.63718340626,
        0.6402355242600001,
        0.62776365426,
        0.6720424512600001,
        0.6506215162600001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10720012282,
      "stddev": 0.00031577405422219797,
      "median": 0.10720259426,
      "user": 0.027990759999999993,
      "system": 0.0198191,
      "min": 0.10664802326,
      "max": 0.10800045526,
      "times": [
        0.10664802326,
        0.10728672826,
        0.10737588026,
        0.10731035426,
        0.10731882626,
        0.10681577226,
        0.10753341326,
        0.10709646726000001,
        0.10678749926,
        0.10739377726,
        0.10739572026000001,
        0.10692215826,
        0.10719522226,
        0.10723914826,
        0.10712407826,
        0.10720259426,
        0.10741339626,
        0.10781969726,
        0.10730500626,
        0.10704187626,
        0.10706846526,
        0.10704761426,
        0.10800045526,
        0.10678768926,
        0.10687320726
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.10722833038000001,
      "stddev": 0.0002752894617884526,
      "median": 0.10728917226,
      "user": 0.028251520000000002,
      "system": 0.0198509,
      "min": 0.10645634926,
      "max": 0.10757024826,
      "times": [
        0.10728917226,
        0.10703953226,
        0.10742529326,
        0.10723379026,
        0.10756990726,
        0.10695347526,
        0.10735444926,
        0.10757024826,
        0.10678904226000001,
        0.10716478726,
        0.10749250326,
        0.10645634926,
        0.10752113526,
        0.10731022426,
        0.10749018026,
        0.10730095126,
        0.10717467426,
        0.10691644226000001,
        0.10684408426,
        0.10743217426,
        0.10737159426000001,
        0.10745604026,
        0.10728553326,
        0.10709128026,
        0.10717539526
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 6.497 ± 0.097 6.370 6.647 1.33 ± 0.03
pacquet@main 6.496 ± 0.173 6.328 6.826 1.33 ± 0.04
pnpr@HEAD 4.890 ± 0.101 4.778 5.046 1.00
pnpr@main 4.892 ± 0.112 4.735 5.117 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 6.49742467444,
      "stddev": 0.09678707370494787,
      "median": 6.48427666734,
      "user": 3.82981762,
      "system": 3.57848378,
      "min": 6.37010639934,
      "max": 6.64656966134,
      "times": [
        6.572486766340001,
        6.44278483134,
        6.62754620934,
        6.45395314834,
        6.37010639934,
        6.53418198434,
        6.51460018634,
        6.4007924133400005,
        6.64656966134,
        6.41122514434
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 6.496139363439999,
      "stddev": 0.17262853246324641,
      "median": 6.43807284934,
      "user": 3.8395580200000006,
      "system": 3.54729368,
      "min": 6.3284106513400005,
      "max": 6.82617591634,
      "times": [
        6.3284106513400005,
        6.76242691834,
        6.39802745634,
        6.47523504134,
        6.82617591634,
        6.354013221340001,
        6.57142991134,
        6.36952881934,
        6.46577004334,
        6.41037565534
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 4.8904755505400015,
      "stddev": 0.100843261050688,
      "median": 4.837263891840001,
      "user": 2.83791242,
      "system": 3.11557498,
      "min": 4.77773546834,
      "max": 5.04647124634,
      "times": [
        4.837106659340001,
        4.83669082934,
        5.0420204253400005,
        4.8374211243400005,
        4.829896225340001,
        4.77773546834,
        4.94151422134,
        5.04647124634,
        4.787481333340001,
        4.96841797234
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 4.89195004114,
      "stddev": 0.11153771060066227,
      "median": 4.87914891884,
      "user": 2.8331100200000003,
      "system": 3.12527798,
      "min": 4.734754227340001,
      "max": 5.117012503340001,
      "times": [
        4.93991125834,
        4.98957440734,
        4.900824911340001,
        4.7981664983400005,
        5.117012503340001,
        4.84990697834,
        4.734754227340001,
        4.942056331340001,
        4.78982036934,
        4.857472926340001
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12558
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
4,190.87 ms
(-1.28%)Baseline: 4,245.12 ms
5,094.15 ms
(82.27%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
3,037.90 ms
(+0.11%)Baseline: 3,034.50 ms
3,641.40 ms
(83.43%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,367.47 ms
(+1.27%)Baseline: 1,350.33 ms
1,620.39 ms
(84.39%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
641.39 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
3,724.66 ms
(-9.03%)Baseline: 4,094.49 ms
4,913.39 ms
(75.81%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
6,497.42 ms
(-6.63%)Baseline: 6,958.57 ms
8,350.28 ms
(77.81%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
643.22 ms
(+2.27%)Baseline: 628.93 ms
754.72 ms
(85.23%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12558
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
2,099.74 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
659.69 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
669.77 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
107.20 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,061.21 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
4,890.48 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
716.60 ms
🐰 View full continuous benchmarking report in Bencher

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 579bf4a

1 similar comment
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 579bf4a

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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

1 similar comment
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 4aad8b8

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

Projects

None yet

4 participants