Skip to content

fix: don't silently drop locked optional deps on resolution failure - #12855

Merged
zkochan merged 5 commits into
pnpm:mainfrom
davidbarratt:fix/optional-dep-locked-resolution-failure
Jul 9, 2026
Merged

zkochan merged 5 commits into
pnpm:mainfrom
davidbarratt:fix/optional-dep-locked-resolution-failure

Conversation

@davidbarratt

@davidbarratt davidbarratt commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes pnpm/pnpm#12853.

When re-resolution of an optional dependency fails, the resolver silently skips it (pnpm:skipped-optional-dependency, reason=resolution_failure) — even when pnpm-lock.yaml already holds a locked resolution for that dependency. The parent's snapshot is then rewritten without those edges and pruneSharedLockfile erases the now-orphaned entries. This is how @napi-rs/[email protected] in the issue ends up serialized as '@napi-rs/[email protected]': {} with all 11 platform-binary entries removed.

The most common trigger is registry metadata that differs between machines — for example a mirror whose packument for the platform-binary packages hasn't synced a recently published version yet (the 1.0.2 binaries were 8 days old when the issue was filed, and only the freshly published version is affected, which matches the issue's observation that the older @napi-rs/[email protected] survived). During pnpm dedupe every package re-resolves from registry metadata, so all 11 exact-pinned binaries fail resolution at once and are dropped from the lockfile in one run, while a machine with a healthy registry restores them — the two hosts fight over the lockfile indefinitely, which the reporter perceived as OS-dependence. I verified that the minimal repro from the issue produces byte-identical lockfiles on macOS arm64 and Linux arm64 against a healthy registry, and that a stale packument reproduces the emptied snapshot exactly.

With this change, the resolution error is rethrown instead of swallowed when the wanted lockfile already contains an entry satisfying the wanted range: the install fails loudly and the lockfile stays intact. An optional dependency that never resolved (no locked entry) keeps the skip-on-failure behavior, so genuinely unresolvable optional deps still install fine. This follows the same pattern as #10289 and #10211, which stopped silently skipping optional deps for policy failures.

Verified end-to-end with the issue's reproduction against a proxy serving stale packuments: before, pnpm dedupe silently rewrote the snapshot to {}; after, it fails with ERR_PNPM_NO_MATCHING_VERSION naming the dependency path, and the lockfile keeps all 11 platform binaries. A healthy registry dedupe still succeeds.

pacquet parity: pacquet previously failed loudly on every optional-dependency resolution failure (its resolver never had the silent skip). This PR now aligns the two stacks on both cases: pacquet skips a never-locked unresolvable optional dep like pnpm — emitting the same pnpm:skipped-optional-dependency (reason=resolution_failure) payload including the parents chain (newly added to the wire type), with the default reporter rendering the same top-level info line — and keeps failing loudly, now with the same hint, when the wanted lockfile holds a satisfying entry. Covered by resolver-level tests mirroring the TypeScript regression test (locked entry → loud failure with the hint; never-locked → skip with the notification payload; out-of-range locked entry → still skips). One wording gap remains: the loud failure's message text differs (ERR_PNPM_NO_MATCHING_VERSION vs pacquet's stringified resolver-chain error, and miette prints help: where pnpm prints hint:) — that is pacquet's pre-existing error-rendering shape, left for a follow-up.

Squash Commit Body

When re-resolution of an optional dependency fails (for example, a
registry mirror whose packument has not synced the pinned version yet),
the resolver silently skipped the dependency. The parent's snapshot was
then rewritten without the edge and the pruner erased the locked
entries, so identical inputs produced different lockfiles depending on
which machine ran the install, and a frozen install on another host had
no entry to link for the affected package.

Rethrow the resolution error instead of skipping when the wanted
lockfile already holds an entry that satisfies the wanted range. An
optional dependency that never resolved keeps the skip-on-failure
behavior.

pacquet previously failed loudly on every optional-dependency
resolution failure. It now skips never-locked optional deps like pnpm,
emitting the same skipped-optional-dependency log (with the parents
chain and the same top-level reporter output), and keeps the loud
failure — with the same hint — when the lockfile holds a satisfying
entry, so the two stacks agree on both cases.

Closes pnpm/pnpm#12853

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pacquet/ 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-fable-5).

Summary by CodeRabbit

  • Bug Fixes

    • Fixed optional dependency handling so installs fail (instead of silently changing the lockfile) when a locked optional dependency can’t be resolved.
    • Prevents lockfile divergence and missing links in frozen installs when optional dependency versions are no longer available.
  • New Features

    • Improved reporting for skipped optional dependencies, including more precise context for resolution-failure skips.
  • Tests

    • Added regression coverage for locked optional-dependency invariance when registry metadata hides a previously locked version.
    • Added resolver scenarios verifying whether optional edges are skipped or installation fails based on lockfile satisfaction.

@davidbarratt
davidbarratt requested a review from zkochan as a code owner July 8, 2026 14:44
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 74cdad34-4be8-4b2e-8405-04c577a7ee8b

📥 Commits

Reviewing files that changed from the base of the PR and between 0ac0b27 and e9fcb45.

📒 Files selected for processing (12)
  • pacquet/crates/default-reporter/src/state.rs
  • pacquet/crates/default-reporter/tests/render.rs
  • pacquet/crates/env-installer/src/install_config_deps.rs
  • pacquet/crates/package-manager/src/build_modules.rs
  • pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pacquet/crates/package-manager/src/installability.rs
  • pacquet/crates/reporter/src/lib.rs
  • pacquet/crates/reporter/src/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/lib.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
 _______________________________________________________
< Cyberdyne Systems Model GPT-101: Code Review Edition. >
 -------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
📝 Walkthrough

Walkthrough

pnpm now fails optional dependency resolution when a locked version cannot be resolved from registry metadata, instead of removing the locked entries. The PR adds resolver logic, a regression test with a version-hiding proxy, and a changeset entry.

Changes

Optional dependency resolution failure handling

