Repository navigation
Conversation
A registry version that carried no `dist.integrity` was recorded in the lockfile with a bare tarball URL and no hash, and `--lockfile-only` never computed one — so the very first `pnpm install --frozen-lockfile` over that lockfile failed with `ERR_PNPM_MISSING_TARBALL_INTEGRITY`. Two independent gaps produced it, and both are closed here. First, `dist.shasum` was ignored. pnpm's `getIntegrity` promotes the legacy hex digest to a `sha1-` SRI string when `dist.integrity` is absent, which is what pins every version published before subresource integrity — the whole of `https://node-registry.bit.cloud/`, for one. pacquet parsed the field and dropped it, leaving those versions unpinned and diverging from the lockfile the TypeScript CLI writes for the same graph. `dist_integrity` now mirrors `getIntegrity`, including the `ERR_PNPM_INVALID_TARBALL_INTEGRITY` failure for a shasum that is not a hex digest. It also restores the stronger of the two behaviours: a registry-published hash pins the bytes, where hashing whatever arrived pins nothing. Second, `--lockfile-only` skipped the `PrefetchingResolver` wholesale, and that wrapper owns `populate_missing_integrity` — the only path that hashes a tarball no registry hash covers. Background prefetching and integrity completion are now separate concerns: the wrapper always sits in the resolver chain, and `prefetch_downloads` turns off only the speculative download. A run that materializes nothing (`--lockfile-only`) or only part of the graph (a filtered workspace selection) still fetches the few tarballs whose hash the lockfile cannot be written without, which is what pnpm does with `resolutionNeedsFetch` under `dryRun`. Closes #13547 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughRegistry resolution now derives tarball integrity from SRI or legacy SHA-1 metadata. Lockfile-only installs fetch tarballs only when required to compute missing integrity. Background prefetching remains configurable, and resolver and CLI tests cover the new behavior. ChangesRegistry integrity and lockfile-only resolution
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related 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 --lockfile-only by always recording tarball integrity in lockfile
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (3): Last reviewed commit: "style(pacquet): trim the comments added ..." | Re-trigger Greptile |
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1.
|
There was a problem hiding this comment.
Pull request overview
Fixes pacquet lockfile parity and correctness when registry metadata lacks dist.integrity, ensuring --lockfile-only still produces an installable lockfile (matching pnpm TypeScript behavior).
Changes:
- Add
dist.shasum→sha1-...SRI fallback in the npm resolver (and error on unparsable shasum). - Keep
PrefetchingResolverin the resolver chain even for--lockfile-only, while gating only the background prefetch via a newprefetch_downloadsflag (integrity completion remains on). - Add targeted tests covering shasum-only metadata, unparsable shasum erroring, and integrity population with prefetching disabled.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pnpm/crates/resolving-npm-resolver/src/npm_resolver/tests.rs | Adds resolver tests for shasum-only metadata and invalid shasum failure mode. |
| pnpm/crates/resolving-npm-resolver/src/npm_resolver.rs | Uses derived integrity for tarball resolutions; adds dist_integrity fallback logic. |
| pnpm/crates/resolving-npm-resolver/src/lib.rs | Re-exports the new InvalidTarballIntegrityError. |
| pnpm/crates/resolving-npm-resolver/src/errors.rs | Introduces InvalidTarballIntegrityError with a dedicated diagnostic code. |
| pnpm/crates/resolving-npm-resolver/Cargo.toml | Promotes ssri to a normal dependency (now used in non-test code). |
| pnpm/crates/package-manager/src/prefetching_resolver/tests.rs | Adds tests ensuring integrity completion occurs even when background prefetching is disabled. |
| pnpm/crates/package-manager/src/prefetching_resolver.rs | Splits “integrity completion” from “background prefetch” via prefetch_downloads. |
| pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs | Always wraps resolver with PrefetchingResolver, disabling only background prefetch for lockfile-only/filtered runs. |
| pnpm/crates/cli/tests/lockfile_only.rs | Adds an e2e test verifying --lockfile-only computes integrity for an unpinned tarball and supports frozen install. |
| .changeset/lockfile-only-records-tarball-integrity.md | Adds a patch changeset documenting the fix for pacquet users. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.changeset/lockfile-only-records-tarball-integrity.md (1)
5-5: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake the changeset concise and user-facing.
Describe the lockfile behavior that users observe. Remove internal resolver details, the registry example, and the historical error explanation.
State that pacquet now records usable tarball integrity for registry packages that omit SRI metadata, including with
--lockfile-only.Based on learnings, changesets should describe user-visible behavior rather than internal resolver behavior.
🤖 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 @.changeset/lockfile-only-records-tarball-integrity.md at line 5, Rewrite the changeset text to be concise and user-facing: state that pacquet records usable tarball integrity for registry packages without SRI metadata, including when using --lockfile-only. Remove resolver implementation details, the registry example, and the historical error explanation.Sources: Path instructions, Learnings
🤖 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 @.changeset/lockfile-only-records-tarball-integrity.md:
- Line 5: Rewrite the changeset text to be concise and user-facing: state that
pacquet records usable tarball integrity for registry packages without SRI
metadata, including when using --lockfile-only. Remove resolver implementation
details, the registry example, and the historical error explanation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b9e201ff-22e7-4854-947d-50a0cb5265a3
📒 Files selected for processing (10)
.changeset/lockfile-only-records-tarball-integrity.mdpnpm/crates/cli/tests/lockfile_only.rspnpm/crates/package-manager/src/install_with_fresh_lockfile.rspnpm/crates/package-manager/src/prefetching_resolver.rspnpm/crates/package-manager/src/prefetching_resolver/tests.rspnpm/crates/resolving-npm-resolver/Cargo.tomlpnpm/crates/resolving-npm-resolver/src/errors.rspnpm/crates/resolving-npm-resolver/src/lib.rspnpm/crates/resolving-npm-resolver/src/npm_resolver.rspnpm/crates/resolving-npm-resolver/src/npm_resolver/tests.rs
Micro-Benchmark ResultsLinux |
…rror `InvalidTarballIntegrityError` quotes `dist.tarball` and `dist.shasum` straight from a packument into a message that reaches the terminal, CI logs, and reporters. A registry configured with inline `user:pass@host` basic-auth would have leaked the credentials, and a metadata string carrying control characters could rewrite the surrounding output. Both fields now go through `redact_and_sanitize` at construction, the same contract `FetchMetadataError` documents for its URL-bearing variants. Also trims the changeset to the user-visible behaviour, per review.
|
Review round 1 addressed in 897d251. Fixed — unsanitized integrity error output (Qodo, Copilot): real issue. Fixed — changeset wording (CodeRabbit): trimmed to the user-visible behaviour. Not changing — Not changing — Written by an agent (Claude Code, claude-opus-5). |
|
Code review by qodo was updated up to the latest commit 897d251 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Suppressed comments (1)
pnpm/crates/resolving-npm-resolver/src/errors.rs:180
- The
Displaymessage forInvalidTarballIntegrityErrorincludes an extra trailing"after{shasum}, which will show up in user-facing output (and may break tests/assertions expecting the exact pnpm error text).
#[derive(Debug, Display, Error, Diagnostic)]
#[display(r#"Tarball "{tarball}" has invalid shasum specified in its metadata: {shasum}"#)]
#[diagnostic(code(ERR_PNPM_INVALID_TARBALL_INTEGRITY))]
Several of them restated the code, re-narrated a call site from the callee's doc, or spelled out what a test's name and asserts already say. The remaining prose is the contract of each new item plus the one design note that has no other home: the module doc for the resolver wrapper now states once that the prefetch is speculative while the integrity hashing is not, and the call site just reads `prefetch_downloads`.
|
Code review by qodo was updated up to the latest commit dff8954 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main pnpm/pnpm#13549 +/- ##
=======================================
Coverage 87.92% 87.92%
=======================================
Files 550 550
Lines 96449 96464 +15
=======================================
+ Hits 84800 84816 +16
+ Misses 11649 11648 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. 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.5955342728399997,
"stddev": 0.1451443442362219,
"median": 2.5835138838400002,
"user": 2.0829429800000003,
"system": 1.6081102399999998,
"min": 2.42964563434,
"max": 2.92275676034,
"times": [
2.92275676034,
2.68063230834,
2.62711786634,
2.53990990134,
2.66745466634,
2.48285859834,
2.51043734834,
2.63064750234,
2.46388214234,
2.42964563434
]
},
{
"command": "pacquet@main",
"mean": 2.6883529052399995,
"stddev": 0.15341377823481067,
"median": 2.63373618484,
"user": 2.4955742799999996,
"system": 1.86552984,
"min": 2.52207685534,
"max": 2.97691832734,
"times": [
2.57799996434,
2.66979444434,
2.56840436734,
2.5976779253399997,
2.55784418134,
2.52207685534,
2.78120852034,
2.97691832734,
2.87757282534,
2.75403164134
]
},
{
"command": "pnpr@HEAD",
"mean": 1.56883555014,
"stddev": 0.12293445029871546,
"median": 1.62225073884,
"user": 1.42381878,
"system": 1.4215394399999999,
"min": 1.40371053634,
"max": 1.72707064134,
"times": [
1.40371053634,
1.45891698334,
1.61819876134,
1.6263027163400001,
1.42884881634,
1.68324052634,
1.6781658133400001,
1.43569268334,
1.72707064134,
1.62820802334
]
},
{
"command": "pnpr@main",
"mean": 1.56330853404,
"stddev": 0.13075993246966658,
"median": 1.5271548693399999,
"user": 1.47328268,
"system": 1.4086082400000002,
"min": 1.40923518734,
"max": 1.7361360483400001,
"times": [
1.7361360483400001,
1.52923550834,
1.50916705134,
1.72683094934,
1.40923518734,
1.42811157634,
1.52507423034,
1.68005760834,
1.67761217734,
1.41162500334
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.3343167037600001,
"stddev": 0.02482913726198659,
"median": 0.33597510665999997,
"user": 0.30025667999999994,
"system": 0.6610986000000001,
"min": 0.29963956016,
"max": 0.37007329316000004,
"times": [
0.35044522516000004,
0.33927007016,
0.34057238616,
0.37007329316000004,
0.36947862216,
0.30625592916,
0.29963956016,
0.32583494216000003,
0.33268014316,
0.30891686616
]
},
{
"command": "pacquet@main",
"mean": 0.32420645666,
"stddev": 0.011780137540385921,
"median": 0.32446487916,
"user": 0.27136718,
"system": 0.6716565000000001,
"min": 0.30530260016,
"max": 0.34463694216,
"times": [
0.32838176616000003,
0.30530260016,
0.32869727016,
0.32117747916,
0.34463694216,
0.32775227916,
0.31765125916000003,
0.33788403616,
0.31169884316,
0.31888209116
]
},
{
"command": "pnpr@HEAD",
"mean": 0.34951219346,
"stddev": 0.020279977897983126,
"median": 0.34937474716000005,
"user": 0.30831837999999995,
"system": 0.6715429,
"min": 0.31927398916,
"max": 0.38091741516,
"times": [
0.33210009816,
0.35538702516000004,
0.32887413516,
0.35107455316,
0.33993525516,
0.37718542616,
0.31927398916,
0.36269909616,
0.34767494116000003,
0.38091741516
]
},
{
"command": "pnpr@main",
"mean": 0.36344062146,
"stddev": 0.016270344633056225,
"median": 0.36024975116,
"user": 0.30547158,
"system": 0.7096954999999999,
"min": 0.34079073916,
"max": 0.39282524116,
"times": [
0.36254483416,
0.34079073916,
0.34544755116000003,
0.39282524116,
0.37601633216,
0.37097719716,
0.35763170916000003,
0.35101754516,
0.35795466816,
0.37920039716000004
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.0032763173,
"stddev": 0.07924761266550157,
"median": 2.9790605732,
"user": 2.75327284,
"system": 2.1232406799999994,
"min": 2.8975175187,
"max": 3.1709099577,
"times": [
2.8975175187,
2.9783419387000003,
2.9768634187000003,
3.1709099577,
2.9635366367000002,
2.9266176997,
2.9797792077,
3.0082476177,
3.0740322727000002,
3.0569169047
]
},
{
"command": "pacquet@main",
"mean": 2.9549645372,
"stddev": 0.08441871683304827,
"median": 2.9623540962,
"user": 2.62437074,
"system": 2.0343757800000004,
"min": 2.8100710417,
"max": 3.0636360667,
"times": [
2.9885445187,
2.9135742917000003,
3.0217524977,
3.0636360667,
2.9361636737,
3.0242351297,
3.0245696997000002,
2.9273475867000003,
2.8397508657,
2.8100710417
]
},
{
"command": "pnpr@HEAD",
"mean": 1.754737733,
"stddev": 0.16621018520832984,
"median": 1.6862256097000001,
"user": 1.43950694,
"system": 1.5032292799999998,
"min": 1.5725255397,
"max": 1.9786363257000001,
"times": [
1.6283766217000002,
1.9786363257000001,
1.5725255397,
1.9781197517,
1.5979574927,
1.9538190617,
1.6943293427000001,
1.8439527317,
1.6781218767000001,
1.6215385857000002
]
},
{
"command": "pnpr@main",
"mean": 1.6805824813,
"stddev": 0.17053247733037077,
"median": 1.6232239182000001,
"user": 1.43720234,
"system": 1.5467333799999996,
"min": 1.4802445147,
"max": 1.9474689157,
"times": [
1.7394402477000002,
1.8894883177000001,
1.6409354557000002,
1.5383259227,
1.9474689157,
1.5920762417,
1.6055123807,
1.5018808587,
1.8704519577,
1.4802445147
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.49823053451999993,
"stddev": 0.03341789283342362,
"median": 0.49269013742,
"user": 0.6974239799999999,
"system": 0.79732974,
"min": 0.47467087492000004,
"max": 0.58834096792,
"times": [
0.49382431592000003,
0.58834096792,
0.47759588092000005,
0.48093552992000005,
0.47467087492000004,
0.49302336592,
0.49490435392000004,
0.50930712692,
0.47734601992000003,
0.49235690892000006
]
},
{
"command": "pacquet@main",
"mean": 0.5637463798199999,
"stddev": 0.09538648643094326,
"median": 0.51720133942,
"user": 0.78380378,
"system": 0.88402414,
"min": 0.48379021292,
"max": 0.7765868259200001,
"times": [
0.67116795492,
0.7765868259200001,
0.60646201292,
0.5057333269200001,
0.5647778599200001,
0.50705972792,
0.48379021292,
0.49070722792000004,
0.52734295092,
0.50383569792
]
},
{
"command": "pnpr@HEAD",
"mean": 0.35429772602000004,
"stddev": 0.010688042737309727,
"median": 0.35198873442,
"user": 0.25998708,
"system": 0.60994594,
"min": 0.33922675692000004,
"max": 0.37287618792000005,
"times": [
0.35982030492,
0.33922675692000004,
0.34788881192000004,
0.34942933792,
0.37287618792000005,
0.36687874692,
0.35379408092000003,
0.36062518992000003,
0.35018338792000003,
0.34225445492
]
},
{
"command": "pnpr@main",
"mean": 0.37124733342000005,
"stddev": 0.029830164337046775,
"median": 0.36142081942000004,
"user": 0.26944717999999995,
"system": 0.66348484,
"min": 0.33717779192,
"max": 0.41569802592000005,
"times": [
0.34378548292,
0.33932939892,
0.33717779192,
0.36405686092,
0.35555745292,
0.40132423892,
0.41569802592000005,
0.40997505292,
0.35878477792,
0.38678425092
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.86792533548,
"stddev": 0.029090214874760573,
"median": 1.86283639528,
"user": 0.9910724799999999,
"system": 0.9289696999999999,
"min": 1.82862745328,
"max": 1.92704603328,
"times": [
1.92704603328,
1.85755820328,
1.82862745328,
1.90885656128,
1.86026689928,
1.8446740152799999,
1.86540589128,
1.8544772112799999,
1.86691502728,
1.8654260592799998
]
},
{
"command": "pacquet@main",
"mean": 1.8488404778799996,
"stddev": 0.014449030351400173,
"median": 1.85312905328,
"user": 0.9806894799999999,
"system": 0.9039976,
"min": 1.82458072328,
"max": 1.8648924142799999,
"times": [
1.85803059328,
1.8505246892799998,
1.8478912322799999,
1.86231792728,
1.86008287228,
1.82807774728,
1.85573341728,
1.83627316228,
1.82458072328,
1.8648924142799999
]
},
{
"command": "pnpr@HEAD",
"mean": 0.3935698016800001,
"stddev": 0.04995200783594351,
"median": 0.37472120978,
"user": 0.28691737999999994,
"system": 0.6864545999999999,
"min": 0.33771834028000003,
"max": 0.49686991928000007,
"times": [
0.35639577128000005,
0.37220939328,
0.36457937428000003,
0.37723302628000005,
0.33771834028000003,
0.35825599828000004,
0.39089145428000005,
0.4430760542800001,
0.43846868528000005,
0.49686991928000007
]
},
{
"command": "pnpr@main",
"mean": 0.40249937408,
"stddev": 0.028745476294234556,
"median": 0.41280368028000003,
"user": 0.2939479799999999,
"system": 0.6790212999999999,
"min": 0.33566300428000007,
"max": 0.42877434328,
"times": [
0.37736500528000005,
0.42372948028000007,
0.40804194528000004,
0.4175654152800001,
0.42236033828,
0.39222387628000005,
0.39665046528000003,
0.42261986728000006,
0.42877434328,
0.33566300428000007
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.27648932496727274,
"stddev": 0.02957134434074048,
"median": 0.26422437924000003,
"user": 0.26759191454545456,
"system": 0.09064676727272726,
"min": 0.24769134224,
"max": 0.32995935424000006,
"times": [
0.25998667924,
0.32605911824000006,
0.32995935424000006,
0.30358337324,
0.26422437924000003,
0.25851291024,
0.24769134224,
0.27256022024000004,
0.25480318324,
0.25166763024000005,
0.27233438424000006
]
},
{
"command": "pacquet@main",
"mean": 0.22935115687636365,
"stddev": 0.019463166890127104,
"median": 0.22194583224,
"user": 0.22540246,
"system": 0.07222122181818182,
"min": 0.20911936324,
"max": 0.26340274024000004,
"times": [
0.26340274024000004,
0.25018635724000005,
0.23093232724,
0.22194583224,
0.21806493224,
0.21610788124,
0.26019509124,
0.21319316524,
0.22388354424,
0.21583149124,
0.20911936324
]
},
{
"command": "pnpr@HEAD",
"mean": 0.09390876207333336,
"stddev": 0.002345956358601712,
"median": 0.09376442574000002,
"user": 0.023912226666666665,
"system": 0.012021771999999997,
"min": 0.08907481224000001,
"max": 0.09963723024000001,
"times": [
0.09360633824,
0.09375289424000001,
0.09335349124,
0.09048213624000001,
0.09187687524,
0.09963723024000001,
0.09464616924000001,
0.09467886124000001,
0.09315336324000001,
0.09131026824,
0.09175088824000001,
0.09186037524000001,
0.09127216624000001,
0.09277265524,
0.09526476524000001,
0.09875753224000001,
0.09460476124,
0.09199306524,
0.09384996724000001,
0.09377595724000001,
0.08907481224000001,
0.09319379024,
0.09536547524000001,
0.09257056424000001,
0.09485869024,
0.09431743824000001,
0.09713605424,
0.09705439924,
0.09532452824000001,
0.09596734924000001
]
},
{
"command": "pnpr@main",
"mean": 0.09791305007870968,
"stddev": 0.0043783087951818275,
"median": 0.09663580024000001,
"user": 0.027533911612903226,
"system": 0.011858749677419352,
"min": 0.09088800224,
"max": 0.11230995924,
"times": [
0.09124206924,
0.10181270424000001,
0.11230995924,
0.09708172124,
0.09088800224,
0.09568569824,
0.09554064524000001,
0.09483937324000001,
0.10341092824,
0.09605899424000001,
0.09295291524,
0.09529714624,
0.10309044324000001,
0.09826117524000001,
0.10077778124,
0.09379702724000001,
0.10416775524,
0.09821408724000001,
0.09467160624000001,
0.10157273024,
0.10253052724,
0.09652266724000001,
0.09652430024000001,
0.09517470624,
0.09727127924000001,
0.09830148224,
0.10136749324000001,
0.09663580024000001,
0.09630486624000001,
0.09797221124000001,
0.09502645624
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.6321721611,
"stddev": 0.13482712570447666,
"median": 4.5874190588,
"user": 2.3215566,
"system": 1.70848686,
"min": 4.518193638800001,
"max": 4.9738533588000005,
"times": [
4.7339672428,
4.5993720708,
4.564989248800001,
4.5754660468,
4.9738533588000005,
4.6530896658000005,
4.5611975078,
4.5417110188,
4.518193638800001,
4.5998818118
]
},
{
"command": "pacquet@main",
"mean": 4.6929535926,
"stddev": 0.13285801420531576,
"median": 4.628072897300001,
"user": 2.2984201,
"system": 1.7032346600000001,
"min": 4.5666352828,
"max": 4.9501258708,
"times": [
4.5733482328,
4.8293526878,
4.5849548318,
4.625220507800001,
4.8169515898,
4.7384951508,
4.9501258708,
4.5666352828,
4.6135264848,
4.6309252868
]
},
{
"command": "pnpr@HEAD",
"mean": 3.6255816517,
"stddev": 0.10869299015683057,
"median": 3.6102876418,
"user": 1.6464675999999998,
"system": 1.52057436,
"min": 3.5129935208,
"max": 3.7928323118,
"times": [
3.5707898368,
3.7928323118,
3.5173385637999997,
3.5129935208,
3.5168758737999997,
3.5289207397999998,
3.7268385368,
3.6948563898,
3.7445852968,
3.6497854467999997
]
},
{
"command": "pnpr@main",
"mean": 3.7106762011999996,
"stddev": 0.1073711130912091,
"median": 3.6818912328,
"user": 1.8390697,
"system": 1.74493936,
"min": 3.5830500867999997,
"max": 3.9065729898,
"times": [
3.6090508428,
3.9065729898,
3.5830500867999997,
3.7022503847999997,
3.6615320808,
3.7170830078,
3.6514255908,
3.6464260808,
3.7556788788,
3.8736920688
]
}
]
} |
Summary
Closes #13547.
pnpm add <pkg> --lockfile-onlyagainst a registry whose versions carry nodist.integritywrote a lockfile with a bare tarball URL and no hash, and the firstpnpm install --frozen-lockfileover it failed withERR_PNPM_MISSING_TARBALL_INTEGRITY.Reproducing the issue turned up two independent gaps, both fixed here. Only fixing the reported one would have left pacquet downloading every tarball of such a registry during
--lockfile-onlyand writing sha512 hashes where the TypeScript CLI writes sha1 — a lockfile divergence.1.
dist.shasumwas ignored (resolving-npm-resolver). pnpm'sgetIntegrityfalls back tossri.fromHex(dist.shasum, 'sha1')whendist.integrityis absent; that fallback is what pins every version published before subresource integrity, including all ofhttps://node-registry.bit.cloud/. pacquet parseddist.shasumintoPackageDistributionand then dropped it. The newdist_integritymirrorsgetIntegrity, including theERR_PNPM_INVALID_TARBALL_INTEGRITYfailure for a shasum that is not a hex digest.pnpralready assumed this fallback exists — its packument trimmer deliberately keepsshasumwhenintegrityis missing "so pnpm's sha1 fallback still has a hash (pre-2017 publishes)".This is also the more secure of the two behaviours: a registry-published hash pins the bytes, whereas hashing whatever the network returned pins nothing.
2.
--lockfile-onlyskippedpopulate_missing_integrity(package-manager). The reported bug: the wholePrefetchingResolverwas skipped underlockfileOnly(and under a filtered workspace selection), and that wrapper owns the only path that hashes a tarball no registry hash covers. The two jobs are now separated — the wrapper always sits in the resolver chain, and the newprefetch_downloadsflag turns off only the speculative background download. So--lockfile-onlystill fetches nothing speculatively, but does fetch the few tarballs whose hash the lockfile cannot be written without. This is what pnpm does:packageRequesterfetches whenresolutionNeedsFetchis true even withskipFetch/dryRunset.Verification
The issue's reproduction, before and after, against the real registry:
The lockfile pacquet writes for that graph is now byte-identical to the one
[email protected]writes (diffof the twopnpm-lock.yamlfiles is empty), andpnpm install --frozen-lockfileover it succeeds.Parity
TypeScript side needs no change — it already has both behaviours (
getIntegrity, and theresolutionNeedsFetchfetch underdryRunfrom #12491). This PR brings pacquet up to them.Squash Commit Body
Checklist
already linked to it solves it.
pnpm/port, or the description notes what still needs porting.(Rust-only: the TypeScript CLI already has both behaviours — see Parity above.)
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Tests added:
computes_the_integrity_of_an_unpinned_tarball(CLI, end to end over a hand-built packument that pins nothing — verified to fail without the fix),shasum_only_metadata_resolves_to_a_sha1_integrity+unparsable_shasum_fails_the_resolve(npm resolver), andpopulates_integrity_with_prefetching_off/skips_the_background_download_with_prefetching_off/claims_the_background_download_with_prefetching_on(prefetching resolver). Full Rust suite green (7531 tests).Written by an agent (Claude Code, claude-opus-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
node_moduleswhile still supporting later frozen installs.