Skip to content

fix(env-installer): stop pinning the exe package from pnpm v12 - #13599

Merged
zkochan merged 4 commits into
mainfrom
env-lockfile-opt
Aug 3, 2026
Merged

zkochan merged 4 commits into
mainfrom
env-lockfile-opt

Conversation

@zkochan

@zkochan zkochan commented Aug 3, 2026 •

Copy link
Copy Markdown
Member

Summary

From pnpm v12 the unscoped pnpm package is itself the native executable — the CLI no longer ships a separate @pnpm/exe wrapper. The env lockfile, however, always pinned both pnpm and @pnpm/exe under packageManagerDependencies, so a v12 pin would try to resolve a package that is not published for that version.

Both stacks now pick the package set from the wanted version: pnpm alone from v12 (and before 6.17.1, where @pnpm/exe did not exist yet), both packages in between.

One consequence needed fixing along with it: the native-binary leg of the engine identity check looked up the host's platform package under @pnpm/exe by name. With @pnpm/exe absent from a v12 lockfile that leg silently verified nothing, leaving the bytes that actually execute unchecked. It now follows whichever package carries the platform binary as an optional dependency — @pnpm/exe for the majors that publish it, the unscoped pnpm from v12.

On the TypeScript side resolvePackageManagerIntegrities is also called with a range or dist-tag (pnpm with latest), where the package set is not known up front. It now resolves pnpm first and only runs the second resolution for versions that do ship @pnpm/exe. The Rust entry point already receives an exact version, so it needs no such step.

Noticed while working here, left alone as out of scope: when the platform binary is missing from the lockfile, pacquet fails closed but the TypeScript CLI skips it silently.

Squash Commit Body

From v12 the unscoped `pnpm` package is itself the native executable, so
`@pnpm/exe` is no longer published alongside it. The env lockfile now pins
only `pnpm` for those versions, in both stacks, instead of resolving a
package that does not exist.

The native-binary leg of the engine identity check followed `@pnpm/exe`
by name, so it silently verified nothing once that package is absent. It
now follows whichever package carries the host's platform binary as an
optional dependency: `@pnpm/exe` for the majors that publish it, the
unscoped `pnpm` from v12.

On the TypeScript side the wanted version can arrive as a range or a
dist-tag (`pnpm with latest`), so `pnpm` is resolved first and the second
resolution only happens for the versions that do ship `@pnpm/exe`.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

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


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

Summary by CodeRabbit

  • Bug Fixes
    • Improved self-update verification for pnpm 12 and later by correctly identifying and validating the platform-specific native executable.
    • Updated environment installation and lockfile handling to support pnpm’s version-dependent executable packaging.
    • Preserved compatibility with older pnpm releases, including versions that use a separate executable package.
    • Added safeguards for missing, incomplete, or outdated lockfile metadata during installation and updates.

From v12 the unscoped `pnpm` package is itself the native executable, so
`@pnpm/exe` is no longer published alongside it. The env lockfile now pins
only `pnpm` for those versions, in both stacks, instead of resolving a
package that does not exist.

The native-binary leg of the engine identity check followed `@pnpm/exe`
by name, so it silently verified nothing once that package is absent. It
now follows whichever package carries the host's platform binary as an
optional dependency: `@pnpm/exe` for the majors that publish it, the
unscoped `pnpm` from v12.

On the TypeScript side the wanted version can arrive as a range or a
dist-tag (`pnpm with latest`), so `pnpm` is resolved first and the second
resolution only happens for the versions that do ship `@pnpm/exe`.
Copilot AI review requested due to automatic review settings August 3, 2026 00:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d204921f-4ac8-4304-872f-6a51e8e23868

📥 Commits

Reviewing files that changed from the base of the PR and between def170b and bfb396d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (8)
  • pnpm/crates/cli/src/cli_args/pre_command/tests.rs
  • pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs
  • pnpm/crates/env-installer/src/resolve_package_manager_integrities.rs
  • pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts
  • pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts
  • pnpm11/installing/env-installer/package.json
  • pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts
  • pnpm11/installing/env-installer/tsconfig.json
💤 Files with no reviewable changes (1)
  • pnpm/crates/cli/src/cli_args/pre_command/tests.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts
  • pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs
  • pnpm/crates/env-installer/src/resolve_package_manager_integrities.rs
  • pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts

📝 Walkthrough

Walkthrough

The changes make package-manager lockfile resolution and engine identity verification version-aware. pnpm versions 12 and later use native platform binaries supplied through pnpm, without a separate @pnpm/exe package dependency.

Changes

Native engine resolution

Layer / File(s) Summary
Version-aware package dependency selection
.changeset/..., pnpm/crates/env-installer/..., pnpm11/installing/env-installer/..., pnpm/crates/cli/src/cli_args/pre_command/tests.rs
Dependency selection now uses the resolved pnpm version. Versions 6.17.1 through 11 include pnpm and @pnpm/exe; earlier versions and versions 12 or later include only pnpm. Tests cover exact lockfile validation and pnpm 12 resolution.
Rust native engine verification
pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs, pnpm/crates/cli/src/cli_args/self_update/verify_engine/tests.rs
The Rust verifier selects @pnpm/exe when available or pnpm for version 12 and later. Tests cover supported and unsupported dependency maps.
TypeScript native engine verification
pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts, pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts
The TypeScript verifier uses the detected native wrapper and validates the pnpm 12 platform binary. Tests cover missing binaries, host-platform mismatches, and version-specific registry metadata.

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

Sequence Diagram(s)

sequenceDiagram
  participant Installer
  participant PackageResolver
  participant EnvLockfile
  participant EngineVerifier
  Installer->>PackageResolver: resolve pnpm version
  PackageResolver-->>Installer: return version-specific dependencies
  Installer->>EnvLockfile: record selected packages
  EnvLockfile-->>EngineVerifier: provide platform package metadata
  EngineVerifier->>EngineVerifier: select native wrapper
  EngineVerifier-->>Installer: verify native binary identity
Loading

Possibly related PRs

  • pnpm/pnpm#13057: Updates pnpm 12 versioning and lockfile configuration.
  • pnpm/pnpm#13076: Modifies pnpm self-update engine verification and installation validation.
  • pnpm/pnpm#13382: Modifies environment lockfile and package-manager dependency handling.

Suggested labels: product: pacquet, product: pnpm@11

Suggested reviewers: copilot

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch env-lockfile-opt

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix env lockfile pnpm v12 pins and verify native binary integrity

🐞 Bug fix 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Stop pinning @pnpm/exe in env lockfiles for pnpm v12+, where pnpm is the native executable.
• Update engine identity verification to validate the host platform binary via the correct wrapper
 package.
• Add/adjust Rust and TypeScript tests to cover v12 and pre-@pnpm/exe behavior.
Diagram

graph TD
  A["Wanted pnpm spec/version"] --> B["TS env-installer"] --> C[("Env lockfile")]
  A --> D["Rust env-installer"] --> C
  C --> E["TS engine verify"] --> F["Native wrapper selector"] --> G["Platform pkg integrity check"]
  C --> H["Rust engine verify"] --> F
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Always pin `@pnpm/exe` and tolerate missing versions
  • ➕ Simpler dependency set (always the same keys in packageManagerDependencies)
  • ➕ Avoids version parsing/branching logic
  • ➖ Fails for pnpm v12+ because the package is not published
  • ➖ Encourages “best-effort” behavior in a security-sensitive verification path
2. Derive wrapper choice from lockfile snapshots only (no semver checks)
  • ➕ Avoids hardcoded cutoffs like v12 and 6.17.1
  • ➕ Follows the actual resolved graph rather than assumptions
  • ➖ More complex graph inspection (must infer which package is the wrapper)
  • ➖ Harder to keep behavior consistent across TS/Rust implementations

Recommendation: Keep the PR’s approach: explicitly model the known historical packaging transitions (pre-6.17.1: pnpm-only, 6.17.1–11.x: pnpm+@pnpm/exe, 12+: pnpm-only) and ensure engine verification follows whichever package owns the platform-binary optional deps. This is the most predictable behavior, prevents invalid resolutions for v12+, and closes the verification gap caused by hardcoding @pnpm/exe.

