Repository navigation
fix(lockfile): omit empty bundled dependencies - #13148
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughLockfile rebuilding now omits empty bundled dependency arrays while preserving ChangesBundled dependency normalization
Estimated code review effort: 2 (Simple) | ~10 minutes Assessment against linked issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Confidence Score: 5/5Safe to merge — the change is a narrow, well-guarded filter that only removes empty arrays from the lockfile output; existing nonempty arrays, Both the TypeScript and Rust implementations apply the same minimal guard ( Files Needing Attention: No files require special attention. Reviews (2): Last reviewed commit: "fix(pacquet): drop empty bundled-depende..." | Re-trigger Greptile |
|
@zkochan CI is fully green and CodeRabbit approved with no actionable findings, but Qodo reports that reviews are paused because this contributor account has no paid Teams seat: #13148 (comment). Since this is an account-level gate rather than a code issue, could the Qodo approval requirement be waived or replaced with manual review for this PR? |
…adata The TypeScript CLI now omits empty bundledDependencies arrays from lockfile package entries, so pacquet must stop recording them. An empty list under the preferred spelling falls through to a meaningful legacy bundleDependencies value, matching the TypeScript semantics. Also add pacquet to the changeset, since this is a parity change. Co-Authored-By: Claude Fable 5 <[email protected]>
0604c29 to
0892552
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13148 +/- ##
=======================================
Coverage 87.86% 87.86%
=======================================
Files 549 549
Lines 96091 96092 +1
=======================================
+ Hits 84429 84432 +3
+ Misses 11662 11660 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1. Bundling flag still true
|
| if ( | ||
| Array.isArray(pkg.additionalInfo.bundledDependencies) || | ||
| (Array.isArray(pkg.additionalInfo.bundledDependencies) && pkg.additionalInfo.bundledDependencies.length > 0) || | ||
| pkg.additionalInfo.bundledDependencies === true | ||
| ) { | ||
| result['bundledDependencies'] = pkg.additionalInfo.bundledDependencies | ||
| } else if ( | ||
| Array.isArray(pkg.additionalInfo.bundleDependencies) || | ||
| (Array.isArray(pkg.additionalInfo.bundleDependencies) && pkg.additionalInfo.bundleDependencies.length > 0) || | ||
| pkg.additionalInfo.bundleDependencies === true | ||
| ) { | ||
| result['bundledDependencies'] = pkg.additionalInfo.bundleDependencies |
There was a problem hiding this comment.
2. Bundling flag still true 🐞 Bug ☼ Reliability
After this PR, updateLockfile() omits empty bundledDependencies/bundleDependencies arrays from the lockfile snapshot, but ResolvedPackage.hasBundledDependencies is still computed as true when the manifest contains an empty array. This makes bundled-bin linking differ between a fresh resolve (graph-driven) and a lockfile-driven reinstall, and can add unnecessary filesystem work scanning <pkg>/node_modules for packages that bundle nothing.
Agent Prompt
## Issue description
`updateLockfile.ts` now treats empty `bundledDependencies`/`bundleDependencies` arrays as absent when serializing a `PackageSnapshot`, but `resolveDependencies.ts` still sets `hasBundledDependencies` based on nullish presence (`??`) which treats `[]` as meaningful. This creates inconsistent behavior: the initial install (using the resolver graph) may attempt bundled-bin linking, while a reinstall from the generated lockfile will not.
## Issue Context
- The lockfile-driven dep graph sets `hasBundledDependencies` from `pkgSnapshot.bundledDependencies != null`, so omitting the field changes later behavior.
- `hasBundledDependencies` gates extra bin-linking work (`linkBins(<pkg>/node_modules, ...)`).
## Fix Focus Areas
- pnpm11/installing/deps-resolver/src/resolveDependencies.ts[2380-2407]
- pnpm11/installing/deps-resolver/src/updateLockfile.ts[152-162]
## What to change
1. Update `ResolvedPackage.hasBundledDependencies` computation in `resolveDependencies.ts` to match the new lockfile semantics:
- Treat `bundledDependencies: []` and `bundleDependencies: []` as absent.
- Preserve `true` and non-empty arrays.
- Keep precedence: prefer `bundledDependencies` when meaningful, but if it is `false`/`[]`/other non-meaningful, fall through to `bundleDependencies`.
Example shape:
```ts
const preferred = options.pkg.bundledDependencies
const legacy = options.pkg.bundleDependencies
const preferredMeaningful = (Array.isArray(preferred) ? preferred.length > 0 : preferred === true)
const legacyMeaningful = (Array.isArray(legacy) ? legacy.length > 0 : legacy === true)
hasBundledDependencies: preferredMeaningful || (!preferredMeaningful && legacyMeaningful)
```
2. (Optional) Consider extracting a small helper used by both `hasBundledDependencies` and `toLockfileDependency()` to avoid future drift.
## Tests
Add/extend a test that demonstrates a package with `bundledDependencies: []` does **not** set `hasBundledDependencies` in the resolved graph (or does not take the bundled-bin linking branch), matching the lockfile-driven behavior.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
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.4396314302000004,
"stddev": 0.12831472187059517,
"median": 2.388087127,
"user": 1.65188216,
"system": 1.31858054,
"min": 2.356220086,
"max": 2.773984006,
"times": [
2.356220086,
2.373027678,
2.386803498,
2.773984006,
2.389370756,
2.358275081,
2.366406885,
2.476284043,
2.511277488,
2.404664781
]
},
{
"command": "pacquet@main",
"mean": 2.659390636,
"stddev": 0.18833320221938543,
"median": 2.6088833055,
"user": 1.9453994599999997,
"system": 1.50390174,
"min": 2.388648728,
"max": 2.9291942950000003,
"times": [
2.804629674,
2.485129449,
2.388648728,
2.9291942950000003,
2.847451734,
2.609361425,
2.608405186,
2.598413964,
2.8581517080000003,
2.464520197
]
},
{
"command": "pnpr@HEAD",
"mean": 1.6044862255,
"stddev": 0.1276065269433619,
"median": 1.5963622415,
"user": 1.3967140600000003,
"system": 1.50539024,
"min": 1.410562731,
"max": 1.799879603,
"times": [
1.5747869680000002,
1.577393039,
1.773406301,
1.6153314440000002,
1.656539312,
1.799879603,
1.667147913,
1.410562731,
1.433604095,
1.5362108490000002
]
},
{
"command": "pnpr@main",
"mean": 1.6689720651000002,
"stddev": 0.16837852502079564,
"median": 1.5970537565,
"user": 1.59641846,
"system": 1.6540153399999997,
"min": 1.4837734980000001,
"max": 1.925953472,
"times": [
1.803670022,
1.860466219,
1.6054566700000001,
1.4854188640000001,
1.587225342,
1.5178873780000002,
1.4837734980000001,
1.8312183430000002,
1.925953472,
1.588650843
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.29480888018000007,
"stddev": 0.013721696982156511,
"median": 0.29938324888,
"user": 0.24679083999999998,
"system": 0.57267914,
"min": 0.27112021988000007,
"max": 0.30936196088000006,
"times": [
0.30897817988000004,
0.28273021488000005,
0.27583128988000005,
0.30936196088000006,
0.29389217788000005,
0.30514261588,
0.29717776588000006,
0.27112021988000007,
0.30158873188,
0.30226564488
]
},
{
"command": "pacquet@main",
"mean": 0.29114301978000007,
"stddev": 0.016237950139538933,
"median": 0.28972027988000004,
"user": 0.25237923999999995,
"system": 0.57677284,
"min": 0.26650079188000003,
"max": 0.31772917788000005,
"times": [
0.28359340888000006,
0.28270186188,
0.26650079188000003,
0.29245414288000005,
0.28908261188000006,
0.31037769188000003,
0.31772917788000005,
0.30586165888000005,
0.27277090388,
0.29035794788
]
},
{
"command": "pnpr@HEAD",
"mean": 0.3306660948800001,
"stddev": 0.03095140427189125,
"median": 0.33691645288000005,
"user": 0.26195714,
"system": 0.64723574,
"min": 0.26656148288000003,
"max": 0.37096413188000005,
"times": [
0.31054530988000006,
0.33382180888000007,
0.37096413188000005,
0.35132795788000004,
0.34001109688000003,
0.32382671388000006,
0.26656148288000003,
0.35792296888,
0.34953809188000007,
0.30214138588000006
]
},
{
"command": "pnpr@main",
"mean": 0.33832831288,
"stddev": 0.03324621077400953,
"median": 0.33292467688000005,
"user": 0.26931554,
"system": 0.6316200399999999,
"min": 0.29612077688000005,
"max": 0.40873069788000005,
"times": [
0.40873069788000005,
0.32563964288,
0.34393116788000005,
0.34020971088000007,
0.31196368588000006,
0.30972923488000004,
0.29612077688000005,
0.32380441188000003,
0.35135557988000005,
0.37179821988000006
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.8664833353200003,
"stddev": 0.12526197183382454,
"median": 2.85405465822,
"user": 2.2222833799999995,
"system": 1.8224166,
"min": 2.7126466652200003,
"max": 3.0561536362200004,
"times": [
3.0011315022200002,
2.9551224462200003,
2.97920626322,
2.7665029052200003,
2.72941755122,
2.7126466652200003,
2.8832274942200002,
3.0561536362200004,
2.7565430672200004,
2.82488182222
]
},
{
"command": "pacquet@main",
"mean": 2.7263078868200004,
"stddev": 0.02804907231676148,
"median": 2.7335228777200005,
"user": 1.8887788799999998,
"system": 1.5266420999999997,
"min": 2.67742905322,
"max": 2.75711810622,
"times": [
2.7423423922200003,
2.67742905322,
2.7470150182200004,
2.72529051922,
2.7559205442200003,
2.72656127722,
2.70154681222,
2.75711810622,
2.68937066722,
2.7404844782200004
]
},
{
"command": "pnpr@HEAD",
"mean": 1.69318208412,
"stddev": 0.16781406690585432,
"median": 1.6910219527199999,
"user": 1.4006012799999998,
"system": 1.5138009000000001,
"min": 1.50244418822,
"max": 1.93577411322,
"times": [
1.77881459622,
1.90867773322,
1.52827166122,
1.52700662422,
1.93577411322,
1.84132985622,
1.68054182122,
1.52745816322,
1.50244418822,
1.70150208422
]
},
{
"command": "pnpr@main",
"mean": 1.6868725692200002,
"stddev": 0.14660754210342392,
"median": 1.6842866062200001,
"user": 1.27891458,
"system": 1.4590174,
"min": 1.5156680682199999,
"max": 1.86062102222,
"times": [
1.86062102222,
1.8461926412199998,
1.60095543422,
1.56253716622,
1.54523064422,
1.5156680682199999,
1.83727839122,
1.76761777822,
1.79986173622,
1.53276281022
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.59391414674,
"stddev": 0.06045073778561396,
"median": 0.58103395834,
"user": 0.7708566599999999,
"system": 0.87158292,
"min": 0.50886570484,
"max": 0.69363177084,
"times": [
0.54085321084,
0.50886570484,
0.5431966178400001,
0.61823137584,
0.58659667284,
0.69363177084,
0.6713829868400001,
0.64077980284,
0.57547124384,
0.56013208084
]
},
{
"command": "pacquet@main",
"mean": 0.48984274154000007,
"stddev": 0.027084536265094092,
"median": 0.48488260484,
"user": 0.67141296,
"system": 0.73641512,
"min": 0.44901385684,
"max": 0.5320594658400001,
"times": [
0.51444739084,
0.48427744184000004,
0.5151471158400001,
0.45886972784,
0.48548776784000003,
0.50918210984,
0.44901385684,
0.46858375384,
0.5320594658400001,
0.48135878484
]
},
{
"command": "pnpr@HEAD",
"mean": 0.32977105184,
"stddev": 0.018297114332125972,
"median": 0.32669052634000006,
"user": 0.21985936,
"system": 0.5567595200000001,
"min": 0.31003335184,
"max": 0.36668405084,
"times": [
0.36668405084,
0.33110323884000004,
0.32211238284,
0.31504557584000004,
0.31003335184,
0.32626574284000004,
0.32711530984000003,
0.31351050884000004,
0.32961417984,
0.35622617684
]
},
{
"command": "pnpr@main",
"mean": 0.34314990134,
"stddev": 0.02746372148466485,
"median": 0.33797615384,
"user": 0.24203926,
"system": 0.5833727200000001,
"min": 0.31521316384000003,
"max": 0.38528269884,
"times": [
0.35331037484,
0.35581560584,
0.32253117484,
0.31814524784000003,
0.31537596884,
0.32264193284000003,
0.31521316384000003,
0.36421437084,
0.38528269884,
0.37896847484
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.97009143376,
"stddev": 0.08215081867450022,
"median": 1.94952791476,
"user": 1.135218,
"system": 0.9805834600000001,
"min": 1.88632102426,
"max": 2.12415069126,
"times": [
1.9606359222599998,
1.9384199072600001,
2.00697441226,
2.12415069126,
2.04550020926,
1.89037749126,
1.88632102426,
2.04569076726,
1.91459732726,
1.88824658526
]
},
{
"command": "pacquet@main",
"mean": 1.9500440388600002,
"stddev": 0.07840111968961877,
"median": 1.94254502726,
"user": 1.1334755,
"system": 0.94412006,
"min": 1.83825767126,
"max": 2.11885156626,
"times": [
1.95911902126,
1.8970470342599999,
1.90155062326,
1.93543631426,
1.96662606826,
1.83825767126,
1.94965374026,
2.03029634826,
2.11885156626,
1.90360200126
]
},
{
"command": "pnpr@HEAD",
"mean": 0.41362051456,
"stddev": 0.044781851033940764,
"median": 0.39913867626,
"user": 0.30605199999999994,
"system": 0.6818250599999999,
"min": 0.35061472726,
"max": 0.49647736926,
"times": [
0.44774020226,
0.39081565926,
0.40482020626000004,
0.49647736926,
0.44435093826,
0.39345714626,
0.35061472726,
0.45256504726,
0.37849390726,
0.37686994226000003
]
},
{
"command": "pnpr@main",
"mean": 0.39044292516000006,
"stddev": 0.023874496428603693,
"median": 0.39264025526,
"user": 0.2761637,
"system": 0.6574110599999999,
"min": 0.35196027626,
"max": 0.42811419326,
"times": [
0.42811419326,
0.39011664426000003,
0.40466754926000004,
0.39516386626,
0.36746296126,
0.35196027626,
0.41148007126,
0.40427124526,
0.36141101926,
0.38978142526000004
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.30999172742000003,
"stddev": 0.03934751225550144,
"median": 0.30053074732000007,
"user": 0.3107559999999999,
"system": 0.09111240000000001,
"min": 0.27368702432,
"max": 0.41206722432000004,
"times": [
0.32470423732000003,
0.29849416732000006,
0.41206722432000004,
0.28698631432000005,
0.27368702432,
0.32227346632000003,
0.28264591232,
0.30491704632000005,
0.29157455432,
0.30256732732
]
},
{
"command": "pacquet@main",
"mean": 0.28548461932,
"stddev": 0.040179311411015085,
"median": 0.27390488332,
"user": 0.2856495545454545,
"system": 0.07744740909090908,
"min": 0.24000167432,
"max": 0.37346867532000005,
"times": [
0.26445903032,
0.37346867532000005,
0.27390488332,
0.27124515232,
0.32833897332000006,
0.27852408132000006,
0.30080006432000006,
0.31167405332000003,
0.24259163632,
0.24000167432,
0.25532258832000004
]
},
{
"command": "pnpr@HEAD",
"mean": 0.10510292275333334,
"stddev": 0.00976620993196107,
"median": 0.10205332632000001,
"user": 0.029815899999999996,
"system": 0.015913833333333335,
"min": 0.09492912832000001,
"max": 0.13587447232,
"times": [
0.09517372732000001,
0.09492912832000001,
0.10630613532000001,
0.10027952032000001,
0.11518475232000001,
0.12120403232000002,
0.11677769832000001,
0.11558788932000001,
0.11786217632000001,
0.09921847432000001,
0.10217927332000001,
0.09640798932000001,
0.10579807832000002,
0.11135966832000001,
0.11863576232000002,
0.09825573532000001,
0.10157130032000002,
0.09846649132000002,
0.10284819232000002,
0.09996334632000001,
0.10374969732000001,
0.10416716232,
0.13587447232,
0.10338352832000001,
0.09973806332000001,
0.09739407432000001,
0.09494453732000001,
0.10192737932000001,
0.09524263832000002,
0.09865675832000001
]
},
{
"command": "pnpr@main",
"mean": 0.09852282507862069,
"stddev": 0.010651745916152977,
"median": 0.09479854332000001,
"user": 0.0266542724137931,
"system": 0.013194293103448274,
"min": 0.08812705632000001,
"max": 0.14056005232,
"times": [
0.09737084032000001,
0.11048150632,
0.09395003732000001,
0.09479854332000001,
0.08812705632000001,
0.09380007432000001,
0.10975628332000001,
0.09967258032000001,
0.09707614732000001,
0.09093807332,
0.09375811632000002,
0.08948572032000002,
0.09361060932000001,
0.09229771032000002,
0.08979453332000001,
0.09244530832000002,
0.09191042232000002,
0.09118770332000001,
0.09621705032000001,
0.10561562532000002,
0.11005051632000001,
0.09830593932000001,
0.09289631632,
0.09715572632000001,
0.09901250832000001,
0.11539388532000001,
0.14056005232,
0.09828031032000001,
0.09321273132
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.842925590519999,
"stddev": 0.1769261285094337,
"median": 4.840663580919999,
"user": 2.8063781800000003,
"system": 2.0432010199999997,
"min": 4.58409891892,
"max": 5.17853580992,
"times": [
4.805906998919999,
5.17853580992,
5.02769162192,
4.68986293292,
4.92294792692,
4.86346198892,
4.8178651729199995,
4.8810447969199995,
4.58409891892,
4.65783973692
]
},
{
"command": "pacquet@main",
"mean": 4.7388286958200005,
"stddev": 0.1200540909206714,
"median": 4.72109508492,
"user": 2.5458953799999997,
"system": 1.89406042,
"min": 4.5945675569199995,
"max": 4.9159462959199995,
"times": [
4.896533186919999,
4.68458305392,
4.642680587919999,
4.5945675569199995,
4.81675337792,
4.616365099919999,
4.828968017919999,
4.9159462959199995,
4.75760711592,
4.63428266492
]
},
{
"command": "pnpr@HEAD",
"mean": 3.7012576040200003,
"stddev": 0.09432916417385533,
"median": 3.71795951842,
"user": 1.78031418,
"system": 1.7079645199999998,
"min": 3.55580797292,
"max": 3.83361274992,
"times": [
3.83361274992,
3.59034657792,
3.5949319489200002,
3.77073208492,
3.80232460992,
3.74435143592,
3.71218654692,
3.72373248992,
3.68454962292,
3.55580797292
]
},
{
"command": "pnpr@main",
"mean": 3.73712412302,
"stddev": 0.21019451676887363,
"median": 3.63548532242,
"user": 1.68514278,
"system": 1.66493802,
"min": 3.53172494292,
"max": 4.12897408692,
"times": [
3.58045661592,
3.61112608292,
3.65984456192,
3.9801445059200002,
4.12897408692,
3.83580988892,
3.56376314392,
3.57140880292,
3.53172494292,
3.90798859792
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13148 |
| 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,502.44 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 350.61 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 310.03 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 94.93 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,410.56 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,555.81 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 266.56 ms |
|
Congrats on merging your first pull request! 🎉🎉🎉 |
Summary
Treat empty
bundledDependenciesandbundleDependenciesarrays as absent when generating package lockfile entries.Tarball-derived manifests can retain an empty array while registry metadata omits the field. Serializing that array made the resulting lockfile depend on which manifest source was used. Nonempty arrays and
trueremain preserved,bundledDependencieskeeps precedence when meaningful, and an empty preferred value can fall back to meaningfulbundleDependencies.Pacquet is updated to match:
BundledDependencies::from_manifestpreviously recorded an empty list (deliberately mirroring the old TypeScript gate); it now skips empty lists and falls through to the legacy spelling, and the changeset targetspacquetas well.Closes #13123.
Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any published package.Verification
cargo test -p pacquet-lockfile(including the new empty-list tests),cargo fmt --check, clippy, and the workspace dylint passAI disclosure
OpenCode using
myself/gpt-5.6-solassisted with issue investigation, implementation, and test preparation. I reviewed the source changes, parity behavior, and verification results.Written by an agent (OpenCode, myself/gpt-5.6-sol).
Pacquet parity commit and description update by an agent (Claude Code, claude-fable-5).
Summary by CodeRabbit
Bug Fixes
Tests