Layer / File(s) Summary
Lockfile check and error handling
pnpm11/installing/deps-resolver/src/resolveDependencies.ts
Adds wantedLockfileContainsSatisfyingEntry and updates optional dependency error handling to rethrow with a hint when a locked entry satisfies the wanted dependency.
Regression test and registry proxy
pnpm11/installing/deps-installer/test/install/optionalDependencies.ts
Adds a test that hides a locked version from registry metadata and asserts install failure with an unchanged lockfile.
Changeset documentation
.changeset/optional-locked-resolution-failure.md
Documents the patch release for pnpm and @pnpm/installing.deps-resolver.

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

Possibly related PRs

  • pnpm/pnpm#11373: Also changes optional-dependency resolution behavior in pnpm11/installing/deps-resolver.

Suggested labels: product: pnpm@11

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.

@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 `@pnpm11/installing/deps-resolver/src/resolveDependencies.ts`:
- Line 1852: The resolver currently treats any satisfying package entry in the
lockfile as a match, which can incorrectly block skip-on-failure behavior for
optional dependencies. Update the dependency check in resolveDependencies to
prefer the current locked edge/path for the specific wantedDependency before
falling back to any package-wide match, and keep the fix contained within the
existing resolver flow around wantedLockfileContainsSatisfyingEntry and the
related logic at the second call site. Preserve the exact locator/name mapping
so only the current locked dep path is considered already resolved when
available.
🪄 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: c8392a94-92c7-46c8-9223-22e60052031f

📥 Commits

Reviewing files that changed from the base of the PR and between eb12194 and 34a661c.

📒 Files selected for processing (3)
  • .changeset/optional-locked-resolution-failure.md
  • pnpm11/installing/deps-installer/test/install/optionalDependencies.ts
  • pnpm11/installing/deps-resolver/src/resolveDependencies.ts

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 8, 2026
davidbarratt and others added 2 commits July 9, 2026 16:19
When re-resolution of an optional dependency fails (for example, a
registry mirror whose packument has not synced the pinned version yet),
the resolver silently skipped the dependency. The parent's snapshot was
then rewritten without the edge and the pruner erased the locked
entries, so identical inputs produced different lockfiles depending on
which machine ran the install, and a frozen install on another host had
no entry to link for the affected package.

Rethrow the resolution error instead of skipping when the wanted
lockfile already holds an entry that satisfies the wanted range. An
optional dependency that never resolved keeps the skip-on-failure
behavior.

pacquet already fails loudly in this scenario (its resolver never had
the silent skip), so the two stacks now agree on the locked-entry case.

Closes pnpm#12853

Co-Authored-By: Claude Fable 5 <[email protected]>
Match hidden packument paths by decoding the request URL instead of
hand-encoding the package name, and serve the test proxy's error
response as text/plain (CodeQL findings on the test helper).

Document why wantedLockfileContainsSatisfyingEntry matches by package
name and range instead of the current edge's locked dep path: dedupe
clears per-snapshot dependency maps before resolving, so no edge-level
linkage exists on the code path where the erasure happens.