Files changed (9) +312 / -75

Enhancement (1) +69 / -23
resolvePackageManagerIntegrities.tsResolve and pin only the pnpm package set appropriate for the resolved version +69/-23

Resolve and pin only the pnpm package set appropriate for the resolved version

• Adds 'packageManagerDeps' to determine whether to pin '@pnpm/exe' based on semver (pre-6.17.1, 6.17.1–11.x, v12+). Refactors resolution to first resolve 'pnpm' alone (to handle ranges/dist-tags) and conditionally perform a second resolution including '@pnpm/exe' only when applicable.

pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts

Bug fix (3) +64 / -28
verify_engine.rsVerify native platform binary via the correct wrapper package +27/-13

Verify native platform binary via the correct wrapper package

• Reworks engine component collection so the host platform binary is discovered via a wrapper selector rather than assuming '@pnpm/exe'. Adds 'native_engine_wrapper' to choose '@pnpm/exe' when present or 'pnpm' for v12+; fails closed when required data is missing.

pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs

resolve_package_manager_integrities.rsConditionally pin '@pnpm/exe' based on pnpm version +16/-10

Conditionally pin '@pnpm/exe' based on pnpm version

• Renames constants and updates 'package_manager_deps' to return pnpm-only for v12+ and pre-6.17.1 versions, while keeping pnpm+'@pnpm/exe' for the middle range. Removes the standalone 'pnpm_exe_package_exists' helper in favor of explicit semver branching.

pnpm/crates/env-installer/src/resolve_package_manager_integrities.rs

verifyPnpmEngineIdentity.tsFollow wrapper package to verify the host platform binary (v12 aware) +21/-5

Follow wrapper package to verify the host platform binary (v12 aware)

• Introduces 'nativeEngineWrapper' to select the package whose optional deps contain the platform binary ('@pnpm/exe' or 'pnpm' for v12+). Updates collection of engine packages to verify to use this wrapper instead of hardcoding '@pnpm/exe'.

pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts

Tests (4) +171 / -24
tests.rsAdd unit test coverage for native wrapper selection +30/-3

Add unit test coverage for native wrapper selection

• Adds helpers to build 'packageManagerDependencies' maps and tests that wrapper selection prefers '@pnpm/exe', falls back to 'pnpm' for v12+, and returns none for older JS-only versions.

pnpm/crates/cli/src/cli_args/self_update/verify_engine/tests.rs

tests.rsUpdate fixtures and add v12 pnpm-only env-lockfile test +67/-17

Update fixtures and add v12 pnpm-only env-lockfile test

• Adjusts existing resolver test to use realistic v11 versions and validates pinning of both 'pnpm' and '@pnpm/exe' for that range. Adds a new test ensuring v12 env lockfiles pin only 'pnpm' while still recording the platform package as an optional dependency.

pnpm/crates/env-installer/src/tests.rs

verifyPnpmEngineIdentity.test.tsAdd v12 test ensuring unscoped pnpm platform binary is verified +35/-4

Add v12 test ensuring unscoped pnpm platform binary is verified

• Adds a v12 env lockfile fixture where only 'pnpm' is pinned and the platform binary comes from the v12 naming scheme. Extends packument mocking to support arbitrary versions and asserts verification fails when the platform package signature doesn’t match.

pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts

resolvePackageManagerIntegrities.test.tsAdd tests for packageManagerDependencies pinning rules across versions +39/-0

Add tests for packageManagerDependencies pinning rules across versions

• Introduces unit tests for 'isPackageManagerResolved' covering the pnpm+'@pnpm/exe' range, v12 pnpm-only behavior, and pre-'@pnpm/exe' pnpm-only behavior. Verifies mismatched pins and missing lockfiles are treated as unresolved.

pnpm11/installing/env-installer/test/resolvePackageManagerIntegrities.test.ts

Documentation (1) +8 / -0
env-lockfile-skips-pnpm-exe-from-v12.mdAdd changeset documenting v12 env-lockfile pinning behavior +8/-0

Add changeset documenting v12 env-lockfile pinning behavior

• Introduces a patch changeset for affected packages. Documents that env lockfiles should not pin '@pnpm/exe' for pnpm v12+ and that native binary verification follows the correct wrapper package.

.changeset/env-lockfile-skips-pnpm-exe-from-v12.md

@greptile-apps

greptile-apps Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported named-registry version misclassification is corrected by extracting the concrete semver before deciding whether @pnpm/exe is required.

Reviews (2): Last reviewed commit: "chore(env-installer): sync tsconfig refe..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.03     11.0±0.09ms    34.2 MB/sec    1.00     10.7±0.24ms    35.1 MB/sec
packument/parse                                  1.04     37.6±0.28µs  1766.5 MB/sec    1.00     36.2±0.79µs  1833.1 MB/sec
tarball/download_dependency                      1.00      2.8±0.08ms  1574.0 KB/sec    1.01      2.8±0.12ms  1558.9 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    163.2±2.52ms 98.0 KElem/sec    1.01    164.8±1.69ms 97.1 KElem/sec
workspace_resolution/hoist_heavy                 1.00    224.5±1.18ms        ? ?/sec    1.01    225.7±0.89ms        ? ?/sec

@qodo-code-review

qodo-code-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Action required

1. Native binary check fail-open ✓ Resolved 🐞 Bug ⛨ Security
Description
In verifyPnpmEngineIdentity(), when a native wrapper is detected but its snapshot has no
optionalDependencies (or none of the expected host platform package names are present), the code
silently verifies only pnpm/@pnpm/exe and skips verifying the native platform package. This can
let the executable bytes go unchecked in malformed/tampered env-lockfile scenarios, weakening the
self-update tamper protections (Rust fails closed here).
Code

pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts[R109-112]

