Skip to content

fix(lockfile): parse large lockfiles - #13485

Merged
zkochan merged 1 commit into
mainfrom
fix-12857
Jul 29, 2026
Merged

zkochan merged 1 commit into
mainfrom
fix-12857

Conversation

@zkochan

@zkochan zkochan commented Jul 29, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Scale pacquet's YAML event and node budgets with the lockfile size so valid large lockfiles can be parsed.
  • Preserve the parser's depth, alias, anchor, merge-key, scalar, and comment limits.
  • Add a regression test whose generated lockfile exceeds serde-saphyr's default 250,000-node budget.
  • The TypeScript CLI already handles these lockfiles, so no TypeScript change is needed.

Fixes #12857.

Squash Commit Body

Pacquet parsed lockfiles with serde-saphyr's default structural budgets, which reject valid large lockfiles after 250,000 YAML nodes.

Set the event and node budgets to the greater of their defaults and the lockfile's byte length. This keeps the structural work allowance proportional to an input that is already in memory while retaining the parser's other resource limits.

Add a regression test that parses a generated lockfile above the previous node limit.

Fixes pnpm/pnpm#12857.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

Written by an agent (Codex, GPT-5).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes
    • Large lockfiles can now be parsed successfully, even when they exceed the YAML parser’s default structural limits.
    • Prevents entries from being dropped when processing lockfiles with very large numbers of importers.

Copilot AI review requested due to automatic review settings July 29, 2026 09:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The 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 pacquet.

Changes

Large lockfile parsing

