Skip to content

fix(network): fall back to bundled CA roots when the system trust store is empty - #13593

Merged
zkochan merged 3 commits into
mainfrom
fix-13588
Aug 2, 2026
Merged

zkochan merged 3 commits into
mainfrom
fix-13588

Conversation

@zkochan

@zkochan zkochan commented Aug 2, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #13588.

On a machine whose system trust store is empty or absent (a nixpkgs sandbox, a scratch container, SSL_CERT_FILE=), pnpm install died with a panic before doing any work:

Error:   × Main thread panicked.
  ├─▶ at pnpm/crates/network/src/lib.rs:421:32
  ╰─▶ build reqwest client with default timeouts and proxy: reqwest::Error { kind: Builder, source: General("No CA certificates were loaded from the system") }

reqwest's rustls-platform-verifier backend fails ClientBuilder::build() outright when the platform store yields nothing, and the install client turned that into a panic through .expect(...). Every install on such a machine failed — --offline included, even though nothing is fetched — whereas pnpm 11 works there because Node ships its own bundled Mozilla root store.

The fix keeps the platform verifier as the primary trust source and falls back to the Mozilla roots bundled via webpki-root-certs only when a client cannot be built with the platform verifier at all. That restores pnpm-11/Node parity for both offline and online installs on a certless system, and changes nothing for anyone whose system store loads: a root deliberately distrusted system-wide stays distrusted, and system / NODE_EXTRA_CA_CERTS / .npmrc ca+cafile roots keep taking precedence. A build failure for any other reason now surfaces as ForInstallsError::ClientBuild instead of a panic, carrying both the platform attempt's error (as the diagnostic source, since it describes the environment) and the bundled-roots retry's own error.

webpki-root-certs was already in Cargo.lock as a transitive dependency of rustls-platform-verifier, and its CDLA-Permissive-2.0 license is already allowed in deny.toml; the dependency was approved for promotion to [workspace.dependencies].

Parity: pacquet-only. The TypeScript CLI is unaffected — Node's bundled root store is exactly why pnpm 11 works on these systems — so this change restores parity rather than diverging, and needs no TypeScript counterpart.

Verified end-to-end with the issue's repro (a debug pnpm binary, SSL_CERT_FILE= SSL_CERT_DIR=): the offline install now completes, and so does a fresh online install against registry.npmjs.org over HTTPS. A regression test points SSL_CERT_FILE at an empty bundle (which switches rustls-native-certs to env-only loading), asserts a plain reqwest client build fails in that environment, and asserts for_installs still succeeds. It also pins that a configured ca keeps the platform verifier constructible — a user with custom roots never reaches the fallback.

Not addressed here: PnprClient::new (the opt-in pnprServer path) uses reqwest::Client::new(), which panics the same way. It is a separate, non-default code path and its constructor is infallible today, so converting it is left as a follow-up.

Squash Commit Body

reqwest's `rustls-platform-verifier` backend hard-errors with
"No CA certificates were loaded from the system" when the platform
store yields nothing, and the install client turned that into a
`Main thread panicked` through an `.expect` on `ClientBuilder::build`.
Any install on such a machine — a nixpkgs sandbox, a scratch
container — died, offline installs included, even though pnpm 11 works
there because Node ships its own Mozilla root store.

Keep the platform verifier as the primary trust source and fall back to
the Mozilla roots bundled via `webpki-root-certs` only when the client
cannot be built with it at all. A user who deliberately distrusts a root
system-wide keeps that decision as long as their store loads, and a
build failure for any other reason now surfaces as
`ForInstallsError::ClientBuild` — carrying both that error and the
retry's own — instead of a panic.

pacquet-only: the TypeScript CLI is unaffected, since Node's bundled
root store is what makes pnpm 11 work on these systems.

Closes pnpm/pnpm#13588

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • 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).

Summary by CodeRabbit

  • Bug Fixes

    • pnpm install now succeeds when the system certificate store is unavailable by using bundled Mozilla root certificates.
    • Existing system certificates, NODE_EXTRA_CA_CERTS, and npm certificate settings retain priority.
    • Improved error reporting when secure network connections cannot be established.
  • Documentation

    • Updated TLS documentation to explain certificate fallback and additional certificate authority handling.

zkochan added 2 commits August 2, 2026 17:07
reqwest's `rustls-platform-verifier` backend hard-errors with
"No CA certificates were loaded from the system" when the platform
store yields nothing, and the install client turned that into a
`Main thread panicked` through an `.expect` on `ClientBuilder::build`.
Any install on such a machine — a nixpkgs sandbox, a scratch
container — died, offline installs included, even though pnpm 11 works
there because Node ships its own Mozilla root store.

Keep the platform verifier as the primary trust source and fall back to
the Mozilla roots bundled via `webpki-root-certs` only when the client
cannot be built with it at all. A user who deliberately distrusts a root
system-wide keeps that decision as long as their store loads, and a
build failure for any other reason now surfaces as
`ForInstallsError::ClientBuild` instead of a panic.

Closes #13588
cspell flags `nixpkgs` in `.changeset/*.md`; the sandbox is described generically instead.
Copilot AI review requested due to automatic review settings August 2, 2026 15:16

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 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The network client now retries client construction with bundled Mozilla root certificates when the platform trust store is unavailable. The change adds dependency wiring, lazy certificate loading, error handling, Unix regression coverage, documentation, and a patch changeset.

Changes

Certificate fallback

Layer / File(s) Summary
Trust-root client construction
Cargo.toml, pnpm/crates/network/Cargo.toml, pnpm/crates/network/src/lib.rs
The network crate adds webpki-root-certs, lazily loads bundled roots, tries platform roots first, retries with bundled roots, and reports ClientBuild when both builds fail.
Fallback validation and documentation
pnpm/crates/network/src/tests.rs, pnpm/crates/network/src/lib.rs, pnpm/crates/network/src/tls.rs, .changeset/install-without-system-ca-certificates.md
A Unix regression test verifies installation client creation with empty system certificate sources. Documentation and release metadata describe fallback and certificate precedence.

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

Sequence Diagram(s)

sequenceDiagram
  participant InstallClient
  participant PlatformTrustStore
  participant BundledMozillaRoots
  participant Reqwest
  InstallClient->>PlatformTrustStore: Build client with platform roots
  PlatformTrustStore-->>InstallClient: Fail when no certificates are loaded
  InstallClient->>BundledMozillaRoots: Load bundled roots
  BundledMozillaRoots->>Reqwest: Build fallback client
  Reqwest-->>InstallClient: Return install client
Loading

Assessment against linked issues