+  const wrapper = nativeEngineWrapper(pmDeps)
+  if (wrapper != null) {
+    const optionalDeps = envLockfile.snapshots[`${wrapper.name}@${wrapper.version}`]?.optionalDependencies ?? {}
    const libcFamily = familySync()
Relevance

●●● Strong

Team favors fail-closed self-update/lockfile security hardening (accepted in PRs #13076, #12872).

PR-#13076
PR-#12872

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The TS implementation currently treats missing platform-binary metadata as an empty set and returns
without error, while the Rust implementation explicitly errors when the wrapper snapshot/optional
deps are missing or when no host candidate is found, which is the intended security posture for
executable-bytes verification.

pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts[97-125]
pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs[142-187]

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

### Issue description
`collectEnginePackagesToVerify()` currently defaults missing wrapper snapshot/optionalDependencies to `{}` and simply returns without adding any platform package to `toVerify` if no candidate is found. For native wrappers this should fail closed (throw `PNPM_ENGINE_IDENTITY_UNVERIFIABLE`) when the lockfile cannot prove which platform binary will run.

### Issue Context
The Rust port already treats missing optional deps / missing host candidate as unverifiable and errors, preventing a “verified” result without checking native bytes.

### Fix Focus Areas
- pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts[107-125]
- pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs[142-187]

### What to change
- When `wrapper != null`:
 - If the wrapper snapshot is missing OR `optionalDependencies` is missing/empty, throw `PNPM_ENGINE_IDENTITY_UNVERIFIABLE`.
 - If none of the `candidateNames` are present in `optionalDependencies`, throw `PNPM_ENGINE_IDENTITY_UNVERIFIABLE`.
- Add/adjust tests to cover the fail-closed behavior (e.g. v12 wrapper present but snapshots missing / no candidate present).

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



Remediation recommended

2. pnpm/exe versions can diverge 🐞 Bug ☼ Reliability ⭐ New
Description
When a non-exact spec resolves to a pnpm version that needs @pnpm/exe, the second resolution
reuses the original range/dist-tag (spec) for @pnpm/exe instead of pinning it to the
already-resolved pnpm version. If the range/dist-tag resolves differently between the two package
names, the env lockfile can end up inconsistent and SEA flows (which install @pnpm/exe) can fail
because they expect @pnpm/exe@<pnpmVersion> to be present/verifiable.
Code

pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[R140-143]

+  if (resolvedVersion == null || !packageManagerDeps(resolvedVersion).includes('@pnpm/exe')) {
+    return lockfile
+  }
+  return resolveManifestDependencies({ dependencies: wantedDependencies(resolvedVersion, spec) }, resolveOpts)
Relevance

●●● Strong

Env-lockfile correctness/hardening changes are commonly accepted; similar env-installer lockfile
fixes merged in #12470.

PR-#12470

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The second pass explicitly reuses the original spec when resolving @pnpm/exe, but downstream SEA
installs choose @pnpm/exe as the package name and build an install lockfile for
@pnpm/exe@<pnpmVersion>, which requires the env lockfile to contain that exact version.

pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[123-144]
pnpm11/cli/meta/src/index.ts[37-39]
pnpm11/engine/pm/commands/src/self-updater/installPnpm.ts[60-70]
pnpm11/engine/pm/commands/src/self-updater/installPnpm.ts[117-130]
pnpm11/engine/pm/commands/src/self-updater/installPnpm.ts[559-584]

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

### Issue description
For non-exact specs, after determining `resolvedVersion` (from the first pnpm-only resolve), the second resolve currently uses the original `spec` for both `pnpm` and `@pnpm/exe`. This allows `@pnpm/exe` (and even `pnpm`) to resolve to a different version than `resolvedVersion`.

### Issue Context
SEA installs use `@pnpm/exe` as the package name (via `getCurrentPackageName()`), and the install path builds a lockfile that installs `pkgName@pnpmVersion`. If the env lockfile resolved `@pnpm/exe` to a different version, the install/verification path can break.

### Fix Focus Areas
- pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[136-144]

### Suggested change
In the second pass, resolve the full wanted package set using an *exact* spec derived from the first pass result, not the original range/tag:
- Compute an exact resolved spec from the first-pass importer ref (it is already exact and may be registry-qualified):
 - `const exactResolvedSpec = ref ?? resolvedVersion`
- Call `resolveManifestDependencies()` with `wantedDependencies(resolvedVersion, exactResolvedSpec)`.
- Optionally add a post-check that the second pass resolved `pnpm` (and `@pnpm/exe` when present) to `resolvedVersion`, and throw a clear error if they diverge.
This guarantees the env lockfile is self-consistent and matches the version that downstream install flows request.

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


3. Registry exact resolves twice 🐞 Bug ➹ Performance ⭐ New
Description
resolveWantedPnpmPackages() only treats plain semver as "exact", so an exact named-registry spec
like "work:11.0.0" takes the non-exact two-pass path and can run the resolver twice (extra graph
work and potential network). This is unnecessary because the version is already known from the
registry-qualified spec format.
Code

pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[R133-135]

+  if (semver.valid(spec) != null) {
+    return resolveManifestDependencies({ dependencies: wantedDependencies(spec, spec) }, resolveOpts)
+  }
Relevance

●● Moderate

No direct precedent; named-registry changes show interest, but this is a minor perf edge-case.

PR-#13528

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The code currently only short-circuits on semver.valid(spec), so work:11.0.0 falls into the
non-exact branch even though the repo defines that form as an exact version slot for named
registries.

pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[117-144]
pnpm11/deps/path/src/index.ts[49-63]

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

### Issue description
`resolveWantedPnpmPackages()` detects "exact" specs with `semver.valid(spec)`, which does not recognize registry-qualified exact versions (e.g. `work:11.0.0`). Those specs unnecessarily take the two-pass resolution path.

### Issue Context
`parseRegistryQualifiedVersion()` already defines/recognizes `<registryName>:<version>` as an exact-version form for named registries.

### Fix Focus Areas
- pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[133-143]

### Suggested change
Before the `semver.valid(spec)` check falls through, detect `parseRegistryQualifiedVersion(spec)`.
- If present, treat it as exact:
 - Use `qualified.version` for `packageManagerDeps()` decisions.
 - Use the original `spec` (including the registry name) as the dependency spec when calling `resolveManifestDependencies()` so it stays pinned to that named registry.
This should collapse registry-qualified exact specs to a single resolve call.

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


4. Historical phrasing in comments ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
New/modified doc comments use historical phrasing like before ... was not published yet and `from
v12`, which documents history rather than stating the current behavioral contract. Rephrase these
comments in terms of the current version-conditional behavior (e.g., `for pnpm versions <6.17.1 ...;
for >=12 ...`).
Code

pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[R52-54]

+ * either one. Outside that range only `pnpm` exists: before 6.17.1 `@pnpm/exe`
+ * was not published yet, and from v12 the unscoped `pnpm` is itself the native
+ * executable.
Relevance

●●● Strong

Reviewers accepted rephrasing comments to avoid “used to” historical phrasing (PR #13383).

PR-#13383

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 772199 forbids comments that describe historical behavior using temporal phrasing.
The added/modified comments explicitly use historical framing such as `before 6.17.1 ... was not
published yet, from v12, and predate`.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[50-54]
pnpm/crates/env-installer/src/resolve_package_manager_integrities.rs[147-151]
pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts[130-135]
pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs[192-195]

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

## Issue description
Several newly added/modified comments describe behavior using historical framing (e.g., "before ... was not published yet", "from v12"), which violates the guideline to describe current behavior rather than history.

## Issue Context
These comments are describing version-conditional behavior; they can be rewritten to state the present contract without temporal/historical wording.

## Fix Focus Areas
- pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[50-55]
- pnpm/crates/env-installer/src/resolve_package_manager_integrities.rs[147-151]
- pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts[130-135]
- pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs[192-195]

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


View more (2)
5. mockPackument() has four params ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The modified mockPackument helper now takes 4 parameters, exceeding the project limit of three and
making call sites harder to read/extend. This should be refactored to use an options object (or
otherwise reduce positional parameters).
Code

pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts[166]

+function mockPackument (name: string, integrity: string, signatures: unknown, version: string = '9.1.0'): void {
Relevance

●●● Strong

3-parameter limit enforced before; 4-positional-params refactor to options object was accepted (PR
#13464).

PR-#13464

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713433 limits TypeScript functions to three parameters or fewer. The changed
mockPackument function signature has four parameters (name, integrity, signatures,
version).

Rule 713433: Limit TypeScript functions to three parameters or fewer
pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts[166-166]

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

## Issue description
`mockPackument(name, integrity, signatures, version)` exceeds the 3-parameter limit for TypeScript functions.

## Issue Context
This helper is used in Jest tests and the extra positional parameter (`version`) reduces readability and increases the chance of argument-order mistakes.

## Fix Focus Areas
- pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts[166-176]

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


6. Redundant dependency resolution ✓ Resolved 🐞 Bug ➹ Performance
Description
resolveWantedPnpmPackages() always resolves pnpm first and then runs a second full
resolveManifestDependencies() for @pnpm/exe when the resolved version indicates it exists. For
exact version specs in the 6.17.1–11.x range (e.g. self-update passes an exact version), this adds
avoidable extra resolver/graph work and can add latency (and extra network on cold caches).
Code

pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[R133-136]

+  const lockfile = await resolveManifestDependencies({ dependencies: { pnpm: spec } }, resolveOpts)
+  const resolvedVersion = lockfile.importers['.' as ProjectId]?.dependencies?.['pnpm']
+  if (resolvedVersion == null || !packageManagerDeps(resolvedVersion).includes('@pnpm/exe')) {
+    return lockfile
Relevance

●● Moderate

Perf-only refactors are mixed; similar “avoid extra clone/work” suggestion was rejected (PR #13477).

PR-#13477

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new helper explicitly does an initial pnpm-only resolution and then conditionally does a second
full resolution including @pnpm/exe. Self-update passes an exact version into
resolvePackageManagerIntegrities, so exact-version flows can pay this extra resolver work
unnecessarily for versions that still publish @pnpm/exe.

pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[117-147]
pnpm11/engine/pm/commands/src/self-updater/selfUpdate.ts[238-247]

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

### Issue description
`resolveWantedPnpmPackages()` performs two separate `resolveManifestDependencies()` calls when the resolved version requires `@pnpm/exe`. For exact version specs (common in `self-update` and some switch flows), the package set is already knowable from the spec itself, so the initial “pnpm-only” resolution is redundant.

### Issue Context
- `selfUpdate.ts` calls `resolvePackageManagerIntegrities(resolution.manifest.version, ...)` with an exact version.
- For 6.17.1–11.x, `@pnpm/exe` is required, so the code does a pnpm-only resolve and then a second resolve including `@pnpm/exe`.

### Fix Focus Areas
- pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[117-147]
- pnpm11/engine/pm/commands/src/self-updater/selfUpdate.ts[238-247]

### What to change
- In `resolveWantedPnpmPackages(spec, opts)` add an early fast-path:
 - If `spec` is an exact semver (use `semver.valid(spec, { loose: true })` or equivalent), compute `wantedDeps` via `packageManagerDeps(spec)` and call `resolveManifestDependencies()` once with `{ dependencies: Object.fromEntries(wantedDeps.map(d => [d, spec])) }`.
 - Keep the current 2-step behavior only for ranges/dist-tags (where the exact version is unknown upfront).
- Add a unit test asserting only one resolver pass for an exact `11.x` spec (can be done by spying/mocking `resolveManifestDependencies`).

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


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Previous review results

Review updated until commit bfb396d

Results up to commit def170b ⚖️ Balanced


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


Action required
1. Native binary check fail-open ✓ Resolved 🐞 Bug ⛨ Security
Description
In verifyPnpmEngineIdentity(), when a native wrapper is detected but its snapshot has no
optionalDependencies (or none of the expected host platform package names are present), the code
silently verifies only pnpm/@pnpm/exe and skips verifying the native platform package. This can
let the executable bytes go unchecked in malformed/tampered env-lockfile scenarios, weakening the
self-update tamper protections (Rust fails closed here).
Code

pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts[R109-112]

+  const wrapper = nativeEngineWrapper(pmDeps)
+  if (wrapper != null) {
+    const optionalDeps = envLockfile.snapshots[`${wrapper.name}@${wrapper.version}`]?.optionalDependencies ?? {}
    const libcFamily = familySync()
Relevance

●●● Strong

Team favors fail-closed self-update/lockfile security hardening (accepted in PRs #13076, #12872).

PR-#13076
PR-#12872

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The TS implementation currently treats missing platform-binary metadata as an empty set and returns
without error, while the Rust implementation explicitly errors when the wrapper snapshot/optional
deps are missing or when no host candidate is found, which is the intended security posture for
executable-bytes verification.

pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts[97-125]
pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs[142-187]

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

### Issue description
`collectEnginePackagesToVerify()` currently defaults missing wrapper snapshot/optionalDependencies to `{}` and simply returns without adding any platform package to `toVerify` if no candidate is found. For native wrappers this should fail closed (throw `PNPM_ENGINE_IDENTITY_UNVERIFIABLE`) when the lockfile cannot prove which platform binary will run.

### Issue Context
The Rust port already treats missing optional deps / missing host candidate as unverifiable and errors, preventing a “verified” result without checking native bytes.

### Fix Focus Areas
- pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts[107-125]
- pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs[142-187]

### What to change
- When `wrapper != null`:
 - If the wrapper snapshot is missing OR `optionalDependencies` is missing/empty, throw `PNPM_ENGINE_IDENTITY_UNVERIFIABLE`.
 - If none of the `candidateNames` are present in `optionalDependencies`, throw `PNPM_ENGINE_IDENTITY_UNVERIFIABLE`.
- Add/adjust tests to cover the fail-closed behavior (e.g. v12 wrapper present but snapshots missing / no candidate present).

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



Remediation recommended
2. Historical phrasing in comments ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
New/modified doc comments use historical phrasing like before ... was not published yet and `from
v12`, which documents history rather than stating the current behavioral contract. Rephrase these
comments in terms of the current version-conditional behavior (e.g., `for pnpm versions <6.17.1 ...;
for >=12 ...`).
Code

pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[R52-54]

+ * either one. Outside that range only `pnpm` exists: before 6.17.1 `@pnpm/exe`
+ * was not published yet, and from v12 the unscoped `pnpm` is itself the native
+ * executable.
Relevance

●●● Strong

Reviewers accepted rephrasing comments to avoid “used to” historical phrasing (PR #13383).

PR-#13383

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 772199 forbids comments that describe historical behavior using temporal phrasing.
The added/modified comments explicitly use historical framing such as `before 6.17.1 ... was not
published yet, from v12, and predate`.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[50-54]
pnpm/crates/env-installer/src/resolve_package_manager_integrities.rs[147-151]
pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts[130-135]
pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs[192-195]

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

## Issue description
Several newly added/modified comments describe behavior using historical framing (e.g., "before ... was not published yet", "from v12"), which violates the guideline to describe current behavior rather than history.

## Issue Context
These comments are describing version-conditional behavior; they can be rewritten to state the present contract without temporal/historical wording.

## Fix Focus Areas
- pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[50-55]
- pnpm/crates/env-installer/src/resolve_package_manager_integrities.rs[147-151]
- pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts[130-135]
- pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs[192-195]

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


3. mockPackument() has four params ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The modified mockPackument helper now takes 4 parameters, exceeding the project limit of three and
making call sites harder to read/extend. This should be refactored to use an options object (or
otherwise reduce positional parameters).
Code

pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts[166]

+function mockPackument (name: string, integrity: string, signatures: unknown, version: string = '9.1.0'): void {
Relevance

●●● Strong

3-parameter limit enforced before; 4-positional-params refactor to options object was accepted (PR
#13464).

PR-#13464

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713433 limits TypeScript functions to three parameters or fewer. The changed
mockPackument function signature has four parameters (name, integrity, signatures,
version).

Rule 713433: Limit TypeScript functions to three parameters or fewer
pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts[166-166]

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

## Issue description
`mockPackument(name, integrity, signatures, version)` exceeds the 3-parameter limit for TypeScript functions.

## Issue Context
This helper is used in Jest tests and the extra positional parameter (`version`) reduces readability and increases the chance of argument-order mistakes.

## Fix Focus Areas
- pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts[166-176]

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


4. Redundant dependency resolution ✓ Resolved 🐞 Bug ➹ Performance
Description
resolveWantedPnpmPackages() always resolves pnpm first and then runs a second full
resolveManifestDependencies() for @pnpm/exe when the resolved version indicates it exists. For
exact version specs in the 6.17.1–11.x range (e.g. self-update passes an exact version), this adds
avoidable extra resolver/graph work and can add latency (and extra network on cold caches).
Code

pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[R133-136]

+  const lockfile = await resolveManifestDependencies({ dependencies: { pnpm: spec } }, resolveOpts)
+  const resolvedVersion = lockfile.importers['.' as ProjectId]?.dependencies?.['pnpm']
+  if (resolvedVersion == null || !packageManagerDeps(resolvedVersion).includes('@pnpm/exe')) {
+    return lockfile
Relevance

●● Moderate

Perf-only refactors are mixed; similar “avoid extra clone/work” suggestion was rejected (PR #13477).

PR-#13477

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new helper explicitly does an initial pnpm-only resolution and then conditionally does a second
full resolution including @pnpm/exe. Self-update passes an exact version into
resolvePackageManagerIntegrities, so exact-version flows can pay this extra resolver work
unnecessarily for versions that still publish @pnpm/exe.

pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[117-147]
pnpm11/engine/pm/commands/src/self-updater/selfUpdate.ts[238-247]

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

### Issue description
`resolveWantedPnpmPackages()` performs two separate `resolveManifestDependencies()` calls when the resolved version requires `@pnpm/exe`. For exact version specs (common in `self-update` and some switch flows), the package set is already knowable from the spec itself, so the initial “pnpm-only” resolution is redundant.

### Issue Context
- `selfUpdate.ts` calls `resolvePackageManagerIntegrities(resolution.manifest.version, ...)` with an exact version.
- For 6.17.1–11.x, `@pnpm/exe` is required, so the code does a pnpm-only resolve and then a second resolve including `@pnpm/exe`.

### Fix Focus Areas
- pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts[117-147]
- pnpm11/engine/pm/commands/src/self-updater/selfUpdate.ts[238-247]

### What to change
- In `resolveWantedPnpmPackages(spec, opts)` add an early fast-path:
 - If `spec` is an exact semver (use `semver.valid(spec, { loose: true })` or equivalent), compute `wantedDeps` via `packageManagerDeps(spec)` and call `resolveManifestDependencies()` once with `{ dependencies: Object.fromEntries(wantedDeps.map(d => [d, spec])) }`.
 - Keep the current 2-step behavior only for ranges/dist-tags (where the exact version is unknown upfront).
- Add a unit test asserting only one resolver pass for an exact `11.x` spec (can be done by spying/mocking `resolveManifestDependencies`).

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


Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts (1)

107-125: 🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win

TS silently skips native-binary verification when wrapper metadata is missing; Rust fails closed for the same case. The root cause is the ?? {} fallback in verifyPnpmEngineIdentity.ts, which lets verification succeed without ever checking the actual native binary.

  • pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts#L107-L125: throw a PnpmError when the wrapper's snapshot/optionalDependencies are missing, and again when no platform candidate matches, mirroring the Err(EngineIdentityUnverifiable) behavior in pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs's collect_engine_components.
  • pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts#L104-L135: add a test with a wrapper snapshot missing optionalDependencies (or missing a matching platform entry) and assert verifyPnpmEngineIdentity rejects it.
🤖 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 `@pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts`
around lines 107 - 125, Update native wrapper handling in
verifyPnpmEngineIdentity to throw a PnpmError when the wrapper snapshot or
optionalDependencies are missing, and again when no platform candidate matches,
instead of silently continuing without verification. Add a test in
verifyPnpmEngineIdentity.test.ts covering missing optionalDependencies or a
missing platform entry and assert that verifyPnpmEngineIdentity rejects.
pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts (1)

34-45: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

isPackageManagerResolved never checks the specifier, and no test covers a specifier-only change. The root cause is in resolvePackageManagerIntegrities.ts: the short-circuit check compares only the resolved version, never the specifier, unlike the Rust is_package_manager_resolved_with_deps which requires both to match.

  • pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts#L34-L45: add a wantedSpecifier parameter to isPackageManagerResolved and require pmDeps[name]?.specifier === wantedSpecifier in addition to the version check, matching the Rust contract.
  • pnpm11/installing/env-installer/test/resolvePackageManagerIntegrities.test.ts#L1-L39: add a test where the specifier changes but the resolved version stays the same, and assert isPackageManagerResolved returns false, mirroring the Rust test !is_package_manager_resolved(&env, "~11.0.0", "11.0.0").
🤖 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 `@pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts`
around lines 34 - 45, Update isPackageManagerResolved in
pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts:34-45 to
accept wantedSpecifier and require each dependency’s specifier and resolved
version to match, preserving the Rust contract. Add a test in
pnpm11/installing/env-installer/test/resolvePackageManagerIntegrities.test.ts:1-39
where the specifier changes while the resolved version remains the same, and
assert isPackageManagerResolved returns false.
🤖 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/test/self-updater/verifyPnpmEngineIdentity.test.ts`:
- Around line 104-135: Add test coverage around verifyPnpmEngineIdentity using
an envLockfileV12 variant whose native pnpm snapshot omits optionalDependencies
or its matching platform entry, while package metadata remains otherwise valid.
Assert the verification rejects with the expected “Refusing to run pnpm” error,
covering both missing platform metadata cases without changing the existing
valid-lockfile test.

In
`@pnpm11/installing/env-installer/test/resolvePackageManagerIntegrities.test.ts`:
- Around line 1-39: Add a test in the resolvePackageManagerIntegrities suite
that keeps the pinned package version equal to the requested version but changes
its specifier, and assert isPackageManagerResolved returns false. Cover the
relevant pnpm/@pnpm/exe lockfile dependency shape using envLockfile, matching
the Rust behavior without changing existing tests.

---

Outside diff comments:
In `@pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts`:
- Around line 107-125: Update native wrapper handling in
verifyPnpmEngineIdentity to throw a PnpmError when the wrapper snapshot or
optionalDependencies are missing, and again when no platform candidate matches,
instead of silently continuing without verification. Add a test in
verifyPnpmEngineIdentity.test.ts covering missing optionalDependencies or a
missing platform entry and assert that verifyPnpmEngineIdentity rejects.

In `@pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts`:
- Around line 34-45: Update isPackageManagerResolved in
pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts:34-45 to
accept wantedSpecifier and require each dependency’s specifier and resolved
version to match, preserving the Rust contract. Add a test in
pnpm11/installing/env-installer/test/resolvePackageManagerIntegrities.test.ts:1-39
where the specifier changes while the resolved version remains the same, and
assert isPackageManagerResolved returns false.
🪄 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: 7bf7731a-4a53-48c3-be24-3aeedee8c82a

📥 Commits

Reviewing files that changed from the base of the PR and between 641ccd3 and def170b.

📒 Files selected for processing (9)
  • .changeset/env-lockfile-skips-pnpm-exe-from-v12.md
  • pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs
  • pnpm/crates/cli/src/cli_args/self_update/verify_engine/tests.rs
  • pnpm/crates/env-installer/src/resolve_package_manager_integrities.rs
  • pnpm/crates/env-installer/src/tests.rs
  • pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts
  • pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts
  • pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts
  • pnpm11/installing/env-installer/test/resolvePackageManagerIntegrities.test.ts

zkochan added 3 commits August 3, 2026 02:31
Review follow-ups on the v12 engine-pin change:

The v12 env lockfile pins only `pnpm`, so the pre-command test fixture
had to drop its `@pnpm/exe` entry — it was the one test the change broke
across every CI job.

The TypeScript engine check treated a wrapper with no platform binaries
in the lockfile as nothing to verify, so the bytes that actually execute
went unchecked. It now fails closed on a missing snapshot, missing
optional dependencies, or no host candidate, with the messages pacquet
already used.

A pnpm resolved from a named registry is referenced as
`<registry>:<version>`, which does not parse as semver; the qualifier is
now stripped before the version decides the package set. An exact
specifier skips the probing resolution entirely, since the package set is
known before resolving.
Copilot AI review requested due to automatic review settings August 3, 2026 00:39

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.

@zkochan

zkochan commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

Correction to my thread replies above: they cite 3719e9529c, which is only the follow-up test rename. The review fixes themselves — fail-closed native-binary verification, the named-registry version unwrapping, the exact-specifier fast path, the comment rephrasing, and the options-object test helper — are in 8ca665662f.


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

@khutchinskh-cmyk khutchinskh-cmyk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Documentation Index

Fetch the complete documentation index at: https://docs.coderabbit.ai/llms.txt
Use this file to discover all available pages before exploring further.

Issue trackers

CodeRabbit integrates with popular issue tracking systems to enrich reviews with issue context, validate requirements, create issues from review comments, and design Coding Plans.

export const ProPlanBadge = ({tip = "This feature is available as part of the Pro, Pro+ and Enterprise plans. Please refer to our pricing page for more information about our plans and features.", title = "Pro Plan", cta = "Read more", href = "https://coderabbit.ai/pricing", disabled = false}) => {
return
<Badge icon="shield-check" disabled={disabled || undefined}>
{title}

;
};

Supported integrations

Works automatically without setup{" "} Works automatically without setup Works through your Azure DevOps platform setup Connect via the CodeRabbit Forge app from Atlassian Marketplace OAuth-based integration for Linear workspaces

Features

CodeRabbit connects with your issue tracking systems to bring issue context into every stage of development, from planning through code review. Here's what the integration enables:

Pulls in issue details: descriptions, acceptance criteria, and discussions, so CodeRabbit understands *why* a change is being made. Assesses whether your code changes properly address the linked issue's acceptance criteria and flags any gaps. Analyzes your issues and codebase to generate step-by-step Coding Plans for a handoff to any coding agent or IDE copilot. Creates new issues directly from PR review comments, ensuring nothing discussed during review gets lost.

Integration Guides

Install and configure the Jira Cloud integration via the Atlassian Marketplace Install and configure the Linear integration via OAuth

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

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.98%. Comparing base (641ccd3) to head (bfb396d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...staller/src/resolve_package_manager_integrities.rs 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13599      +/-   ##
==========================================
- Coverage   88.00%   87.98%   -0.02%     
==========================================
  Files         567      567              
  Lines       97930    97939       +9     
==========================================
- Hits        86179    86176       -3     
- Misses      11751    11763      +12     

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

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

@qodo-code-review

Copy link
Copy Markdown

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

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

@zkochan

zkochan commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

On Qodo's remaining finding (pnpm/@pnpm/exe versions can diverge): not introduced here, and pinning would cost parity.

For a non-exact spec the second pass resolves both names in a single resolveManifestDependencies call at that same spec — exactly what the pre-PR code did with { pnpm: spec, '@pnpm/exe': spec }. The first, pnpm-only pass exists solely to learn which package set is wanted; its lockfile is discarded. So the two names are no more likely to diverge than before this change.

Pinning the second pass to the already-resolved version would also move the recorded specifier away from pacquet's contract: pacquet records the user's specifier (^11, latest) alongside the exact version, while the TypeScript side derives the specifier from what it resolved. Making @pnpm/exe resolve at an exact version would record that exact version as the specifier for a range pin, which is_package_manager_resolved on the Rust side then reads as a mismatch.

If a dist-tag really can point at different versions for the two packages, the fix belongs with the specifier-recording contract in both stacks, not in this change.


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

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: bfb396dc0376

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.477 ± 0.144 2.349 2.766 1.68 ± 0.19
pacquet@main 2.516 ± 0.156 2.352 2.711 1.71 ± 0.20
pnpr@HEAD 1.491 ± 0.157 1.344 1.780 1.01 ± 0.15
pnpr@main 1.475 ± 0.148 1.347 1.780 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.47695114186,
      "stddev": 0.14418759326606134,
      "median": 2.40855428476,
      "user": 1.63007974,
      "system": 1.3188662199999999,
      "min": 2.34929107876,
      "max": 2.76586336776,
      "times": [
        2.37390905776,
        2.61503766676,
        2.76586336776,
        2.40282834076,
        2.34929107876,
        2.41428022876,
        2.37545801076,
        2.64301830876,
        2.37844969276,
        2.45137566576
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.51631262246,
      "stddev": 0.15596113282435203,
      "median": 2.50241495476,
      "user": 1.62693194,
      "system": 1.30397292,
      "min": 2.35160141576,
      "max": 2.71126598776,
      "times": [
        2.38077071476,
        2.35160141576,
        2.60123472776,
        2.71001767476,
        2.71126598776,
        2.58059604076,
        2.42423386876,
        2.35878193376,
        2.35925595476,
        2.68536790576
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.49101798076,
      "stddev": 0.15745921023383455,
      "median": 1.4253696527600002,
      "user": 1.2170675399999997,
      "system": 1.11976272,
      "min": 1.34402478476,
      "max": 1.7802543697600002,
      "times": [
        1.45969894376,
        1.34402478476,
        1.37516316876,
        1.36619194376,
        1.7802543697600002,
        1.6348152097600002,
        1.35835743776,
        1.6889924117600001,
        1.39104036176,
        1.51164117576
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.4745974244600002,
      "stddev": 0.1477351603109294,
      "median": 1.43808343576,
      "user": 1.19865034,
      "system": 1.13047412,
      "min": 1.34650088776,
      "max": 1.78033196076,
      "times": [
        1.78033196076,
        1.39404157376,
        1.34650088776,
        1.50660683976,
        1.44437571776,
        1.35169662276,
        1.34731253976,
        1.68598574376,
        1.43179115376,
        1.45733120476
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 252.6 ± 7.0 246.3 267.5 1.02 ± 0.04
pacquet@main 247.3 ± 6.5 240.6 258.3 1.00
pnpr@HEAD 274.2 ± 5.2 265.8 283.3 1.11 ± 0.04
pnpr@main 265.1 ± 5.7 258.3 276.7 1.07 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25257255478,
      "stddev": 0.0070046567260178645,
      "median": 0.25060492698000003,
      "user": 0.19539304,
      "system": 0.51554104,
      "min": 0.24634816048000002,
      "max": 0.26747596548,
      "times": [
        0.25332810348,
        0.24685265948000001,
        0.24881652848000002,
        0.24634816048000002,
        0.26008329848,
        0.25639805348,
        0.26747596548,
        0.24652499548,
        0.24750445748000002,
        0.25239332548000004
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.24725746998000003,
      "stddev": 0.006493875693547237,
      "median": 0.24548293448000003,
      "user": 0.20718343999999997,
      "system": 0.49624554,
      "min": 0.24063504748,
      "max": 0.25829567448,
      "times": [
        0.25829567448,
        0.24133460048000002,
        0.25713780048,
        0.24170002548000002,
        0.24738923048000003,
        0.25213583748,
        0.24644303248000002,
        0.24452283648,
        0.24298061448000002,
        0.24063504748
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27421823108000004,
      "stddev": 0.00521459954961582,
      "median": 0.27463892048000005,
      "user": 0.20635603999999996,
      "system": 0.52827864,
      "min": 0.26583492548000004,
      "max": 0.28332460548,
      "times": [
        0.27807534148,
        0.27484555648000003,
        0.27301705748,
        0.27819003948000004,
        0.26967581548,
        0.27637416248,
        0.28332460548,
        0.26583492548000004,
        0.27443228448,
        0.26841252248
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.26514731458,
      "stddev": 0.005745041667101113,
      "median": 0.26469072198,
      "user": 0.19572963999999998,
      "system": 0.51904054,
      "min": 0.25832726248000004,
      "max": 0.27670253448000004,
      "times": [
        0.27175114048000004,
        0.25832726248000004,
        0.26445998548,
        0.27670253448000004,
        0.26312338748,
        0.26492145848000004,
        0.25908643048,
        0.26719664248,
        0.25993457448,
        0.26596972948000003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.580 ± 0.013 2.551 2.604 1.62 ± 0.17
pacquet@main 2.577 ± 0.010 2.560 2.590 1.62 ± 0.17
pnpr@HEAD 1.634 ± 0.110 1.459 1.781 1.03 ± 0.13
pnpr@main 1.593 ± 0.165 1.421 1.869 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.58012914652,
      "stddev": 0.01287366477436416,
      "median": 2.5801250402200004,
      "user": 1.6258584800000002,
      "system": 1.3255100000000002,
      "min": 2.55135874672,
      "max": 2.60372765472,
      "times": [
        2.57620926172,
        2.57786636372,
        2.5783130127200002,
        2.60372765472,
        2.58371225672,
        2.5857365417200002,
        2.55135874672,
        2.58193706772,
        2.58529340272,
        2.57713715672
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5765514264200005,
      "stddev": 0.00982746216258867,
      "median": 2.57451649272,
      "user": 1.60488328,
      "system": 1.3063301,
      "min": 2.56023610672,
      "max": 2.58967447172,
      "times": [
        2.56749736972,
        2.5710923987200003,
        2.58726242372,
        2.57310035872,
        2.58884755672,
        2.58041087272,
        2.58967447172,
        2.57146007872,
        2.5759326267200002,
        2.56023610672
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.63358233652,
      "stddev": 0.11031651849652473,
      "median": 1.64378732972,
      "user": 1.1955448800000001,
      "system": 1.1508046,
      "min": 1.45850570072,
      "max": 1.7808129537200001,
      "times": [
        1.61596727372,
        1.6716073857200002,
        1.5517447127200001,
        1.4785033247200001,
        1.71929885072,
        1.74848229372,
        1.7808129537200001,
        1.45850570072,
        1.61551244872,
        1.69538842072
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5934344162200003,
      "stddev": 0.1646334238583409,
      "median": 1.5709037447200003,
      "user": 1.1788690800000001,
      "system": 1.1543645000000002,
      "min": 1.42131638472,
      "max": 1.8691666257200001,
      "times": [
        1.42954479372,
        1.43416109572,
        1.62498610872,
        1.5756991557200002,
        1.8691666257200001,
        1.47315088872,
        1.7104955887200002,
        1.82971518672,
        1.42131638472,
        1.5661083337200001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 389.0 ± 10.4 374.0 410.1 1.31 ± 0.04
pacquet@main 382.5 ± 12.3 366.7 400.5 1.29 ± 0.05
pnpr@HEAD 297.9 ± 4.4 290.0 303.5 1.01 ± 0.02
pnpr@main 296.1 ± 5.1 284.8 304.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3889564613,
      "stddev": 0.010431230249907091,
      "median": 0.38942997870000007,
      "user": 0.4944728800000001,
      "system": 0.7125832999999999,
      "min": 0.37398375670000006,
      "max": 0.4100726927,
      "times": [
        0.37398375670000006,
        0.37668978170000006,
        0.38847670470000006,
        0.4100726927,
        0.38962332470000005,
        0.38998294170000003,
        0.39338764370000007,
        0.39734062870000003,
        0.38077050570000004,
        0.38923663270000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.3824805525,
      "stddev": 0.01233814989658622,
      "median": 0.3818965662,
      "user": 0.51185608,
      "system": 0.6651657999999999,
      "min": 0.36671411970000006,
      "max": 0.4005498417,
      "times": [
        0.38074667570000004,
        0.38304645670000004,
        0.39049965070000003,
        0.36754820670000005,
        0.3910214437,
        0.36671411970000006,
        0.3984447877,
        0.4005498417,
        0.37233200870000005,
        0.37390233370000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29787411020000004,
      "stddev": 0.0044264668294785176,
      "median": 0.2972251722,
      "user": 0.18751868,
      "system": 0.5078354999999999,
      "min": 0.28998583270000006,
      "max": 0.3034521627,
      "times": [
        0.30287846770000004,
        0.3034521627,
        0.3012386757,
        0.29801384270000003,
        0.2949559547,
        0.28998583270000006,
        0.2959991377,
        0.2964365017,
        0.2938578277,
        0.30192269870000005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.2960724544000001,
      "stddev": 0.005070095624020318,
      "median": 0.2963812067,
      "user": 0.20448588,
      "system": 0.4860617999999999,
      "min": 0.2848497797,
      "max": 0.3042338117,
      "times": [
        0.2972841217,
        0.29556060970000003,
        0.29939738870000004,
        0.2848497797,
        0.2990911157,
        0.29203044870000006,
        0.2965538857,
        0.29620852770000006,
        0.29551485470000005,
        0.3042338117
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.723 ± 0.007 1.714 1.735 5.85 ± 0.12
pacquet@main 1.714 ± 0.012 1.698 1.734 5.82 ± 0.13
pnpr@HEAD 0.297 ± 0.004 0.289 0.307 1.01 ± 0.03
pnpr@main 0.294 ± 0.006 0.287 0.306 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.7228200362200004,
      "stddev": 0.007136685379103555,
      "median": 1.7213835515200002,
      "user": 0.72315806,
      "system": 0.7586162799999999,
      "min": 1.7142871665200001,
      "max": 1.7349668795200002,
      "times": [
        1.72883933352,
        1.7142871665200001,
        1.72634833352,
        1.72446757252,
        1.7181834045200002,
        1.73033853652,
        1.7182995305200002,
        1.71538396152,
        1.7170856435200001,
        1.7349668795200002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.7140506523200003,
      "stddev": 0.011781385953133675,
      "median": 1.71364487502,
      "user": 0.7190873600000002,
      "system": 0.74720018,
      "min": 1.69814766652,
      "max": 1.7341372945200002,
      "times": [
        1.70925951852,
        1.71582131652,
        1.73209434052,
        1.71346573852,
        1.71382401152,
        1.6993480575200002,
        1.71518661652,
        1.7341372945200002,
        1.70922196252,
        1.69814766652
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29739666682,
      "stddev": 0.0044480500473983746,
      "median": 0.29713660302,
      "user": 0.19783656,
      "system": 0.49793588,
      "min": 0.28882141352,
      "max": 0.30660205052,
      "times": [
        0.29723380252,
        0.29486425852,
        0.28882141352,
        0.29775592452,
        0.30071802452,
        0.29703940351999997,
        0.29629525052,
        0.30660205052,
        0.29796601152,
        0.29667052852
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.29439878132,
      "stddev": 0.006146451481995238,
      "median": 0.29318150902,
      "user": 0.18115946,
      "system": 0.49888027999999995,
      "min": 0.28657618152,
      "max": 0.30559215852,
      "times": [
        0.28860193752,
        0.29150217652,
        0.28657618152,
        0.29822014752,
        0.28902586652,
        0.29239727552,
        0.30225786052,
        0.29584846652,
        0.29396574252,
        0.30559215852
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 179.2 ± 3.7 175.2 186.4 1.98 ± 0.09
pacquet@main 180.1 ± 4.5 172.5 192.7 1.99 ± 0.09
pnpr@HEAD 91.4 ± 3.4 85.1 97.5 1.01 ± 0.06
pnpr@main 90.6 ± 3.6 85.7 98.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.17924577981999998,
      "stddev": 0.0036740183566633645,
      "median": 0.17789565082,
      "user": 0.16182826999999997,
      "system": 0.08377019250000001,
      "min": 0.17524373882,
      "max": 0.18635483882,
      "times": [
        0.17971730382,
        0.18635483882,
        0.17799237882,
        0.18203686682,
        0.17669856681999999,
        0.17636214081999999,
        0.17572844582,
        0.18045126482,
        0.17766676382,
        0.17779892282,
        0.18485110982,
        0.17574388982,
        0.17524373882,
        0.17630583482,
        0.17934826482,
        0.18563214582
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.18014431519500002,
      "stddev": 0.004543140638712417,
      "median": 0.18008228232,
      "user": 0.15687552000000002,
      "system": 0.0890461925,
      "min": 0.17249617781999999,
      "max": 0.19271185582,
      "times": [
        0.18073511882,
        0.17249617781999999,
        0.18125012782,
        0.18339564482,
        0.18104498782,
        0.17719681082,
        0.18061262982,
        0.17987247582,
        0.17468219882,
        0.18515130682,
        0.19271185582,
        0.18029208882,
        0.17727097282,
        0.17812778482,
        0.17878463282,
        0.17868422881999999
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09144222213034485,
      "stddev": 0.0033854367998303945,
      "median": 0.09147773682,
      "user": 0.02241964068965517,
      "system": 0.011473711724137931,
      "min": 0.08514803582000001,
      "max": 0.09753084482,
      "times": [
        0.09753084482,
        0.08826686582000001,
        0.08514803582000001,
        0.09123718382000001,
        0.09147773682,
        0.08916222882000001,
        0.08915645082000001,
        0.09601956682000001,
        0.09265817282000001,
        0.09365537982000001,
        0.08773002582,
        0.09086265382000001,
        0.09407136182,
        0.09326877782000001,
        0.08535883882,
        0.08798655682,
        0.09101105582,
        0.09580501482,
        0.09284779682000001,
        0.09370068982,
        0.09735947982000001,
        0.08836617482,
        0.09412612582,
        0.09038158982000001,
        0.08594186382,
        0.09191041882,
        0.09470914682,
        0.08992852082000001,
        0.09214588282000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.09062451785225804,
      "stddev": 0.0036419361668289167,
      "median": 0.09049182882000001,
      "user": 0.02231018129032258,
      "system": 0.011290670322580645,
      "min": 0.08573709982000001,
      "max": 0.09838560482000001,
      "times": [
        0.08931367682000001,
        0.09451684182,
        0.09372321082000001,
        0.09076204482000001,
        0.09134040382000001,
        0.08675050982,
        0.08608015482,
        0.08885730082000001,
        0.08971586782,
        0.08631045582,
        0.08647805382000001,
        0.09176668982000001,
        0.09068497682000001,
        0.08573709982000001,
        0.08620354482,
        0.09221065682000001,
        0.09003080582,
        0.09126087082,
        0.09015572882,
        0.09670878382,
        0.09462009782000001,
        0.09171484582,
        0.09838383582,
        0.09049182882000001,
        0.08909869182,
        0.09552197382000001,
        0.08623671482,
        0.09171820282000001,
        0.09838560482000001,
        0.08863875082,
        0.08594182782000001
      ]
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 835.4 ± 87.7 688.3 1002.0 1.00
pacquet@main 897.7 ± 129.3 648.6 1059.1 1.07 ± 0.19
pnpm@HEAD 2898.5 ± 90.2 2821.5 3121.6 3.47 ± 0.38
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.8354306487311113,
      "stddev": 0.08773414539113152,
      "median": 0.84635558462,
      "user": 0.7768958222222222,
      "system": 0.2065518666666667,
      "min": 0.6882669896200001,
      "max": 1.00197671162,
      "times": [
        1.00197671162,
        0.73792086162,
        0.6882669896200001,
        0.83604653762,
        0.86942780362,
        0.8227619176200001,
        0.8476875486200001,
        0.8684318836200001,
        0.84635558462
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.89765475762,
      "stddev": 0.12934297952274,
      "median": 0.90212011562,
      "user": 0.8349250444444443,
      "system": 0.23009208888888885,
      "min": 0.64857023562,
      "max": 1.05914683462,
      "times": [
        0.84019334562,
        1.03307656762,
        0.9132130956200001,
        0.64857023562,
        0.81629047462,
        0.8474892356200001,
        0.90212011562,
        1.01879291362,
        1.05914683462
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 2.8984893925088895,
      "stddev": 0.09017595657663453,
      "median": 2.87062887262,
      "user": 4.134120711111112,
      "system": 0.31097686666666663,
      "min": 2.8214590306200003,
      "max": 3.12158181862,
      "times": [
        2.84431618962,
        2.85294537162,
        2.87062887262,
        2.9316655426200002,
        2.88332915162,
        2.8214590306200003,
        2.9082383166200003,
        3.12158181862,
        2.8522402386200003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.557 ± 0.155 4.429 4.820 1.29 ± 0.06
pacquet@main 4.464 ± 0.053 4.412 4.559 1.26 ± 0.05
pnpr@HEAD 3.571 ± 0.156 3.441 3.841 1.01 ± 0.06
pnpr@main 3.545 ± 0.124 3.450 3.849 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.55696733538,
      "stddev": 0.15493119849720524,
      "median": 4.49559903618,
      "user": 1.75396668,
      "system": 1.44166588,
      "min": 4.42926294318,
      "max": 4.82038773218,
      "times": [
        4.51336822618,
        4.66354663518,
        4.82038773218,
        4.4515862771800006,
        4.4307448241800005,
        4.4294697341800005,
        4.42926294318,
        4.8160733681800005,
        4.53740376718,
        4.477829846180001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.46351273828,
      "stddev": 0.05336584756199517,
      "median": 4.4432953811800004,
      "user": 1.7702944799999998,
      "system": 1.41251338,
      "min": 4.4124946961800005,
      "max": 4.55893142518,
      "times": [
        4.5324181791800005,
        4.41368379618,
        4.46561219418,
        4.45032590918,
        4.55893142518,
        4.43218647618,
        4.43626485318,
        4.51544941518,
        4.41776043818,
        4.4124946961800005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5712228566799995,
      "stddev": 0.15630350823226696,
      "median": 3.4922204246799997,
      "user": 1.2825852799999997,
      "system": 1.2285425799999998,
      "min": 3.44059609818,
      "max": 3.84137919018,
      "times": [
        3.65333912918,
        3.45519446518,
        3.5064198351799996,
        3.4468643151799996,
        3.84137919018,
        3.47802101418,
        3.44059609818,
        3.8381867331799997,
        3.58058042118,
        3.47164736518
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.544725131479999,
      "stddev": 0.12351776559192754,
      "median": 3.5085955376799998,
      "user": 1.25765618,
      "system": 1.28933988,
      "min": 3.4495575271799996,
      "max": 3.84900477018,
      "times": [
        3.5333084061799997,
        3.6590903021799996,
        3.48403561718,
        3.4544939221799997,
        3.51670857918,
        3.84900477018,
        3.54466917118,
        3.4495575271799996,
        3.5004824961799996,
        3.45590052318
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13599
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,551.36 ms
(-0.85%)Baseline: 2,573.17 ms
3,087.81 ms
(82.63%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,714.29 ms
(-0.49%)Baseline: 1,722.80 ms
2,067.35 ms
(82.92%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
373.98 ms
(-3.26%)Baseline: 386.60 ms
463.91 ms
(80.61%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
175.24 ms
(-0.71%)Baseline: 176.49 ms
211.79 ms
(82.74%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,349.29 ms
(-0.69%)Baseline: 2,365.62 ms
2,838.74 ms
(82.76%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,429.26 ms
(-0.12%)Baseline: 4,434.70 ms
5,321.63 ms
(83.23%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
246.35 ms
(+0.35%)Baseline: 245.48 ms
294.58 ms
(83.63%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
688.27 ms
(-20.13%)Baseline: 861.73 ms
1,034.07 ms
(66.56%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13599
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,458.51 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
288.82 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
289.99 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
85.15 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,344.02 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,440.60 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
265.83 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit 51b43ed into main Aug 3, 2026
45 checks passed
@zkochan
zkochan deleted the env-lockfile-opt branch August 3, 2026 08:23
@coderabbitai coderabbitai Bot mentioned this pull request Aug 15, 2026
4 of 5 tasks
zakxxi added a commit to aker-dev/microfolio that referenced this pull request Aug 17, 2026
Pinning 11.20.0 made every machine with a different global pnpm fail
before startup with "Cannot verify the identity of the
@pnpm/exe.darwin-x64 native binary: it is missing from pnpm-lock.yaml".
The lockfile was never at fault: 11.20.0 restructured the per-platform
binary packages (pnpm/pnpm#13599) and its engine identity check throws
even with no lockfile at all (pnpm/pnpm#13622). Fixed in 11.21.0
(pnpm/pnpm#13619, pnpm/pnpm#13147), so pin 11.22.0 instead.

CI and corepack install the exact pinned version, so they never hit the
switch. If your global pnpm is exactly 11.20.0, upgrade it first
(brew upgrade pnpm / pnpm self-update): its own switch code is the bug.

Co-Authored-By: Claude Fable 5 <[email protected]>
zkochan added a commit that referenced this pull request Aug 24, 2026
…om (#14132)

A pnpm below 11.20.0 pins `@pnpm/exe` beside `pnpm` for a v12 version, because
that is the set its own major is installed from — #13599 is where pnpm
learned that v12 publishes the executable as the unscoped package alone. A
project pinning pnpm 12 whose lockfile such a pnpm last wrote therefore carries
an entry every newer pnpm rejects, and `--frozen-lockfile` fails on it from
either side of the disagreement while a plain install rewrites the block and
hides it again. The two versions take turns.

That entry pins the wanted version through the same integrity and cannot change
which pnpm runs, so the frozen refusal now accepts a block that records every
package this pnpm installs from, whatever else it records. An entry pinning
another version is a lockfile that disagrees with the manifest and is still
refused. The predicate that drives the write keeps the exact-set rule, so a
writable install still rewrites the block to the packages this pnpm installs
from — the trade is that `--frozen-lockfile` no longer guarantees that block is
byte-stable against a later plain install.

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants