Repository navigation
Conversation
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.
📝 WalkthroughWalkthroughThe 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. ChangesCertificate fallback
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
Assessment against linked issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoFix pacquet TLS: fall back to bundled Mozilla roots when OS trust store is empty
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "fix(network): report the bundled-roots r..." | Re-trigger Greptile |
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Micro-Benchmark ResultsLinux |
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Thanks — responses to the four findings. 1. "Fallback drops custom CAs" — not reproducible; answered inline. 2. "Fallback on any build error" — deliberate, and the alternative is worse. The suggested discriminator is the string 3. "Workspace-scoped 4. "Fallback hides second error" — fair, fixed in 5dfb999. Written by an agent (Claude Code, claude-opus-5). |
|
Code review by qodo was updated up to the latest commit 5dfb999 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pnpm/crates/network/src/tests.rs (1)
779-787: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep the client-build error in the test failure.
is_ok()discards thereqwestbuild 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
📒 Files selected for processing (2)
pnpm/crates/network/src/lib.rspnpm/crates/network/src/tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- pnpm/crates/network/src/lib.rs
|
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 Putting the platform error into the 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). |
Integrated-Benchmark Report (Linux)Commit: 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
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
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
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
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
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
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
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
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
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13593 |
| Testbed | pnpr |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,422.75 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 296.07 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 292.28 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 84.25 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,350.65 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,434.20 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 258.59 ms |
Summary
Closes #13588.
On a machine whose system trust store is empty or absent (a nixpkgs sandbox, a scratch container,
SSL_CERT_FILE=),pnpm installdied with a panic before doing any work:reqwest's
rustls-platform-verifierbackend failsClientBuilder::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 —--offlineincluded, 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-certsonly 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/.npmrcca+cafileroots keep taking precedence. A build failure for any other reason now surfaces asForInstallsError::ClientBuildinstead 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-certswas already inCargo.lockas a transitive dependency ofrustls-platform-verifier, and itsCDLA-Permissive-2.0license is already allowed indeny.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
pnpmbinary,SSL_CERT_FILE= SSL_CERT_DIR=): the offline install now completes, and so does a fresh online install againstregistry.npmjs.orgover HTTPS. A regression test pointsSSL_CERT_FILEat an empty bundle (which switchesrustls-native-certsto env-only loading), asserts a plain reqwest client build fails in that environment, and assertsfor_installsstill succeeds. It also pins that a configuredcakeeps the platform verifier constructible — a user with custom roots never reaches the fallback.Not addressed here:
PnprClient::new(the opt-inpnprServerpath) usesreqwest::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
Checklist
already linked to it solves it.
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-opus-5).
Summary by CodeRabbit
Bug Fixes
pnpm installnow succeeds when the system certificate store is unavailable by using bundled Mozilla root certificates.NODE_EXTRA_CA_CERTS, and npm certificate settings retain priority.Documentation