Co-Authored-By: Claude Fable 5 <[email protected]>
@zkochan
zkochan force-pushed the fix/optional-dep-locked-resolution-failure branch from fa5ac06 to 0ac0b27 Compare July 9, 2026 14:21
@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (1) 📎 Requirement gaps (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 51 rules

Grey Divider


Action required

1. LockedOptionalResolutionFailure error diverges ✗ Dismissed 📘 Rule violation ≡ Correctness ⭐ New
Description
The new ResolveDependencyTreeError::LockedOptionalResolutionFailure wraps the underlying resolver
error and adds a pacquet-specific help message, producing user-visible error output that does not
align with pnpm’s canonical error codes/messages for the same resolution-failure scenarios. This
violates the requirement that pacquet errors and user-visible behavior remain pnpm-compatible.
Code

pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[R216-226]

+    /// An optional dependency failed to resolve while the wanted
+    /// lockfile still holds a package entry satisfying the wanted
+    /// range. Rethrown loudly instead of skipped, because skipping
+    /// would erase the locked entries and make the lockfile differ
+    /// depending on which machine ran the install
+    /// (<https://github.com/pnpm/pnpm/issues/12853>).
+    #[display("{_0}")]
+    #[diagnostic(help(
+        "This optional dependency is not skipped, because the lockfile contains a resolution for it. Skipping it would remove the locked entries, making the lockfile differ depending on which machine ran the install. If the version was intentionally removed from the registry, update the dependent package or remove the entries from the lockfile."
+    ))]
+    LockedOptionalResolutionFailure(#[error(not(source))] Box<ResolveDependencyTreeError>),
Evidence
Rule 713473 requires pacquet to emit pnpm-aligned error codes/messages for pnpm-documented error
conditions, and rule 713429 requires pacquet not to add user-visible behavior beyond pnpm. The new
LockedOptionalResolutionFailure variant adds a pacquet-specific help string and is explicitly
returned on the locked-entry path, while pnpm’s corresponding resolution-failure error message does
not include this lockfile-specific wrapper/help text.

Rule 713473: Align pacquet error codes and messages with pnpm
Rule 713429: Pacquet must not introduce new user-visible behavior beyond pnpm
Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[216-226]
pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[1436-1442]
pnpm11/resolving/npm-resolver/src/index.ts[78-86]

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

## Issue description
`ResolveDependencyTreeError::LockedOptionalResolutionFailure` introduces a pacquet-specific wrapper and diagnostic help text for a scenario where pnpm surfaces a canonical pnpm error (e.g. `ERR_PNPM_NO_MATCHING_VERSION` / `SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER`) without additional pacquet-only wording.

## Issue Context
This PR’s intent is to keep pnpm (TS) and pacquet (Rust) user-visible behavior in sync for locked optional dependency resolution failures. The new wrapper changes the observable error output (and may obscure/preserve codes inconsistently), which risks pnpm/pacquet divergence.

## Fix Focus Areas
- pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[216-226]
- pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[1436-1442]

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



Remediation recommended

2. Skipped-optional prefix mismatch 🐞 Bug ≡ Correctness ⭐ New
Description
ReporterState::on_skipped_optional requires log.prefix == self.cwd, so path-equivalent prefixes
(e.g. different normalization/trailing separators) will fail the check and the top-level
skipped-optional info line won’t render. This is inconsistent with other reporter paths that treat
normalized prefixes as equivalent, reducing observability for the current project.
Code

pacquet/crates/default-reporter/src/state.rs[R1033-1035]

+    fn on_skipped_optional(&mut self, log: &SkippedOptionalDependencyLog) {
+        if log.prefix != self.cwd || !log.parents.as_ref().is_some_and(Vec::is_empty) {
+            return;
Evidence
The skipped-optional handler uses raw equality, while the reporter already has a normalized-prefix
equivalence path used elsewhere for “current prefix” checks; cwd itself is stored un-normalized.

pacquet/crates/default-reporter/src/state.rs[1029-1036]
pacquet/crates/default-reporter/src/state.rs[629-633]
pacquet/crates/default-reporter/src/state.rs[261-279]

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

### Issue description
`on_skipped_optional` uses strict string equality (`log.prefix != self.cwd`) which can suppress the intended top-level skipped-optional info message when `cwd` and `prefix` differ only by lexical normalization.

### Issue Context
Other reporter filtering uses `is_current_prefix()` which includes `normalized_prefix()` equivalence checks.

### Fix Focus Areas
- pacquet/crates/default-reporter/src/state.rs[1029-1036]
- pacquet/crates/default-reporter/src/state.rs[629-633]

### Suggested fix
- Replace `log.prefix != self.cwd` with `!self.is_current_prefix(&log.prefix)` (or compare `normalized_prefix(&self.cwd, &log.prefix)` to `normalized_prefix(&self.cwd, &self.cwd)`), keeping the `parents == Some([])` condition unchanged.

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


3. O(n) scan on failure 🐞 Bug ➹ Performance
Description
wantedLockfileContainsSatisfyingEntry() scans every key in lockfile.packages and parses each depPath
on every optional dependency resolution failure, adding O(lockfile package count) CPU work per
failure. In cases like many platform-binary optional deps failing together, this can multiply the
cost via repeated full scans before the install aborts.
Code

pnpm11/installing/deps-resolver/src/resolveDependencies.ts[R2191-2198]

+function wantedLockfileContainsSatisfyingEntry (lockfile: LockfileObject, wantedDependency: WantedDependency): boolean {
+  if (!wantedDependency.alias) return false
+  const { pkgName, bareSpecifier } = unwrapPackageName(wantedDependency.alias, wantedDependency.bareSpecifier)
+  if (semver.validRange(bareSpecifier) == null) return false
+  return Object.keys(lockfile.packages ?? {}).some((depPath) => {
+    const parsed = dp.parse(depPath)
+    return parsed.name === pkgName && parsed.version != null && semver.satisfies(parsed.version, bareSpecifier)
+  })
Evidence
The new helper is invoked in the optional-dependency resolution failure path, and it performs a full
scan of all lockfile package keys with parsing and semver checks. The repository’s own review guide
flags repeated scans/parsing in resolver loops as a performance smell.

pnpm11/installing/deps-resolver/src/resolveDependencies.ts[1845-1866]
pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2191-2198]
REVIEW_GUIDE.md[124-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
`wantedLockfileContainsSatisfyingEntry()` currently does `Object.keys(lockfile.packages).some(...)` and `dp.parse()` for every entry to find a matching `{name, version}` satisfying the requested semver range. This is a full lockfile scan per optional-resolution failure.

Although the path is triggered only on failures, it can still be hit many times in one run (e.g. many optional platform binaries missing from a stale mirror), and it’s avoidable work in pnpm’s resolver.

### Issue Context
- The check is called from the optional-dependency catch block before deciding whether to skip or rethrow.
- The repo’s performance guide explicitly calls out repeated parsing/scans in resolver loops as something to avoid.

### Fix Focus Areas
- pnpm11/installing/deps-resolver/src/resolveDependencies.ts[1845-1866]
- pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2191-2198]

### Suggested fix
Implement a cheaper lookup:
1) Avoid `Object.keys(...)` allocation; use `for (const depPath in lockfile.packages)`.
2) Preferably, build a lazy index once per run (or once per `ctx.wantedLockfile`) such as `Map<pkgName, string[]>` (versions) or `Map<pkgName, Set<string>>`, then only check versions for the requested package name and run `semver.satisfies()` on that small set.
3) Store the computed index on the resolver context so multiple failures don’t repeatedly rescan the entire lockfile.

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


4. wantedLockfileContainsSatisfyingEntry JSDoc narrates internals 📘 Rule violation ⚙ Maintainability
Description
The new JSDoc for wantedLockfileContainsSatisfyingEntry explains resolver/dedupe internals
(including specific internal function names) rather than documenting the function’s contract
(inputs, return guarantees, and edge cases). This makes the comment brittle and violates the
requirement to document contracts instead of re-describing implementation.
Code

pnpm11/installing/deps-resolver/src/resolveDependencies.ts[R2169-2189]

