Skip to content

fix(package-manager): preserve scalar libc metadata - #13346

Merged
zkochan merged 2 commits into
mainfrom
fix-13324
Jul 25, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix-13324

Conversation

@zkochan

@zkochan zkochan commented Jul 25, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Preserve scalar libc constraints from registry manifests when pacquet generates a fresh lockfile.
  • Accept string or array libc metadata in the dependency-graph conversion while keeping other list fields array-only.
  • The TypeScript CLI already preserves this metadata, so no TypeScript change is required.

Closes #13324.

Squash Commit Body

Registry package manifests may express `libc` as a plain string. Pacquet's
dependency-graph-to-lockfile conversion only accepted arrays, so fresh
lockfiles silently omitted those platform constraints.

Accept both string and array `libc` metadata in that conversion while keeping
other manifest list fields array-only. Cover the scalar form with a regression
test based on sass-embedded's Linux variants, including a check that malformed
scalar bundle metadata remains ignored.

Closes pnpm/pnpm#13324.

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

Summary by CodeRabbit

  • Bug Fixes
    • Fixed generated lockfiles to preserve scalar libc constraints (for example, "musl") instead of dropping them.
    • Improved handling of package metadata when fields are provided as either a single value or a list, ensuring correct recording in lockfiles.
  • Tests
    • Added a fresh-install test to confirm libc is captured properly when declared as a string, and that non-array bundled dependency metadata is not serialized.

Copilot AI review requested due to automatic review settings July 25, 2026 12:53

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 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Lockfile metadata parsing now preserves scalar manifest libc values as single-element lists. A fresh-install test verifies the generated metadata, while a Changesets entry records a patch release for pacquet.

Changes

Libc lockfile preservation

Layer / File(s) Summary
Metadata parsing and lockfile validation
pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs, pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs, .changeset/pacquet-preserve-string-libc.md
read_string_or_list accepts scalar strings or arrays for libc; the test verifies "musl" is preserved as Some(["musl"]), and the Changesets entry records the patch release.

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

Assessment against linked issues