Objective Addressed Explanation
Allow offline installation when no system CA certificates are available [#13588] ✅

Possibly related PRs

  • pnpm/pnpm#13158: Both changes modify pnpm/crates/network client construction and tests for TLS-related behavior.

Suggested labels: product: pacquet

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 fix-13588

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 pacquet TLS: fall back to bundled Mozilla roots when OS trust store is empty

🐞 Bug fix 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Prevent reqwest client-build panics when the system trust store is empty.
• Keep platform roots primary; fall back to bundled Mozilla roots only if necessary.
• Add regression test and changeset documenting restored offline/online install behavior.
Diagram

graph TD
A["ThrottledClient::for_installs"] --> B["make_builder"] --> C[("OS trust store")] --> D{"Client build ok?"} -->|"yes"| E["reqwest::Client (platform)"]
D -->|"no"| F[("Bundled Mozilla roots")] --> G["reqwest::Client (bundled)"]

subgraph Legend
direction LR
_svc["Function / builder"] ~~~ _db[("Trust roots")] ~~~ _dec{"Decision"}
end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Always use bundled Mozilla roots (ignore platform store)
  • ➕ Predictable behavior across minimal containers/sandboxes
  • ➕ Avoids platform verifier quirks entirely
  • ➖ Breaks system-admin trust policy (corporate/MITM roots, distrusted roots)
  • ➖ Reduces parity with typical OS TLS behavior when the store exists
2. Expose an explicit config/env toggle for trust-root source
  • ➕ Makes behavior explicit and debuggable
  • ➕ Lets users force bundled roots even when platform store exists
  • ➖ Adds surface area and support burden
  • ➖ Still needs a safe default; does not solve the immediate crash alone

Recommendation: The chosen approach (platform store first, bundled roots only when the platform verifier cannot build a client) is the best default: it preserves OS policy and corporate roots when available, restores pnpm-on-Node parity in certless environments, and turns the previous panic into a typed error for non-empty-store failures.

Files changed (7) +127 / -17

Bug fix (1) +64 / -4
lib.rsFallback to bundled roots when platform verifier cannot build a client +64/-4

Fallback to bundled roots when platform verifier cannot build a client

• Reworks install client construction to attempt a platform-trust build first and fall back to bundled Mozilla roots only if that build fails. Removes the panic-on-build via .expect and surfaces failures as ForInstallsError::ClientBuild; adds cached parsing of bundled roots via LazyLock.

pnpm/crates/network/src/lib.rs

Tests (1) +34 / -0
tests.rsAdd regression test for empty trust-store fallback +34/-0

Add regression test for empty trust-store fallback

• Adds a Unix (non-Apple) test that simulates an empty system trust store via SSL_CERT_FILE/SSL_CERT_DIR. Verifies reqwest builder fails under platform verification, while ThrottledClient::for_installs still succeeds via bundled roots.

pnpm/crates/network/src/tests.rs

Documentation (2) +20 / -7
install-without-system-ca-certificates.mdAdd changeset for CA-root fallback on certless systems +5/-0

Add changeset for CA-root fallback on certless systems

• Documents that installs no longer crash when the system certificate store is empty/absent. Notes that system/.npmrc/NODE_EXTRA_CA_CERTS continue to take precedence when present.

.changeset/install-without-system-ca-certificates.md

tls.rsDocument trust-store fallback behavior alongside NODE_EXTRA_CA_CERTS +15/-7

Document trust-store fallback behavior alongside NODE_EXTRA_CA_CERTS

• Updates module docs to describe both environment-driven extra roots and the platform-to-bundled trust-store fallback used for installs.

pnpm/crates/network/src/tls.rs

Other (3) +9 / -6
Cargo.lockRecord webpki-root-certs as a direct dependency consumer +1/-0

Record webpki-root-certs as a direct dependency consumer

• Updates the lockfile to reflect webpki-root-certs being used directly by the workspace/network crate (previously only transitive).

Cargo.lock

Cargo.tomlPromote webpki-root-certs to workspace dependency +1/-0

Promote webpki-root-certs to workspace dependency

• Adds webpki-root-certs to workspace dependencies so crates can rely on the bundled Mozilla root set consistently.

Cargo.toml

Cargo.tomlAdd webpki-root-certs dependency to network crate +7/-6

Add webpki-root-certs dependency to network crate

• Extends pnpm/crates/network to depend on webpki-root-certs to support bundled-root fallback during reqwest client construction.

pnpm/crates/network/Cargo.toml

@greptile-apps

greptile-apps Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "fix(network): report the bundled-roots r..." | Re-trigger Greptile

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 2, 2026
@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Action required

1. Fallback drops custom CAs ✗ Dismissed 🐞 Bug ⛨ Security
Description
In the bundled-roots fallback path, tls_certs_only(...) is applied after NODE_EXTRA_CA_CERTS and
.npmrc ca/cafile roots are added via add_root_certificate, which can result in those
higher-priority custom roots being ignored if tls_certs_only replaces the root set. This can break
installs that rely on custom CAs (internal registries/corporate TLS) and violates the intended
precedence described in the code comments.
Code

pnpm/crates/network/src/lib.rs[R423-425]

+            if trust_roots == TrustRoots::Bundled {
+                builder = builder.tls_certs_only(bundled_root_certs().iter().cloned());
+            }
Relevance

●●● Strong

Security/compat issue: custom CA precedence is important; likely fix to avoid tls_certs_only wiping
added roots.

PR-#13371

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
make_builder adds extra CA roots and .npmrc CA roots via add_root_certificate before calling
tls_certs_only(...) in the bundled fallback; since apply_tls adds .npmrc CAs through
add_root_certificate, any root-store-resetting operation after it risks discarding those custom
roots.

pnpm/crates/network/src/lib.rs[417-425]
pnpm/crates/network/src/lib.rs[795-820]

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

## Issue description
The bundled-roots fallback uses `builder.tls_certs_only(bundled_root_certs(...))` after adding `NODE_EXTRA_CA_CERTS` and `.npmrc` CA roots with `add_root_certificate`. If `tls_certs_only` replaces the configured root set (as its name implies), it can discard the previously-added custom roots and make internal/corporate registries fail TLS verification.

## Issue Context
`make_builder` currently adds extra certs (`NODE_EXTRA_CA_CERTS`), then applies `.npmrc` TLS (`apply_tls` adds CA roots), and only then switches to bundled roots for the fallback. The comments state `.npmrc` and env-provided roots keep taking precedence whenever available.

## Fix Focus Areas
- pnpm/crates/network/src/lib.rs[407-425]

## Suggested fix direction
In the `TrustRoots::Bundled` path, apply the bundled trust roots *before* adding any custom roots, so subsequent `add_root_certificate` calls (NODE_EXTRA_CA_CERTS and `apply_tls`’s `.npmrc` CAs) remain additive on top of the bundled set. Concretely:
- Move the `if trust_roots == TrustRoots::Bundled { builder = builder.tls_certs_only(...); }` block to run immediately after `default_client_builder(settings)` and before the loops that add extra/root certs and before `apply_tls(...)`.

This preserves the intended trust union while still disabling the platform verifier only for the fallback build.

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



Remediation recommended

2. Fallback on any build error 🐞 Bug ⛨ Security
Description
The fallback to bundled Mozilla roots is triggered for any reqwest::ClientBuilder::build() error
from the platform attempt, not specifically the “no system trust store loaded” failure it is
documented to address. This can silently change trust anchors and mask unrelated
configuration/permission errors by retrying with a different trust model.
Code

pnpm/crates/network/src/lib.rs[R433-437]

+            match make_builder(effective_tls, TrustRoots::Platform)?.build() {
+                Ok(client) => Ok(client),
+                Err(platform_error) => make_builder(effective_tls, TrustRoots::Bundled)?
+                    .build()
+                    .map_err(|_| ForInstallsError::ClientBuild(platform_error)),
Relevance

●●● Strong

They’ve accepted narrowing fallback/retry to specific failure classes; falling back on any build
error seems too broad.

PR-#12648

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The code comments state bundled roots are for when the platform verifier cannot be constructed, but
the implementation falls back on any platform build() error.

pnpm/crates/network/src/lib.rs[668-687]
pnpm/crates/network/src/lib.rs[432-438]

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

## Issue description
The code falls back from `TrustRoots::Platform` to `TrustRoots::Bundled` on *any* `builder.build()` error. This is broader than the documented intent (“only when the platform verifier cannot be constructed at all”), and can unexpectedly switch trust anchors for unrelated builder failures.

## Issue Context
`TrustRoots::Bundled` is documented as a narrow fallback for machines with no trust store. However, the current implementation retries with bundled roots whenever platform build fails for any reason.

## Fix Focus Areas
- pnpm/crates/network/src/lib.rs[432-438]
- pnpm/crates/network/src/lib.rs[668-688]

## Suggested fix direction
- Detect the specific platform-verifier failure mode (e.g., matching the known error text like "No CA certificates were loaded from the system" or another stable discriminator available from `reqwest::Error` / its source chain).
- Only attempt `TrustRoots::Bundled` when that discriminator matches.
- Otherwise, return `Err(ForInstallsError::ClientBuild(platform_error))` immediately (no retry), keeping trust-anchor behavior predictable and errors actionable.

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


3. Workspace-scoped webpki-root-certs dependency 📘 Rule violation ⚙ Maintainability
Description
webpki-root-certs is added at the workspace/root level even though the only visible consumer in
this PR is pnpm/crates/network, which increases workspace-wide coupling for a leaf-only need. Per
the checklist, new dependencies should be declared in the most specific package unless they are
shared by multiple packages.
Code

Cargo.toml[187]

+webpki-root-certs  = { version = "1.0.7" }
Relevance

●● Moderate

Team sometimes centralizes deps; no close precedent on workspace-vs-crate placement for new Rust
deps.

PR-#11760

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires adding new dependencies only to the most specific package that needs them (PR
Compliance ID 713438). The workspace/root adds webpki-root-certs, while the changed code shows
usage in pnpm/crates/network via webpki_root_certs::TLS_SERVER_ROOT_CERTS, indicating a
leaf-level consumer.

Rule 713438: Add new dependencies only to the most specific package that requires them
Cargo.toml[184-188]
pnpm/crates/network/Cargo.toml[13-21]
pnpm/crates/network/src/lib.rs[694-699]

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

## Issue description
`webpki-root-certs` is declared in `[workspace.dependencies]` even though it appears to be used only by `pnpm/crates/network`.

## Issue Context
Keeping leaf-only deps out of workspace/root dependency sets reduces unnecessary coupling and makes it clearer which crate owns/needs the dependency.

## Fix Focus Areas
- Cargo.toml[184-188]
- pnpm/crates/network/Cargo.toml[13-21]

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



Informational

4. ClientBuild loses platform context 🐞 Bug ◔ Observability ⭐ New
Description
ForInstallsError::ClientBuild’s Display string only prints the bundled-retry error even though the
platform-build error is the one that best explains the environment. In JSON error mode, the CLI
serializes only the top-level message, so the platform failure can be omitted entirely when both
builds fail, reducing diagnosability.
Code

pnpm/crates/network/src/lib.rs[R879-882]

+    #[display("Failed to build the HTTP client (retry with bundled CA roots: {bundled})")]
+    ClientBuild {
+        #[error(source)]
+        platform: reqwest::Error,
Relevance

●●● Strong

Team often accepts improving user-facing diagnostics; including platform failure context prevents
JSON output losing key cause.

PR-#13203
PR-#13195
PR-#13202

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
ClientBuild’s Display renders only the bundled error while platform is the only source, and the
CLI’s JSON error message intentionally returns only the first message from the error chain—so the
platform error won’t be included in JSON output.

pnpm/crates/network/src/lib.rs[874-884]
pnpm/crates/cli/src/cli_args/dispatch.rs[496-503]

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

### Issue description
`ForInstallsError::ClientBuild` stores both the platform build error and the bundled-roots retry error, but its `Display` message only includes the bundled error while marking the platform error as `source`. The CLI’s JSON error formatter uses only the first error-chain message, so JSON output can drop the platform failure entirely.

### Issue Context
- `ClientBuild` currently displays only `{bundled}` and uses `platform` as `source`.
- JSON error output uses only the first chain message (`error.chain().next()`), so it will emit only the `Display` string and not the source chain.

### Fix Focus Areas
- pnpm/crates/network/src/lib.rs[874-884]
- pnpm/crates/cli/src/cli_args/dispatch.rs[496-503]

### Suggested fix
1. Update the `#[display(...)]` for `ClientBuild` to include *both* errors (at least include `{platform}` in the message), e.g.:
  - `Failed to build the HTTP client (platform trust store: {platform}; retry with bundled CA roots: {bundled})`
  This ensures JSON output includes the platform error even when sources aren’t serialized.
2. (Optional, more general) Improve `json_error_message` to include more of the chain (e.g., join first two messages) for better diagnostics across error types.

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


5. Fallback hides second error ✓ Resolved 🐞 Bug ◔ Observability
Description
When both the platform and bundled client builds fail, the returned ClientBuild error always
carries the platform error and drops the bundled error context. This reduces diagnosability in the
double-failure case because the user can’t see why the fallback build failed.
Code

pnpm/crates/network/src/lib.rs[R435-437]

+                Err(platform_error) => make_builder(effective_tls, TrustRoots::Bundled)?
+                    .build()
+                    .map_err(|_| ForInstallsError::ClientBuild(platform_error)),
Relevance

●● Moderate

Improves diagnostics but adds error-shaping complexity; team sometimes prefers preserving primary
error only.

PR-#12210

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The fallback error mapping ignores the bundled build’s error (map_err(|_| ...)), so only the
platform error is ever surfaced.

pnpm/crates/network/src/lib.rs[435-438]
pnpm/crates/network/src/lib.rs[874-879]

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

## Issue description
If the platform build fails and the bundled fallback build also fails, the code returns `ClientBuild(platform_error)` and discards the bundled error. That can make debugging harder because the final failure reason is lost.

## Issue Context
The enum docs say `ClientBuild` carries the platform-verifier attempt’s error, which is useful, but preserving the bundled error as additional context would help troubleshoot the rare double-failure scenario.

## Fix Focus Areas
- pnpm/crates/network/src/lib.rs[432-438]
- pnpm/crates/network/src/lib.rs[874-879]

## Suggested fix direction
Consider extending `ForInstallsError::ClientBuild` to carry both errors (e.g., `ClientBuild { platform: reqwest::Error, bundled: reqwest::Error }`) or wrapping the bundled error as additional context in the diagnostic message while keeping the platform error as the primary source.

ⓘ 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 5dfb999

Results up to commit 0611786 ⚖️ Balanced


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


Action required
1. Fallback drops custom CAs ✗ Dismissed 🐞 Bug ⛨ Security
Description
In the bundled-roots fallback path, tls_certs_only(...) is applied after NODE_EXTRA_CA_CERTS and
.npmrc ca/cafile roots are added via add_root_certificate, which can result in those
higher-priority custom roots being ignored if tls_certs_only replaces the root set. This can break
installs that rely on custom CAs (internal registries/corporate TLS) and violates the intended
precedence described in the code comments.
Code

pnpm/crates/network/src/lib.rs[R423-425]

+            if trust_roots == TrustRoots::Bundled {
+                builder = builder.tls_certs_only(bundled_root_certs().iter().cloned());
+            }
Relevance

●●● Strong

Security/compat issue: custom CA precedence is important; likely fix to avoid tls_certs_only wiping
added roots.

PR-#13371

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
make_builder adds extra CA roots and .npmrc CA roots via add_root_certificate before calling
tls_certs_only(...) in the bundled fallback; since apply_tls adds .npmrc CAs through
add_root_certificate, any root-store-resetting operation after it risks discarding those custom
roots.

pnpm/crates/network/src/lib.rs[417-425]
pnpm/crates/network/src/lib.rs[795-820]

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

## Issue description
The bundled-roots fallback uses `builder.tls_certs_only(bundled_root_certs(...))` after adding `NODE_EXTRA_CA_CERTS` and `.npmrc` CA roots with `add_root_certificate`. If `tls_certs_only` replaces the configured root set (as its name implies), it can discard the previously-added custom roots and make internal/corporate registries fail TLS verification.

## Issue Context
`make_builder` currently adds extra certs (`NODE_EXTRA_CA_CERTS`), then applies `.npmrc` TLS (`apply_tls` adds CA roots), and only then switches to bundled roots for the fallback. The comments state `.npmrc` and env-provided roots keep taking precedence whenever available.

## Fix Focus Areas
- pnpm/crates/network/src/lib.rs[407-425]

## Suggested fix direction
In the `TrustRoots::Bundled` path, apply the bundled trust roots *before* adding any custom roots, so subsequent `add_root_certificate` calls (NODE_EXTRA_CA_CERTS and `apply_tls`’s `.npmrc` CAs) remain additive on top of the bundled set. Concretely:
- Move the `if trust_roots == TrustRoots::Bundled { builder = builder.tls_certs_only(...); }` block to run immediately after `default_client_builder(settings)` and before the loops that add extra/root certs and before `apply_tls(...)`.

This preserves the intended trust union while still disabling the platform verifier only for the fallback build.

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



Remediation recommended
2. Fallback on any build error 🐞 Bug ⛨ Security
Description
The fallback to bundled Mozilla roots is triggered for any reqwest::ClientBuilder::build() error
from the platform attempt, not specifically the “no system trust store loaded” failure it is
documented to address. This can silently change trust anchors and mask unrelated
configuration/permission errors by retrying with a different trust model.
Code

pnpm/crates/network/src/lib.rs[R433-437]

+            match make_builder(effective_tls, TrustRoots::Platform)?.build() {
+                Ok(client) => Ok(client),
+                Err(platform_error) => make_builder(effective_tls, TrustRoots::Bundled)?
+                    .build()
+                    .map_err(|_| ForInstallsError::ClientBuild(platform_error)),
Relevance

●●● Strong

They’ve accepted narrowing fallback/retry to specific failure classes; falling back on any build
error seems too broad.

PR-#12648

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The code comments state bundled roots are for when the platform verifier cannot be constructed, but
the implementation falls back on any platform build() error.

pnpm/crates/network/src/lib.rs[668-687]
pnpm/crates/network/src/lib.rs[432-438]

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

## Issue description
The code falls back from `TrustRoots::Platform` to `TrustRoots::Bundled` on *any* `builder.build()` error. This is broader than the documented intent (“only when the platform verifier cannot be constructed at all”), and can unexpectedly switch trust anchors for unrelated builder failures.

## Issue Context
`TrustRoots::Bundled` is documented as a narrow fallback for machines with no trust store. However, the current implementation retries with bundled roots whenever platform build fails for any reason.

## Fix Focus Areas
- pnpm/crates/network/src/lib.rs[432-438]
- pnpm/crates/network/src/lib.rs[668-688]

## Suggested fix direction
- Detect the specific platform-verifier failure mode (e.g., matching the known error text like "No CA certificates were loaded from the system" or another stable discriminator available from `reqwest::Error` / its source chain).
- Only attempt `TrustRoots::Bundled` when that discriminator matches.
- Otherwise, return `Err(ForInstallsError::ClientBuild(platform_error))` immediately (no retry), keeping trust-anchor behavior predictable and errors actionable.

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


3. Workspace-scoped webpki-root-certs dependency 📘 Rule violation ⚙ Maintainability
Description
webpki-root-certs is added at the workspace/root level even though the only visible consumer in
this PR is pnpm/crates/network, which increases workspace-wide coupling for a leaf-only need. Per
the checklist, new dependencies should be declared in the most specific package unless they are
shared by multiple packages.
Code

Cargo.toml[187]

+webpki-root-certs  = { version = "1.0.7" }
Relevance

●● Moderate

Team sometimes centralizes deps; no close precedent on workspace-vs-crate placement for new Rust
deps.

PR-#11760

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires adding new dependencies only to the most specific package that needs them (PR
Compliance ID 713438). The workspace/root adds webpki-root-certs, while the changed code shows
usage in pnpm/crates/network via webpki_root_certs::TLS_SERVER_ROOT_CERTS, indicating a
leaf-level consumer.

Rule 713438: Add new dependencies only to the most specific package that requires them
Cargo.toml[184-188]
pnpm/crates/network/Cargo.toml[13-21]
pnpm/crates/network/src/lib.rs[694-699]

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

## Issue description
`webpki-root-certs` is declared in `[workspace.dependencies]` even though it appears to be used only by `pnpm/crates/network`.

## Issue Context
Keeping leaf-only deps out of workspace/root dependency sets reduces unnecessary coupling and makes it clearer which crate owns/needs the dependency.

## Fix Focus Areas
- Cargo.toml[184-188]
- pnpm/crates/network/Cargo.toml[13-21]

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



Informational
4. Fallback hides second error ✓ Resolved 🐞 Bug ◔ Observability
Description
When both the platform and bundled client builds fail, the returned ClientBuild error always
carries the platform error and drops the bundled error context. This reduces diagnosability in the
double-failure case because the user can’t see why the fallback build failed.
Code

pnpm/crates/network/src/lib.rs[R435-437]

+                Err(platform_error) => make_builder(effective_tls, TrustRoots::Bundled)?
+                    .build()
+                    .map_err(|_| ForInstallsError::ClientBuild(platform_error)),
Relevance

●● Moderate

Improves diagnostics but adds error-shaping complexity; team sometimes prefers preserving primary
error only.

PR-#12210

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The fallback error mapping ignores the bundled build’s error (map_err(|_| ...)), so only the
platform error is ever surfaced.

pnpm/crates/network/src/lib.rs[435-438]
pnpm/crates/network/src/lib.rs[874-879]

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

## Issue description
If the platform build fails and the bundled fallback build also fails, the code returns `ClientBuild(platform_error)` and discards the bundled error. That can make debugging harder because the final failure reason is lost.

## Issue Context
The enum docs say `ClientBuild` carries the platform-verifier attempt’s error, which is useful, but preserving the bundled error as additional context would help troubleshoot the rare double-failure scenario.

## Fix Focus Areas
- pnpm/crates/network/src/lib.rs[432-438]
- pnpm/crates/network/src/lib.rs[874-879]

## Suggested fix direction
Consider extending `ForInstallsError::ClientBuild` to carry both errors (e.g., `ClientBuild { platform: reqwest::Error, bundled: reqwest::Error }`) or wrapping the bundled error as additional context in the diagnostic message while keeping the platform error as the primary source.

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


Qodo Logo

Comment thread pnpm/crates/network/src/lib.rs Resolved
@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.

@github-actions

github-actions Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     11.4±0.22ms    32.8 MB/sec    1.03     11.8±0.05ms    31.7 MB/sec
packument/parse                                  1.05     37.6±0.09µs  1764.5 MB/sec    1.00     36.0±0.10µs  1844.0 MB/sec
tarball/download_dependency                      1.00      2.3±0.06ms  1904.7 KB/sec    1.02      2.3±0.05ms  1871.1 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    170.8±1.09ms 93.7 KElem/sec    1.01    172.0±3.51ms 93.0 KElem/sec
workspace_resolution/hoist_heavy                 1.03    247.6±0.62ms        ? ?/sec    1.00    240.2±0.87ms        ? ?/sec

When both client builds fail, the platform-verifier error stays the
diagnostic's source — it is the one that describes the environment — but
the retry's own error is now spelled out in the message, since the two
can differ.

Also pin, in the regression test, that a configured `ca` keeps the
platform verifier constructible: a user with custom roots never reaches
the bundled fallback at all.
@codecov-commenter

codecov-commenter commented Aug 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.99%. Comparing base (2d30dd6) to head (5dfb999).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13593   +/-   ##
=======================================
  Coverage   87.98%   87.99%           
=======================================
  Files         565      565           
  Lines       97856    97876   +20     
=======================================
+ Hits        86101    86122   +21     
+ Misses      11755    11754    -1     

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

Copilot AI review requested due to automatic review settings August 2, 2026 15:23

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 2, 2026

Copy link
Copy Markdown
Member Author

Thanks — responses to the four findings.

1. "Fallback drops custom CAs" — not reproducible; answered inline. tls_certs_only extends reqwest's config.root_certs and only sets a flag that disables the platform/native roots; previously added roots are preserved and end up in the same rustls store. Separately, a configured custom root keeps the platform verifier constructible, so that path is not even reached when custom CAs exist — now pinned by an assertion in the regression test (5dfb999).

2. "Fallback on any build error" — deliberate, and the alternative is worse. The suggested discriminator is the string "No CA certificates were loaded from the system", which is a rustls::Error::General message with no stability guarantee; matching on it would silently stop working on any rustls/rustls-platform-verifier bump and hand the user back a hard failure on a system pnpm 11 installs fine on. The retry is not a blind "try something else": the two builds differ only in the trust-root source, so a failure with any other cause (bad client identity, invalid TLS versions, bad proxy config) fails identically on the retry and the original platform error is returned unchanged. Nothing is masked, and no error class can be "fixed" by the retry except a trust-store one.

3. "Workspace-scoped webpki-root-certs" — this is the repo's required convention, not a deviation. pnpm/AGENTS.md ("Things not to do"): "Do not add a dependency that is not already declared in [workspace.dependencies] … ask the human to approve it and to add it to [workspace.dependencies]". Every pacquet crate dependency is declared as { workspace = true }; the crate-level entry in pnpm/crates/network/Cargo.toml is what scopes it to the one consumer. Approval for this crate was obtained before adding it.

4. "Fallback hides second error" — fair, fixed in 5dfb999. ForInstallsError::ClientBuild now carries both errors: the platform attempt stays the diagnostic's source (it describes the environment), and the bundled-roots retry's own error is spelled out in the message.


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

@qodo-code-review

Copy link
Copy Markdown

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

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

🧹 Nitpick comments (1)
pnpm/crates/network/src/tests.rs (1)

779-787: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep the client-build error in the test failure.

is_ok() discards the reqwest build error. If this assertion fails, the test reports only the fixed message. Use .expect(...) or print the error before asserting.

As per path instructions, tests must log complex assertion inputs or multi-line errors before non-equality assertions.

Proposed change
-    assert!(
-        reqwest::Client::builder()
-            .add_root_certificate(
-                reqwest::Certificate::from_pem(ca.as_bytes()).expect("parse test ca fixture")
-            )
-            .build()
-            .is_ok(),
-        "a custom CA root keeps the platform verifier constructible",
-    );
+    reqwest::Client::builder()
+        .add_root_certificate(
+            reqwest::Certificate::from_pem(ca.as_bytes()).expect("parse test ca fixture")
+        )
+        .build()
+        .expect("a custom CA root keeps the platform verifier constructible");
🤖 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/network/src/tests.rs` around lines 779 - 787, Update the reqwest
client construction assertion in the test to preserve and report the build error
instead of discarding it with is_ok(). Use expect or equivalent error-reporting
before the non-equality assertion, while retaining the existing custom CA setup
and success message.

Source: Path instructions

🤖 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/network/src/tests.rs`:
- Around line 779-787: Update the reqwest client construction assertion in the
test to preserve and report the build error instead of discarding it with
is_ok(). Use expect or equivalent error-reporting before the non-equality
assertion, while retaining the existing custom CA setup and success message.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 92bc7ddb-41bb-4def-8296-ddc8a2d0ae08

📥 Commits

Reviewing files that changed from the base of the PR and between 0611786 and 5dfb999.

📒 Files selected for processing (2)
  • pnpm/crates/network/src/lib.rs
  • pnpm/crates/network/src/tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/network/src/lib.rs

@zkochan

zkochan commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

Re the new finding "ClientBuild loses platform context" — the premise doesn't hold for pacquet.

There is no JSON fatal-error mode here. Every fatal error leaves pacquet-cli through eprintln!("Error: {error:?}") (pnpm/crates/cli/src/lib.rs), i.e. miette's Debug rendering under the handler installed by pacquet-diagnostics. That handler walks the whole Error::source chain and prints each level as a ╰─▶ cause — it only drops a level when the line above it restates it verbatim (restates in collapsed_chain.rs). platform is the #[error(source)] field, so it renders as that cause. It is the same mechanism that surfaced General("No CA certificates were loaded from the system") under the panic in the original report.

Putting the platform error into the Display string as well would be actively counterproductive: the collapsing handler would then recognise the cause as restated and drop it, so the output would be no richer — just duplicated in one line instead of two.

Findings 2 and 3 are unchanged from the previous pass and were answered in #13593 (comment).


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

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 5dfb999e7b01

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.500 ± 0.141 2.347 2.741 1.66 ± 0.22
pacquet@main 2.537 ± 0.163 2.343 2.795 1.68 ± 0.22
pnpr@HEAD 1.507 ± 0.176 1.351 1.783 1.00
pnpr@main 1.544 ± 0.170 1.354 1.787 1.02 ± 0.16
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.49951967366,
      "stddev": 0.14145149350108266,
      "median": 2.45372462016,
      "user": 1.4873218599999998,
      "system": 1.32036646,
      "min": 2.34722117516,
      "max": 2.74089293816,
      "times": [
        2.5797413111600003,
        2.4193942501600003,
        2.70211495116,
        2.74089293816,
        2.36048857416,
        2.56193306416,
        2.34722117516,
        2.38006633516,
        2.41528914716,
        2.48805499016
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.53678732866,
      "stddev": 0.16256197714138412,
      "median": 2.5311529321600004,
      "user": 1.46956286,
      "system": 1.2929908600000002,
      "min": 2.34283162616,
      "max": 2.79524116716,
      "times": [
        2.46663687416,
        2.62914780016,
        2.59356373716,
        2.46874212716,
        2.69118634516,
        2.3593192011600004,
        2.34415431516,
        2.34283162616,
        2.79524116716,
        2.67705009316
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5066332772600002,
      "stddev": 0.1760900261420681,
      "median": 1.44377181066,
      "user": 1.0664816600000004,
      "system": 1.11402526,
      "min": 1.35065333716,
      "max": 1.78294491916,
      "times": [
        1.35065333716,
        1.35182131416,
        1.35671524416,
        1.52775089216,
        1.35703132916,
        1.39763411416,
        1.48990950716,
        1.7062557061599999,
        1.74561640916,
        1.78294491916
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5439114958599998,
      "stddev": 0.1701790368122762,
      "median": 1.5439959241599999,
      "user": 1.03488786,
      "system": 1.1310958599999998,
      "min": 1.3542172021599999,
      "max": 1.7866116591599999,
      "times": [
        1.3572054651599998,
        1.5058068011599999,
        1.58218504716,
        1.78622502116,
        1.3644299891599998,
        1.3542172021599999,
        1.7866116591599999,
        1.6474866631599998,
        1.64102352116,
        1.41392358916
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 252.7 ± 9.3 238.2 269.6 1.00
pacquet@main 258.1 ± 6.8 249.8 274.5 1.02 ± 0.05
pnpr@HEAD 269.4 ± 8.8 258.6 286.2 1.07 ± 0.05
pnpr@main 267.3 ± 8.4 247.9 276.0 1.06 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25272600116,
      "stddev": 0.00926910279696391,
      "median": 0.25145812456000005,
      "user": 0.2232662,
      "system": 0.48002046,
      "min": 0.23818728306000003,
      "max": 0.26959308806000004,
      "times": [
        0.24626435206000002,
        0.26167738306000005,
        0.25281106106,
        0.26959308806000004,
        0.23818728306000003,
        0.24356508206000002,
        0.24990222706000004,
        0.25010518806000004,
        0.25977416306,
        0.25538018406
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.25805954206000004,
      "stddev": 0.006818925811367632,
      "median": 0.25734461056,
      "user": 0.2010568,
      "system": 0.5445077599999999,
      "min": 0.24981848906000004,
      "max": 0.27454676906000003,
      "times": [
        0.25931214306,
        0.25610909606000004,
        0.25744142306,
        0.24981848906000004,
        0.25724779806000003,
        0.25073336106000005,
        0.26126312406,
        0.25884966306,
        0.25527355406,
        0.27454676906000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26939046086000007,
      "stddev": 0.008750033549733298,
      "median": 0.27107335806,
      "user": 0.2220568,
      "system": 0.5082852599999998,
      "min": 0.25859276006000004,
      "max": 0.28621149806,
      "times": [
        0.26078476506000003,
        0.25866179906000003,
        0.27428429506,
        0.27116648806000004,
        0.28621149806,
        0.27621030906000005,
        0.27098022806,
        0.27187243806,
        0.26514002806000003,
        0.25859276006000004
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.2673072120600001,
      "stddev": 0.008432967148546976,
      "median": 0.26737649506000005,
      "user": 0.2033376,
      "system": 0.52584926,
      "min": 0.24787528906000003,
      "max": 0.27604692806000003,
      "times": [
        0.26693036806000003,
        0.26565489806000003,
        0.27392523706000005,
        0.24787528906000003,
        0.26667310006,
        0.26782262206,
        0.26022838306,
        0.27422929906000004,
        0.27604692806000003,
        0.27368599606000005
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.614 ± 0.022 2.585 2.643 1.66 ± 0.19
pacquet@main 2.609 ± 0.023 2.568 2.641 1.66 ± 0.19
pnpr@HEAD 1.572 ± 0.176 1.423 1.862 1.00
pnpr@main 1.618 ± 0.113 1.439 1.756 1.03 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.61440439948,
      "stddev": 0.022166721402519022,
      "median": 2.6119984682800004,
      "user": 1.46924008,
      "system": 1.3545253799999997,
      "min": 2.58479973428,
      "max": 2.6425759712800003,
      "times": [
        2.62041938828,
        2.6362789712800003,
        2.6425759712800003,
        2.59645366328,
        2.63848373128,
        2.58479973428,
        2.63367881828,
        2.59232032428,
        2.60357754828,
        2.59545584428
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.60883243818,
      "stddev": 0.023224594970212065,
      "median": 2.6070078152800003,
      "user": 1.4795705799999999,
      "system": 1.3171877799999998,
      "min": 2.56845814428,
      "max": 2.6412312202800003,
      "times": [
        2.5917962992800003,
        2.60891423928,
        2.56845814428,
        2.6412312202800003,
        2.63776621328,
        2.6320831942800003,
        2.60032471228,
        2.6051013912800003,
        2.5889222052800003,
        2.6137267622800002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.57241259318,
      "stddev": 0.17625206301676838,
      "median": 1.4588967287799999,
      "user": 1.0427419800000002,
      "system": 1.14513018,
      "min": 1.4227534072799999,
      "max": 1.86234180728,
      "times": [
        1.43666969328,
        1.4227534072799999,
        1.67646154428,
        1.81569848528,
        1.7197601622799998,
        1.44484232128,
        1.46184783228,
        1.4559456252799998,
        1.42780505328,
        1.86234180728
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.61801379588,
      "stddev": 0.11333243474853875,
      "median": 1.65309948778,
      "user": 0.98425418,
      "system": 1.15445288,
      "min": 1.4388443652799998,
      "max": 1.75552938128,
      "times": [
        1.70304527828,
        1.65688708028,
        1.57021053528,
        1.75552938128,
        1.67214835828,
        1.64931189528,
        1.4492329042799998,
        1.7423804572800001,
        1.4388443652799998,
        1.54254770328
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 395.5 ± 13.3 372.2 421.6 1.30 ± 0.05
pacquet@main 382.3 ± 13.5 359.4 403.2 1.26 ± 0.05
pnpr@HEAD 304.1 ± 7.0 292.3 318.5 1.00
pnpr@main 309.3 ± 9.6 299.1 327.1 1.02 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.39553641684,
      "stddev": 0.013316936160896322,
      "median": 0.39451765264000005,
      "user": 0.4998436399999999,
      "system": 0.7084087200000001,
      "min": 0.37224260014000005,
      "max": 0.42162884514000004,
      "times": [
        0.37224260014000005,
        0.38807463414000004,
        0.39436372714,
        0.39825195514000006,
        0.39353732214000003,
        0.39467157814000003,
        0.42162884514000004,
        0.41072729114000006,
        0.39482765114,
        0.38703856414000004
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.38232905994000005,
      "stddev": 0.013544133417398666,
      "median": 0.37780502914,
      "user": 0.52213854,
      "system": 0.64689482,
      "min": 0.35935120214000005,
      "max": 0.40315229614000003,
      "times": [
        0.37615187814,
        0.38620346314000004,
        0.37684091514,
        0.39097806814,
        0.37292106714,
        0.37876914314000004,
        0.40227511614000006,
        0.40315229614000003,
        0.35935120214000005,
        0.37664745014
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30410127244000007,
      "stddev": 0.007024076840915631,
      "median": 0.30307277814,
      "user": 0.19906333999999998,
      "system": 0.52798162,
      "min": 0.29228425614000003,
      "max": 0.31849762514,
      "times": [
        0.30025499614,
        0.30435535214000004,
        0.30179020414,
        0.30812714814000003,
        0.31849762514,
        0.30063666314000004,
        0.30023533814000003,
        0.30984629414000003,
        0.29228425614000003,
        0.30498484714
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30925771124,
      "stddev": 0.009557711930660141,
      "median": 0.30546029114000006,
      "user": 0.20631323999999998,
      "system": 0.53640602,
      "min": 0.29908713914,
      "max": 0.32708829014,
      "times": [
        0.31110578514000004,
        0.32708829014,
        0.30341159614,
        0.30611619514000005,
        0.30480438714,
        0.29908713914,
        0.30115933814,
        0.32475311614,
        0.31082666014000004,
        0.30422460514000005
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.735 ± 0.008 1.722 1.750 5.73 ± 0.15
pacquet@main 1.730 ± 0.008 1.718 1.747 5.71 ± 0.15
pnpr@HEAD 0.303 ± 0.008 0.296 0.321 1.00
pnpr@main 0.304 ± 0.006 0.295 0.315 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.73524800062,
      "stddev": 0.007837648942641006,
      "median": 1.7362195017200002,
      "user": 0.71556844,
      "system": 0.7598788999999998,
      "min": 1.72151438972,
      "max": 1.74972147972,
      "times": [
        1.7374885907200002,
        1.7312107367200003,
        1.74034242972,
        1.72722344272,
        1.74972147972,
        1.7349504127200002,
        1.73825701472,
        1.72151438972,
        1.73181498472,
        1.73995652472
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.7299898255200001,
      "stddev": 0.008073551424946016,
      "median": 1.73075016472,
      "user": 0.7215578399999999,
      "system": 0.7435442999999999,
      "min": 1.7178633407200001,
      "max": 1.74708530972,
      "times": [
        1.7229323597200001,
        1.7301754287200002,
        1.73190805872,
        1.7178633407200001,
        1.74708530972,
        1.7222862837200001,
        1.7332291647200002,
        1.73449144072,
        1.7286019677200002,
        1.73132490072
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30287506042,
      "stddev": 0.00761015731806572,
      "median": 0.30027053822000005,
      "user": 0.19202883999999998,
      "system": 0.5327420999999999,
      "min": 0.29606673772000003,
      "max": 0.32089359672,
      "times": [
        0.30029212872,
        0.30024894772000005,
        0.29606673772000003,
        0.32089359672,
        0.30434183972,
        0.29934724072,
        0.30641208572,
        0.29641445172,
        0.29656687872000004,
        0.30816669672
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30361029392,
      "stddev": 0.00631237450372882,
      "median": 0.30457857022,
      "user": 0.21346363999999998,
      "system": 0.5256219,
      "min": 0.29544433672000003,
      "max": 0.31541049772,
      "times": [
        0.29788069072,
        0.29544433672000003,
        0.29763983772,
        0.30464230572,
        0.30530420972,
        0.30567581972,
        0.31081123472,
        0.30451483472,
        0.31541049772,
        0.29877917172
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 178.4 ± 5.3 171.6 188.2 2.05 ± 0.07
pacquet@main 176.5 ± 2.5 173.2 181.0 2.03 ± 0.04
pnpr@HEAD 87.3 ± 1.5 84.3 91.4 1.00 ± 0.02
pnpr@main 87.1 ± 1.1 82.8 88.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.17844322760705883,
      "stddev": 0.00528276975821899,
      "median": 0.18088804196,
      "user": 0.16201474823529408,
      "system": 0.07220737882352943,
      "min": 0.17159372196,
      "max": 0.18817985396,
      "times": [
        0.17194298996000001,
        0.17258391496,
        0.18356099296,
        0.17314880896,
        0.17203588396,
        0.18207896396,
        0.17330496296,
        0.18088804196,
        0.18153180396000002,
        0.18174200996,
        0.18195637296,
        0.18249776096,
        0.18358791296000002,
        0.17159372196,
        0.18817985396,
        0.17781671296,
        0.17508415996
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.17646750614749998,
      "stddev": 0.0025253378398010086,
      "median": 0.17555309796000002,
      "user": 0.16315747249999998,
      "system": 0.0648498825,
      "min": 0.17316619996000002,
      "max": 0.18100247696,
      "times": [
        0.18023655496000002,
        0.18100247696,
        0.17904446396,
        0.17522301196,
        0.17419093996,
        0.17358644196,
        0.17414410096,
        0.17571223296,
        0.17485466896000001,
        0.17611238596,
        0.17536786496,
        0.17316619996000002,
        0.17765667196,
        0.17539396296,
        0.17746774596,
        0.18032037396
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08728884238424243,
      "stddev": 0.0014715571179588782,
      "median": 0.08717327596,
      "user": 0.02073082666666666,
      "system": 0.009602240000000001,
      "min": 0.08425378096,
      "max": 0.09140113295999999,
      "times": [
        0.08529585696,
        0.08761929996,
        0.08673537596,
        0.08777489196,
        0.08729149196,
        0.08764187596,
        0.09130925896,
        0.08755093695999999,
        0.08536228796,
        0.08693938496,
        0.08761139096,
        0.08763971296,
        0.08699328696,
        0.08804411496,
        0.08644211996,
        0.08692635096,
        0.08809081296,
        0.08613290796,
        0.08738876196,
        0.08827268396,
        0.08576321196,
        0.08717327596,
        0.08912682196,
        0.08693314496,
        0.08771208996,
        0.08692694296,
        0.08518958196,
        0.08662123596,
        0.08425378096,
        0.09140113295999999,
        0.08872859296,
        0.08708990896,
        0.08654927196
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08710869299125,
      "stddev": 0.0010965353141733835,
      "median": 0.08730787496,
      "user": 0.0204914725,
      "system": 0.009531112499999998,
      "min": 0.08280135796,
      "max": 0.08863434596,
      "times": [
        0.08726299495999999,
        0.08666683196,
        0.08773899096,
        0.08745543696,
        0.08658458796,
        0.08631875795999999,
        0.08827150296,
        0.08863434596,
        0.08592274295999999,
        0.08684993696,
        0.08801722496,
        0.08739436296,
        0.08812711096,
        0.08683087196,
        0.08770050696,
        0.08733290696,
        0.08627241096,
        0.08814063596,
        0.08599729296,
        0.08799279896,
        0.08614137396,
        0.08728284296,
        0.08747700796,
        0.08798046596,
        0.08833274896,
        0.08647485096,
        0.08636131796,
        0.08681550296,
        0.08280135796,
        0.08757226695999999,
        0.08806268996,
        0.08666349596
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 881.7 ± 218.9 674.1 1324.6 1.15 ± 0.41
pacquet@main 765.0 ± 193.1 516.1 1062.5 1.00
pnpm@HEAD 2881.4 ± 68.9 2829.0 3051.4 3.77 ± 0.95
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.8816583015533335,
      "stddev": 0.2189373876230933,
      "median": 0.82870098722,
      "user": 0.8104451066666667,
      "system": 0.20136168222222223,
      "min": 0.67406364322,
      "max": 1.3245801402200001,
      "times": [
        0.6816678832199999,
        0.75984352922,
        1.07562610522,
        1.00786336622,
        0.69999440422,
        0.67406364322,
        0.88258465522,
        0.82870098722,
        1.3245801402200001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.7650231764422223,
      "stddev": 0.19307673087728092,
      "median": 0.75838907222,
      "user": 0.6955668844444444,
      "system": 0.17247157111111114,
      "min": 0.5160670682199999,
      "max": 1.06252270422,
      "times": [
        0.80336375322,
        0.6401532062199999,
        1.00756445522,
        0.68922298322,
        0.75838907222,
        0.53277761622,
        0.5160670682199999,
        1.06252270422,
        0.87514772922
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 2.8814236431088887,
      "stddev": 0.068940132507861,
      "median": 2.85679687222,
      "user": 4.4300273288888885,
      "system": 0.2712319044444445,
      "min": 2.82898181922,
      "max": 3.05142575122,
      "times": [
        2.84190157422,
        2.89920080022,
        2.82898181922,
        2.8438122992199997,
        2.89544510222,
        2.85679687222,
        3.05142575122,
        2.88152554822,
        2.83372302122
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.474 ± 0.047 4.419 4.561 1.28 ± 0.03
pacquet@main 4.588 ± 0.172 4.424 4.861 1.31 ± 0.05
pnpr@HEAD 3.547 ± 0.137 3.434 3.877 1.02 ± 0.04
pnpr@main 3.493 ± 0.058 3.437 3.603 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.47403989598,
      "stddev": 0.04743863236961928,
      "median": 4.46125560828,
      "user": 1.6923941999999996,
      "system": 1.31973948,
      "min": 4.41855995228,
      "max": 4.56104205028,
      "times": [
        4.41855995228,
        4.47564342328,
        4.45719436528,
        4.49385267028,
        4.54693301028,
        4.56104205028,
        4.46531685128,
        4.44830715328,
        4.44379155128,
        4.42975793228
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.58839101158,
      "stddev": 0.17246872268966706,
      "median": 4.52014041178,
      "user": 1.6656144999999998,
      "system": 1.3992829800000002,
      "min": 4.42404017128,
      "max": 4.86068517628,
      "times": [
        4.43409232928,
        4.84643044228,
        4.44609397328,
        4.52450492028,
        4.42404017128,
        4.51577590328,
        4.86068517628,
        4.63183932628,
        4.45124277228,
        4.74920510128
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.54709588118,
      "stddev": 0.13654047278116224,
      "median": 3.49560393878,
      "user": 1.1591045999999998,
      "system": 1.2210908799999998,
      "min": 3.43419674028,
      "max": 3.8773143062799997,
      "times": [
        3.63603653928,
        3.46718110128,
        3.53482962428,
        3.43419674028,
        3.47742516928,
        3.44896491228,
        3.45152257528,
        3.51378270828,
        3.8773143062799997,
        3.62970513528
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.4933503845800002,
      "stddev": 0.05760233211590701,
      "median": 3.4684199272800003,
      "user": 1.1355216999999997,
      "system": 1.23608878,
      "min": 3.43745315628,
      "max": 3.60335817428,
      "times": [
        3.5692840432799997,
        3.46368722528,
        3.47315262928,
        3.43745315628,
        3.50037302828,
        3.44399053328,
        3.44960579628,
        3.45651537628,
        3.60335817428,
        3.53608388328
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13593
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,584.80 ms
(-0.05%)Baseline: 2,586.00 ms
3,103.20 ms
(83.29%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,721.51 ms
(-0.67%)Baseline: 1,733.10 ms
2,079.72 ms
(82.78%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
372.24 ms
(-6.18%)Baseline: 396.77 ms
476.12 ms
(78.18%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
171.59 ms
(-5.64%)Baseline: 181.85 ms
218.22 ms
(78.63%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,347.22 ms
(-1.30%)Baseline: 2,378.15 ms
2,853.78 ms
(82.25%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,418.56 ms
(-0.56%)Baseline: 4,443.44 ms
5,332.13 ms
(82.87%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
238.19 ms
(-4.48%)Baseline: 249.35 ms
299.23 ms
(79.60%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
674.06 ms
(-27.44%)Baseline: 928.99 ms
1,114.79 ms
(60.47%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13593
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,422.75 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
296.07 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
292.28 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
84.25 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,350.65 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,434.20 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
258.59 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit 21c8ddd into main Aug 2, 2026
35 checks passed
@zkochan
zkochan deleted the fix-13588 branch August 2, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot run pnpm install --offline without CA certs installed

3 participants