+/**
+ * Whether the wanted lockfile already holds a package entry that satisfies the
+ * wanted dependency. An optional dependency that fails to resolve is normally
+ * skipped, but when a locked resolution exists the failure is environmental
+ * (e.g. a registry mirror that hasn't synced the release yet) rather than a
+ * genuinely uninstallable package. Silently skipping in that case would erase
+ * the locked entries, making the lockfile differ across machines from
+ * identical inputs and leaving frozen installs on other hosts with nothing to
+ * link (https://github.com/pnpm/pnpm/issues/12853).
+ *
+ * Only plain semver specifiers are checked; exotic specifiers (git, catalogs,
+ * tags, URLs) keep the skip-on-failure behavior.
+ *
+ * The check is deliberately by package name and range rather than by the
+ * current edge's locked dep path. `pnpm dedupe` — the flow where the erasure
+ * bites — clears every per-snapshot dependency map before resolving
+ * (`forgetResolutionsOfAllPrevWantedDeps`), so on this code path no edge-level
+ * lockfile linkage exists to key on; only the package entries survive. A
+ * satisfying entry locked via any edge also means the registry served this
+ * package in-range before, so failing loudly instead of skipping is the right
+ * outcome even when the failing edge itself was never locked.
Evidence
PR Compliance ID 713430 requires JSDoc to document function contracts rather than narrating
implementation. The added block includes internal-flow narration and internal identifiers (e.g.,
pnpm dedupe behavior and forgetResolutionsOfAllPrevWantedDeps) instead of a concise contract
statement.

Rule 713430: JSDoc must document function contracts, not re-describe implementation
pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2169-2190]

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 JSDoc for `wantedLockfileContainsSatisfyingEntry` focuses on internal implementation details (dedupe flow specifics and internal function names) instead of stating the function contract.

## Issue Context
Per compliance, JSDoc should primarily describe preconditions, postconditions/guarantees, side effects (if any), and edge cases, without narrating internal control flow or referencing fragile internal implementation details.

## Fix Focus Areas
- pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2169-2190]

ⓘ 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 e9fcb45

Results up to commit 0ac0b27


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


Remediation recommended
1. wantedLockfileContainsSatisfyingEntry JSDoc narrates internals 📘 Rule violation ⚙ Maintainability
Description
The new JSDoc for wantedLockfileContainsSatisfyingEntry explains resolver/dedupe internals
(including specific internal function names) rather than documenting the function’s contract
(inputs, return guarantees, and edge cases). This makes the comment brittle and violates the
requirement to document contracts instead of re-describing implementation.
Code

pnpm11/installing/deps-resolver/src/resolveDependencies.ts[R2169-2189]

+/**
+ * Whether the wanted lockfile already holds a package entry that satisfies the
+ * wanted dependency. An optional dependency that fails to resolve is normally
+ * skipped, but when a locked resolution exists the failure is environmental
+ * (e.g. a registry mirror that hasn't synced the release yet) rather than a
+ * genuinely uninstallable package. Silently skipping in that case would erase
+ * the locked entries, making the lockfile differ across machines from
+ * identical inputs and leaving frozen installs on other hosts with nothing to
+ * link (https://github.com/pnpm/pnpm/issues/12853).
+ *
+ * Only plain semver specifiers are checked; exotic specifiers (git, catalogs,
+ * tags, URLs) keep the skip-on-failure behavior.
+ *
+ * The check is deliberately by package name and range rather than by the
+ * current edge's locked dep path. `pnpm dedupe` — the flow where the erasure
+ * bites — clears every per-snapshot dependency map before resolving
+ * (`forgetResolutionsOfAllPrevWantedDeps`), so on this code path no edge-level
+ * lockfile linkage exists to key on; only the package entries survive. A
+ * satisfying entry locked via any edge also means the registry served this
+ * package in-range before, so failing loudly instead of skipping is the right
+ * outcome even when the failing edge itself was never locked.
Evidence
PR Compliance ID 713430 requires JSDoc to document function contracts rather than narrating
implementation. The added block includes internal-flow narration and internal identifiers (e.g.,
pnpm dedupe behavior and forgetResolutionsOfAllPrevWantedDeps) instead of a concise contract
statement.

Rule 713430: JSDoc must document function contracts, not re-describe implementation
pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2169-2190]

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 JSDoc for `wantedLockfileContainsSatisfyingEntry` focuses on internal implementation details (dedupe flow specifics and internal function names) instead of stating the function contract.

## Issue Context
Per compliance, JSDoc should primarily describe preconditions, postconditions/guarantees, side effects (if any), and edge cases, without narrating internal control flow or referencing fragile internal implementation details.

## Fix Focus Areas
- pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2169-2190]

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


2. O(n) scan on failure 🐞 Bug ➹ Performance
Description
wantedLockfileContainsSatisfyingEntry() scans every key in lockfile.packages and parses each depPath
on every optional dependency resolution failure, adding O(lockfile package count) CPU work per
failure. In cases like many platform-binary optional deps failing together, this can multiply the
cost via repeated full scans before the install aborts.
Code

pnpm11/installing/deps-resolver/src/resolveDependencies.ts[R2191-2198]

+function wantedLockfileContainsSatisfyingEntry (lockfile: LockfileObject, wantedDependency: WantedDependency): boolean {
+  if (!wantedDependency.alias) return false
+  const { pkgName, bareSpecifier } = unwrapPackageName(wantedDependency.alias, wantedDependency.bareSpecifier)
+  if (semver.validRange(bareSpecifier) == null) return false
+  return Object.keys(lockfile.packages ?? {}).some((depPath) => {
+    const parsed = dp.parse(depPath)
+    return parsed.name === pkgName && parsed.version != null && semver.satisfies(parsed.version, bareSpecifier)
+  })
Evidence
The new helper is invoked in the optional-dependency resolution failure path, and it performs a full
scan of all lockfile package keys with parsing and semver checks. The repository’s own review guide
flags repeated scans/parsing in resolver loops as a performance smell.

pnpm11/installing/deps-resolver/src/resolveDependencies.ts[1845-1866]
pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2191-2198]
REVIEW_GUIDE.md[124-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
`wantedLockfileContainsSatisfyingEntry()` currently does `Object.keys(lockfile.packages).some(...)` and `dp.parse()` for every entry to find a matching `{name, version}` satisfying the requested semver range. This is a full lockfile scan per optional-resolution failure.

Although the path is triggered only on failures, it can still be hit many times in one run (e.g. many optional platform binaries missing from a stale mirror), and it’s avoidable work in pnpm’s resolver.

### Issue Context
- The check is called from the optional-dependency catch block before deciding whether to skip or rethrow.
- The repo’s performance guide explicitly calls out repeated parsing/scans in resolver loops as something to avoid.

### Fix Focus Areas
- pnpm11/installing/deps-resolver/src/resolveDependencies.ts[1845-1866]
- pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2191-2198]

### Suggested fix
Implement a cheaper lookup:
1) Avoid `Object.keys(...)` allocation; use `for (const depPath in lockfile.packages)`.
2) Preferably, build a lazy index once per run (or once per `ctx.wantedLockfile`) such as `Map<pkgName, string[]>` (versions) or `Map<pkgName, Set<string>>`, then only check versions for the requested package name and run `semver.satisfies()` on that small set.
3) Store the computed index on the resolver context so multiple failures don’t repeatedly rescan the entire lockfile.

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


Qodo Logo

@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to e9fcb45

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve inherited optional handling

Replace wanted.optional.unwrap_or(false) with current_is_optional in the error
handler. This ensures that transitive optional dependencies are correctly
identified and skipped on resolution failure.

pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs [1432-1443]

 Err(
     err @ (ResolveDependencyTreeError::Resolve(_)
     | ResolveDependencyTreeError::SpecNotSupported { .. }),
-) if wanted.optional.unwrap_or(false) => {
+) if current_is_optional => {
     if wanted_lockfile_contains_satisfying_entry(
         ctx.workspace.wanted_lockfile.as_deref(),
         &wanted,
     ) {
         return Err(ResolveDependencyTreeError::LockedOptionalResolutionFailure(
             Box::new(err),
         ));
     }
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly points out that transitive optional dependencies would be incorrectly treated as required, which would cause the installation to fail instead of skipping them.

High
  • More

Previous suggestions

Suggestions up to commit 0ac0b27
CategorySuggestion                                                                                                                                    Impact
General
Preserve lockfile-specific error guidance

Append the lockfile-specific guidance to err.hint even if a hint already exists.

pnpm11/installing/deps-resolver/src/resolveDependencies.ts [1862-1866]

-if (err.hint == null) {
-  err.hint = 'This optional dependency is not skipped, because the lockfile contains a resolution for it. ' +
-    'Skipping it would remove the locked entries, making the lockfile differ depending on which machine ran the install. ' +
-    'If the version was intentionally removed from the registry, update the dependent package or remove the entries from the lockfile.'
-}
+const lockedOptionalDepHint = 'This optional dependency is not skipped, because the lockfile contains a resolution for it. ' +
+  'Skipping it would remove the locked entries, making the lockfile differ depending on which machine ran the install. ' +
+  'If the version was intentionally removed from the registry, update the dependent package or remove the entries from the lockfile.'
+err.hint = err.hint == null ? lockedOptionalDepHint : `${err.hint}\n\n${lockedOptionalDepHint}`
Suggestion importance[1-10]: 7

__

Why: Appending the new explanatory hint instead of skipping it when a hint already exists ensures that the context about the optional dependency and lockfile is not lost, providing more robust and helpful error messages.

Medium

zkochan and others added 3 commits July 9, 2026 17:26
…ailures

An optional dependency whose resolution fails is now skipped instead
of failing the install, emitting the same
pnpm:skipped-optional-dependency reason=resolution_failure payload as
pnpm (including the parents chain, newly added to the wire type) with
the default reporter rendering the same info line for top-level skips.

The exception matches pnpm's new locked-entry guard: when the wanted
lockfile already holds a package entry satisfying the wanted range,
the failure is rethrown with the same hint so the locked entries are
not silently erased (pnpm#12853).

Co-Authored-By: Claude Fable 5 <[email protected]>
…macro

Fixes the perfectionist macro_trailing_comma dylint finding.

Co-Authored-By: Claude Fable 5 <[email protected]>
…ests

Adds the required trailing comma in a multi-line assert_eq! and wraps
a bare URL in angle brackets.

Co-Authored-By: Claude Fable 5 <[email protected]>
@qodo-code-review

Copy link
Copy Markdown

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

@zkochan

zkochan commented Jul 9, 2026

Copy link
Copy Markdown
Member

Assessment of the remaining Qodo findings on e9fcb45 (the inline LockedOptionalResolutionFailure one is answered in its thread):

"Preserve inherited optional handling" (current_is_optional instead of wanted.optional, importance 9) — would break parity rather than fix it. pnpm gates the skip on the edge's own flag (wantedDependency.optional in the catch block of resolveDependency), not on inherited optionality: currentIsOptional exists on the TS side too, but is only used to mark the resolved package. A hard dependency of an optional package failing to resolve aborts the install in pnpm as well, so wanted.optional.unwrap_or(false) is the exact counterpart. Not applying.

Skipped-optional prefix mismatch (strict equality vs is_current_prefix) — intentional parity. pnpm's reportSkippedOptionalDependencies filters with strict log.prefix === opts.cwd, so the pacquet handler mirrors it exactly (its doc comment says so). Routing it through is_current_prefix would additionally match SummaryScope::AllPrefixes and normalized prefixes, making pacquet render info lines pnpm does not. If prefix normalization is ever a real problem it affects both stacks equally and belongs in a joint follow-up, not this PR.

O(n) lockfile scan per resolution failure — the scan runs only after a resolver chain call has already failed, so each occurrence is preceded by a network round-trip that dominates it by orders of magnitude, and the first rethrow aborts the install. It is not in the resolver's hot loop; an index threaded through the context for a failure-only path is not worth the state. Not applying.

JSDoc narrating internals — the flagged paragraph records the non-obvious why for matching by name+range instead of the current edge's locked dep path, which the repo's comment conventions explicitly allow; the same question was already raised in review, and the paragraph is what stops the check from being "simplified" into the edge-keyed form that would silently disable the fix on the dedupe flow. Keeping it.


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

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.83333% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.33%. Comparing base (abb6f41) to head (e9fcb45).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...package-manager/src/install_with_fresh_lockfile.rs 20.00% 20 Missing ⚠️
...lving-deps-resolver/src/resolve_dependency_tree.rs 85.52% 11 Missing ⚠️
pacquet/crates/default-reporter/src/state.rs 78.57% 3 Missing ⚠️
...acquet/crates/package-manager/src/build_modules.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12855      +/-   ##
==========================================
- Coverage   85.35%   85.33%   -0.03%     
==========================================
  Files         453      453              
  Lines       70868    71032     +164     
==========================================
+ Hits        60488    60613     +125     
- Misses      10380    10419      +39     

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

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: e9fcb45b81fc

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 4.345 ± 0.149 4.191 4.605 2.05 ± 0.15
pacquet@main 4.215 ± 0.101 4.066 4.372 1.99 ± 0.14
pnpr@HEAD 2.120 ± 0.135 1.987 2.379 1.00
pnpr@main 2.187 ± 0.090 2.091 2.370 1.03 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.34524045836,
      "stddev": 0.14935238459297445,
      "median": 4.29881696216,
      "user": 4.0986419,
      "system": 3.6651650599999996,
      "min": 4.19087151816,
      "max": 4.60471543716,
      "times": [
        4.60471543716,
        4.48583589116,
        4.24189424616,
        4.42255761816,
        4.4987729531600005,
        4.22638191816,
        4.19087151816,
        4.20074884016,
        4.22488648316,
        4.35573967816
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.21496676456,
      "stddev": 0.10148990768353224,
      "median": 4.19420748316,
      "user": 4.068008900000001,
      "system": 3.6263930600000003,
      "min": 4.06648262916,
      "max": 4.37159724416,
      "times": [
        4.27903626116,
        4.19076486216,
        4.06648262916,
        4.14066491116,
        4.12378961216,
        4.15965859116,
        4.19765010416,
        4.36555696516,
        4.25446646516,
        4.37159724416
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.11979392996,
      "stddev": 0.13514518033245396,
      "median": 2.08938381766,
      "user": 2.6878411000000004,
      "system": 3.10058636,
      "min": 1.98692844316,
      "max": 2.37872530916,
      "times": [
        2.33335652616,
        2.04859013016,
        1.98692844316,
        2.08826124516,
        2.0086146241600003,
        2.0905063901600003,
        2.00481474716,
        2.10266004516,
        2.37872530916,
        2.15548183916
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.18700816546,
      "stddev": 0.08972427525908652,
      "median": 2.18150420116,
      "user": 2.6874704,
      "system": 3.1034294599999996,
      "min": 2.09098582716,
      "max": 2.3697628021600003,
      "times": [
        2.3697628021600003,
        2.17528573816,
        2.19755986816,
        2.1877226641600003,
        2.09098582716,
        2.29473423716,
        2.0962617151600003,
        2.1131483391600003,
        2.12838961016,
        2.21623085316
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 672.2 ± 16.8 650.7 698.3 1.00
pacquet@main 683.2 ± 30.4 645.1 745.8 1.02 ± 0.05
pnpr@HEAD 723.5 ± 39.5 682.6 816.3 1.08 ± 0.06
pnpr@main 733.3 ± 47.7 688.2 857.6 1.09 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6722474491200001,
      "stddev": 0.01683650269180925,
      "median": 0.66795727532,
      "user": 0.4009619,
      "system": 1.3583739799999999,
      "min": 0.6507332918200001,
      "max": 0.69827606082,
      "times": [
        0.6635310828200001,
        0.6569868388200001,
        0.67238346782,
        0.68794076082,
        0.65840196382,
        0.6507332918200001,
        0.6927014168200001,
        0.65977766882,
        0.68174193882,
        0.69827606082
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6831986612200001,
      "stddev": 0.030411902428670822,
      "median": 0.67555360082,
      "user": 0.40103170000000005,
      "system": 1.3532558799999996,
      "min": 0.64512521582,
      "max": 0.74577499682,
      "times": [
        0.69341099382,
        0.69273323682,
        0.66230566782,
        0.66962642982,
        0.66841804782,
        0.64512521582,
        0.68148077182,
        0.65574417782,
        0.7173670738200001,
        0.74577499682
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.72353392672,
      "stddev": 0.039497084107158555,
      "median": 0.71404951482,
      "user": 0.4049165,
      "system": 1.3758156799999999,
      "min": 0.6826193448200001,
      "max": 0.81631409682,
      "times": [
        0.71513469582,
        0.69539812582,
        0.70612584282,
        0.7275780968200001,
        0.68626331782,
        0.71296433382,
        0.81631409682,
        0.74304721882,
        0.74989419382,
        0.6826193448200001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.73325294992,
      "stddev": 0.04766616797523538,
      "median": 0.7236043788200001,
      "user": 0.40449729999999995,
      "system": 1.3890735799999996,
      "min": 0.68820447882,
      "max": 0.85761776682,
      "times": [
        0.7244486008200001,
        0.75289075782,
        0.68820447882,
        0.71691105682,
        0.70367875282,
        0.73737985782,
        0.73018775782,
        0.69845031282,
        0.72276015682,
        0.85761776682
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.381 ± 0.115 4.221 4.551 1.99 ± 0.15
pacquet@main 4.394 ± 0.051 4.322 4.467 2.00 ± 0.14
pnpr@HEAD 2.197 ± 0.154 2.034 2.483 1.00
pnpr@main 2.232 ± 0.145 2.069 2.496 1.02 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.38061867446,
      "stddev": 0.11503986466323463,
      "median": 4.34918477356,
      "user": 3.8949633599999993,
      "system": 3.4817531199999996,
      "min": 4.22146096406,
      "max": 4.55065669906,
      "times": [
        4.32937231106,
        4.22146096406,
        4.28423088106,
        4.32019750506,
        4.28628652206,
        4.36899723606,
        4.55065669906,
        4.53806279906,
        4.502764385060001,
        4.404157442060001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.39409581896,
      "stddev": 0.051259189228421355,
      "median": 4.40592409256,
      "user": 3.88444236,
      "system": 3.4769126199999993,
      "min": 4.32218161806,
      "max": 4.46664816006,
      "times": [
        4.43453807906,
        4.32218161806,
        4.40467369906,
        4.41604582206,
        4.45331002306,
        4.3365145730600005,
        4.407174486060001,
        4.46664816006,
        4.35662909706,
        4.34324263206
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.19718252656,
      "stddev": 0.15405055522232564,
      "median": 2.12784462606,
      "user": 2.52923816,
      "system": 2.9828415199999996,
      "min": 2.03408700906,
      "max": 2.48285530106,
      "times": [
        2.0524356450599996,
        2.19150812106,
        2.48285530106,
        2.12501648706,
        2.13067276506,
        2.1206425480599997,
        2.42500488506,
        2.03408700906,
        2.1129256550599997,
        2.29667684906
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.23172831146,
      "stddev": 0.14528356289951877,
      "median": 2.16272864406,
      "user": 2.5590013599999994,
      "system": 2.9824019199999996,
      "min": 2.06912242106,
      "max": 2.49556062606,
      "times": [
        2.06912242106,
        2.14025242906,
        2.1453238840599997,
        2.45425850506,
        2.17156149206,
        2.49556062606,
        2.2806085120599997,
        2.15389579606,
        2.11707545606,
        2.2896239930599998
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.445 ± 0.024 1.419 1.495 2.02 ± 0.14
pacquet@main 1.478 ± 0.045 1.438 1.584 2.06 ± 0.15
pnpr@HEAD 0.716 ± 0.049 0.676 0.837 1.00
pnpr@main 0.723 ± 0.040 0.693 0.831 1.01 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.44491993302,
      "stddev": 0.024190703766056084,
      "median": 1.4396221974199999,
      "user": 1.40689662,
      "system": 1.7461303999999997,
      "min": 1.41910615942,
      "max": 1.49535515342,
      "times": [
        1.44072546542,
        1.45669273042,
        1.4284881064200001,
        1.42012427342,
        1.42589316042,
        1.41910615942,
        1.45906175442,
        1.4652335974200001,
        1.43851892942,
        1.49535515342
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.47830682242,
      "stddev": 0.04452185608435972,
      "median": 1.4659360619200001,
      "user": 1.4503173200000001,
      "system": 1.7518631999999996,
      "min": 1.43814049342,
      "max": 1.58375319642,
      "times": [
        1.4707375794200002,
        1.43851999242,
        1.58375319642,
        1.5234356934200002,
        1.4611345444200001,
        1.43814049342,
        1.47141660442,
        1.48495863842,
        1.45657582242,
        1.45439565942
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.7162056669200002,
      "stddev": 0.048845707593090516,
      "median": 0.6944690524200001,
      "user": 0.36923712,
      "system": 1.3440639,
      "min": 0.67593429342,
      "max": 0.83667437442,
      "times": [
        0.76192706042,
        0.67593429342,
        0.69127001742,
        0.68829011242,
        0.83667437442,
        0.6885649704200001,
        0.68927295842,
        0.71888286642,
        0.7135719284200001,
        0.6976680874200001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.72300590832,
      "stddev": 0.03976547455672049,
      "median": 0.7119805154200001,
      "user": 0.38269591999999997,
      "system": 1.3461104000000002,
      "min": 0.69334136642,
      "max": 0.8309299074200001,
      "times": [
        0.69835255342,
        0.7008775714200001,
        0.7171174144200001,
        0.73076976242,
        0.7117809284200001,
        0.7072406544200001,
        0.8309299074200001,
        0.72746882242,
        0.7121801024200001,
        0.69334136642
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.303 ± 0.026 3.252 3.337 4.74 ± 0.26
pacquet@main 3.185 ± 0.050 3.101 3.266 4.57 ± 0.25
pnpr@HEAD 0.698 ± 0.016 0.681 0.735 1.00 ± 0.06
pnpr@main 0.697 ± 0.037 0.674 0.799 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.30289562058,
      "stddev": 0.026136924719632252,
      "median": 3.30647826628,
      "user": 2.0127278799999995,
      "system": 2.10731968,
      "min": 3.25165421428,
      "max": 3.33704072028,
      "times": [
        3.30722693728,
        3.29176917228,
        3.27816731728,
        3.31646204028,
        3.29068321428,
        3.31339995528,
        3.30572959528,
        3.33704072028,
        3.25165421428,
        3.33682303928
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.1849974630799993,
      "stddev": 0.049957490668623414,
      "median": 3.19275659678,
      "user": 1.9254343799999998,
      "system": 2.03139188,
      "min": 3.10102856428,
      "max": 3.26563494328,
      "times": [
        3.20936258528,
        3.23876760228,
        3.19387548228,
        3.20209070128,
        3.17532691528,
        3.12781668728,
        3.10102856428,
        3.26563494328,
        3.14443343828,
        3.19163771128
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.6977849615799999,
      "stddev": 0.01632105957503282,
      "median": 0.69125108778,
      "user": 0.3466810800000001,
      "system": 1.3635592799999998,
      "min": 0.6807573302800001,
      "max": 0.73485188928,
      "times": [
        0.6852042082800001,
        0.68826773228,
        0.73485188928,
        0.70197742728,
        0.7130586642800001,
        0.69346602128,
        0.6890361542800001,
        0.6875786702800001,
        0.6807573302800001,
        0.70365151828
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6965965418800002,
      "stddev": 0.03708144068084767,
      "median": 0.6876830097800001,
      "user": 0.35983768,
      "system": 1.3199610799999997,
      "min": 0.6741042432800001,
      "max": 0.79867121628,
      "times": [
        0.6872060132800001,
        0.69896929228,
        0.6976632592800001,
        0.6784289852800001,
        0.6755621662800001,
        0.6881600062800001,
        0.79867121628,
        0.6741042432800001,
        0.6929197862800001,
        0.67428045028
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 672.3 ± 16.0 652.1 699.7 6.13 ± 0.20
pacquet@main 679.8 ± 11.9 664.2 700.5 6.20 ± 0.17
pnpr@HEAD 111.4 ± 2.7 106.2 117.3 1.02 ± 0.03
pnpr@main 109.7 ± 2.4 106.3 113.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6723080150000001,
      "stddev": 0.015988011304625207,
      "median": 0.6737235167000002,
      "user": 0.6390511200000001,
      "system": 0.15931515999999998,
      "min": 0.6520537147000001,
      "max": 0.6996729137000001,
      "times": [
        0.6780538077000001,
        0.6781812397000001,
        0.6828393027000002,
        0.6520537147000001,
        0.6996729137000001,
        0.6693932257000001,
        0.6569481207000001,
        0.6560114667000001,
        0.6601483617000001,
        0.6897779967000001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6797552307000001,
      "stddev": 0.011892664455557542,
      "median": 0.6752257847,
      "user": 0.64607652,
      "system": 0.16169275999999996,
      "min": 0.6642259277000001,
      "max": 0.7004913877000001,
      "times": [
        0.7004913877000001,
        0.6911800907000001,
        0.6720038977000001,
        0.6809198557000001,
        0.6948112007000001,
        0.6692885117000001,
        0.6760784027000001,
        0.6743731667000001,
        0.6642259277000001,
        0.6741798657000001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.1114171842,
      "stddev": 0.002743234033826324,
      "median": 0.1111282392,
      "user": 0.030066695000000004,
      "system": 0.019836110000000004,
      "min": 0.10623495670000001,
      "max": 0.11729041670000001,
      "times": [
        0.1133488177,
        0.1103610867,
        0.1105422887,
        0.1112362717,
        0.10816479270000001,
        0.1089235597,
        0.1117838337,
        0.1126164597,
        0.10623495670000001,
        0.1099894317,
        0.1124447487,
        0.1110647807,
        0.1158157337,
        0.1086393997,
        0.1081066937,
        0.1144761937,
        0.1108705987,
        0.11339413270000001,
        0.1165167767,
        0.11119169770000001,
        0.11729041670000001,
        0.1117895047,
        0.10987934270000001,
        0.10933090170000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.1096666067,
      "stddev": 0.0023610978151212664,
      "median": 0.10998113970000001,
      "user": 0.029634039999999997,
      "system": 0.019120439999999995,
      "min": 0.10627333870000001,
      "max": 0.1136427977,
      "times": [
        0.11017292470000001,
        0.1116507357,
        0.1111423757,
        0.1134902527,
        0.1110894827,
        0.10696816370000001,
        0.11027738270000001,
        0.11090375070000001,
        0.1120368067,
        0.10627333870000001,
        0.10726976070000001,
        0.1099990057,
        0.1136427977,
        0.1066411087,
        0.1081290027,
        0.10666951870000001,
        0.10835713570000001,
        0.1084906957,
        0.11292713870000001,
        0.10699091670000001,
        0.10745017470000001,
        0.10998113970000001,
        0.11339713570000001,
        0.10962184470000001,
        0.10809257770000001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 7.223 ± 0.133 6.993 7.470 1.44 ± 0.03
pacquet@main 7.071 ± 0.204 6.795 7.406 1.41 ± 0.05
pnpr@HEAD 5.015 ± 0.072 4.895 5.093 1.00
pnpr@main 5.065 ± 0.133 4.888 5.294 1.01 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 7.222642153599999,
      "stddev": 0.13338320553518754,
      "median": 7.1945719227,
      "user": 4.233438980000001,
      "system": 3.9127147,
      "min": 6.9926943327,
      "max": 7.4698752627,
      "times": [
        7.2857884907,
        7.4698752627,
        7.3870875487,
        7.1788785177,
        7.1765999067,
        7.2102653277,
        7.1565422657,
        6.9926943327,
        7.1419251407,
        7.2267647426999995
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 7.071359868200001,
      "stddev": 0.204266482691757,
      "median": 7.0588128141999995,
      "user": 4.16367438,
      "system": 3.846716,
      "min": 6.7949735637,
      "max": 7.4059558207,
      "times": [
        6.7949735637,
        7.0161278617,
        7.4059558207,
        6.9129753417,
        7.0402005617,
        7.0774250667,
        7.4031334147,
        6.8592024777,
        7.0783771417,
        7.1252274317
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 5.0151501992,
      "stddev": 0.0717321859471935,
      "median": 5.0382652332,
      "user": 2.77824268,
      "system": 3.2820961000000004,
      "min": 4.8954852167,
      "max": 5.0933919727,
      "times": [
        5.0659683497,
        5.0559361397,
        4.8954852167,
        5.0475344747,
        5.0866301597,
        4.9385115616999995,
        4.9183611047,
        5.0933919727,
        5.0289959917,
        5.0206870207
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 5.065099377699999,
      "stddev": 0.13323417074064137,
      "median": 5.0216006666999995,
      "user": 2.790309779999999,
      "system": 3.3162388999999997,
      "min": 4.8877780347,
      "max": 5.2935553657,
      "times": [
        4.9497399487000004,
        5.2935553657,
        5.0214301087,
        4.8877780347,
        5.1361375957,
        5.2156342957,
        4.9708267447,
        5.1823083317,
        5.0217712247,
        4.9718121267
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12855
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,380.62 ms
(+3.20%)Baseline: 4,244.73 ms
5,093.68 ms
(86.00%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
3,302.90 ms
(+8.94%)Baseline: 3,031.90 ms
3,638.28 ms
(90.78%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,444.92 ms
(+6.85%)Baseline: 1,352.29 ms
1,622.75 ms
(89.04%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
672.31 ms
(+5.15%)Baseline: 639.40 ms
767.28 ms
(87.62%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
4,345.24 ms
(+8.70%)Baseline: 3,997.43 ms
4,796.92 ms
(90.58%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
7,222.64 ms
(+5.94%)Baseline: 6,817.95 ms
8,181.54 ms
(88.28%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
672.25 ms
(+4.67%)Baseline: 642.26 ms
770.71 ms
(87.22%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12855
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,197.18 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
697.78 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
716.21 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
111.42 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,119.79 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
5,015.15 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
723.53 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit 14332f0 into pnpm:main Jul 9, 2026
35 checks passed
asim29 added a commit to asim29/asimwaheed.com that referenced this pull request Jul 27, 2026
`pnpm audit --audit-level high` failed on four advisories, all in dev-scope
transitive dependencies:

  fast-uri        3.1.3  -> 3.1.4   GHSA-v2hh-gcrm-f6hx
  js-yaml         5.2.1  -> 5.2.2   GHSA-pm4m-ph32-ghv5
  postcss         8.5.15 -> 8.5.23  GHSA-r28c-9q8g-f849
  brace-expansion 5.0.7  -> 5.0.8   GHSA-mh99-v99m-4gvg

Every patched version already satisfies the range its parent declares
(ajv wants fast-uri ^3.0.1, minimatch wants brace-expansion ^5.0.5, and so
on), so these were stale lockfile resolutions rather than blocked ones.
Refreshing the resolutions is sufficient; no `overrides:` entries are needed,
and adding them would pin packages that should stay free to float.

Dependabot could not produce this fix itself. Its security update for
fast-uri ran with `update-subdependencies: false` and `allowed-updates`
restricted to direct dependencies, so it errored out rather than opening a PR.
Because the audit gate is repo-wide rather than diff-scoped, that single
unfixable alert turned `ci` red on every open PR.

Bumping pnpm is load-bearing here, not incidental. Under 11.9.0, regenerating
this lockfile drops all eleven `lightningcss-*` platform binary packages: the
package is reached both as a regular dependency (vite -> lightningcss) and
through an optional one (vitefu -> vite), which triggers a resolver bug that
erases locked optional entries instead of failing loudly. The resulting
lockfile builds nowhere, including the linux-x64 host Cloudflare Pages deploys
from. pnpm/pnpm#12855 fixes this in 11.11.0; 11.17.0 is the current release.

`pnpm/action-setup` reads the version from `packageManager`, so CI and the
deploy host pick it up with no workflow change.
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 state: automerge

Projects

None yet

4 participants