Skip to content

fix(self-updater): fix missing resolution for peer dependencies in env lockfile - #12960

Closed
ImBIOS wants to merge 11 commits into
pnpm:mainfrom
ImBIOS:fix-self-update-peer-deps
Closed

ImBIOS wants to merge 11 commits into
pnpm:mainfrom
ImBIOS:fix-self-update-peer-deps

Conversation

@ImBIOS

@ImBIOS ImBIOS commented Jul 13, 2026 •

Copy link
Copy Markdown

This PR fixes a bug in pnpm self-update that causes it to crash with Cannot use 'in' operator to search for 'integrity' in undefined when there are peer dependencies recorded in the global environment lockfile (~/.local/share/pnpm/pnpm-lock.yaml).

The Issue

When pnpm self-update constructs the in-memory temporary lockfile via buildLockfileFromEnvLockfile, it loops through envLockfile.snapshots. For peer dependencies (e.g. [email protected]([email protected])), it attempts to extract the base package resolution details from envLockfile.packages[depPath]. However, this entry maps to undefined because the base package is keyed without the peer suffix (i.e. [email protected]).

As a result, the constructed lockfile lacks a resolution block for peer packages. The headless installer later tries to check resolution.integrity and throws the crash.

The Fix

When parsing envLockfile.packages[depPath], this PR adds a fallback to strip the peer dependency suffix and look up the base package instead if it cannot be found exactly.

Fixes #12959


Workaround / How to resolve until merged

If you are encountering this issue, you can resolve it by using one of the following methods:

  1. Delete the global environment lockfile:
    The crash occurs because of peer dependency entries stored in your global environment lockfile. Deleting this file will resolve the crash and allow pnpm self-update to run successfully.

    • Linux/macOS:
      rm ~/.local/share/pnpm/pnpm-lock.yaml
      (Note: On macOS, the path may also be under ~/Library/Application Support/pnpm/pnpm-lock.yaml depending on your environment).
    • Windows (PowerShell):
      Remove-Item "$env:LOCALAPPDATA\pnpm\pnpm-lock.yaml" -Force
  2. Pin pnpm version temporarily:
    If you are running in CI or want to avoid the issue entirely until the fix is released, you can temporarily pin pnpm to 11.11.0 in your package.json under devEngines:

    "devEngines": {
      "packageManager": {
        "name": "pnpm",
        "version": "~11.11.0",
        "onFail": "download"
      }
    }

@ImBIOS
ImBIOS requested a review from zkochan as a code owner July 13, 2026 01:42
Copilot AI review requested due to automatic review settings July 13, 2026 01:42
@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 13, 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

The self-update lockfile builder now falls back to base package metadata for peer-suffixed paths. Engine integrity verification and environment installation use the same fallback, with exports, workspace wiring, and regression coverage added.

Changes

Self-update lockfile handling

Layer / File(s) Summary
Package data fallback and regression coverage
pnpm11/engine/pm/commands/src/self-updater/installPnpm.ts, pnpm11/engine/pm/commands/src/index.ts, pnpm11/engine/pm/commands/package.json, pnpm11/engine/pm/commands/tsconfig.json, pnpm11/engine/pm/commands/test/self-updater/installPnpm.test.ts
buildLockfileFromEnvLockfile falls back from peer-suffixed paths to base package metadata, is publicly re-exported, and is covered by a regression test.
Runtime integrity and installation fallbacks
pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs, pnpm/crates/env-installer/src/install_config_deps.rs, pnpm/crates/env-installer/src/resolve_package_manager_integrities.rs
Integrity and package lookups accept peer-less package entries when exact peer-suffixed entries are absent.

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

Sequence Diagram(s)

sequenceDiagram
  participant SelfUpdate
  participant buildLockfileFromEnvLockfile
  participant EnvLockfile
  participant EnvInstaller
  SelfUpdate->>buildLockfileFromEnvLockfile: build lockfile from environment lockfile
  buildLockfileFromEnvLockfile->>EnvLockfile: read snapshot and exact package entry
  buildLockfileFromEnvLockfile->>EnvLockfile: fallback to peer-less package entry
  SelfUpdate->>EnvInstaller: install generated lockfile
  EnvInstaller->>EnvLockfile: resolve package metadata and integrity
  EnvLockfile-->>EnvInstaller: return exact or peer-less package data
Loading

Assessment against linked issues