Layer / File(s) Summary
Configurable YAML parsing budget
pnpm/crates/lockfile/src/load_lockfile.rs
Lockfile::parse derives bounded YAML event and node budgets from the main document size and uses them during parsing.
Large lockfile regression coverage
pnpm/crates/lockfile/src/load_lockfile/tests.rs, .changeset/large-lockfiles-parse.md
Tests parsing 130,000 importer entries and records the corresponding pacquet patch release.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Prevent pacquet from exhausting the YAML parser budget on very large lockfiles [#12857] ✅

Suggested labels: product: pacquet

Suggested reviewers: copilot

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-12857

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Scale YAML parser budgets to parse large pnpm lockfiles

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Scale serde-saphyr YAML node/event budgets based on lockfile byte length.
• Keep existing depth/alias/anchor/merge-key/scalar/comment safety limits unchanged.
• Add regression test parsing a generated lockfile exceeding the default node budget.
Diagram

graph TD
  A["Lockfile loader"] --> B["Lockfile::parse"] --> C["extract_main_document"] --> D{"Main empty?"}
  D -->|"yes"| E["Return None"]
  D -->|"no"| F["serde-saphyr parse (scaled budget)"]
  F --> G["Lockfile struct"] --> H["Reconstruct directory resolutions"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Raise budgets to a larger fixed constant
  • ➕ Simpler mental model (no scaling logic).
  • ➕ Avoids tiny-lockfile budgets changing if defaults change upstream.
  • ➖ Still risks rejecting valid lockfiles above the new cap.
  • ➖ Either too small (still fails) or too large (more DoS headroom) for typical inputs.
2. Expose budgets via configuration (env/CLI)
  • ➕ Gives power users an escape hatch for extreme monorepos.
  • ➕ Avoids coupling budgets to byte length.
  • ➖ More surface area to document/support.
  • ➖ Harder to ensure safe defaults in all embedding contexts.
3. Use a streaming/low-allocation YAML parse path
  • ➕ Better asymptotic behavior for very large lockfiles.
  • ➕ Could reduce peak memory and structural work limits.
  • ➖ Much larger refactor; higher regression risk.
  • ➖ May not be supported cleanly by current serde-based model.

Recommendation: The chosen approach (scale max_events/max_nodes to at least the lockfile byte length while preserving other structural limits) is the best tradeoff for this bug: it fixes valid large lockfiles with minimal surface area and keeps existing safety constraints intact. A fixed-budget bump is simpler but less robust; configurability/streaming are heavier-weight options best reserved for follow-up work if real-world lockfiles continue to exceed scaled limits.

Files changed (3) +39 / -7

Bug fix (1) +17 / -6
load_lockfile.rsScale serde-saphyr budgets by lockfile size during parse +17/-6

Scale serde-saphyr budgets by lockfile size during parse

• Adds default YAML event/node budget constants and switches to serde_saphyr::from_str_with_options to set max_events/max_nodes to max(default, main document byte length). Keeps existing empty-document handling and post-parse reconstruction, and preserves error sanitization via without_snippet().

pnpm/crates/lockfile/src/load_lockfile.rs

Tests (1) +17 / -1
tests.rsRegression test for lockfiles exceeding default YAML node budget +17/-1

Regression test for lockfiles exceeding default YAML node budget

• Adds a unit test that generates a lockfile with 130,000 importers to exceed the prior 250,000-node budget and asserts successful parsing and importer count. Extends imports to support efficient string generation and path creation.

pnpm/crates/lockfile/src/load_lockfile/tests.rs

Documentation (1) +5 / -0
large-lockfiles-parse.mdAdd changeset noting large lockfile parsing fix +5/-0

Add changeset noting large lockfile parsing fix

• Introduces a patch changeset for pacquet documenting that large lockfiles beyond the YAML parser's default structural budget now parse successfully, referencing pnpm/pnpm#12857.

.changeset/large-lockfiles-parse.md

@greptile-apps

greptile-apps Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The 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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 02f8807 and 135dc6a.

📒 Files selected for processing (3)
  • .changeset/large-lockfiles-parse.md
  • pnpm/crates/lockfile/src/load_lockfile.rs
  • pnpm/crates/lockfile/src/load_lockfile/tests.rs

@github-actions

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     11.8±0.06ms    31.7 MB/sec    1.07     12.6±0.32ms    29.6 MB/sec
packument/parse                                  1.00     39.4±0.28µs  1683.4 MB/sec    1.08     42.5±0.44µs  1561.5 MB/sec
tarball/download_dependency                      1.00      2.4±0.09ms  1810.9 KB/sec    1.04      2.5±0.16ms  1739.8 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    176.1±7.70ms 90.9 KElem/sec    1.07    188.9±4.52ms 84.7 KElem/sec

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 29, 2026
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Remediation recommended

1. Test lacks budget assertion 🐞 Bug ☼ Reliability
Description
The new regression test only asserts that parsing succeeds and the importer count matches, but it
does not prove the generated YAML would have exceeded the old 250,000-node default budget. If
serde-saphyr node accounting changes (or the fixture changes), the test can pass without actually
exercising the intended regression condition.
Code

pnpm/crates/lockfile/src/load_lockfile/tests.rs[R101-115]

+#[test]
+fn parses_lockfile_larger_than_default_yaml_node_budget() {
+    const IMPORTER_COUNT: usize = 130_000;
+
+    let mut content = String::from("lockfileVersion: '9.0'\n\nimporters:\n");
+    for index in 0..IMPORTER_COUNT {
+        writeln!(content, "  project-{index}: {{}}").expect("write importer");
+    }
+
+    let lockfile = Lockfile::parse(&content, Path::new(Lockfile::FILE_NAME))
+        .expect("parse large lockfile")
+        .expect("large lockfile should be present");
+
+    assert_eq!(lockfile.importers.len(), IMPORTER_COUNT);
+}
Relevance

⭐⭐⭐ High

They’ve accepted strengthening regression tests to prevent false positives/weak assertions in
lockfile/YAML areas.

PR-#13432
PR-#13081

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test constructs a large importers map and calls Lockfile::parse(), but it never checks
behavior under the previous/default node budget it’s named after. The defaults are now hardcoded in
the loader module (250,000 nodes), so the test can and should assert the old-budget failure
explicitly.

pnpm/crates/lockfile/src/load_lockfile/tests.rs[101-115]
pnpm/crates/lockfile/src/load_lockfile.rs[12-13]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The regression test claims to exceed the YAML parser’s default node budget, but it only checks that the current `Lockfile::parse()` succeeds. It never asserts that the same content fails under the previous/default structural budget, so it can become a false-green.

## Issue Context
The fix is specifically about lifting serde-saphyr’s default structural budgets for large lockfiles.

## Fix Focus Areas
- pnpm/crates/lockfile/src/load_lockfile/tests.rs[101-115]
- pnpm/crates/lockfile/src/load_lockfile.rs[12-13]

### Suggested fix
In the test, add a control assertion that parsing the generated YAML with the *default/old* budgets fails.

Because `tests` is a child module of `load_lockfile`, it can reference `super::DEFAULT_YAML_MAX_NODES`/`super::DEFAULT_YAML_MAX_EVENTS` and call serde-saphyr directly:
```rust
let default_budget_err = serde_saphyr::from_str_with_options::<Lockfile>(
   &content,
   serde_saphyr::options! {
       budget: serde_saphyr::budget! {
           max_events: super::DEFAULT_YAML_MAX_EVENTS,
           max_nodes: super::DEFAULT_YAML_MAX_NODES,
       },
   },
)
.expect_err("fixture should exceed default YAML structural budgets");

// Then assert the new path succeeds:
let lockfile = Lockfile::parse(&content, Path::new(Lockfile::FILE_NAME))?
   .expect("large lockfile should be present");
```
Avoid over-specifying the error string unless serde-saphyr exposes a stable error kind you can match.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. No hard YAML cap 🐞 Bug ⛨ Security
Description
Lockfile::parse now raises serde-saphyr max_events/max_nodes to main.len() for large lockfiles,
removing the previous fixed structural ceiling and allowing extremely large attacker-controlled
lockfiles to consume much more CPU/time during YAML parsing. This affects any path that loads
pnpm-lock.yaml (including pnpr’s resolve flow) because there is no file-size or budget hard cap
before parsing.
Code

pnpm/crates/lockfile/src/load_lockfile.rs[R118-125]

+        serde_saphyr::from_str_with_options::<Self>(
+            main,
+            serde_saphyr::options! {
+                budget: serde_saphyr::budget! {
+                    max_events: main.len().max(DEFAULT_YAML_MAX_EVENTS),
+                    max_nodes: main.len().max(DEFAULT_YAML_MAX_NODES),
+                },
+            },
Relevance

⭐⭐ Medium

Team has rejected some lockfile DoS-hardening; no clear precedent for adding a hard YAML cap here.

PR-#13075

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed code explicitly sets the YAML structural budgets to main.len().max(DEFAULT_…) with no
upper bound, and the loader reads the full file into memory before parsing. The lockfile parser is
used in multiple flows (including pnpr’s resolve path), so an attacker-controlled huge lockfile can
force substantially more parsing work than before instead of failing at the prior fixed budget.

pnpm/crates/lockfile/src/load_lockfile.rs[113-141]
pnpm/crates/lockfile/src/lazy_lockfile.rs[4-13]
pnpr/crates/pnpr/src/resolver/resolve.rs[242-246]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`Lockfile::parse()` scales serde-saphyr YAML `max_events`/`max_nodes` budgets up to the lockfile byte length, which removes the prior fixed structural ceiling. For extremely large, attacker-controlled lockfiles this increases the worst-case parse work (CPU/time and potentially memory) instead of failing early.

## Issue Context
- The lockfile is read fully into memory (`fs::read_to_string`) and then parsed.
- Multiple product paths load the wanted/current lockfile; pnpr also loads the wanted lockfile as part of its resolve flow.

## Fix Focus Areas
- pnpm/crates/lockfile/src/load_lockfile.rs[118-131]

### Suggested fix
- Introduce a **hard maximum** for `max_events` and `max_nodes` (or a hard maximum lockfile size), and clamp the scaled budgets to it.
- Keep current behavior for typical “large but reasonable” lockfiles, but preserve defense-in-depth against pathological sizes.

Example shape (pick caps appropriate to pnpm/pacquet expectations):
```rust
const HARD_MAX_EVENTS: usize = 20_000_000;
const HARD_MAX_NODES: usize = 5_000_000;

let scaled_events = main.len().max(DEFAULT_YAML_MAX_EVENTS).min(HARD_MAX_EVENTS);
let scaled_nodes = main.len().max(DEFAULT_YAML_MAX_NODES).min(HARD_MAX_NODES);
```
Optionally also add a file-size guard in `load_from_path` before parsing.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.77%. Comparing base (627476d) to head (135dc6a).
⚠️ Report is 3 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@github-actions

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 135dc6a025e9

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.544 ± 0.170 2.405 2.817 1.63 ± 0.22
pacquet@main 2.672 ± 0.143 2.440 2.835 1.72 ± 0.22
pnpr@HEAD 1.558 ± 0.182 1.360 1.771 1.00
pnpr@main 1.637 ± 0.156 1.396 1.795 1.05 ± 0.16
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 283.8 ± 14.3 257.6 300.9 1.06 ± 0.08
pacquet@main 266.9 ± 13.7 246.4 292.5 1.00
pnpr@HEAD 307.6 ± 10.1 294.1 323.1 1.15 ± 0.07
pnpr@main 317.0 ± 11.6 294.3 335.6 1.19 ± 0.07
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.900 ± 0.033 2.829 2.950 1.77 ± 0.19
pacquet@main 2.872 ± 0.041 2.806 2.935 1.75 ± 0.19
pnpr@HEAD 1.640 ± 0.177 1.471 1.939 1.00
pnpr@main 1.657 ± 0.228 1.425 2.099 1.01 ± 0.18
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 626.1 ± 21.4 578.6 649.4 2.05 ± 0.10
pacquet@main 599.6 ± 16.0 577.3 623.1 1.97 ± 0.08
pnpr@HEAD 304.8 ± 9.8 291.3 327.4 1.00
pnpr@main 309.9 ± 6.2 300.4 317.2 1.02 ± 0.04
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.917 ± 0.014 1.900 1.943 6.41 ± 0.09
pacquet@main 1.911 ± 0.013 1.896 1.932 6.39 ± 0.09
pnpr@HEAD 0.299 ± 0.004 0.293 0.305 1.00
pnpr@main 0.309 ± 0.006 0.298 0.317 1.03 ± 0.02
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 368.4 ± 12.2 350.7 383.2 4.27 ± 0.17
pacquet@main 378.5 ± 10.5 353.6 390.5 4.38 ± 0.15
pnpr@HEAD 87.3 ± 1.5 84.3 91.5 1.01 ± 0.03
pnpr@main 86.4 ± 1.8 82.5 88.6 1.00
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.570 ± 0.160 4.418 4.876 1.30 ± 0.05
pacquet@main 4.533 ± 0.147 4.430 4.797 1.29 ± 0.05
pnpr@HEAD 3.550 ± 0.126 3.438 3.842 1.01 ± 0.04
pnpr@main 3.509 ± 0.070 3.434 3.634 1.00
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
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13485
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,828.67 ms
(-0.30%)Baseline: 2,837.11 ms
3,404.53 ms
(83.09%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,900.16 ms
(-4.53%)Baseline: 1,990.42 ms
2,388.50 ms
(79.55%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
578.57 ms
(-12.89%)Baseline: 664.20 ms
797.04 ms
(72.59%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
350.69 ms
(-13.83%)Baseline: 406.95 ms
488.34 ms
(71.81%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,405.02 ms
(-1.33%)Baseline: 2,437.54 ms
2,925.04 ms
(82.22%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,418.16 ms
(-2.51%)Baseline: 4,532.06 ms
5,438.47 ms
(81.24%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
257.62 ms
(-10.76%)Baseline: 288.67 ms
346.40 ms
(74.37%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13485
Testbedpnpr

⚠️ 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-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,471.22 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
293.35 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
291.34 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
84.27 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,359.97 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,437.88 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
294.09 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit 54abb6a into main Jul 29, 2026
39 of 40 checks passed
@zkochan
zkochan deleted the fix-12857 branch July 29, 2026 10:12
zkochan added a commit that referenced this pull request Jul 30, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pacquet fails to parse large lockfiles (>12mb)

3 participants