Objective Addressed Explanation
Preserve package libc constraints in generated lockfiles, including scalar manifest values [#13324] ✅

Possibly related issues

  • [#12366] The change preserves libc metadata in generated lockfiles, matching the issue’s related objective.

Suggested labels: product: pacquet

Suggested reviewers: copilot, debadityahait, qodo-code-review

✨ 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-13324

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

Preserve scalar libc constraints when generating pacquet lockfiles

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

Grey Divider

AI Description

• Preserve libc platform constraints when registry manifests use scalar string form.
• Accept libc as string or array during dependency-graph → lockfile conversion.
• Add regression test covering libc: "musl" using sass-embedded Linux variants.
Diagram

graph TD
A["Registry manifest JSON"] --> B["dep graph"] --> C["graph->lockfile"] --> D[("pnpm-lock.yaml")]
C --> E["read_string_list()"]
F["Regression test"] --> C
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Serde helper type (StringOrVec)
  • ➕ Centralizes scalar-or-array coercion in a reusable, typed deserializer
  • ➕ Reduces manual Value matching and potential inconsistencies across fields
  • ➖ Requires refactoring surrounding code to use typed structs instead of serde_json::Value
  • ➖ More churn than necessary for a single-field bug fix
2. Normalize manifest metadata earlier (resolver/graph builder)
  • ➕ Keeps lockfile conversion simpler by guaranteeing canonical manifest shape
  • ➕ Could benefit other consumers of the manifest fragment
  • ➖ Moves responsibility away from where the data is actually interpreted
  • ➖ May require broader changes and additional tests across graph construction

Recommendation: Keep the current localized fix: extending read_string_list() to accept both string and array is minimal, matches existing behavior elsewhere (installability/environment-lockfile readers), and directly addresses the regression risk. Consider a typed serde approach only if more manifest fields need scalar-or-array coercion across the codebase.

Files changed (3) +56 / -6

Bug fix (1) +12 / -6
dependencies_graph_to_lockfile.rsAccept scalar 'libc' (string) in manifest metadata parsing +12/-6

Accept scalar 'libc' (string) in manifest metadata parsing

• Updates 'read_string_list()' to handle JSON string values in addition to arrays, returning a single-item 'Vec<String>' for non-empty strings. This prevents dropping platform metadata like 'libc: "musl"' during fresh lockfile generation.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs

Tests (1) +39 / -0
tests.rsRegression test for scalar 'libc' in fresh lockfile generation +39/-0

Regression test for scalar 'libc' in fresh lockfile generation

• Adds a new test constructing a dependency node with 'libc' expressed as a string and asserting the generated lockfile preserves it as a one-element list. Uses '[email protected]' as a realistic fixture.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs

Documentation (1) +5 / -0
pacquet-preserve-string-libc.mdAdd changeset entry for scalar 'libc' preservation fix +5/-0

Add changeset entry for scalar 'libc' preservation fix

• Introduces a patch-level changeset for 'pacquet' documenting that generated lockfiles now retain scalar 'libc' constraints.

.changeset/pacquet-preserve-string-libc.md

@greptile-apps

greptile-apps Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "fix(package-manager): scope scalar metad..." | 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/package-manager/src/dependencies_graph_to_lockfile.rs`:
- Around line 600-612: Restrict scalar-string handling in read_string_list to
the libc field only, while preserving array parsing for all callers. Ensure
bundledDependencies and bundleDependencies use array-only behavior so a scalar
manifest value is ignored, and add coverage confirming malformed scalar bundle
metadata does not mark a package as bundled.
🪄 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: c1777390-a3d1-4f54-90eb-db483a128fce

📥 Commits

Reviewing files that changed from the base of the PR and between f7e1fee and c33294f.

📒 Files selected for processing (3)
  • .changeset/pacquet-preserve-string-libc.md
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs

@github-actions

github-actions Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
lockfile/parse_pnpm_lock       1.00     11.1±0.03ms    33.6 MB/sec    1.04     11.6±0.03ms    32.3 MB/sec
packument/parse                1.01     38.6±0.23µs  1718.6 MB/sec    1.00     38.3±0.06µs  1731.5 MB/sec
tarball/download_dependency    1.00      2.3±0.11ms  1904.3 KB/sec    1.00      2.3±0.05ms  1900.1 KB/sec

@qodo-code-review

qodo-code-review Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Informational

1. Redundant libc array lookup 🐞 Bug ➹ Performance ⭐ New
Description
In read_string_or_list(), the Value::Array(_) branch calls read_string_list(manifest, key),
which re-fetches manifest.get(key) and re-matches the value that was already matched. This adds a
small, avoidable overhead on the lockfile generation path that runs once per graph node.
Code

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs[R614-618]

+fn read_string_or_list(manifest: Option<&Value>, key: &str) -> Option<Vec<String>> {
+    match manifest?.get(key)? {
+        Value::String(value) if !value.is_empty() => Some(vec![value.clone()]),
+        Value::Array(_) => read_string_list(manifest, key),
+        _ => None,
Relevance

⭐⭐ Medium

Team sometimes accepts redundant-work cuts, but similar micro-optimizations/dedup passes have been
rejected as not worth churn.

PR-#13170
PR-#12876

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new helper matches manifest?.get(key)? but then re-reads the same key via read_string_list()
for the array case; this helper is invoked during per-node metadata generation while building the
packages map.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs[493-503]
pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs[551-562]
pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs[614-619]
pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs[600-612]

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

### Issue description
`read_string_or_list()` matches on `manifest?.get(key)?`, but for the array case it delegates to `read_string_list(manifest, key)`, which performs the same `get(key)` lookup again. This creates unnecessary work (extra map lookup + match) when `libc` is present as an array.

### Issue Context
This function is used when generating fresh lockfiles; package metadata is built for each graph node.

### Fix Focus Areas
- pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs[614-619]

### Suggested fix
Refactor `read_string_or_list()` to handle `Value::Array(items)` directly (sharing the same `items.iter().filter_map(Value::as_str)` logic as `read_string_list()`), or change `read_string_list()` to accept the already-fetched `&Value` so the array branch can reuse it without re-looking up the key.

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


2. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset only declares a pacquet bump and omits an explicit pnpm entry. This violates
the repository changeset requirement and may result in incomplete or incorrect release
notes/versioning metadata.
Code

.changeset/pacquet-preserve-string-libc.md[R1-3]

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

⭐ Low

Multiple prior reviews rejected adding a required pnpm entry when changeset only bumped pacquet.

PR-#13329
PR-#13327
PR-#13297

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires every changeset to explicitly include the pnpm package with a
valid bump type. The added changeset front-matter includes only "pacquet": patch and does not
mention pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/pacquet-preserve-string-libc.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 changeset front-matter is missing an explicit `pnpm` entry with a valid bump type (`patch`/`minor`/`major`).

## Issue Context
The PR adds a new changeset file `.changeset/pacquet-preserve-string-libc.md` but its front-matter only includes `"pacquet": patch`.

## Fix Focus Areas
- .changeset/pacquet-preserve-string-libc.md[1-3]

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


Grey Divider

Previous review results

Review updated until commit 1e9881c ⚖️ Balanced

Results up to commit c33294f ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Informational
1. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset only declares a pacquet bump and omits an explicit pnpm entry. This violates
the repository changeset requirement and may result in incomplete or incorrect release
notes/versioning metadata.
Code

.changeset/pacquet-preserve-string-libc.md[R1-3]

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

⭐ Low

Multiple prior reviews rejected adding a required pnpm entry when changeset only bumped pacquet.

PR-#13329
PR-#13327
PR-#13297

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires every changeset to explicitly include the pnpm package with a
valid bump type. The added changeset front-matter includes only "pacquet": patch and does not
mention pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/pacquet-preserve-string-libc.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 changeset front-matter is missing an explicit `pnpm` entry with a valid bump type (`patch`/`minor`/`major`).

## Issue Context
The PR adds a new changeset file `.changeset/pacquet-preserve-string-libc.md` but its front-matter only includes `"pacquet": patch`.

## Fix Focus Areas
- .changeset/pacquet-preserve-string-libc.md[1-3]

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


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.

@codecov-commenter

codecov-commenter commented Jul 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.04%. Comparing base (352125d) to head (1e9881c).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...kage-manager/src/dependencies_graph_to_lockfile.rs 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13346      +/-   ##
==========================================
+ Coverage   87.03%   87.04%   +0.01%     
==========================================
  Files         533      535       +2     
  Lines       91682    91865     +183     
==========================================
+ Hits        79791    79968     +177     
- Misses      11891    11897       +6     

☔ 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

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: c33294f4d0ee

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.527 ± 0.170 2.361 2.803 1.67 ± 0.19
pacquet@main 2.528 ± 0.173 2.359 2.766 1.67 ± 0.19
pnpr@HEAD 1.520 ± 0.182 1.354 1.790 1.01 ± 0.15
pnpr@main 1.511 ± 0.135 1.358 1.740 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.526785022320001,
      "stddev": 0.17022605153305567,
      "median": 2.47340299372,
      "user": 1.5422539199999998,
      "system": 1.2652332999999998,
      "min": 2.3614004427200004,
      "max": 2.80326883072,
      "times": [
        2.7791444227200004,
        2.5045906537200002,
        2.6537341847200002,
        2.3725725857200004,
        2.3614004427200004,
        2.44221533372,
        2.5858604087200003,
        2.36434634572,
        2.40071701472,
        2.80326883072
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5277263268200003,
      "stddev": 0.173196224611214,
      "median": 2.46979208422,
      "user": 1.5044236199999999,
      "system": 1.3275178000000003,
      "min": 2.3589505717200003,
      "max": 2.7658787957200004,
      "times": [
        2.3589505717200003,
        2.7658787957200004,
        2.37813151272,
        2.6999536557200003,
        2.6346215547200003,
        2.7619088367200004,
        2.40137770272,
        2.36303240972,
        2.37520176272,
        2.53820646572
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5197472255200002,
      "stddev": 0.18215364035745754,
      "median": 1.42234400172,
      "user": 1.03076712,
      "system": 1.1228859,
      "min": 1.35409923872,
      "max": 1.79036471372,
      "times": [
        1.35409923872,
        1.59877294772,
        1.44711268272,
        1.39757532072,
        1.39284381972,
        1.78999347572,
        1.70128938072,
        1.35625242072,
        1.36916825472,
        1.79036471372
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.51051581502,
      "stddev": 0.13515378560440033,
      "median": 1.49390044622,
      "user": 1.0822547200000001,
      "system": 1.0888068,
      "min": 1.35752181272,
      "max": 1.74020304972,
      "times": [
        1.69387613572,
        1.48512482772,
        1.59268910672,
        1.40917120872,
        1.37551561072,
        1.38468874072,
        1.35752181272,
        1.56369159272,
        1.50267606472,
        1.74020304972
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 253.7 ± 8.1 244.5 270.7 1.00
pacquet@main 256.1 ± 5.8 244.4 265.7 1.01 ± 0.04
pnpr@HEAD 267.3 ± 6.2 255.1 274.3 1.05 ± 0.04
pnpr@main 268.5 ± 5.3 261.6 277.4 1.06 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25374815478,
      "stddev": 0.008079634730340861,
      "median": 0.25074984688,
      "user": 0.20554566,
      "system": 0.5082255,
      "min": 0.24446830088000002,
      "max": 0.27067991488,
      "times": [
        0.25285480288,
        0.24767952888,
        0.24808343588,
        0.26195525788,
        0.24864489088,
        0.25715645988,
        0.24857431988,
        0.24446830088000002,
        0.25738463588,
        0.27067991488
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.25605980518,
      "stddev": 0.005807885870067467,
      "median": 0.25677814338000005,
      "user": 0.20180805999999998,
      "system": 0.5394437999999999,
      "min": 0.24442679288,
      "max": 0.26572327988,
      "times": [
        0.25481903088,
        0.25424669588,
        0.26572327988,
        0.25620676588,
        0.24442679288,
        0.25793282588,
        0.25734952088,
        0.25994734888,
        0.25984004688,
        0.25010574388
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26729018858,
      "stddev": 0.0061699534111929995,
      "median": 0.26816095588,
      "user": 0.21051786,
      "system": 0.5325746,
      "min": 0.25514541388,
      "max": 0.27430806488,
      "times": [
        0.26847236088,
        0.27430806488,
        0.27292854588,
        0.26784955088,
        0.26222930188,
        0.26499240888000003,
        0.27278421488,
        0.27215640688,
        0.26203561688,
        0.25514541388
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.26851891618,
      "stddev": 0.005251681801539492,
      "median": 0.26730479888,
      "user": 0.20780575999999992,
      "system": 0.5389977,
      "min": 0.26163797088,
      "max": 0.27735611688,
      "times": [
        0.27735611688,
        0.26163797088,
        0.26510403788000003,
        0.26820623088,
        0.26561241188,
        0.27048037088,
        0.26959820488,
        0.26640336688,
        0.26383617788,
        0.27695427288
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.769 ± 0.022 2.735 2.806 1.73 ± 0.17
pacquet@main 2.753 ± 0.028 2.711 2.794 1.72 ± 0.17
pnpr@HEAD 1.597 ± 0.161 1.434 1.874 1.00
pnpr@main 1.644 ± 0.150 1.433 1.866 1.03 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.76937767796,
      "stddev": 0.02239824877237479,
      "median": 2.76717525936,
      "user": 1.66618684,
      "system": 1.33496252,
      "min": 2.73533528486,
      "max": 2.80605710186,
      "times": [
        2.7466146888600003,
        2.80605710186,
        2.73533528486,
        2.76534806686,
        2.75755236686,
        2.77568886486,
        2.76900245186,
        2.77565618286,
        2.7591834408600002,
        2.80333832986
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.7531564006600004,
      "stddev": 0.027917336257668318,
      "median": 2.75548137436,
      "user": 1.6769827399999997,
      "system": 1.2871200200000001,
      "min": 2.71105814386,
      "max": 2.79406197586,
      "times": [
        2.73787270386,
        2.71105814386,
        2.77339221286,
        2.79406197586,
        2.78645641786,
        2.76600089686,
        2.73365376286,
        2.71810514386,
        2.75147117086,
        2.75949157786
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5972877701600001,
      "stddev": 0.16061569922663105,
      "median": 1.54650555636,
      "user": 1.0414743400000002,
      "system": 1.13324982,
      "min": 1.43441234586,
      "max": 1.8738142178600001,
      "times": [
        1.43856716486,
        1.43441234586,
        1.46144257886,
        1.56762094586,
        1.8738142178600001,
        1.64961695586,
        1.7112009168600002,
        1.82424897086,
        1.52539016686,
        1.4865634378600001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.64369344136,
      "stddev": 0.14962237734034314,
      "median": 1.58728139886,
      "user": 1.00396214,
      "system": 1.13599922,
      "min": 1.43254826586,
      "max": 1.86642444486,
      "times": [
        1.53454785786,
        1.8221969118599999,
        1.5033026138599999,
        1.71066211586,
        1.81340505286,
        1.57928435286,
        1.58877858386,
        1.43254826586,
        1.86642444486,
        1.58578421386
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 581.8 ± 10.7 562.6 598.5 1.94 ± 0.04
pacquet@main 567.1 ± 8.8 555.9 578.7 1.89 ± 0.04
pnpr@HEAD 302.1 ± 3.1 297.9 308.5 1.01 ± 0.02
pnpr@main 300.1 ± 3.4 295.1 306.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5817932980000001,
      "stddev": 0.010695290831516744,
      "median": 0.5809552747,
      "user": 0.72752116,
      "system": 0.66418684,
      "min": 0.5626272577,
      "max": 0.5984818977,
      "times": [
        0.5750796147,
        0.5984818977,
        0.5747960217000001,
        0.5850966387000001,
        0.5773085287,
        0.5973703807,
        0.5820763287,
        0.5852620907,
        0.5798342207,
        0.5626272577
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.5670866739000001,
      "stddev": 0.008835750885004205,
      "median": 0.5662748402,
      "user": 0.68133346,
      "system": 0.6644199399999999,
      "min": 0.5559122247,
      "max": 0.5787086127000001,
      "times": [
        0.5775160407000001,
        0.5705138987,
        0.5561052987,
        0.5559122247,
        0.5605336207,
        0.5756221197000001,
        0.5724481197000001,
        0.5787086127000001,
        0.5614710217000001,
        0.5620357817
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3021488445,
      "stddev": 0.0030759825057911326,
      "median": 0.30137919020000004,
      "user": 0.18665866000000003,
      "system": 0.53415484,
      "min": 0.29791364470000004,
      "max": 0.30848446970000004,
      "times": [
        0.3048321527,
        0.30848446970000004,
        0.3014612137,
        0.3012971667,
        0.3012260337,
        0.29791364470000004,
        0.30452545770000006,
        0.2989672427,
        0.30071707770000006,
        0.30206398570000004
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3001135071,
      "stddev": 0.0034053567965104375,
      "median": 0.3006706697,
      "user": 0.18545375999999997,
      "system": 0.54522034,
      "min": 0.29509039470000004,
      "max": 0.3062220527,
      "times": [
        0.2959474917,
        0.29509039470000004,
        0.2996633387,
        0.29718175970000005,
        0.30246006970000006,
        0.3062220527,
        0.30173026970000005,
        0.29905377470000005,
        0.30210791870000003,
        0.3016780007
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.899 ± 0.009 1.889 1.914 6.33 ± 0.09
pacquet@main 1.893 ± 0.006 1.880 1.901 6.31 ± 0.09
pnpr@HEAD 0.302 ± 0.007 0.295 0.318 1.01 ± 0.03
pnpr@main 0.300 ± 0.004 0.294 0.310 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8987678091,
      "stddev": 0.009311915760526292,
      "median": 1.8946511907999999,
      "user": 0.89848204,
      "system": 0.76860308,
      "min": 1.8889546163000002,
      "max": 1.9140929723,
      "times": [
        1.9140929723,
        1.8919600693,
        1.8889546163000002,
        1.8908207612999999,
        1.8911610693,
        1.9022678902999999,
        1.8955301903,
        1.8937721912999999,
        1.9103615173,
        1.9087568133
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.8930739491999997,
      "stddev": 0.006027248710956463,
      "median": 1.8943239773,
      "user": 0.91569194,
      "system": 0.7327349799999998,
      "min": 1.8803715423,
      "max": 1.9005941783,
      "times": [
        1.8971076023,
        1.8964359013,
        1.8985345323,
        1.8918531893000001,
        1.8803715423,
        1.8867547073,
        1.8946129393,
        1.9005941783,
        1.8904398842999999,
        1.8940350152999998
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30150374020000004,
      "stddev": 0.006559615126833881,
      "median": 0.3000490418,
      "user": 0.18830454,
      "system": 0.53118368,
      "min": 0.2952858553,
      "max": 0.3175742293,
      "times": [
        0.30689486930000004,
        0.3007890253,
        0.2961661273,
        0.3175742293,
        0.2952858553,
        0.30152122230000006,
        0.29796167830000003,
        0.2976607733,
        0.3018745633,
        0.29930905830000004
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.2998841119,
      "stddev": 0.0042176336901664155,
      "median": 0.29971411330000003,
      "user": 0.21603714,
      "system": 0.50698418,
      "min": 0.2937191033,
      "max": 0.30971354230000003,
      "times": [
        0.2979696533,
        0.30197146630000005,
        0.30159499030000003,
        0.2976614953,
        0.29998201230000004,
        0.2996580133,
        0.30971354230000003,
        0.2937191033,
        0.29977021330000003,
        0.2968006293
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 350.0 ± 14.7 334.6 383.5 4.01 ± 0.17
pacquet@main 352.4 ± 8.0 344.7 364.6 4.04 ± 0.10
pnpr@HEAD 87.2 ± 0.9 84.9 89.9 1.00
pnpr@main 87.3 ± 1.3 84.2 90.6 1.00 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.34995630436,
      "stddev": 0.014728233516505627,
      "median": 0.34664684546,
      "user": 0.34379803999999997,
      "system": 0.05134141999999999,
      "min": 0.33464841546,
      "max": 0.38351136146000003,
      "times": [
        0.33584659546000006,
        0.33464841546,
        0.34016944046,
        0.34003712146000004,
        0.35689421946000005,
        0.35581316046000006,
        0.34488733646,
        0.35934903846000005,
        0.34840635446000007,
        0.38351136146000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.35240304096,
      "stddev": 0.00798781201076042,
      "median": 0.34910782696000003,
      "user": 0.3414017399999999,
      "system": 0.06119912000000001,
      "min": 0.34469722046000006,
      "max": 0.36455957146000006,
      "times": [
        0.35154402546,
        0.36455957146000006,
        0.34469722046000006,
        0.36194421046,
        0.34667162846000005,
        0.34505174646000003,
        0.36144821846,
        0.35657053246000003,
        0.34657425546000004,
        0.34496900046000006
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08718974606606064,
      "stddev": 0.0009425063329685743,
      "median": 0.08731317346000002,
      "user": 0.020362261212121206,
      "system": 0.009095546666666662,
      "min": 0.08486264246000001,
      "max": 0.08993168946,
      "times": [
        0.08695252646000001,
        0.08693933146000002,
        0.08522248846000001,
        0.08682848346000001,
        0.08649847446000002,
        0.08731317346000002,
        0.08627207946000001,
        0.08538895046000002,
        0.08993168946,
        0.08486264246000001,
        0.08743219746000001,
        0.08761747446000001,
        0.08743881846000001,
        0.08747757246000001,
        0.08721364646000002,
        0.08762043046000001,
        0.08734430246000001,
        0.08764872346000001,
        0.08668923246000002,
        0.08752382946000001,
        0.08865309846000001,
        0.08633693146000002,
        0.08718171746000002,
        0.08784112546000002,
        0.08684261046000001,
        0.08807670746000001,
        0.08757676746000001,
        0.08696733346000002,
        0.08695864846000001,
        0.08757958346000001,
        0.08724780146000001,
        0.08801812646000001,
        0.08776510146000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08727546086625002,
      "stddev": 0.0013382000672926028,
      "median": 0.08719062346,
      "user": 0.01945554624999999,
      "system": 0.01053251875,
      "min": 0.08420192246000001,
      "max": 0.09055765546000001,
      "times": [
        0.08902095046000001,
        0.08612980146000002,
        0.08526553846000001,
        0.08765667846000001,
        0.08670527246000001,
        0.08795591046000001,
        0.09010648646000001,
        0.08584204146000002,
        0.08698050846000001,
        0.08772500646000002,
        0.08779980746000002,
        0.08725451346000002,
        0.08665786346000001,
        0.08771704246,
        0.08815516446000002,
        0.08626106846,
        0.08712632246000002,
        0.08839722946000002,
        0.08566991846000001,
        0.08740899346000001,
        0.08704532946000001,
        0.08689206346000002,
        0.08420192246000001,
        0.08737813546,
        0.08878508646000001,
        0.08497956246000002,
        0.08769680446000001,
        0.08704840646,
        0.08699915446,
        0.08826777546000002,
        0.08712673346000001,
        0.09055765546000001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.543 ± 0.153 4.417 4.790 1.30 ± 0.05
pacquet@main 4.538 ± 0.162 4.421 4.887 1.30 ± 0.05
pnpr@HEAD 3.483 ± 0.041 3.438 3.556 1.00
pnpr@main 3.516 ± 0.085 3.444 3.720 1.01 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.54294491026,
      "stddev": 0.15332954246900948,
      "median": 4.44123870336,
      "user": 1.73191192,
      "system": 1.31065698,
      "min": 4.41684707036,
      "max": 4.78990401336,
      "times": [
        4.6491686233600005,
        4.45309337936,
        4.42269437836,
        4.42938402736,
        4.703908092360001,
        4.72259973536,
        4.78990401336,
        4.42440784536,
        4.41684707036,
        4.4174419373600005
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.5377854199600005,
      "stddev": 0.1618253006568586,
      "median": 4.47259792336,
      "user": 1.6816515200000002,
      "system": 1.3566876799999998,
      "min": 4.42108474036,
      "max": 4.88732326736,
      "times": [
        4.45319103336,
        4.791697084360001,
        4.48993141936,
        4.42108474036,
        4.473195560360001,
        4.48564229736,
        4.451292690360001,
        4.45249582036,
        4.47200028636,
        4.88732326736
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.4828485051599998,
      "stddev": 0.040876549031726765,
      "median": 3.47218637686,
      "user": 1.16767262,
      "system": 1.1830695799999997,
      "min": 3.4376754583599998,
      "max": 3.5556258813599997,
      "times": [
        3.44941732136,
        3.5556258813599997,
        3.46985475936,
        3.52683509136,
        3.4376754583599998,
        3.44218029436,
        3.4745179943599998,
        3.51793848936,
        3.45018649536,
        3.5042532663599997
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5164435783599997,
      "stddev": 0.08473695893290097,
      "median": 3.48563635186,
      "user": 1.1906032199999999,
      "system": 1.18265698,
      "min": 3.44435970736,
      "max": 3.72024125936,
      "times": [
        3.46814546036,
        3.59445741036,
        3.46925159736,
        3.72024125936,
        3.52197980536,
        3.52758952636,
        3.44435970736,
        3.46522871536,
        3.50202110636,
        3.45116119536
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13346
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,735.34 ms
(-1.92%)Baseline: 2,788.78 ms
3,346.53 ms
(81.74%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,888.95 ms
(-3.53%)Baseline: 1,958.03 ms
2,349.63 ms
(80.39%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
562.63 ms
(-11.43%)Baseline: 635.20 ms
762.24 ms
(73.81%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
334.65 ms
(-14.47%)Baseline: 391.26 ms
469.51 ms
(71.28%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,361.40 ms
(-1.25%)Baseline: 2,391.37 ms
2,869.65 ms
(82.29%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,416.85 ms
(-1.64%)Baseline: 4,490.56 ms
5,388.67 ms
(81.97%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
244.47 ms
(-7.54%)Baseline: 264.40 ms
317.28 ms
(77.05%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13346
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,434.41 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
295.29 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
297.91 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
84.86 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,354.10 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,437.68 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
255.15 ms
🐰 View full continuous benchmarking report in Bencher

Copilot AI review requested due to automatic review settings July 25, 2026 13:32

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 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/package-manager/src/dependencies_graph_to_lockfile.rs (1)

600-602: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep the rustdoc focused on the contract.

This private helper’s comment mostly restates its implementation. Remove it or document only the non-obvious behavior, such as malformed or missing metadata returning None.

As per coding guidelines, comments should explain only non-obvious invariants, workarounds, deliberate exceptions, or contracts.

🤖 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/package-manager/src/dependencies_graph_to_lockfile.rs` around
lines 600 - 602, Refine or remove the rustdoc for the private JSON-array helper
so it documents only the non-obvious contract: missing or malformed metadata,
including arrays without string values, returns None. Remove implementation
details about reading, flattening, and Vec<String> construction.

Source: Coding guidelines

🤖 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/package-manager/src/dependencies_graph_to_lockfile.rs`:
- Around line 600-602: Refine or remove the rustdoc for the private JSON-array
helper so it documents only the non-obvious contract: missing or malformed
metadata, including arrays without string values, returns None. Remove
implementation details about reading, flattening, and Vec<String> construction.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c81a2933-74a3-41a9-895b-2a6de07c0443

📥 Commits

Reviewing files that changed from the base of the PR and between c33294f and 1e9881c.

📒 Files selected for processing (2)
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 1e9881c

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

@zkochan
zkochan merged commit b4032e8 into main Jul 25, 2026
36 checks passed
@zkochan
zkochan deleted the fix-13324 branch July 25, 2026 13:44
zkochan added a commit that referenced this pull request Jul 25, 2026
The scalar libc regression test covered the string branch added in #13346, while Codecov identified the array and invalid-value branches as uncovered.

Exercise both remaining shapes directly so the parser keeps accepting arrays and rejecting malformed metadata without changing production behavior.

Follow-up to #13346.
kairosci added a commit to kairosci/pnpm that referenced this pull request Jul 27, 2026
Registry package manifests may express `libc` as a plain string. Pacquet's
dependency-graph-to-lockfile conversion only accepted arrays, so fresh
lockfiles silently omitted those platform constraints.

Accept both string and array `libc` metadata in that conversion while keeping
other manifest list fields array-only. Cover the scalar form with a regression
test based on sass-embedded's Linux variants, including a check that malformed
scalar bundle metadata remains ignored.

Closes pnpm#13324.
kairosci added a commit to kairosci/pnpm that referenced this pull request Jul 27, 2026
The scalar libc regression test covered the string branch added in pnpm#13346, while Codecov identified the array and invalid-value branches as uncovered.

Exercise both remaining shapes directly so the parser keeps accepting arrays and rejecting malformed metadata without changing production behavior.

Follow-up to pnpm#13346.
zkochan added a commit that referenced this pull request Sep 26, 2026
The install loaded only the global and project pnpmfiles, so a config
dependency plugin's pnpmfile contributed its updateConfig hook and
nothing else. Its readPackage, afterAllResolved and custom resolvers
never ran, and pnpmfileChecksum left it out. pnpm 11 puts plugin
pnpmfiles in the same requireHooks set as the project's.

PnpmfileSelection now carries the config dependencies, and
find_pnpmfiles returns the global pnpmfile, then the installed plugin
pnpmfiles, then the project's own, which is pnpm 11's order. Every
consumer of the selection now sees the same set: install, update,
deploy, the lockfile freshness checks, the optimistic repeat-install
state, and the updateConfig/beforePacking pass. The updateConfig pass
used to run plugins ahead of the global pnpmfile and now runs them
after it, as pnpm 11 does.

The up-to-date fast path already bails out whenever config dependencies
exist, so it is unaffected. The workspace state's pnpmfile list now
includes plugin pnpmfiles, as pnpm 11's does. A state written before
this change therefore triggers one re-validation.

Closes pnpm/pnpm#12366. Its env-lockfile items were already fixed by
#13382, #13346 and #13436. This was the last
lockfile divergence found while verifying them.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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 drops libc constraints from generated lockfiles

3 participants