Objective Addressed Explanation
Self-update succeeds when the environment lockfile contains peer-dependent packages [#12959] ✅

Possibly related PRs

  • pnpm/pnpm#11662: Addresses missing base package metadata for peer-variant lockfile entries.

Suggested labels: product: pnpm@11

Suggested reviewers: zkochan, copilot

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

@greptile-apps

greptile-apps Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The change is a minimal, targeted one-line fix with a correct fallback through a well-tested utility function, backed by new regression tests.

The root cause is clearly understood, the chosen utility (getPkgIdWithPatchHash) already handles all three key shapes — no suffix, peer suffix only, and patch-hash + peer suffix — and the two new unit tests directly exercise the previously crashing path. No existing behaviour is changed for packages without a peer suffix.

No files require special attention.

Reviews (7): Last reviewed commit: "fix(self-updater): key the env lockfile ..." | Re-trigger Greptile

packages[depPath as DepPath] = {
...snapshot,
...envLockfile.packages[depPath],
...(envLockfile.packages[depPath] ?? envLockfile.packages[depPath.split('(')[0]]),

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.

P2 No test added for the peer-dep crash path

This fixes a real crash (Cannot use 'in' operator to search for 'integrity' in undefined) but there are no unit or integration tests for buildLockfileFromEnvLockfile. Without a regression test, future refactors of this function have no safety net for the peer-dep case — the bug could silently reappear. A minimal test that passes an EnvLockfile whose snapshots contains a peer-suffix key (e.g. [email protected]([email protected])) and whose packages only has the base key ([email protected]) would cover this exactly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@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/engine/pm/commands/src/self-updater/installPnpm.ts`:
- Line 495: Update the package lookup in the installPnpm lockfile generation
flow to use the repository’s canonical removeSuffix helper instead of
depPath.split('(')[0], while retaining the direct depPath lookup fallback. Add a
regression test covering a global environment lockfile with a peer-suffixed
package entry and verify the generated temporary lockfile preserves its
resolution.
🪄 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: 3f665340-f848-4d08-96a3-9280cbf2311a

📥 Commits

Reviewing files that changed from the base of the PR and between b45c85a and 979c4ef.

📒 Files selected for processing (1)
  • pnpm11/engine/pm/commands/src/self-updater/installPnpm.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a pnpm self-update crash when the global env lockfile contains peer-suffixed snapshot keys by falling back to a base package entry when copying package metadata into the temporary in-memory lockfile.

Changes:

  • Add a fallback lookup for envLockfile.packages[...] when depPath contains a peer suffix.
  • Prevent missing resolution blocks for peer-variant snapshot entries during self-update lockfile construction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +493 to +495
packages[depPath as DepPath] = {
...snapshot,
...envLockfile.packages[depPath],
...(envLockfile.packages[depPath] ?? envLockfile.packages[depPath.split('(')[0]]),
Comment on lines 492 to 496
for (const [depPath, snapshot] of Object.entries(envLockfile.snapshots)) {
packages[depPath as DepPath] = {
...snapshot,
...envLockfile.packages[depPath],
...(envLockfile.packages[depPath] ?? envLockfile.packages[depPath.split('(')[0]]),
}
Copilot AI review requested due to automatic review settings July 13, 2026 02:06
@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

pnpm11/engine/pm/commands/src/self-updater/installPnpm.ts:489

  • buildLockfileFromEnvLockfile is now exported, but its signature has no explicit return type and the module-boundary lint is suppressed. Since LockfileObject is already in scope, it’s better to type the export and drop the eslint suppression so the API surface stays well-defined.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export function buildLockfileFromEnvLockfile (
  envLockfile: EnvLockfile,
  pkgName: string,
  version: string
) {

Comment on lines +1 to +5
/* eslint-disable @typescript-eslint/no-explicit-any */
import { describe, expect, test } from '@jest/globals'

import { buildLockfileFromEnvLockfile } from '../../src/self-updater/installPnpm.js'

Comment thread pnpm-lock.yaml Outdated
Comment on lines 137 to 141
version: 2.31.0
'@commitlint/cli':
specifier: ^21.0.2
version: 21.2.0
version: 21.2.1
'@commitlint/config-conventional':
dependencies: {},
},
},
}
Comment on lines +29 to +31
const result = buildLockfileFromEnvLockfile(envLockfile as any, 'pnpm', '11.12.0')

expect((result.packages as any)['[email protected]([email protected])']).toEqual({
dependencies: { picomatch: '4.0.5' },
})

expect((result.packages as any)['[email protected]']).toEqual({
Copilot AI review requested due to automatic review settings July 13, 2026 02:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

pnpm11/engine/pm/commands/src/self-updater/installPnpm.ts:489

  • Avoid disabling @typescript-eslint/explicit-module-boundary-types here by giving the exported helper an explicit return type. This keeps lint checks meaningful and documents the function contract for callers/tests.
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export function buildLockfileFromEnvLockfile (
  envLockfile: EnvLockfile,
  pkgName: string,
  version: string
) {

Comment on lines 494 to 498
for (const [depPath, snapshot] of Object.entries(envLockfile.snapshots)) {
packages[depPath as DepPath] = {
...snapshot,
...envLockfile.packages[depPath],
...(envLockfile.packages[depPath] ?? envLockfile.packages[removePeersSuffix(depPath)]),
}
Copilot AI review requested due to automatic review settings July 13, 2026 02:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines +1 to +5
import { describe, expect, test } from '@jest/globals'
import type { EnvLockfile } from '@pnpm/lockfile.types'
import type { DepPath } from '@pnpm/types'

import { buildLockfileFromEnvLockfile } from '../../src/self-updater/installPnpm.js'
Copilot AI review requested due to automatic review settings July 13, 2026 03:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.25%. Comparing base (c6fd0b7) to head (387e281).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...pm/crates/env-installer/src/install_config_deps.rs 83.33% 2 Missing ⚠️
...staller/src/resolve_package_manager_integrities.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12960      +/-   ##
==========================================
+ Coverage   85.18%   85.25%   +0.07%     
==========================================
  Files         486      486              
  Lines       76975    77076     +101     
==========================================
+ Hits        65570    65711     +141     
+ Misses      11405    11365      -40     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pnpm/crates/env-installer/src/install_config_deps.rs (1)

361-370: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting the peer-suffix fallback lookup into a helper.

The pattern env_lockfile.packages.get(&key).or_else(|| env_lockfile.packages.get(&key.without_peer())) is now duplicated in normalize_from_lockfile (Line 361), read_optional_subdeps (Line 423), and verify_engine.rs (Line 206). A small helper on EnvLockfile or a free function would reduce duplication and ensure consistent fallback behavior if the logic needs to evolve.

♻️ Optional refactor: extract a `get_package` helper
+/// Looks up a package entry by key, falling back to the base (peer-stripped) key
+/// when the exact peer-suffixed key is not present.
+fn get_package<'a>(
+    packages: &'a BTreeMap<PackageKey, PackageEntry>,
+    key: &PackageKey,
+) -> Option<&'a PackageEntry> {
+    packages.get(key).or_else(|| packages.get(&key.without_peer()))
+}

Then replace the three call sites:

-        let pkg = env_lockfile
-            .packages
-            .get(&key)
-            .or_else(|| env_lockfile.packages.get(&key.without_peer()))
-            .ok_or_else(|| ConfigDepError::EnvLockfileCorrupted {
+        let pkg = get_package(&env_lockfile.packages, &key)
+            .ok_or_else(|| ConfigDepError::EnvLockfileCorrupted {

Also applies to: 423-433

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/env-installer/src/install_config_deps.rs` around lines 361 - 370,
Extract the duplicated package lookup logic into a shared get_package helper on
EnvLockfile or an appropriate free function, preserving the
exact-key-then-without_peer fallback order. Replace the lookups in
normalize_from_lockfile, read_optional_subdeps, and verify_engine.rs with the
helper while keeping their existing error and optional-result handling
unchanged.
🤖 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.

Nitpick comments:
In `@pnpm/crates/env-installer/src/install_config_deps.rs`:
- Around line 361-370: Extract the duplicated package lookup logic into a shared
get_package helper on EnvLockfile or an appropriate free function, preserving
the exact-key-then-without_peer fallback order. Replace the lookups in
normalize_from_lockfile, read_optional_subdeps, and verify_engine.rs with the
helper while keeping their existing error and optional-result handling
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4916a470-fa31-4c52-a37e-df1e894972db

📥 Commits

Reviewing files that changed from the base of the PR and between 9344899 and 387e281.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (6)
  • pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs
  • pnpm/crates/env-installer/src/install_config_deps.rs
  • pnpm/crates/env-installer/src/resolve_package_manager_integrities.rs
  • pnpm11/engine/pm/commands/src/index.ts
  • pnpm11/engine/pm/commands/test/self-updater/installPnpm.test.ts
  • pnpm11/engine/pm/commands/tsconfig.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm11/engine/pm/commands/test/self-updater/installPnpm.test.ts

@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 393b74afa45c

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 2.782 ± 0.163 2.584 3.052 1.83 ± 0.18
pacquet@main 2.749 ± 0.182 2.548 3.131 1.81 ± 0.19
pnpr@HEAD 1.641 ± 0.159 1.447 1.909 1.08 ± 0.13
pnpr@main 1.521 ± 0.119 1.372 1.806 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.78162838028,
      "stddev": 0.16285580780531617,
      "median": 2.78425853738,
      "user": 2.73934944,
      "system": 2.02483282,
      "min": 2.58449795088,
      "max": 3.05226111188,
      "times": [
        2.60959480388,
        2.58449795088,
        2.75039085288,
        2.9336575908799998,
        2.61392252688,
        2.95144350688,
        2.83108353988,
        2.6713056968799997,
        2.81812622188,
        3.05226111188
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.74938823428,
      "stddev": 0.18221170589000685,
      "median": 2.69875334138,
      "user": 2.40353494,
      "system": 1.8509152199999999,
      "min": 2.54793245188,
      "max": 3.13099272988,
      "times": [
        2.8907778398799997,
        2.86818311488,
        2.61065114088,
        2.64181487588,
        2.70159950688,
        2.56474618688,
        2.84127731988,
        2.69590717588,
        2.54793245188,
        3.13099272988
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.64140090038,
      "stddev": 0.1586810737859995,
      "median": 1.58214124638,
      "user": 1.44745964,
      "system": 1.46455402,
      "min": 1.44694278088,
      "max": 1.90945663388,
      "times": [
        1.51450166688,
        1.44694278088,
        1.77896759888,
        1.56136089688,
        1.77470419588,
        1.79080097388,
        1.58659640888,
        1.47299176388,
        1.57768608388,
        1.90945663388
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5208786625800004,
      "stddev": 0.11891050818659463,
      "median": 1.52060204088,
      "user": 1.3644431399999999,
      "system": 1.48968072,
      "min": 1.37222174588,
      "max": 1.8058002368800001,
      "times": [
        1.49319728188,
        1.57796142188,
        1.52781834488,
        1.39285816688,
        1.37222174588,
        1.8058002368800001,
        1.46328338788,
        1.52331863688,
        1.51788544488,
        1.53444195788
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 279.6 ± 33.7 243.8 352.0 1.09 ± 0.16
pacquet@main 260.2 ± 19.2 229.4 290.7 1.01 ± 0.11
pnpr@HEAD 256.8 ± 20.9 231.8 300.2 1.00
pnpr@main 287.5 ± 48.2 239.1 376.2 1.12 ± 0.21
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2796115449,
      "stddev": 0.03374530661145655,
      "median": 0.2679049937,
      "user": 0.28525295999999994,
      "system": 0.71951218,
      "min": 0.2438471307,
      "max": 0.3520304407,
      "times": [
        0.2438471307,
        0.2612735607,
        0.2638690547,
        0.2981350397,
        0.2719409327,
        0.3520304407,
        0.2909226397,
        0.3114242057,
        0.2515385327,
        0.2511339117
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.26020410250000003,
      "stddev": 0.019163307240612295,
      "median": 0.2601653662,
      "user": 0.25792186,
      "system": 0.6676647799999998,
      "min": 0.2294380687,
      "max": 0.2906910627,
      "times": [
        0.2400744817,
        0.2660535147,
        0.2294380687,
        0.2472156297,
        0.2648326677,
        0.2521866417,
        0.2906910627,
        0.2842672067,
        0.2717836867,
        0.2554980647
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.25684081400000003,
      "stddev": 0.020911731135244777,
      "median": 0.25755078070000004,
      "user": 0.22553776,
      "system": 0.65118168,
      "min": 0.2317534947,
      "max": 0.3002250527,
      "times": [
        0.23502062270000001,
        0.2317534947,
        0.2446798977,
        0.2369479287,
        0.2562569907,
        0.2689521897,
        0.2655883897,
        0.2701390027,
        0.3002250527,
        0.2588445707
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.28748610290000004,
      "stddev": 0.048174047495984196,
      "median": 0.2642382137,
      "user": 0.26434156,
      "system": 0.72195938,
      "min": 0.2391074327,
      "max": 0.3761930457,
      "times": [
        0.2589652377,
        0.24899691170000002,
        0.2391074327,
        0.2665364427,
        0.2619399847,
        0.3485037347,
        0.3761930457,
        0.32220755570000004,
        0.30866793870000003,
        0.2437427447
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.037 ± 0.222 2.821 3.595 1.91 ± 0.20
pacquet@main 2.960 ± 0.111 2.804 3.153 1.86 ± 0.15
pnpr@HEAD 1.663 ± 0.141 1.436 1.895 1.05 ± 0.12
pnpr@main 1.591 ± 0.115 1.464 1.853 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.0365270311200003,
      "stddev": 0.22212386897335562,
      "median": 2.97585668412,
      "user": 2.5025365600000002,
      "system": 1.7183451599999997,
      "min": 2.82109572762,
      "max": 3.59468061162,
      "times": [
        3.59468061162,
        3.06080173462,
        3.1348508956199996,
        2.88624119762,
        2.96343846262,
        2.98827490562,
        2.94811975062,
        3.1108355576199997,
        2.85693146762,
        2.82109572762
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.95969749422,
      "stddev": 0.11065290521516644,
      "median": 2.9811504751199998,
      "user": 2.31167166,
      "system": 1.6488452599999999,
      "min": 2.8040099286199998,
      "max": 3.15271555162,
      "times": [
        3.01748253262,
        2.95466638662,
        2.90708300462,
        2.86921196462,
        3.04440741662,
        3.15271555162,
        3.00763456362,
        2.81562886162,
        2.8040099286199998,
        3.02413473162
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6634125365200003,
      "stddev": 0.14093561872439725,
      "median": 1.67020230162,
      "user": 1.3093679599999999,
      "system": 1.35221286,
      "min": 1.4362670696200002,
      "max": 1.8947430466200001,
      "times": [
        1.7615238536200002,
        1.8947430466200001,
        1.4362670696200002,
        1.65959605062,
        1.78872312662,
        1.51423764462,
        1.68080855262,
        1.7444600046200003,
        1.53097849262,
        1.6227875236200002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5908374549200002,
      "stddev": 0.11517966063277374,
      "median": 1.56610735862,
      "user": 1.50565106,
      "system": 1.6019833599999997,
      "min": 1.46449048262,
      "max": 1.85278789762,
      "times": [
        1.4744547516200002,
        1.56436481962,
        1.46449048262,
        1.50615514462,
        1.85278789762,
        1.53602777362,
        1.5678498976200002,
        1.65212805862,
        1.6557815826200002,
        1.6343341406200003
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 807.1 ± 58.7 743.2 907.0 2.78 ± 0.25
pacquet@main 716.6 ± 83.8 594.7 836.6 2.47 ± 0.32
pnpr@HEAD 303.1 ± 39.0 269.7 388.1 1.04 ± 0.15
pnpr@main 290.1 ± 15.5 266.4 317.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.80709640486,
      "stddev": 0.05866371947386723,
      "median": 0.7968375170600001,
      "user": 1.0369232599999998,
      "system": 0.85591648,
      "min": 0.74321973356,
      "max": 0.9070451055600001,
      "times": [
        0.9070451055600001,
        0.8428661725600001,
        0.7501462975600001,
        0.82368486056,
        0.8734180865600001,
        0.84516005756,
        0.7699901735600001,
        0.7563071785600001,
        0.74321973356,
        0.7591263825600001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.71657767856,
      "stddev": 0.08384570811190982,
      "median": 0.71181003056,
      "user": 0.9508881600000001,
      "system": 0.73779538,
      "min": 0.5946695105600001,
      "max": 0.8366179245600001,
      "times": [
        0.7246246965600001,
        0.8366179245600001,
        0.75356027956,
        0.69899536456,
        0.63650199056,
        0.5946695105600001,
        0.62181332256,
        0.82928750356,
        0.6930549365600001,
        0.77665125656
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30310490436000004,
      "stddev": 0.03901666682057101,
      "median": 0.28506974956,
      "user": 0.24806625999999996,
      "system": 0.61960078,
      "min": 0.26967292056000003,
      "max": 0.38805030056,
      "times": [
        0.27885874356,
        0.29611203556000004,
        0.28504137656,
        0.28492743156,
        0.26967292056000003,
        0.27916899756,
        0.28509812256,
        0.35944459856000005,
        0.30467451656,
        0.38805030056
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.29007785926000007,
      "stddev": 0.015501649723434272,
      "median": 0.29252653906000003,
      "user": 0.23790965999999997,
      "system": 0.59305748,
      "min": 0.26638399256,
      "max": 0.31768668956,
      "times": [
        0.27525298756,
        0.26638399256,
        0.29471413556000003,
        0.29055538056,
        0.30277104556,
        0.27405609656,
        0.30106587656,
        0.31768668956,
        0.29449769756,
        0.28379469056
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.049 ± 0.088 1.943 2.206 6.62 ± 0.51
pacquet@main 2.284 ± 0.093 2.197 2.443 7.39 ± 0.56
pnpr@HEAD 0.325 ± 0.035 0.274 0.394 1.05 ± 0.13
pnpr@main 0.309 ± 0.020 0.278 0.349 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.04913107026,
      "stddev": 0.08791519385079197,
      "median": 2.03450408216,
      "user": 1.2645395000000001,
      "system": 0.9072917199999999,
      "min": 1.94344316566,
      "max": 2.20643131666,
      "times": [
        2.17176062466,
        2.20643131666,
        2.09397397466,
        1.94344316566,
        2.0682304176599997,
        1.9941360376600001,
        2.01512037966,
        2.05388778466,
        1.96259972066,
        1.98172728066
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.2844970244599994,
      "stddev": 0.09336882137663387,
      "median": 2.25166878266,
      "user": 1.6226919,
      "system": 1.03829632,
      "min": 2.1966506136599997,
      "max": 2.44319094666,
      "times": [
        2.20335268366,
        2.3927457786599997,
        2.22616590066,
        2.19785514966,
        2.20592223866,
        2.32560350266,
        2.1966506136599997,
        2.37631176566,
        2.27717166466,
        2.44319094666
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3251140054600001,
      "stddev": 0.03463617154326558,
      "median": 0.32509583516000007,
      "user": 0.28657049999999995,
      "system": 0.62137082,
      "min": 0.27446128566000005,
      "max": 0.3941332416600001,
      "times": [
        0.31707087066000006,
        0.34944033766000004,
        0.31392819666000005,
        0.33312079966,
        0.3941332416600001,
        0.33995384766000003,
        0.34318651966,
        0.29404213966000003,
        0.29180281566000005,
        0.27446128566000005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3093320697600001,
      "stddev": 0.019973960881862703,
      "median": 0.30566469866,
      "user": 0.24322110000000002,
      "system": 0.63068992,
      "min": 0.27807877166000006,
      "max": 0.34938014266000006,
      "times": [
        0.29063936666000006,
        0.27807877166000006,
        0.30106578566000003,
        0.31139384766000006,
        0.32941404566000004,
        0.30341252066,
        0.31943752366000006,
        0.34938014266000006,
        0.30791687666000006,
        0.30258181666000006
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 493.9 ± 50.0 412.4 563.2 5.31 ± 0.60
pacquet@main 481.8 ± 44.8 448.5 599.3 5.18 ± 0.55
pnpr@HEAD 94.2 ± 6.6 86.2 112.8 1.01 ± 0.09
pnpr@main 93.0 ± 4.7 85.6 106.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.4938846700000001,
      "stddev": 0.049983508403393516,
      "median": 0.4916752401,
      "user": 0.4871065,
      "system": 0.07913755999999998,
      "min": 0.41237250810000003,
      "max": 0.5631941261,
      "times": [
        0.5598212881,
        0.5264390171,
        0.5631941261,
        0.5186057071,
        0.41237250810000003,
        0.4926160961,
        0.4830711341,
        0.4336775251,
        0.4583149141,
        0.49073438410000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.48179477530000003,
      "stddev": 0.04484780637355877,
      "median": 0.4696059536,
      "user": 0.4702203000000001,
      "system": 0.08691695999999999,
      "min": 0.44851553510000003,
      "max": 0.5993183571,
      "times": [
        0.44851553510000003,
        0.5993183571,
        0.48817584010000004,
        0.5022133431,
        0.47650939810000004,
        0.4498879061,
        0.4491178081,
        0.4656090781,
        0.4736028291,
        0.4649976581
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09424423822903226,
      "stddev": 0.006587014715784609,
      "median": 0.0910200961,
      "user": 0.023070541935483874,
      "system": 0.012472993548387098,
      "min": 0.0862090231,
      "max": 0.1127642001,
      "times": [
        0.0901579541,
        0.0993224581,
        0.0891238791,
        0.10087743410000001,
        0.0954089141,
        0.08976866110000001,
        0.0875892601,
        0.0894074721,
        0.0910434301,
        0.08981508910000001,
        0.0899642101,
        0.0908603551,
        0.0906960861,
        0.09099437810000001,
        0.1063051061,
        0.1090404831,
        0.09545212510000001,
        0.1127642001,
        0.0953965011,
        0.09913012610000001,
        0.1003653301,
        0.0968008531,
        0.0878085031,
        0.08697808010000001,
        0.09470188510000001,
        0.0982664511,
        0.0972204331,
        0.0862090231,
        0.0890911571,
        0.08999145010000001,
        0.0910200961
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.09296626294375,
      "stddev": 0.004721817266463152,
      "median": 0.0928669311,
      "user": 0.0190249875,
      "system": 0.015293153750000002,
      "min": 0.08558485910000001,
      "max": 0.1067591011,
      "times": [
        0.08738274310000001,
        0.0896613891,
        0.0935247491,
        0.0966710591,
        0.0966290501,
        0.09555489910000001,
        0.0944601691,
        0.0953911811,
        0.0930874961,
        0.0944386181,
        0.0900511231,
        0.0942302071,
        0.0866498131,
        0.0885152741,
        0.1037100841,
        0.0999741751,
        0.0901925381,
        0.0931498041,
        0.0913666181,
        0.09699663210000001,
        0.0936335041,
        0.08922128210000001,
        0.0899574461,
        0.0890281081,
        0.08558485910000001,
        0.0885150821,
        0.0926463661,
        0.0906563821,
        0.0971737351,
        0.1067591011,
        0.0898826761,
        0.0902242491
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.724 ± 0.143 4.585 5.013 1.33 ± 0.06
pacquet@main 4.616 ± 0.064 4.519 4.721 1.30 ± 0.04
pnpr@HEAD 3.546 ± 0.102 3.468 3.800 1.00
pnpr@main 3.576 ± 0.065 3.502 3.708 1.01 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.72411322222,
      "stddev": 0.14324109316560688,
      "median": 4.68836028632,
      "user": 2.63725806,
      "system": 1.87560076,
      "min": 4.58505518532,
      "max": 5.01345209332,
      "times": [
        4.63233966632,
        4.68564184032,
        4.68622481832,
        5.01345209332,
        4.58505518532,
        4.70595849932,
        4.95120567932,
        4.69049575432,
        4.59617947832,
        4.6945792073199994
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.616249529219999,
      "stddev": 0.0639767400857248,
      "median": 4.62622813682,
      "user": 2.48357866,
      "system": 1.8058032599999998,
      "min": 4.51903541232,
      "max": 4.72138370332,
      "times": [
        4.61643504032,
        4.63607433332,
        4.5925143113199995,
        4.63602123332,
        4.72138370332,
        4.68306756632,
        4.65022321732,
        4.58202053532,
        4.52571993932,
        4.51903541232
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5459114532199996,
      "stddev": 0.10181101563924341,
      "median": 3.51732499482,
      "user": 1.5010603599999999,
      "system": 1.42364466,
      "min": 3.46760710032,
      "max": 3.79955878532,
      "times": [
        3.54114889632,
        3.55064163832,
        3.53148843032,
        3.47999191232,
        3.46760710032,
        3.47145629232,
        3.48421521932,
        3.50316155932,
        3.79955878532,
        3.62984469832
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5759075693200004,
      "stddev": 0.06511938223773754,
      "median": 3.55935153232,
      "user": 1.4774576600000002,
      "system": 1.46228746,
      "min": 3.50249259032,
      "max": 3.70806099132,
      "times": [
        3.51945378532,
        3.64107968832,
        3.5322684873199997,
        3.57486055932,
        3.54470386532,
        3.53138000532,
        3.50249259032,
        3.63077652132,
        3.5739991993199998,
        3.70806099132
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12960
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
3,036.53 ms
(-19.20%)Baseline: 3,757.86 ms
4,509.44 ms
(67.34%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
2,049.13 ms
(-22.84%)Baseline: 2,655.54 ms
3,186.64 ms
(64.30%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
807.10 ms
(-28.79%)Baseline: 1,133.35 ms
1,360.03 ms
(59.34%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
493.88 ms
(-10.66%)Baseline: 552.82 ms
663.39 ms
(74.45%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,781.63 ms
(-18.49%)Baseline: 3,412.71 ms
4,095.26 ms
(67.92%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,724.11 ms
(-23.00%)Baseline: 6,135.34 ms
7,362.41 ms
(64.17%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
279.61 ms
(-45.56%)Baseline: 513.59 ms
616.31 ms
(45.37%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12960
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

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

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,663.41 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
325.11 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
303.10 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
94.24 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,641.40 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,545.91 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
256.84 ms
🐰 View full continuous benchmarking report in Bencher

vinayakkulkarni added a commit to vinayakkulkarni/vinayakkulkarni.dev that referenced this pull request Jul 14, 2026
pnpm/action-setup resolves the version from the packageManager field.
11.12.0 and 11.13.0 crash during the action's self-update step with
"Cannot use 'in' operator to search for 'integrity' in undefined"
(pnpm/pnpm#12959) — buildLockfileFromEnvLockfile drops the resolution
block for peer-suffixed snapshots. 11.13.0 still ships the unfixed
code path (verified against the published dist). Unpin once the fix
in pnpm/pnpm#12960 or #12961 lands in a release.

Signed-off-by: Vinayak Kulkarni <[email protected]>
Copilot AI review requested due to automatic review settings July 15, 2026 16:22
@ImBIOS

ImBIOS commented Jul 15, 2026

Copy link
Copy Markdown
Author

Conflict has been successfully resolved and changes pushed. cc @tats-u

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.

@ImBIOS

ImBIOS commented Jul 16, 2026

Copy link
Copy Markdown
Author

I added a workaround in the description until PR is merged

@zkochan

zkochan commented Jul 16, 2026

Copy link
Copy Markdown
Member

Sorry for missing this PR for so long. These were a hard few days.

zkochan added 2 commits July 16, 2026 10:53
pacquet does not have the `pnpm self-update` crash these fallbacks were
added to mirror. Its env lockfile merge, `lockfile_to_dep_graph`, already
derives the `packages:` key from a snapshot key via `without_peer`.

Three of the four fallbacks were unreachable. `verify_engine` and
`resolve_package_manager_integrities` build their key from an already
peerless version — `plain_version` strips the suffix, and the other is
gated on `dep.version == pnpm_version` — so `without_peer` was an
identity no-op and a wasted second lookup.

The fourth, in `read_optional_subdeps`, was reachable but incomplete: it
located the package yet left the peer suffix on `version`, which then
flowed into `npm_tarball_url`. That turns a clear ENV_LOCKFILE_CORRUPTED
error into a 404 for a tarball named after the suffixed version. Worth
fixing on its own terms, not as a side effect of a TypeScript bug fix.
…atchHash

`buildLockfileFromEnvLockfile` looked the resolution up as
`envLockfile.packages[depPath]`, using the full `snapshots` key. The
`packages:` map is keyed by pkgIdWithPatchHash — the depPath minus its
peers suffix — so a peer-suffixed entry such as `[email protected]([email protected])`
found nothing, and the built lockfile carried no `resolution`. The
headless installer then crashed on `resolution.integrity`.

Deriving the key with `getPkgIdWithPatchHash` names that invariant and is
an identity on a peerless key, so one lookup covers both shapes without a
fallback. It also keeps the patch hash, which `removeSuffix` would strip;
the second test pins that distinction down, since `packages:` keys retain
`(patch_hash=...)` and drop only the peers suffix.

Restore the lockfile to a minimal diff: the rebase left it re-resolved
against a stale metadata cache, which downgraded unrelated catalog
entries. Only the new `@pnpm/deps.path` workspace link is needed.

Refs pnpm#12959
Refs pnpm/action-setup#276
Copilot AI review requested due to automatic review settings July 16, 2026 08:59
@zkochan
zkochan force-pushed the fix-self-update-peer-deps branch from 306f431 to 393b74a Compare July 16, 2026 08:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 18 rules

Grey Divider


Remediation recommended

1. Prototype-mutable packages map 🐞 Bug ⛨ Security
Description
buildLockfileFromEnvLockfile populates a plain object map with keys from envLockfile.snapshots; a
corrupted lockfile containing an own enumerable "__proto__" key can mutate the returned
lockfile.packages prototype and lead to unexpected inherited entries during later iteration. The
repo has at least one consumer iterating lockfile.packages via for..in without an own-property
guard, which would then process inherited enumerable keys.
Code

pnpm11/engine/pm/commands/src/self-updater/installPnpm.ts[R495-500]

  const packages: Record<string, PackageSnapshot> = {}
  for (const [depPath, snapshot] of Object.entries(envLockfile.snapshots)) {
    packages[depPath as DepPath] = {
      ...snapshot,
-      ...envLockfile.packages[depPath],
+      ...envLockfile.packages[getPkgIdWithPatchHash(depPath as DepPath)],
    }
Evidence
The helper constructs packages as a normal object and assigns snapshot keys directly; the repo
already documents __proto__-key prototype mutation as a concern and uses null-prototype objects
elsewhere, and there is at least one for..in iteration over lockfile.packages without an
own-property guard that would observe inherited enumerable keys if the prototype were polluted.

pnpm11/engine/pm/commands/src/self-updater/installPnpm.ts[487-512]
pnpm11/installing/env-installer/src/migrateConfigDeps.ts[29-33]
pnpm11/releasing/commands/src/deploy/createDeployFiles.ts[73-91]

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

### Issue description
`buildLockfileFromEnvLockfile()` builds `dependencies`/`packages` as normal `{}` objects and assigns keys from `envLockfile.snapshots` using bracket notation. If `envLockfile.snapshots` is tampered and contains an own enumerable key like `__proto__`, the assignment `packages['__proto__'] = …` can mutate the object prototype (prototype pollution primitive).

Because some code iterates `lockfile.packages` with `for...in` without an own-property check, inherited enumerable keys from the polluted prototype may be processed as if they were real dep paths.

### Issue Context
This helper is now exported and can be reused by other code paths; it should return a lockfile object that is robust against prototype-mutation hazards when given corrupted input.

### Fix Focus Areas
- pnpm11/engine/pm/commands/src/self-updater/installPnpm.ts[487-512]

### Suggested fix
- Initialize `dependencies` and `packages` with `Object.create(null)` instead of `{}`.
- (Optional defense-in-depth) Reject/skip dangerous keys (`'__proto__'`, `'prototype'`, `'constructor'`) before assignment.

Example:
```ts
const dependencies = Object.create(null) as Record<string, string>
const packages = Object.create(null) as Record<string, PackageSnapshot>

for (const [depPath, snapshot] of Object.entries(envLockfile.snapshots)) {
 if (depPath === '__proto__' || depPath === 'constructor' || depPath === 'prototype') continue
 packages[depPath as DepPath] = {
   ...snapshot,
   ...envLockfile.packages[getPkgIdWithPatchHash(depPath as DepPath)],
 }
}
```

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


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

Auto-approved notes - no code suggestions found
- 'approve_pr_on_self_review' flag enabled

@zkochan

zkochan commented Jul 24, 2026

Copy link
Copy Markdown
Member

Closing this in favor of #13082, which merged and closed #12959.

#13082 guards the version-switch path with assertReleaseIsInstallable, so pnpm now refuses the broken releases (11.12.0, 11.13.0) that produced peer-suffixed env lockfiles, with a clear reason instead of crashing. That resolves the reported Cannot use 'in' operator to search for 'integrity' in undefined crash.

The remaining part of this PR was a defense-in-depth fix to buildLockfileFromEnvLockfile for peer-suffixed snapshot keys. Since the reported issue is resolved and this branch is now stale/conflicting, we're closing it. If we want that hardening later, it can go in fresh as a small standalone change.

Thanks for the investigation and the workaround write-up, @ImBIOS.


Written by an agent (Claude Code, claude-opus-4-8).

@zkochan zkochan closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

self-update crashes with Cannot use 'in' operator to search for 'integrity' in undefined due to peer dependencies

5 participants