Repository navigation
fix: remove a dependency whose manifest is malformed - #17828
Conversation
`removeBinsOfDependency` read the removed dependency's manifest with `safeReadPackageJsonFromDir`, which throws on a malformed `package.json`. The isolated linker's prune, the hoisted stale-link pass with a real `.bin`, and the hoisted orphan cleanup all go through it, so a malformed manifest failed the install before the dependency was removed. v12 skips the bins and removes the dependency. `safeReadDependencyManifest` now returns `undefined` for a missing or malformed manifest, or one under a path that is not a directory, and rethrows other errors, as v12 does. `removeBinsOfDependency` and the hoisted stale-link pass both use it. Both stacks' tests now cover the removal under each linker, with and without a real `.bin`. Closes pnpm/tasks#295 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Nothing new recorded1 job recorded · compared with the last 10 runs on TS CI / Test / ubuntu (24.0.0, 2) / Node 24 / chunk 2/3
|
Micro-Benchmark ResultsLinux |
Same-run regression checkHEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval. Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.
Same-run syscall checkEach install runs 2 more times per revision, untimed, under
Integrated-Benchmark Report (Linux)Commit: Compared against main at: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked, injected, and Cargo workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.55136567548,
"stddev": 0.10205155898484135,
"median": 2.59357014418,
"user": 2.6285966,
"system": 1.7231125999999999,
"min": 2.40276215618,
"max": 2.6853666021800002
},
{
"command": "pacquet@main",
"mean": 2.55973069888,
"stddev": 0.07227449411608763,
"median": 2.54331261618,
"user": 2.4289506999999997,
"system": 1.5803882999999996,
"min": 2.4654669831800002,
"max": 2.70556114718
},
{
"command": "pnpr@HEAD",
"mean": 1.4386795702799997,
"stddev": 0.1348274823236386,
"median": 1.3822416941800002,
"user": 2.1271884,
"system": 1.5091907999999998,
"min": 1.29455706218,
"max": 1.71500753318
},
{
"command": "pnpr@main",
"mean": 1.48192620918,
"stddev": 0.10521111200965715,
"median": 1.4770988201800002,
"user": 2.2090141,
"system": 1.5050063999999996,
"min": 1.30211001618,
"max": 1.65143571418
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2664716403400001,
"stddev": 0.011817191376332765,
"median": 0.26559553494000004,
"user": 0.33473949999999997,
"system": 0.59045272,
"min": 0.25216590894,
"max": 0.29534483694
},
{
"command": "pacquet@main",
"mean": 0.29944402574000006,
"stddev": 0.03261648052551954,
"median": 0.29243572294000003,
"user": 0.36248080000000005,
"system": 0.6750769199999999,
"min": 0.27245814294000004,
"max": 0.38788114194000006
},
{
"command": "pnpr@HEAD",
"mean": 0.3424452754400001,
"stddev": 0.049531887760141696,
"median": 0.33732917994,
"user": 0.36717599999999995,
"system": 0.74111662,
"min": 0.28812721694000004,
"max": 0.43155211494000006
},
{
"command": "pnpr@main",
"mean": 0.29708740974000003,
"stddev": 0.010235560260458153,
"median": 0.29392960644000005,
"user": 0.32677589999999995,
"system": 0.64411272,
"min": 0.28372684194000003,
"max": 0.31324599594
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.012375241928167535,
"stddev": 0.0014739397209250682,
"median": 0.01202701008,
"user": 0.007305412670157066,
"system": 0.0062001193717277515,
"min": 0.00936167708,
"max": 0.01867881408
},
{
"command": "pacquet@main",
"mean": 0.011275161075238085,
"stddev": 0.0013239054185020095,
"median": 0.01105674358,
"user": 0.0067359342857142845,
"system": 0.005598867809523809,
"min": 0.00881126508,
"max": 0.01494126908
},
{
"command": "pnpr@HEAD",
"mean": 0.011617836952222222,
"stddev": 0.0016956118099360922,
"median": 0.01122761908,
"user": 0.006913836666666663,
"system": 0.005786678000000001,
"min": 0.00925961608,
"max": 0.018802585080000003
},
{
"command": "pnpr@main",
"mean": 0.011088240171666663,
"stddev": 0.0009489719536096452,
"median": 0.01089118358,
"user": 0.006798411666666669,
"system": 0.0053954300000000005,
"min": 0.00918628808,
"max": 0.01470074708
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.010712074069644674,
"stddev": 0.0009175593333950442,
"median": 0.010585597759999999,
"user": 0.0063541152284263954,
"system": 0.005296214822335025,
"min": 0.008654369759999999,
"max": 0.014984244760000001
},
{
"command": "pacquet@main",
"mean": 0.01069161576,
"stddev": 0.0011124868967270771,
"median": 0.01049214776,
"user": 0.006413974439461884,
"system": 0.005286861704035875,
"min": 0.00907753776,
"max": 0.01437454576
},
{
"command": "pnpr@HEAD",
"mean": 0.010985293395135137,
"stddev": 0.0009778539999601202,
"median": 0.01088769776,
"user": 0.0063977936936936925,
"system": 0.005598932072072074,
"min": 0.00873289876,
"max": 0.013924794760000001
},
{
"command": "pnpr@main",
"mean": 0.011111680111464425,
"stddev": 0.0009529471926054579,
"median": 0.01099443776,
"user": 0.006548146025104603,
"system": 0.005579893054393303,
"min": 0.00910444576,
"max": 0.01366720176
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.51911103728,
"stddev": 0.01994398289356339,
"median": 2.52395970528,
"user": 2.2759947,
"system": 1.41115896,
"min": 2.48667020528,
"max": 2.54349563928
},
{
"command": "pacquet@main",
"mean": 2.51566026128,
"stddev": 0.022404185777442805,
"median": 2.5226018002800004,
"user": 2.280374,
"system": 1.42384256,
"min": 2.47456158528,
"max": 2.54135465128
},
{
"command": "pnpr@HEAD",
"mean": 1.5132431813799998,
"stddev": 0.13132984070207818,
"median": 1.45210223178,
"user": 1.7776443999999998,
"system": 1.3090216600000002,
"min": 1.3839287222799999,
"max": 1.72739532228
},
{
"command": "pnpr@main",
"mean": 1.48271822748,
"stddev": 0.09881623288982098,
"median": 1.4480516892800002,
"user": 1.8208474,
"system": 1.28505656,
"min": 1.38664559128,
"max": 1.66245144028
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.59037848004,
"stddev": 0.041296763589182585,
"median": 0.58787247304,
"user": 0.88669598,
"system": 1.3041199799999998,
"min": 0.53282232404,
"max": 0.66522849704
},
{
"command": "pacquet@main",
"mean": 0.5644887850400001,
"stddev": 0.03107462883911022,
"median": 0.55492851454,
"user": 0.8351909799999999,
"system": 1.2242045799999999,
"min": 0.52938956604,
"max": 0.61046676804
},
{
"command": "pnpr@HEAD",
"mean": 0.34070155864000007,
"stddev": 0.024344129558520583,
"median": 0.33488953954000006,
"user": 0.34710918,
"system": 0.63015668,
"min": 0.31269275704000005,
"max": 0.37717743204000004
},
{
"command": "pnpr@main",
"mean": 0.35808291904000006,
"stddev": 0.039430430837757095,
"median": 0.34644527354000004,
"user": 0.36430777999999997,
"system": 0.6570532800000002,
"min": 0.32059885404000005,
"max": 0.44448631304
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.62843098416,
"stddev": 0.02044523179216358,
"median": 1.62946712046,
"user": 0.81752308,
"system": 0.8123552799999999,
"min": 1.60518528246,
"max": 1.66475546446
},
{
"command": "pacquet@main",
"mean": 1.6363781664600001,
"stddev": 0.011731226992965008,
"median": 1.6346610989600001,
"user": 0.83046708,
"system": 0.8105653800000001,
"min": 1.62188563546,
"max": 1.6542374734599998
},
{
"command": "pnpr@HEAD",
"mean": 0.28116944126000004,
"stddev": 0.005299258976241755,
"median": 0.28142888846,
"user": 0.25912248,
"system": 0.50185198,
"min": 0.27278139546,
"max": 0.28985109046
},
{
"command": "pnpr@main",
"mean": 0.26611004656000004,
"stddev": 0.006524779853391681,
"median": 0.26726315346,
"user": 0.25453788,
"system": 0.48913898000000006,
"min": 0.25492410346,
"max": 0.27530106946
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2383195987733334,
"stddev": 0.014007639764198727,
"median": 0.23652393644000003,
"user": 0.22626849666666668,
"system": 0.24792791999999997,
"min": 0.21647522044000003,
"max": 0.26269529144
},
{
"command": "pacquet@main",
"mean": 0.24385120089454543,
"stddev": 0.01713300956708002,
"median": 0.24940518944000004,
"user": 0.2142821709090909,
"system": 0.24984142,
"min": 0.21566512944000002,
"max": 0.26476707244
},
{
"command": "pnpr@HEAD",
"mean": 0.0848471336521212,
"stddev": 0.0021780696439672198,
"median": 0.08362345944,
"user": 0.027764110303030307,
"system": 0.02006903090909091,
"min": 0.08230443244,
"max": 0.08815676444000001
},
{
"command": "pnpr@main",
"mean": 0.08468394692484851,
"stddev": 0.002156151129198496,
"median": 0.08353188744000001,
"user": 0.028822504242424246,
"system": 0.019093091515151508,
"min": 0.08209951744,
"max": 0.08954661444
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.21582303346888893,
"stddev": 0.017636055812125333,
"median": 0.21864721258,
"user": 0.22330066888888891,
"system": 0.05331855555555555,
"min": 0.18952061358,
"max": 0.24492953758000002
},
{
"command": "pacquet@main",
"mean": 0.21970012002444447,
"stddev": 0.015175504953893302,
"median": 0.21971971558,
"user": 0.23308122444444443,
"system": 0.042678888888888884,
"min": 0.19988999758,
"max": 0.23808034558000002
},
{
"command": "pnpm@HEAD",
"mean": 4.154938486357778,
"stddev": 0.14993810800002477,
"median": 4.167819643580001,
"user": 6.341226668888889,
"system": 0.38264977777777776,
"min": 3.86179621258,
"max": 4.41833829958
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.09953103364666667,
"stddev": 0.00840034738815393,
"median": 0.10074003038000001,
"user": 0.09261682000000002,
"system": 0.05175725333333333,
"min": 0.08620509238000001,
"max": 0.11669190638000002
},
{
"command": "pacquet@main",
"mean": 0.09853731765586207,
"stddev": 0.0071125178626781065,
"median": 0.09804433038000002,
"user": 0.09667106137931034,
"system": 0.04827660275862069,
"min": 0.08702188838000001,
"max": 0.11353562338
}
]
}Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.13791470238761905,
"stddev": 0.007920075237871006,
"median": 0.13981377434,
"user": 0.054966966666666665,
"system": 0.09551516190476188,
"min": 0.11687182734000001,
"max": 0.14823596734
},
{
"command": "pacquet@main",
"mean": 0.13370249579000001,
"stddev": 0.00916392329007162,
"median": 0.13615632334,
"user": 0.05637249999999999,
"system": 0.08881165,
"min": 0.10692157334,
"max": 0.14409673534
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.67094528714,
"stddev": 0.13515889396564812,
"median": 4.651556858039999,
"user": 2.6329899199999995,
"system": 1.74552578,
"min": 4.53534462854,
"max": 5.01173746254
},
{
"command": "pacquet@main",
"mean": 4.60354734864,
"stddev": 0.1426666836297505,
"median": 4.54781341104,
"user": 2.49658182,
"system": 1.7480606799999996,
"min": 4.45122344454,
"max": 4.89144224254
},
{
"command": "pnpr@HEAD",
"mean": 3.6314262411399993,
"stddev": 0.14872099202766587,
"median": 3.57898838154,
"user": 2.3112161199999997,
"system": 1.57193408,
"min": 3.49136281954,
"max": 3.9321064875399996
},
{
"command": "pnpr@main",
"mean": 3.6775299343399994,
"stddev": 0.12963017205683572,
"median": 3.64586417804,
"user": 2.3416290199999996,
"system": 1.5891051800000002,
"min": 3.49550552254,
"max": 3.92735915954
}
]
}Scenario: GVS linker: fresh restore, hot cache + hot storeSame install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.15036092230444442,
"stddev": 0.004854097484682148,
"median": 0.14826639536,
"user": 0.1851489444444444,
"system": 0.1493749,
"min": 0.14460785286,
"max": 0.16287486386
},
{
"command": "pacquet@main",
"mean": 0.15037264838941178,
"stddev": 0.006937521358585548,
"median": 0.14995349286,
"user": 0.19180326470588238,
"system": 0.1396298117647059,
"min": 0.14078666286,
"max": 0.16669571286
},
{
"command": "pnpr@HEAD",
"mean": 0.16137284886000003,
"stddev": 0.006538339033057739,
"median": 0.15942444636000003,
"user": 0.1911320625,
"system": 0.14460602499999997,
"min": 0.15350900986,
"max": 0.17961042286
},
{
"command": "pnpr@main",
"mean": 0.16185544436000004,
"stddev": 0.005646945357635103,
"median": 0.16033710786,
"user": 0.1930625,
"system": 0.14697658749999998,
"min": 0.15234038186,
"max": 0.17206419386
}
]
}Scenario: Store only: unlocked direct deps, cold cache + hot storeStore-only install (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.2227214487600002,
"stddev": 0.04588619635824387,
"median": 1.21115004346,
"user": 0.5006839200000001,
"system": 0.20242907999999998,
"min": 1.17540221396,
"max": 1.30621369196
},
{
"command": "pacquet@main",
"mean": 1.22514044446,
"stddev": 0.04823206108663259,
"median": 1.20290965796,
"user": 0.48999062000000004,
"system": 0.19883858000000001,
"min": 1.18163390396,
"max": 1.33086259396
}
]
}Scenario: Cargo: repeat install, hot cache + hot storeFrozen repeat install of a Cargo workspace (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.03718746201971831,
"stddev": 0.003671119553655769,
"median": 0.036896923400000003,
"user": 0.026819016338028183,
"system": 0.019776664788732398,
"min": 0.031258308400000004,
"max": 0.0606652754
},
{
"command": "pacquet@main",
"mean": 0.033853590928735626,
"stddev": 0.0024275824447832816,
"median": 0.0340988214,
"user": 0.025586523218390816,
"system": 0.017335113103448277,
"min": 0.0281168154,
"max": 0.0402794664
}
]
} |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #17828 +/- ##
=======================================
Coverage 93.05% 93.06%
=======================================
Files 2166 2166
Lines 275870 275911 +41
=======================================
+ Hits 256717 256766 +49
+ Misses 19153 19145 -8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
PR Summary by QodoRemove dependencies with malformed manifests without failing install
AI Description
Diagram
High-Level Assessment
Files changed (9)
|
[Medium impact] The PR appears safe to merge. Reviews (4) · Last reviewed commit: "test: name the bin cases of the malforme..." · Reviewed by Greptile |
Code Review by Qodo
1. A regression case passes without the fix
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
The v12 test takes a `LinkedBins` enum in place of a `bool` and reports what it saw in a named struct. `safeReadDependencyManifest`'s doc comment now names the not-a-directory case and says that other read errors are rethrown. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Replies to the Qodo review of 1c1739d.
Written by an agent (Claude Code, claude-opus-5-5). |
|
Code review by qodo was updated up to the latest commit 782622d |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Summary
Closes pnpm/tasks#295.
In v11,
removeBinsOfDependencythrewERR_PNPM_BAD_PACKAGE_JSONon a removed dependency's malformedpackage.json. Three paths go through it, so the install failed before the dependency was removed:.bin;v12 skips the bins and removes the dependency (
remove_dep_bins_with_version). v11 now does the same. A newsafeReadDependencyManifestin@pnpm/bins.removerreturnsundefinedfor a missing or malformed manifest, or one under a path that is not a directory, and rethrows other errors.removeBinsOfDependencyand the hoisted stale-link pass both use it, so the reader that #17820 added to the hoisted pass is gone.v12 needs no code change. Its test now also covers a real
.bin, to match v11's.The test
a removed link: dependency with a malformed manifest is unlinkednow runs under each linker, with and without a real.bin, in both stacks. Without the fix, the v11 isolated cases and the hoisted case with a real.binfail. The hoisted case without one already passed through the reader from #17820. It now covers the shared reader that replaces that one.Squash Commit Body
Checklist
already linked to it solves it.
are implemented in every affected version.
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
🤖 Generated with Claude Code
Written by an agent (Claude Code, claude-opus-5-5).
Summary by CodeRabbit