Repository navigation
Conversation
📝 WalkthroughWalkthroughThe lockfile loader now configures YAML parser event and node budgets based on document size, with default upper bounds. A regression test parses 130,000 importers, and a Changesets entry records a patch release for ChangesLarge lockfile parsing
Estimated code review effort: 3 (Moderate) | ~20 minutes Assessment against linked issues
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 QodoScale YAML parser budgets to parse large pnpm lockfiles
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security issues identified. The parser retains its existing default structural limits for ordinary lockfiles, raises only the event and node budgets for larger inputs, and includes focused regression coverage for the previously rejected lockfile size. Reviews (1): Last reviewed commit: "fix(lockfile): parse large lockfiles" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@pnpm/crates/lockfile/src/load_lockfile.rs`:
- Around line 122-123: Update the lockfile YAML budget calculation around
max_events and max_nodes so size-based scaling remains available for valid large
lockfiles but is clamped to documented hard maximums, preventing
attacker-controlled input from producing unbounded budgets. Define or reuse
named constants for both caps, document their limits, and add a regression test
covering pathological oversized input being rejected.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 4dc123f2-6ba1-49f8-9272-23b56ecceac6
📒 Files selected for processing (3)
.changeset/large-lockfiles-parse.mdpnpm/crates/lockfile/src/load_lockfile.rspnpm/crates/lockfile/src/load_lockfile/tests.rs
Micro-Benchmark ResultsLinux |
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1. Test lacks budget assertion
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13485 +/- ##
=======================================
Coverage 87.76% 87.77%
=======================================
Files 549 549
Lines 95452 95457 +5
=======================================
+ Hits 83778 83785 +7
+ Misses 11674 11672 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.54365081114,
"stddev": 0.17029839126735352,
"median": 2.4763708519399996,
"user": 1.7339696000000004,
"system": 1.4394230599999998,
"min": 2.40501843094,
"max": 2.8168549379399996,
"times": [
2.40768260194,
2.40544914894,
2.8168549379399996,
2.41304604194,
2.47054710794,
2.40501843094,
2.79737735694,
2.48219459594,
2.5016835559399997,
2.7366543329399997
]
},
{
"command": "pacquet@main",
"mean": 2.67227461404,
"stddev": 0.14305726501726096,
"median": 2.73419616294,
"user": 1.7766595000000003,
"system": 1.46678116,
"min": 2.43972925894,
"max": 2.8349828009399998,
"times": [
2.8349828009399998,
2.4780377409399996,
2.73246848394,
2.43972925894,
2.73592384194,
2.6528821149399997,
2.51873818494,
2.78466379894,
2.74527951694,
2.80004039794
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5581581925400003,
"stddev": 0.1815075577375253,
"median": 1.54452688344,
"user": 1.1852532,
"system": 1.2742118599999999,
"min": 1.3599672309400002,
"max": 1.77058760294,
"times": [
1.65293523594,
1.4087257619400002,
1.4361185309400002,
1.38018525794,
1.3599672309400002,
1.77058760294,
1.36513615494,
1.7502389789400001,
1.7588327839400002,
1.6988543869400001
]
},
{
"command": "pnpr@main",
"mean": 1.63704950134,
"stddev": 0.15610419154958666,
"median": 1.6970452694400002,
"user": 1.2881025,
"system": 1.30434946,
"min": 1.39633732294,
"max": 1.79533432294,
"times": [
1.39633732294,
1.75201302994,
1.79204177294,
1.79533432294,
1.6617277519400002,
1.7323627869400002,
1.47602152694,
1.7525959139400002,
1.4172205909400002,
1.5948399939400002
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2838410093,
"stddev": 0.01426759624011773,
"median": 0.28376600490000004,
"user": 0.2484641,
"system": 0.55885052,
"min": 0.2576174814,
"max": 0.30093374640000004,
"times": [
0.30093374640000004,
0.29840734240000005,
0.29213417540000003,
0.2774004834,
0.28121674840000005,
0.29971192240000005,
0.27265663640000004,
0.2576174814,
0.2863152614,
0.27201629540000005
]
},
{
"command": "pacquet@main",
"mean": 0.26691280940000006,
"stddev": 0.013682884403718827,
"median": 0.2675675824,
"user": 0.2096726,
"system": 0.55158442,
"min": 0.2464430524,
"max": 0.29250692440000003,
"times": [
0.2740958894,
0.27955748340000003,
0.2721487944,
0.29250692440000003,
0.26835337740000004,
0.2667817874,
0.25326425840000005,
0.2464430524,
0.25449885740000006,
0.26147766940000006
]
},
{
"command": "pnpr@HEAD",
"mean": 0.30759355290000007,
"stddev": 0.010130088088440693,
"median": 0.3086457349,
"user": 0.25851379999999996,
"system": 0.57451612,
"min": 0.29408998840000006,
"max": 0.32311070240000006,
"times": [
0.29408998840000006,
0.32311070240000006,
0.3166009314,
0.29484028640000004,
0.31041276240000004,
0.2964347594,
0.3168703064,
0.31261969640000004,
0.30407738840000004,
0.30687870740000006
]
},
{
"command": "pnpr@main",
"mean": 0.3170240435000001,
"stddev": 0.011607184873247455,
"median": 0.31434398390000007,
"user": 0.26663059999999994,
"system": 0.6081758199999999,
"min": 0.29434316340000005,
"max": 0.33564300240000006,
"times": [
0.31471004140000003,
0.33181388240000004,
0.33564300240000006,
0.3128735234,
0.3125695124,
0.31869123540000005,
0.31160430940000006,
0.32401383840000003,
0.29434316340000005,
0.31397792640000005
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.8996022747000003,
"stddev": 0.03294258294608612,
"median": 2.9024805268000002,
"user": 2.0784915199999996,
"system": 1.53887718,
"min": 2.8286675413,
"max": 2.9502893803,
"times": [
2.9137283783,
2.8730654363,
2.8986954663000004,
2.9062655873,
2.9502893803,
2.8923910393,
2.9207100563000004,
2.9239223773000003,
2.8882874843,
2.8286675413
]
},
{
"command": "pacquet@main",
"mean": 2.8715194264,
"stddev": 0.04148834733780587,
"median": 2.8641110898,
"user": 1.9667559200000002,
"system": 1.4758294799999998,
"min": 2.8061674373,
"max": 2.9351674203,
"times": [
2.9188448363000004,
2.9351674203,
2.8459478733,
2.8421516663000004,
2.8344836003000005,
2.8061674373,
2.8967891353,
2.8656434123000003,
2.9074201153000003,
2.8625787673
]
},
{
"command": "pnpr@HEAD",
"mean": 1.6400635126,
"stddev": 0.17715478211422012,
"median": 1.5480580287999999,
"user": 1.15803382,
"system": 1.27616218,
"min": 1.4712164823,
"max": 1.9393563062999999,
"times": [
1.4970123123,
1.4847097142999999,
1.7128409933,
1.9393563062999999,
1.5213972453,
1.4712164823,
1.5730444802999999,
1.8781568353,
1.7998291792999999,
1.5230715772999999
]
},
{
"command": "pnpr@main",
"mean": 1.6571896023000001,
"stddev": 0.22809073963595644,
"median": 1.6060124258,
"user": 1.1880123200000001,
"system": 1.3416097800000002,
"min": 1.4253436683,
"max": 2.0993587333000003,
"times": [
1.8282128083,
1.8137733483,
1.4253436683,
1.8300756563,
1.5585989183,
1.4917403553,
1.4298706783,
2.0993587333000003,
1.6534259333,
1.4414959233
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6260723218600002,
"stddev": 0.0214033549327252,
"median": 0.62480805106,
"user": 0.75568182,
"system": 0.6957151599999999,
"min": 0.5785661095600001,
"max": 0.6493658925600001,
"times": [
0.6493658925600001,
0.6410288405600001,
0.6124135055600001,
0.6454686055600001,
0.6152414945600001,
0.6228113675600001,
0.6462113005600001,
0.5785661095600001,
0.62520135456,
0.62441474756
]
},
{
"command": "pacquet@main",
"mean": 0.59958446296,
"stddev": 0.015970184591238352,
"median": 0.5955555460600002,
"user": 0.7198229200000001,
"system": 0.67668336,
"min": 0.57729487156,
"max": 0.6231422795600001,
"times": [
0.62259086356,
0.6089624665600001,
0.59027225656,
0.5890532085600001,
0.6231422795600001,
0.5990707555600001,
0.61003249556,
0.5920403365600001,
0.57729487156,
0.5833850955600001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.30482155176000003,
"stddev": 0.009817138580437888,
"median": 0.30222039156,
"user": 0.19030222,
"system": 0.5251229600000001,
"min": 0.29134178656000004,
"max": 0.32743181456000003,
"times": [
0.32743181456000003,
0.30313182256,
0.29867453356,
0.30892584056,
0.30038365256,
0.30085132056,
0.29134178656000004,
0.30273912556,
0.30170165756,
0.31303396356
]
},
{
"command": "pnpr@main",
"mean": 0.30992957596000004,
"stddev": 0.006219581702290728,
"median": 0.30940952356,
"user": 0.19726841999999997,
"system": 0.55181616,
"min": 0.30039352156,
"max": 0.31724704356,
"times": [
0.31402936256,
0.30473566356000004,
0.30209508556000003,
0.31715940856,
0.31724704356,
0.30039352156,
0.31638390256000004,
0.31035625556,
0.30843272456000004,
0.30846279156
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.91710418392,
"stddev": 0.014073863561985124,
"median": 1.91333747972,
"user": 0.9282842599999999,
"system": 0.79420414,
"min": 1.90016462372,
"max": 1.9425640477200001,
"times": [
1.93363466172,
1.92699195072,
1.9425640477200001,
1.90843855772,
1.9221583657199999,
1.90016462372,
1.90960422572,
1.9009337877199999,
1.91707073372,
1.90948088472
]
},
{
"command": "pacquet@main",
"mean": 1.91123547252,
"stddev": 0.012516271286365475,
"median": 1.91025616022,
"user": 0.91900786,
"system": 0.7877902400000001,
"min": 1.89606398472,
"max": 1.93185242572,
"times": [
1.91324697472,
1.90020763372,
1.91350671272,
1.92850444072,
1.92030625872,
1.89606398472,
1.89902237872,
1.9072653457200002,
1.93185242572,
1.90237856972
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29918900792,
"stddev": 0.003640131492243283,
"median": 0.29845130822,
"user": 0.17892426,
"system": 0.5297024400000001,
"min": 0.29335388372000004,
"max": 0.30484615872000004,
"times": [
0.30288212172,
0.29335388372000004,
0.29640785572,
0.29706304672,
0.29692087972000003,
0.29808063672,
0.29882197972,
0.30484615872000004,
0.29980546472,
0.30370805172000004
]
},
{
"command": "pnpr@main",
"mean": 0.30901504692000004,
"stddev": 0.005959712011405645,
"median": 0.30881422372,
"user": 0.18916426,
"system": 0.5539405399999999,
"min": 0.29790677072000005,
"max": 0.31713066272,
"times": [
0.31713066272,
0.31330200572,
0.29790677072000005,
0.31022671972000004,
0.30358037172,
0.30499394672,
0.31520239272,
0.31345464072,
0.30740172772,
0.30695123072
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.36839441298000003,
"stddev": 0.0122296183222141,
"median": 0.37349214748000004,
"user": 0.36380782,
"system": 0.05634578,
"min": 0.35068763798,
"max": 0.38320098098000005,
"times": [
0.37219243198,
0.37694961398000004,
0.37779417998000003,
0.35648628498000007,
0.37901045298,
0.37479186298000006,
0.35068763798,
0.36165500998000005,
0.35117567398000005,
0.38320098098000005
]
},
{
"command": "pacquet@main",
"mean": 0.37850491978000006,
"stddev": 0.01045466150173193,
"median": 0.38059355548000007,
"user": 0.37194082000000006,
"system": 0.05776287999999998,
"min": 0.35359278198000005,
"max": 0.39047670998000006,
"times": [
0.37763589298000005,
0.37984222498000003,
0.38667746698000005,
0.38134488598000005,
0.37086077198000006,
0.37555038698000004,
0.39047670998000006,
0.38565181098000006,
0.38341626498000003,
0.35359278198000005
]
},
{
"command": "pnpr@HEAD",
"mean": 0.08729235660500001,
"stddev": 0.0014729072508149143,
"median": 0.08727657898000002,
"user": 0.020888176249999998,
"system": 0.00888988375,
"min": 0.08426988998000001,
"max": 0.09154861498000001,
"times": [
0.08906060298000001,
0.08854680998000002,
0.08569760998,
0.08640706098,
0.08951960598000001,
0.08651725898000001,
0.08793143398000001,
0.08570352098,
0.08685035398,
0.08761902798000001,
0.08745910698,
0.08733443398000001,
0.08724241998000001,
0.08828198098000001,
0.08612464298000001,
0.08845829198,
0.08577624798000001,
0.08750038398000001,
0.09154861498000001,
0.08981572198000001,
0.08512545698000001,
0.08638324698000001,
0.08648762398000001,
0.08781368198000002,
0.08760049298000001,
0.08861559898000002,
0.08634497498,
0.08717227998,
0.08635966198000002,
0.08426988998000001,
0.08731073798000001,
0.08647663298000001
]
},
{
"command": "pnpr@main",
"mean": 0.08637490182848485,
"stddev": 0.0017611664376868967,
"median": 0.08720487998000001,
"user": 0.0190840503030303,
"system": 0.00939633212121212,
"min": 0.08248748298000001,
"max": 0.08855568698,
"times": [
0.08530562398000001,
0.08748554798000001,
0.08775226698000001,
0.08662316798000001,
0.08855568698,
0.08674150998,
0.08752810698,
0.08738746198000001,
0.08268169898000001,
0.08727623398,
0.08702010398000001,
0.08734819998000001,
0.08248748298000001,
0.08293253898000001,
0.08736101298000001,
0.08750426198000001,
0.08704980898,
0.08269550398000002,
0.08739095898000002,
0.08737353698000001,
0.08753399698000001,
0.08778586198,
0.08667768098,
0.08362276498000001,
0.08741468398,
0.08630075198,
0.08386143298000001,
0.08662462998,
0.08740626798000001,
0.08679346698000001,
0.08808652498000001,
0.08720487998000001,
0.08455810098000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.5702705847,
"stddev": 0.15961144956730233,
"median": 4.5130101769,
"user": 1.7215672399999995,
"system": 1.3665015999999999,
"min": 4.4181552458999995,
"max": 4.8757069489,
"times": [
4.653802993899999,
4.4473970759,
4.4522921558999995,
4.420210744899999,
4.5084910978999995,
4.4181552458999995,
4.5175292558999995,
4.7809595159,
4.6281608119,
4.8757069489
]
},
{
"command": "pacquet@main",
"mean": 4.533079055699999,
"stddev": 0.14683083827052285,
"median": 4.4602073409,
"user": 1.7564671399999998,
"system": 1.3757723,
"min": 4.4301945359,
"max": 4.7967106989,
"times": [
4.4581962199,
4.431054362899999,
4.4729734349,
4.4622184619,
4.7967106989,
4.441619913899999,
4.6110546529,
4.4301945359,
4.4373818359,
4.7893864398999995
]
},
{
"command": "pnpr@HEAD",
"mean": 3.5503467603000005,
"stddev": 0.12631572987131523,
"median": 3.5209655444,
"user": 1.17119544,
"system": 1.2730916999999997,
"min": 3.4378805779,
"max": 3.8421601759,
"times": [
3.4699438959,
3.4566780069000003,
3.5328214359000003,
3.5547011439,
3.5265066419,
3.4378805779,
3.4691698319,
3.6981814459,
3.5154244469000004,
3.8421601759
]
},
{
"command": "pnpr@main",
"mean": 3.5094586411999997,
"stddev": 0.07035183520112734,
"median": 3.4794247144000003,
"user": 1.1882199399999998,
"system": 1.244271,
"min": 3.4344746309,
"max": 3.6338450359000003,
"times": [
3.4344746309,
3.5049374179000004,
3.4811185259,
3.5835599619000003,
3.6005698529,
3.4777309029000003,
3.6338450359000003,
3.4628055779,
3.4701791879000004,
3.4453653179000003
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13485 |
| 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,471.22 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 293.35 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 291.34 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 84.27 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,359.97 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,437.88 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 294.09 ms |
…13497) The node/event budgets already scale with the document's byte length (#13485), but a ~100 MB lockfile still failed with "budget breached: ScalarBytes" at serde-saphyr's 64 MiB scalar-text default. Scale every size-proportional budget dimension (scalar bytes, comment bytes, reader input bytes) the same way: none of them can exceed the size of an input that is already in memory, so a valid lockfile can never trip them. The remaining defaults (aliases, anchors, depth, documents) bound YAML shapes the lockfile emitter never produces and stay as security caps. Add a regression test that parses a generated lockfile above the 64 MiB scalar budget.
Summary
serde-saphyr's default 250,000-node budget.Fixes #12857.
Squash Commit Body
Checklist
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 (Codex, GPT-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit