Skip to content

fix(lockfile): read a CRLF or BOM-prefixed multi-document lockfile - #13609

Merged
zkochan merged 1 commit into
mainfrom
fix-13606
Aug 3, 2026
Merged

zkochan merged 1 commit into
mainfrom
fix-13606

Conversation

@zkochan

@zkochan zkochan commented Aug 3, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #13606: pnpm 12 discarded a pnpm-lock.yaml that pnpm 11 wrote as two YAML documents, warned multiple YAML documents detected; use from_multiple or from_multiple_with_options, and re-resolved every dependency from the registry — so the lockfile stopped pinning anything.

extract_main_document / extract_env_document in pnpm/crates/lockfile/src/yaml_documents.rs split the combined lockfile by matching the literal markers ---\n and \n---\n. A lockfile pacquet did not write may not use LF: a core.autocrlf checkout on Windows (the reporter's platform) gives CRLF, and an editor may add a UTF-8 BOM. Neither marker matches then, so extract_main_document fell through to return content — the whole two-document file — which serde_saphyr::from_str_with_options rejected with exactly the reported error, at the line where the second document starts.

The fix normalizes the whole file (strip a leading BOM, rewrite CRLF as LF) inside both extractors, so every caller is covered: Lockfile::parse, Lockfile::wanted_exists_in_dir, EnvLockfile::read, EnvLockfile::write, and save_value_to_path. Cow keeps the common LF path allocation-free. save_value_to_path already did this normalization inline and now shares the helper instead.

No TypeScript counterpart is needed. pnpm11/lockfile/fs/src/yamlDocuments.ts already normalizes CRLF inside extractMainDocument / extractEnvDocument and strips the BOM at every read site; this brings pacquet to the behavior the TypeScript CLI already has.

Tests added: CRLF and BOM document splits in yaml_documents/tests.rs, a loader-level regression asserting a CRLF combined lockfile loads identically to the equivalent main-only lockfile, and a CRLF env-document read.

Note on local verification: just ready is green except for package_manager_check::a_command_outside_the_install_family_records_the_pinned_package_manager and a_package_manager_field_with_an_integrity_hash_matches_the_running_version, which fail on main too — they bootstrap the pinned [email protected] from the real registry and that version is not published yet (npm's next-12 is still 12.0.0-beta.3). They fail before any lockfile is read.

Squash Commit Body

`extract_main_document` / `extract_env_document` split the combined
`pnpm-lock.yaml` on literal `---\n` and `\n---\n`. A lockfile pacquet
did not write may carry CRLF line endings — a `core.autocrlf` checkout
on Windows — or a UTF-8 BOM, and neither marker then matches. The main
extractor fell through to returning the whole file, which serde rejected
as `multiple YAML documents detected`, so the lockfile was discarded and
every dependency re-resolved from the registry.

Normalize the whole file (strip BOM, CRLF to LF) inside both extractors,
which covers every caller. `save_value_to_path` already normalized the
same way inline and now shares the helper.

The TypeScript stack needs no counterpart change:
`pnpm11/lockfile/fs/src/yamlDocuments.ts` already normalizes CRLF in
`extractMainDocument` / `extractEnvDocument` and strips the BOM at each
read site.

Closes pnpm/pnpm#13606

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • 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 (Claude Code, claude-opus-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

    • Fixed pnpm install handling of lockfiles with CRLF line endings, UTF-8 BOMs, or leading environment documents.
    • Prevented incorrect multiple-document errors and unnecessary dependency re-resolution.
    • Preserved correct lockfile behavior when reading and saving normalized content.
  • Tests

    • Added regression coverage for combined, BOM-prefixed, and CRLF-formatted lockfiles.

`extract_main_document` / `extract_env_document` split the combined
`pnpm-lock.yaml` on literal `---\n` and `\n---\n`. A lockfile pacquet
did not write may carry CRLF line endings — a `core.autocrlf` checkout
on Windows — or a UTF-8 BOM, and neither marker then matches. The main
extractor fell through to returning the whole file, which serde rejected
as `multiple YAML documents detected`, so the lockfile was discarded and
every dependency re-resolved from the registry.

Normalize the whole file (strip BOM, CRLF to LF) inside both extractors,
which covers every caller. `save_value_to_path` already normalized the
same way inline and now shares the helper.

The TypeScript stack needs no counterpart change:
`pnpm11/lockfile/fs/src/yamlDocuments.ts` already normalizes CRLF in
`extractMainDocument` / `extractEnvDocument` and strips the BOM at each
read site.

Closes #13606
Copilot AI review requested due to automatic review settings August 3, 2026 14:07

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 Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Lockfile reading now normalizes UTF-8 BOMs and CRLF line endings before extracting YAML documents. A new normalize_lockfile_content function replaces inline normalization in the save path. extract_main_document and extract_env_document return Cow<str> instead of &str. Parse call sites pass documents by reference. Tests and a changeset were added.

Changes

CRLF/BOM-safe lockfile document extraction

Layer / File(s) Summary
Normalization helper and document extraction
pnpm/crates/lockfile/src/yaml_documents.rs
Adds normalize_lockfile_content to strip a leading BOM and convert CRLF to LF. Updates extract_main_document and extract_env_document to normalize input first and return Cow<str>. Splits document parsing into private main/env helper functions.
Parse call sites updated to borrow extracted documents
pnpm/crates/lockfile/src/load_lockfile.rs, pnpm/crates/lockfile/src/env_lockfile.rs
Lockfile::parse and EnvLockfile::read pass the extracted document by reference to serde_saphyr deserialization functions instead of by value.
Save path uses shared normalization
pnpm/crates/lockfile/src/save_lockfile.rs
Imports and uses normalize_lockfile_content to normalize existing lockfile text before comparison, replacing the previous inline BOM removal and CRLF conversion.
Tests and changeset
pnpm/crates/lockfile/src/yaml_documents/tests.rs, pnpm/crates/lockfile/src/load_lockfile/tests.rs, pnpm/crates/lockfile/src/env_lockfile/tests.rs, .changeset/read-crlf-multi-document-lockfile.md
Adds tests for CRLF and BOM document extraction and normalization, adds regression tests reading CRLF combined lockfiles, and adds a patch changeset describing the fix.

Estimated code review effort: 2 (Simple) | ~15 minutes

Assessment against linked issues

Objective Addressed Explanation
Read multi-document pnpm-lock.yaml written by pnpm 11 (env document plus project document) instead of discarding the lockfile and re-resolving dependencies (#13606) ✅
Correctly extract and parse documents when the file has CRLF line endings or a UTF-8 BOM (#13606) ✅

Possibly related PRs

  • pnpm/pnpm#13075: Overlapping lockfile parsing/normalization and save-path changes in env_lockfile.rs, save_lockfile.rs, and YAML document helpers.
  • pnpm/pnpm#13101: Modifies the same Rust lockfile YAML parsing/error handling paths in load_lockfile.rs and env_lockfile.rs.

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-13606

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

Fix CRLF/BOM handling for multi-document pnpm-lock.yaml parsing

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Normalize lockfile content (strip UTF-8 BOM, convert CRLF→LF) before YAML document splitting.
• Prevent multi-document lockfiles from being discarded with “multiple YAML documents detected”.
• Add regression tests for CRLF/BOM combined lockfiles and env-document reads.
Diagram

graph TD
  A["Lockfile loaders"] --> B["yaml_documents.rs"] --> C("normalize content") --> D("extract main/env") --> E(("serde_saphyr"))
  F["save_lockfile.rs"] --> C
  subgraph Legend
    direction LR
    _mod["Module"] ~~~ _fn("Function") ~~~ _lib(("Library"))
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Parse YAML as a multi-document stream
  • ➕ Avoids manual separator matching and normalization assumptions
  • ➕ Could support more YAML edge cases (comments/whitespace around separators)
  • ➖ More complexity and potentially higher memory/CPU overhead
  • ➖ Requires careful integration with current serde_saphyr usage and error reporting
2. Accept multi-document input directly in deserialization
  • ➕ Minimal changes to splitting logic (possibly none)
  • ➕ Centralizes behavior in YAML parsing layer
  • ➖ May not be supported by current serde_saphyr API in the needed way
  • ➖ Still leaves env/main selection logic unresolved (which doc is authoritative)

Recommendation: The chosen approach (normalize then split) is best here: it matches the existing TypeScript behavior, is low-risk, and fixes the root cause (CRLF/BOM preventing marker matches) for all call sites by centralizing normalization. A full multi-document YAML stream parser would be more robust but is disproportionate for this narrowly-scoped compatibility issue.

Files changed (8) +111 / -19

Bug fix (3) +43 / -14
env_lockfile.rsAdapt EnvLockfile parsing to Cow-based env document extraction +1/-1

Adapt EnvLockfile parsing to Cow-based env document extraction

• Updates env lockfile deserialization to handle the extractor now returning an owned-or-borrowed string (Cow). This ensures BOM/CRLF normalization is applied before parsing env documents.

pnpm/crates/lockfile/src/env_lockfile.rs

load_lockfile.rsAdjust Lockfile loader to accept Cow main document extraction +1/-1

Adjust Lockfile loader to accept Cow main document extraction

• Updates Lockfile YAML parsing to pass a reference to the extracted main document (now returned as Cow). This ensures normalization occurs before deserialization and avoids multi-document parse failures.

pnpm/crates/lockfile/src/load_lockfile.rs

yaml_documents.rsNormalize lockfile content before splitting YAML documents +41/-12

Normalize lockfile content before splitting YAML documents

• Introduces normalize_lockfile_content (strip UTF-8 BOM, convert CRLF→LF) and applies it in extract_main_document and extract_env_document. Refactors splitting logic into helper functions and returns Cow to avoid allocations on the common LF/no-BOM path.

pnpm/crates/lockfile/src/yaml_documents.rs

Refactor (1) +5 / -4
save_lockfile.rsReuse shared lockfile normalization when comparing existing content +5/-4

Reuse shared lockfile normalization when comparing existing content

• Replaces inline BOM stripping and CRLF→LF rewriting with the shared normalize_lockfile_content helper. Keeps save behavior consistent with the new parsing normalization logic.

pnpm/crates/lockfile/src/save_lockfile.rs

Tests (3) +58 / -1
tests.rsAdd regression test for CRLF combined env+main lockfile reads +13/-0

Add regression test for CRLF combined env+main lockfile reads

• Adds a test that writes a combined lockfile, rewrites it with CRLF line endings, and verifies EnvLockfile::read still returns the expected env document.

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

tests.rsAdd loader-level regression for CRLF combined lockfile parsing +23/-0

Add loader-level regression for CRLF combined lockfile parsing

• Adds a regression test asserting a CRLF combined lockfile loads identically to a main-only lockfile. Covers the reported failure mode where the lockfile was discarded due to multi-document detection.

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

tests.rsAdd unit tests for CRLF/BOM document splitting and normalization +22/-1

Add unit tests for CRLF/BOM document splitting and normalization

• Adds tests verifying correct env/main extraction from CRLF combined files, BOM-prefixed combined files, and BOM+CRLF single-document files. Ensures extractors return normalized LF content and correct Option behavior for env docs.

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

Documentation (1) +5 / -0
read-crlf-multi-document-lockfile.mdAdd changeset for CRLF/BOM multi-document lockfile fix +5/-0

Add changeset for CRLF/BOM multi-document lockfile fix

• Adds a release note describing the regression where CRLF or BOM-prefixed combined lockfiles were rejected, causing installs to re-resolve dependencies. Links the fix to issue #13606.

.changeset/read-crlf-multi-document-lockfile.md

@greptile-apps

greptile-apps Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge; no concrete changed-code failure remains after reviewing the normalization, extraction, and read/write paths.

The new normalization matches the TypeScript implementation, all Cow-returning extractor callers preserve valid ownership and document boundaries, and focused tests cover CRLF and BOM handling across extraction and loading.

Reviews (1): Last reviewed commit: "fix(lockfile): read a CRLF or BOM-prefix..." | 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.

🧹 Nitpick comments (1)
pnpm/crates/lockfile/src/save_lockfile.rs (1)

84-85: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Preserve the borrowed Cow on the unchanged path.

At Line 85, .into_owned() clones every existing lockfile. This defeats normalize_lockfile_content returning Cow::Borrowed when no BOM or CRLF is present.

Keep the String from read_to_string alive, then normalize it through as_deref(). This allocates only when normalization changes the content.

As per path instructions, use Cow<'_, str> so unchanged content remains borrowed and normalization allocates only when required.

Proposed refactor
-    let existing = match fs::read_to_string(path) {
-        Ok(existing) => Some(normalize_lockfile_content(&existing).into_owned()),
+    let existing_content = match fs::read_to_string(path) {
+        Ok(existing) => Some(existing),
         Err(error) if error.kind() == io::ErrorKind::NotFound => None,
         Err(error) => return Err(SaveLockfileError::WriteFile(error)),
     };
+    let existing = existing_content
+        .as_deref()
+        .map(normalize_lockfile_content);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm/crates/lockfile/src/save_lockfile.rs` around lines 84 - 85, Update the
existing lockfile branch in the read flow around normalize_lockfile_content to
preserve its borrowed Cow: keep the read_to_string String alive, pass it through
as_deref(), and store the normalized result as Cow<'_, str> instead of calling
into_owned(). Ensure allocation occurs only when normalization changes the
content.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pnpm/crates/lockfile/src/save_lockfile.rs`:
- Around line 84-85: Update the existing lockfile branch in the read flow around
normalize_lockfile_content to preserve its borrowed Cow: keep the read_to_string
String alive, pass it through as_deref(), and store the normalized result as
Cow<'_, str> instead of calling into_owned(). Ensure allocation occurs only when
normalization changes the content.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f4472d9c-e80a-461b-a8fa-a39e2dfa7629

📥 Commits

Reviewing files that changed from the base of the PR and between ebc48ab and ce645d9.

📒 Files selected for processing (8)
  • .changeset/read-crlf-multi-document-lockfile.md
  • pnpm/crates/lockfile/src/env_lockfile.rs
  • pnpm/crates/lockfile/src/env_lockfile/tests.rs
  • pnpm/crates/lockfile/src/load_lockfile.rs
  • pnpm/crates/lockfile/src/load_lockfile/tests.rs
  • pnpm/crates/lockfile/src/save_lockfile.rs
  • pnpm/crates/lockfile/src/yaml_documents.rs
  • pnpm/crates/lockfile/src/yaml_documents/tests.rs

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 3, 2026
@zkochan

zkochan commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

CI note: Rust CI / Test fails on a_command_outside_the_install_family_records_the_pinned_package_manager and a_package_manager_field_with_an_integrity_hash_matches_the_running_version. This is not caused by this PR — it is pre-existing breakage on main:

  • main at ebc48abdc5 (the chore(release): 11.20.0, pacquet 12.0.0-beta.4 commit) fails the same two tests on ubuntu, windows, and macos: https://github.com/pnpm/pnpm/actions/runs/30819701252
  • Both fail with ERR_PNPM_BAD_CONFIG_DEP … No matching version found for [email protected] while fetching it from https://registry.npmjs.org/. The release commit bumped PNPM_VERSION to 12.0.0-beta.4, but that version is not published yet — npm's next-12 dist-tag is still 12.0.0-beta.3.
  • The failure happens while resolving the package-manager bootstrap, before any lockfile is read, so it cannot interact with the document-splitting change here.

These should go green once 12.0.0-beta.4 is published, or on a rebase past whatever unblocks the release.

Every other job is green, including Clippy, Doc, Dylint, and the 1902 other tests in the same macos run.


Written by an agent (Claude Code, claude-opus-5).

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Remediation recommended

1. Regression doccomment is historical 📘 Rule violation ⚙ Maintainability
Description
The newly added doc comment describes past behavior ("was handed to serde whole, failing...") rather
than stating the current contract the test enforces. Comments should describe current
behavior/contracts, not historical implementations.
Code

pnpm/crates/lockfile/src/load_lockfile/tests.rs[R90-93]

+/// Regression test for <https://github.com/pnpm/pnpm/issues/13606>: a
+/// combined lockfile checked out with CRLF line endings was handed to
+/// serde whole, failing as "multiple YAML documents detected" and
+/// making every install re-resolve from the registry.
Relevance

●●● Strong

Team often accepts rewriting historical phrasing in comments to present-tense contracts (e.g., PRs
#13594, #13386).

PR-#13594
PR-#13386
PR-#13575

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 772199 forbids comments that describe historical behavior. The added doc comment
explicitly narrates the previous failure mode ("was handed to serde whole, failing...") instead of
describing the current expected behavior the test asserts.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/lockfile/src/load_lockfile/tests.rs[90-93]

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

## Issue description
A newly added Rust doc comment uses historical phrasing to describe prior behavior/regression, instead of documenting the current behavior/contract.

## Issue Context
The repo’s compliance rules require comments to document current behavior and invariants, not prior implementations.

## Fix Focus Areas
- pnpm/crates/lockfile/src/load_lockfile/tests.rs[90-93]

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


2. CRLF main doc double-copy 🐞 Bug ➹ Performance
Description
When the lockfile contains CRLF, extract_main_document() allocates a full normalized copy and then
allocates again by calling to_string() on the extracted slice, duplicating the entire lockfile for
single-document files. This adds avoidable O(n) copy + peak memory overhead in common read paths
like Lockfile::wanted_exists_in_dir() and Lockfile::parse().
Code

pnpm/crates/lockfile/src/yaml_documents.rs[R41-43]

+        Cow::Borrowed(content) => Cow::Borrowed(main_document_of(content)),
+        Cow::Owned(content) => Cow::Owned(main_document_of(&content).to_string()),
    }
Relevance

●●● Strong

Perf/alloc-avoidance suggestions like removing double allocations are commonly accepted (e.g., PR
#13417).

PR-#13417
PR-#13594
PR-#13500

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
normalize_lockfile_content() returns an owned normalized String when CRLF is present, and
extract_main_document() then unconditionally clones the extracted main slice via to_string() in the
Cow::Owned branch. For single-document lockfiles, main_document_of() returns the entire input when
it doesn't start with the document marker, so the entire normalized string is duplicated; this
extractor is called from common lockfile read paths.

pnpm/crates/lockfile/src/yaml_documents.rs[24-44]
pnpm/crates/lockfile/src/yaml_documents.rs[62-70]
pnpm/crates/lockfile/src/load_lockfile.rs[103-122]

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

## Issue description
`extract_main_document()` normalizes CRLF/BOM by producing a `Cow::Owned(String)` and then immediately does `main_document_of(&content).to_string()`, causing a second allocation/copy of the (sub)slice. For single-document CRLF lockfiles (no leading `---\n`), `main_document_of()` returns the entire normalized content, so the whole lockfile is copied twice.

## Issue Context
This extra allocation happens on Windows `core.autocrlf` checkouts (exactly the scenario this PR targets) and is reachable from hot lockfile paths (`wanted_exists_in_dir`, `parse`).

## Fix Focus Areas
- pnpm/crates/lockfile/src/yaml_documents.rs[24-75]

Suggested approach:
- In the `Cow::Owned(mut content)` branch, avoid `to_string()` when the main document is the whole normalized string (i.e. when it does **not** start with `YAML_DOCUMENT_START`): just return `Cow::Owned(content)`.
- When it *does* start with `YAML_DOCUMENT_START`, consider extracting the main doc by mutating `content` in-place (e.g. `drain(..prefix_len)` / `replace_range(..prefix_len, "")`) so you can return the same owned buffer without allocating a second `String` for the main document.

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



Informational

3. Changeset missing pnpm bump 📘 Rule violation § Compliance
Description
The new changeset only lists pacquet and omits a pnpm entry, so the pnpm package version would
not be bumped for this user-visible lockfile fix. This violates the changeset policy requiring an
explicit pnpm bump type.
Code

.changeset/read-crlf-multi-document-lockfile.md[R1-3]

+---
+"pacquet": patch
+---
Relevance

● Weak

Similar “missing pnpm entry” changeset findings were repeatedly rejected (e.g., PRs #13502, #13384).

PR-#13502
PR-#13384
PR-#13347

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires each new/modified changeset to include an explicit pnpm entry
with a valid bump type. The added changeset front-matter includes only "pacquet": patch and no
"pnpm": ... entry.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/read-crlf-multi-document-lockfile.md[1-3]

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 new changeset file does not declare a bump for the `pnpm` package.

## Issue Context
Per the compliance checklist, changeset front-matter must explicitly include `pnpm` with a valid bump type (`patch`/`minor`/`major`). This PR is a bug fix, so `patch` is likely appropriate unless the release policy says otherwise.

## Fix Focus Areas
- .changeset/read-crlf-multi-document-lockfile.md[1-3]

ⓘ 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

@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

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     19.4±3.82ms    19.3 MB/sec    1.01     19.7±2.30ms    19.1 MB/sec
packument/parse                                  1.00     42.9±3.89µs  1545.4 MB/sec    1.14     48.8±6.25µs  1359.8 MB/sec
tarball/download_dependency                      1.00      2.7±0.40ms  1608.4 KB/sec    2.13      5.8±1.86ms   754.4 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00   197.1±15.08ms 81.2 KElem/sec    1.86   367.3±62.76ms 43.6 KElem/sec
workspace_resolution/hoist_heavy                 1.00   325.7±12.51ms        ? ?/sec    1.31   427.6±56.77ms        ? ?/sec

@zkochan

zkochan commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

Re the Qodo finding that the changeset is missing a "pnpm" entry — declining, this one does not apply here.

AGENTS.md ("Changesets for the Rust products"): "Do not add "pnpm" to a Rust-only changeset: in changesets, pnpm always means the TypeScript CLI package. A changeset whose implementation is Rust-only and targets pacquet must omit "pnpm"."

This fix is Rust-only — the TypeScript stack already normalizes CRLF in extractMainDocument / extractEnvDocument and strips the BOM at every read site, so there is no TS-side change to release. Adding "pnpm": patch would cut a TypeScript CLI release containing no TypeScript change.

Qodo scored this finding ● Weak itself and flagged that the same "missing pnpm entry" finding was rejected on #13502 and #13384.


Written by an agent (Claude Code, claude-opus-5).

@zkochan

zkochan commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

Addendum to the CI note above, for accuracy: because nextest stops scheduling after a failure, these runs aborted before reaching pacquet-lockfile at all (4887/6592 tests not run on windows, 5098/6995 on ubuntu, 5096/7000 on macos). So CI has not yet exercised the tests added here — the green-looking counts are just the tests that ran before the abort.

They were verified locally instead: cargo nextest run -p pacquet-lockfile is 285/285, and a full just ready passed 1921 tests before hitting the same two package_manager_check failures. The change is platform-independent string handling, so the Linux run covers it, but a re-run once 12.0.0-beta.4 is published is what will actually prove it in CI.

Also for the record: the two unused import warnings in pacquet-lockfile on the windows job (symlinked_lockfile_error, self) are pre-existing cfg-gated warnings — identical on main at ebc48abdc5, same count, not introduced here.


Written by an agent (Claude Code, claude-opus-5).

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.00%. Comparing base (37b387f) to head (ce645d9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13609   +/-   ##
=======================================
  Coverage   87.99%   88.00%           
=======================================
  Files         568      568           
  Lines       98002    98017   +15     
=======================================
+ Hits        86239    86258   +19     
+ Misses      11763    11759    -4     

☔ 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.

@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: ce645d92782a

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. 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.852 ± 0.160 2.543 3.084 1.71 ± 0.17
pacquet@main 2.984 ± 0.312 2.685 3.628 1.79 ± 0.24
pnpr@HEAD 1.667 ± 0.142 1.524 1.963 1.00
pnpr@main 1.757 ± 0.184 1.561 2.018 1.05 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.85232121486,
      "stddev": 0.16018666183082364,
      "median": 2.82902759656,
      "user": 2.88628426,
      "system": 2.20260066,
      "min": 2.54295216456,
      "max": 3.08357509256,
      "times": [
        2.75828834256,
        2.83416311156,
        3.00401277256,
        2.78070081056,
        3.08357509256,
        2.96552207756,
        2.98852710756,
        2.7415785875600003,
        2.54295216456,
        2.82389208156
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.9837154427600003,
      "stddev": 0.3116796792709169,
      "median": 2.91892508956,
      "user": 3.19112786,
      "system": 2.4377862599999998,
      "min": 2.6851826985600002,
      "max": 3.62778015656,
      "times": [
        2.7297691245599998,
        2.72333039456,
        3.15581796156,
        3.14236330756,
        3.62778015656,
        3.03830369556,
        3.23758337056,
        2.6851826985600002,
        2.69747723456,
        2.79954648356
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.66681533236,
      "stddev": 0.14162729126809387,
      "median": 1.63101752356,
      "user": 1.9908447599999999,
      "system": 1.8814692599999998,
      "min": 1.5235196745600001,
      "max": 1.96272284156,
      "times": [
        1.66947683656,
        1.5235196745600001,
        1.55221184956,
        1.96272284156,
        1.5697875855599999,
        1.84312219556,
        1.7005656015600001,
        1.69410711456,
        1.59255821056,
        1.5600814135599999
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.7569179953599998,
      "stddev": 0.18362749051213906,
      "median": 1.69961637706,
      "user": 2.0403138599999995,
      "system": 1.9341328599999996,
      "min": 1.56087783356,
      "max": 2.01834508856,
      "times": [
        1.74731244056,
        2.01834508856,
        1.56087783356,
        2.00725313856,
        1.63096875456,
        1.67235882356,
        2.00360575356,
        1.72687393056,
        1.58640247056,
        1.61518171956
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 466.1 ± 33.5 401.5 506.3 1.07 ± 0.11
pacquet@main 434.8 ± 33.6 378.8 496.5 1.00
pnpr@HEAD 450.5 ± 35.8 402.4 518.5 1.04 ± 0.11
pnpr@main 483.5 ± 41.3 406.7 546.7 1.11 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.46613138750000005,
      "stddev": 0.033453812890760326,
      "median": 0.46809332760000005,
      "user": 0.40244805999999994,
      "system": 0.75139986,
      "min": 0.4014866501,
      "max": 0.5063220081,
      "times": [
        0.46841430310000004,
        0.5063220081,
        0.5058143411,
        0.47896139610000005,
        0.49385278810000005,
        0.4369299931,
        0.4014866501,
        0.46777235210000007,
        0.46578864510000006,
        0.4359713981
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.4347787718,
      "stddev": 0.033610967775492245,
      "median": 0.4351782551,
      "user": 0.36422496,
      "system": 0.73668696,
      "min": 0.37884541010000006,
      "max": 0.49645505110000004,
      "times": [
        0.43402046310000003,
        0.4563774031,
        0.4179206521,
        0.4320673031,
        0.45134723210000005,
        0.49645505110000004,
        0.4363360471,
        0.45289468110000003,
        0.37884541010000006,
        0.3915234751
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.45052554060000005,
      "stddev": 0.03577722226543313,
      "median": 0.44035963610000006,
      "user": 0.40370945999999996,
      "system": 0.7387585599999998,
      "min": 0.4023532221,
      "max": 0.5185256631,
      "times": [
        0.44150359210000006,
        0.48862736110000005,
        0.43477978410000007,
        0.5185256631,
        0.4220923481,
        0.48027960510000006,
        0.45770431610000006,
        0.43921568010000006,
        0.4023532221,
        0.42017383410000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.4834665255000001,
      "stddev": 0.041324214093015864,
      "median": 0.4847560221,
      "user": 0.38686985999999995,
      "system": 0.79003556,
      "min": 0.40668235310000006,
      "max": 0.5466821181,
      "times": [
        0.49156283310000004,
        0.40668235310000006,
        0.5466821181,
        0.4535677631,
        0.5181898981,
        0.48317918210000005,
        0.48633286210000004,
        0.5266372191,
        0.47545672010000006,
        0.44637430610000006
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.074 ± 0.071 2.944 3.209 1.79 ± 0.14
pacquet@main 3.033 ± 0.087 2.826 3.158 1.76 ± 0.14
pnpr@HEAD 1.722 ± 0.130 1.563 1.893 1.00
pnpr@main 1.725 ± 0.180 1.505 2.043 1.00 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.0738259884799994,
      "stddev": 0.07131121786782783,
      "median": 3.0641514595799997,
      "user": 2.8461119199999994,
      "system": 2.19044282,
      "min": 2.94418451908,
      "max": 3.2092170580799997,
      "times": [
        3.2092170580799997,
        3.0886868320799996,
        3.1443805980799997,
        3.0387712790799997,
        3.06815723208,
        3.1100927490799997,
        3.03809119208,
        3.03653273808,
        3.06014568708,
        2.94418451908
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.03299623658,
      "stddev": 0.08669104680305645,
      "median": 3.04157607558,
      "user": 2.78639212,
      "system": 2.2048375199999994,
      "min": 2.82599938308,
      "max": 3.15816618708,
      "times": [
        2.82599938308,
        3.02561805708,
        3.02820443108,
        2.98356611008,
        3.15816618708,
        3.08585901208,
        3.0477550020799997,
        3.0916420320799998,
        3.04030380208,
        3.04284834908
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.72154021648,
      "stddev": 0.13020951524066138,
      "median": 1.66325398658,
      "user": 1.8571073199999997,
      "system": 1.7927806200000003,
      "min": 1.56331941708,
      "max": 1.89274261208,
      "times": [
        1.8850855620800002,
        1.6802484180800001,
        1.64625955508,
        1.64156689608,
        1.5842096860800001,
        1.8921318160800003,
        1.7844990180800002,
        1.6453391840800002,
        1.89274261208,
        1.56331941708
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.7253537212800005,
      "stddev": 0.17951169303494544,
      "median": 1.7205057785800002,
      "user": 1.6975292199999998,
      "system": 1.6468926199999998,
      "min": 1.50528696808,
      "max": 2.0425219600799998,
      "times": [
        1.7473642560800002,
        2.0425219600799998,
        1.77763525208,
        1.63220959908,
        1.50528696808,
        1.9193869160800001,
        1.51757126308,
        1.6936473010800002,
        1.55609110408,
        1.86182259308
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 510.3 ± 41.1 428.1 575.7 1.30 ± 0.13
pacquet@main 622.8 ± 70.6 517.1 725.0 1.58 ± 0.20
pnpr@HEAD 458.2 ± 28.0 409.5 495.8 1.16 ± 0.10
pnpr@main 393.8 ± 21.8 362.9 440.9 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5102759909,
      "stddev": 0.041077721291245185,
      "median": 0.5113407459,
      "user": 0.70761754,
      "system": 0.91269256,
      "min": 0.42807479240000007,
      "max": 0.5757400944,
      "times": [
        0.42807479240000007,
        0.48636766840000006,
        0.5133628964,
        0.5334327214,
        0.5084489874,
        0.5256432234,
        0.5093185954,
        0.47387330140000006,
        0.5484976284,
        0.5757400944
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6227705273000002,
      "stddev": 0.07059709825098072,
      "median": 0.6225251884,
      "user": 0.84171934,
      "system": 1.01404206,
      "min": 0.5170969984,
      "max": 0.7249630264,
      "times": [
        0.5374970114000001,
        0.5720053944,
        0.6559183624,
        0.6365992574,
        0.6084511194,
        0.5875732354000001,
        0.5170969984,
        0.7107160614,
        0.6768848064,
        0.7249630264
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.45818382729999996,
      "stddev": 0.027950504857015206,
      "median": 0.4577424579,
      "user": 0.34891054,
      "system": 0.77876956,
      "min": 0.4094854264000001,
      "max": 0.49581696640000006,
      "times": [
        0.4257529024000001,
        0.44507798440000007,
        0.49581696640000006,
        0.44348796940000007,
        0.47928589540000005,
        0.4882033404000001,
        0.4551490624,
        0.4792428724000001,
        0.46033585340000005,
        0.4094854264000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3937930501000001,
      "stddev": 0.021820737029799746,
      "median": 0.3959113369,
      "user": 0.26202354,
      "system": 0.68214926,
      "min": 0.36291833440000004,
      "max": 0.44093974240000006,
      "times": [
        0.36291833440000004,
        0.3784870464,
        0.44093974240000006,
        0.40379518940000003,
        0.4085539074,
        0.39656056940000006,
        0.37603396740000006,
        0.39527712840000007,
        0.37881907040000007,
        0.39654554540000003
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.990 ± 0.082 1.855 2.168 4.45 ± 0.32
pacquet@main 2.116 ± 0.092 1.985 2.219 4.73 ± 0.34
pnpr@HEAD 0.448 ± 0.026 0.416 0.495 1.00
pnpr@main 0.484 ± 0.023 0.446 0.512 1.08 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.9903030564200002,
      "stddev": 0.08234971146361635,
      "median": 1.9837730981200004,
      "user": 1.2256924200000001,
      "system": 1.1613880399999998,
      "min": 1.8552946546200002,
      "max": 2.16764694762,
      "times": [
        2.16764694762,
        1.95247133262,
        1.9303291096200001,
        1.9474032216200001,
        1.8552946546200002,
        1.9737398566200002,
        2.02808452362,
        2.03262915162,
        2.02162542662,
        1.9938063396200003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.11567067462,
      "stddev": 0.0924478000704011,
      "median": 2.13096458112,
      "user": 1.3939449199999998,
      "system": 1.27494914,
      "min": 1.9847514826200001,
      "max": 2.21867100162,
      "times": [
        1.9980748956200003,
        2.0389877156200003,
        2.05335123662,
        1.9847514826200001,
        2.21867100162,
        2.08906952962,
        2.19730297262,
        2.1950162836200002,
        2.1728596326200003,
        2.20862199562
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.44752408162,
      "stddev": 0.026137372889528752,
      "median": 0.44328539012,
      "user": 0.32481891999999996,
      "system": 0.7448264400000001,
      "min": 0.41577584062,
      "max": 0.49503452162,
      "times": [
        0.47360657862,
        0.47160849062,
        0.42319254262,
        0.43084014762,
        0.43618812462,
        0.49503452162,
        0.45481054162,
        0.45038265562,
        0.42380137262,
        0.41577584062
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.48356057312,
      "stddev": 0.02290700936327454,
      "median": 0.48995572412,
      "user": 0.3593334199999999,
      "system": 0.7313753399999999,
      "min": 0.44598475762,
      "max": 0.51221682262,
      "times": [
        0.44998805362,
        0.51221682262,
        0.46941284562,
        0.49728711762,
        0.49623737662,
        0.50714064662,
        0.44598475762,
        0.47597780262,
        0.48367407162000003,
        0.49768623662
      ]
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 299.6 ± 28.5 268.9 347.1 2.67 ± 0.33
pacquet@main 303.9 ± 39.1 250.5 363.3 2.71 ± 0.41
pnpr@HEAD 112.3 ± 8.8 98.8 133.8 1.00
pnpr@main 116.8 ± 8.3 104.7 130.1 1.04 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.29955428426,
      "stddev": 0.02846170642572156,
      "median": 0.28928921116000006,
      "user": 0.26060418,
      "system": 0.15398142,
      "min": 0.26893194516,
      "max": 0.34707571716,
      "times": [
        0.34648913916,
        0.26893194516,
        0.27898632916000005,
        0.27669504616,
        0.28692732616000005,
        0.30743684116000003,
        0.27789830216000005,
        0.34707571716,
        0.31345110016000005,
        0.29165109616
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.3039401382509091,
      "stddev": 0.0391356641980179,
      "median": 0.31130077416,
      "user": 0.2707194981818182,
      "system": 0.14787184727272729,
      "min": 0.25049563516000006,
      "max": 0.36329910616000005,
      "times": [
        0.25049563516000006,
        0.33603965716000006,
        0.36329910616000005,
        0.36126546316,
        0.26729460116000003,
        0.31466086516,
        0.26703018016,
        0.31907349316000005,
        0.27505574416000006,
        0.31130077416,
        0.27782600116000006
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.11233923823999997,
      "stddev": 0.008809914345541008,
      "median": 0.11070076916000002,
      "user": 0.035452199999999996,
      "system": 0.017251799999999998,
      "min": 0.09880835616000001,
      "max": 0.13376229816000001,
      "times": [
        0.11033055416000001,
        0.12245964116000002,
        0.10329583216000002,
        0.09880835616000001,
        0.11093964416000002,
        0.10517691416000001,
        0.11082929816000002,
        0.10085562316000002,
        0.10850912916000001,
        0.10342739816000002,
        0.11070076916000002,
        0.10856337616000002,
        0.11255649116000001,
        0.10225405916000001,
        0.13376229816000001,
        0.11822360716000001,
        0.10834049416000001,
        0.11689961116000001,
        0.10843362216,
        0.11496295016000001,
        0.12255424516000002,
        0.10723166616000002,
        0.12298267716000001,
        0.11773826016000001,
        0.12864443816
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.11675440041000001,
      "stddev": 0.00833897782361016,
      "median": 0.11615232566000001,
      "user": 0.036046304999999994,
      "system": 0.021163120000000004,
      "min": 0.10472016716000002,
      "max": 0.13014077816,
      "times": [
        0.11266012416000001,
        0.12301487516000001,
        0.10472016716000002,
        0.12063376516000002,
        0.12403623116000002,
        0.10514552716000002,
        0.12865098816,
        0.11567627316000001,
        0.10736413516000001,
        0.10491502616000001,
        0.11656963216000002,
        0.10717212116000001,
        0.11047436316000002,
        0.11668739916000001,
        0.11808874416000001,
        0.12872222516,
        0.13014077816,
        0.12915722816,
        0.11208516816000001,
        0.11573501916000001,
        0.11064047716000001,
        0.11159751616000001,
        0.12730293616,
        0.12091488916000001
      ]
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.540 ± 0.353 1.001 2.217 1.14 ± 0.41
pacquet@main 1.351 ± 0.382 0.705 1.929 1.00
pnpm@HEAD 4.241 ± 0.496 3.405 4.883 3.14 ± 0.96
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.540490206006667,
      "stddev": 0.3533253393190046,
      "median": 1.5379901633400002,
      "user": 1.4966666288888886,
      "system": 0.42673075555555556,
      "min": 1.00097066234,
      "max": 2.2166128773400002,
      "times": [
        1.4565396023400001,
        1.56391511134,
        1.00097066234,
        1.64178211234,
        1.79383826834,
        1.5379901633400002,
        1.13048087034,
        1.52228218634,
        2.2166128773400002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.351024467451111,
      "stddev": 0.38154632355207113,
      "median": 1.4149266253400001,
      "user": 1.3247482955555556,
      "system": 0.37711275555555557,
      "min": 0.70478041134,
      "max": 1.9285786713400002,
      "times": [
        1.53438622534,
        1.9285786713400002,
        1.3929458193400002,
        1.57649223034,
        1.1051096413400001,
        1.4149266253400001,
        0.70478041134,
        0.9026910663400001,
        1.59930951634
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.240957395117778,
      "stddev": 0.4960151611297315,
      "median": 4.27292244934,
      "user": 6.281725295555555,
      "system": 0.47368319999999997,
      "min": 3.40468976634,
      "max": 4.88252271334,
      "times": [
        4.22263580034,
        4.87477691934,
        4.3294366463400005,
        4.38013976534,
        4.21341741834,
        4.88252271334,
        4.27292244934,
        3.40468976634,
        3.58807507734
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.679 ± 0.087 4.532 4.825 1.23 ± 0.04
pacquet@main 4.651 ± 0.143 4.474 4.939 1.23 ± 0.05
pnpr@HEAD 3.808 ± 0.099 3.656 3.965 1.00 ± 0.04
pnpr@main 3.791 ± 0.104 3.664 3.999 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.678785556420001,
      "stddev": 0.08748568890515197,
      "median": 4.6749446172199995,
      "user": 2.6351381199999997,
      "system": 1.9243316599999996,
      "min": 4.53209039722,
      "max": 4.82522866722,
      "times": [
        4.7101267162200005,
        4.67366755922,
        4.67622167522,
        4.61884250622,
        4.6543697252200005,
        4.53209039722,
        4.6873212552200005,
        4.8031458252200006,
        4.60684123722,
        4.82522866722
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.65091071612,
      "stddev": 0.14290649510149575,
      "median": 4.63868642272,
      "user": 2.5035386199999996,
      "system": 1.8878586599999998,
      "min": 4.47380552122,
      "max": 4.938858806220001,
      "times": [
        4.50634804622,
        4.6159768232200005,
        4.47380552122,
        4.51664542622,
        4.59172315422,
        4.66139602222,
        4.7072540942200005,
        4.79050039122,
        4.70659887622,
        4.938858806220001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.807635399920001,
      "stddev": 0.09927816129932245,
      "median": 3.81687076472,
      "user": 2.30084732,
      "system": 2.0652969600000004,
      "min": 3.65551047922,
      "max": 3.96465774422,
      "times": [
        3.65551047922,
        3.82783558822,
        3.92659440122,
        3.8059059412200003,
        3.7521042012200003,
        3.87314110422,
        3.96465774422,
        3.67879996922,
        3.82827880122,
        3.76352576922
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.79063822672,
      "stddev": 0.10376466293635805,
      "median": 3.7930078962200002,
      "user": 2.2546958200000002,
      "system": 2.08780116,
      "min": 3.6637779862200004,
      "max": 3.9991439702200005,
      "times": [
        3.8529126232200004,
        3.8136937102200004,
        3.8693727752200004,
        3.77232208222,
        3.7177262332200005,
        3.9991439702200005,
        3.8302458562200004,
        3.67527357322,
        3.71191345722,
        3.6637779862200004
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13609
Testbedpacquet

🚨 3 Alerts

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
isolated-linker.fresh-resolve.hot-cache.offlineLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
268.93 ms
(+53.85%)Baseline: 174.81 ms
209.77 ms
(128.20%)

isolated-linker.fresh-restore.hot-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
401.49 ms
(+62.06%)Baseline: 247.74 ms
297.29 ms
(135.05%)

isolated-linker.peer-heavy-resolve.hot-cache.offlineLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
1,000.97 ms
(+21.97%)Baseline: 820.67 ms
984.81 ms
(101.64%)

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,944.18 ms
(+14.18%)Baseline: 2,578.44 ms
3,094.13 ms
(95.15%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,855.29 ms
(+7.57%)Baseline: 1,724.68 ms
2,069.61 ms
(89.64%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
428.07 ms
(+10.65%)Baseline: 386.87 ms
464.25 ms
(92.21%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
🚨 view alert (🔔)
268.93 ms
(+53.85%)Baseline: 174.81 ms
209.77 ms
(128.20%)

isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,542.95 ms
(+7.91%)Baseline: 2,356.52 ms
2,827.82 ms
(89.93%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,532.09 ms
(+2.41%)Baseline: 4,425.26 ms
5,310.31 ms
(85.35%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
401.49 ms
(+62.06%)Baseline: 247.74 ms
297.29 ms
(135.05%)

isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
🚨 view alert (🔔)
1,000.97 ms
(+21.97%)Baseline: 820.67 ms
984.81 ms
(101.64%)

🐰 View full continuous benchmarking report in Bencher

@zkochan

zkochan commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

The Bencher Report alerts are measurement noise, not a regression from this change. Three independent lines of evidence:

1. Re-running the identical commit produces completely different deltas. Same code, same PR, two runs:

Benchmark run 1 run 2
fresh-restore.hot-cache.hot-store +22.77% +62.06%
fresh-resolve.hot-cache.offline +20.86% +53.85%
fresh-install.hot-cache.hot-store +24.39% +10.65%

A real regression does not move from +22% to +62% to +10% on unchanged code. Bencher compares against a historical baseline from main, so a slower runner shifts every scenario at once — and indeed all 8 scenarios rose in both runs, including cold-cache.cold-store, which is dominated by network and tarball extraction and cannot be affected by lockfile document splitting.

2. The in-run HEAD vs main control shows parity. The benchmark builds both pacquet@HEAD and pacquet@main and runs them on the same machine in the same job — the controlled comparison. Means (ms) across the 8 scenarios:

HEAD: 2852.0  466.1  3074.0  510.3  1990.0  299.6  1540.0  4679.0
main: 2984.0  434.8  3033.0  622.8  2116.0  303.9  1351.0  4651.0

HEAD wins 4, main wins 4, every gap inside the reported ±σ. Summed, HEAD is 0.6% faster. Compare Benchmarks — the check that gates on exactly this comparison — passed.

3. The added work is ~12 µs. The change adds one strip_prefix(BOM) plus one contains("\r\n") scan per lockfile read. Measured on this repo's own 822 KB pnpm-lock.yaml (larger than the benchmark fixtures), that scan takes 12.5 µs — memchr-backed, no allocation on the LF path, which stays Cow::Borrowed. The alerts are 36–93 ms, about 3000x larger. Even a thousand lockfile reads per install would not account for one of them.


Written by an agent (Claude Code, claude-opus-5).

@zkochan
zkochan merged commit ee3bb4b into main Aug 3, 2026
43 of 49 checks passed
@zkochan
zkochan deleted the fix-13606 branch August 3, 2026 20:18
KSXGitHub pushed a commit that referenced this pull request Aug 4, 2026
Picks up #13609, which normalizes a BOM or CRLF line endings
before splitting the combined `pnpm-lock.yaml` into its env and main
documents, and #13621, which passes the restart tests' log
path through `process.argv` instead of interpolating it into a JS
string literal.

Neither touches the files this branch edits, so the merge is clean.
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.

pnpm 12.0.0-beta.3 cannot read a multi document pnpm-lock.yaml and ignores the whole lockfile

3 participants