Repository navigation
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe 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. ChangesSelf-update lockfile handling
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
Assessment against linked issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Confidence Score: 5/5The 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]]), |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
pnpm11/engine/pm/commands/src/self-updater/installPnpm.ts
There was a problem hiding this comment.
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[...]whendepPathcontains a peer suffix. - Prevent missing
resolutionblocks for peer-variant snapshot entries during self-update lockfile construction.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| packages[depPath as DepPath] = { | ||
| ...snapshot, | ||
| ...envLockfile.packages[depPath], | ||
| ...(envLockfile.packages[depPath] ?? envLockfile.packages[depPath.split('(')[0]]), |
| 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]]), | ||
| } |
There was a problem hiding this comment.
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
buildLockfileFromEnvLockfileis now exported, but its signature has no explicit return type and the module-boundary lint is suppressed. SinceLockfileObjectis 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
) {
| /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
| import { describe, expect, test } from '@jest/globals' | ||
|
|
||
| import { buildLockfileFromEnvLockfile } from '../../src/self-updater/installPnpm.js' | ||
|
|
| version: 2.31.0 | ||
| '@commitlint/cli': | ||
| specifier: ^21.0.2 | ||
| version: 21.2.0 | ||
| version: 21.2.1 | ||
| '@commitlint/config-conventional': |
| dependencies: {}, | ||
| }, | ||
| }, | ||
| } |
| 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({ |
There was a problem hiding this comment.
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-typeshere 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
) {
| for (const [depPath, snapshot] of Object.entries(envLockfile.snapshots)) { | ||
| packages[depPath as DepPath] = { | ||
| ...snapshot, | ||
| ...envLockfile.packages[depPath], | ||
| ...(envLockfile.packages[depPath] ?? envLockfile.packages[removePeersSuffix(depPath)]), | ||
| } |
| 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' |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pnpm/crates/env-installer/src/install_config_deps.rs (1)
361-370: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider 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 innormalize_from_lockfile(Line 361),read_optional_subdeps(Line 423), andverify_engine.rs(Line 206). A small helper onEnvLockfileor 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml,!pnpm-lock.yaml
📒 Files selected for processing (6)
pnpm/crates/cli/src/cli_args/self_update/verify_engine.rspnpm/crates/env-installer/src/install_config_deps.rspnpm/crates/env-installer/src/resolve_package_manager_integrities.rspnpm11/engine/pm/commands/src/index.tspnpm11/engine/pm/commands/test/self-updater/installPnpm.test.tspnpm11/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
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
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
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
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
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
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
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
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
]
}
]
} |
|
| Branch | pr/12960 |
| Testbed | pnpr |
⚠️ 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-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,663.41 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 325.11 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 303.10 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 94.24 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,641.40 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,545.91 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 256.84 ms |
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]>
|
Conflict has been successfully resolved and changes pushed. cc @tats-u |
|
I added a workaround in the description until PR is merged |
|
Sorry for missing this PR for so long. These were a hard few days. |
…encies in env lockfile
refactor: use removeSuffix instead of split for dependency path parsing
…r peer dependencies
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
306f431 to
393b74a
Compare
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1. Prototype-mutable packages map
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
|
Closing this in favor of #13082, which merged and closed #12959. #13082 guards the version-switch path with The remaining part of this PR was a defense-in-depth fix to Thanks for the investigation and the workaround write-up, @ImBIOS. Written by an agent (Claude Code, claude-opus-4-8). |
This PR fixes a bug in
pnpm self-updatethat causes it to crash withCannot use 'in' operator to search for 'integrity' in undefinedwhen there are peer dependencies recorded in the global environment lockfile (~/.local/share/pnpm/pnpm-lock.yaml).The Issue
When
pnpm self-updateconstructs the in-memory temporary lockfile viabuildLockfileFromEnvLockfile, it loops throughenvLockfile.snapshots. For peer dependencies (e.g.[email protected]([email protected])), it attempts to extract the base package resolution details fromenvLockfile.packages[depPath]. However, this entry maps toundefinedbecause the base package is keyed without the peer suffix (i.e.[email protected]).As a result, the constructed lockfile lacks a
resolutionblock for peer packages. The headless installer later tries to checkresolution.integrityand 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:
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-updateto run successfully.rm ~/.local/share/pnpm/pnpm-lock.yaml~/Library/Application Support/pnpm/pnpm-lock.yamldepending on your environment).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.0in yourpackage.jsonunderdevEngines: