Skip to content

fix(package-manager): record and honor bundledDependencies - #13406

Merged
zkochan merged 6 commits into
mainfrom
fix-13326
Jul 26, 2026
Merged

zkochan merged 6 commits into
mainfrom
fix-13326

Conversation

@zkochan

@zkochan zkochan commented Jul 26, 2026 •

Copy link
Copy Markdown
Member

Summary

While investigating #13326 I found the reported divergence was already fixed — but the audit of the code that fixed it turned up two gaps in the same area that it did not cover, plus a whole upstream test suite with no pnpm 12 counterpart.

What #13326 turned out to be. The issue reports that pnpm 12 resolves the dependency subtree of a platform-incompatible optional package (@tailwindcss/oxide-wasm32-wasi and six transitive packages). Running its exact reproduction against pnpm 11.17.0 and a HEAD build of pnpm 12 now produces byte-identical pnpm-lock.yaml; the fix was eab73b3994 (#13374), which taught extract_children to drop names a manifest declares in bundledDependencies — and @tailwindcss/oxide-wasm32-wasi bundles exactly those six.

The issue's stated expectation — that pnpm 11 skips resolving the subtree of a platform-incompatible optional package — does not hold. On Linux x64, pnpm 11 resolves the full 36-package subtree of the darwin-only [email protected], and records @img/[email protected] with its @img/sharp-libvips-darwin-arm64 edge; pnpm 12 matches both exactly. A 12-package sweep of the platform-heavy ecosystem (esbuild, rollup, @parcel/watcher, lightningcss, oxide, sharp, @swc/core, unrs-resolver, oxc-parser, @napi-rs/canvas, dmg-license, @sentry/profiling-node) is identical between the two stacks both natively and under supportedArchitectures: {os: [darwin], cpu: [arm64]}. So this PR does not add a platform gate to the resolver — that would be a new divergence, and it would fail the existing skip_optional_dependency_that_does_not_support_the_current_os test.

What this PR does fix, both found by porting the upstream bundledDependencies suite:

  1. bundleDependencies: true was dropped from the lockfile. A manifest may declare the boolean form instead of a name list, which npm and pnpm both read as "every entry of dependencies ships inside this tarball". pacquet's writer only understood the list form, and PackageMetadata::bundled_dependencies was typed Option<Vec<String>> — so the boolean could not even be represented, and a pnpm-lock.yaml written by pnpm 11 for such a package failed to parse. The field is now modelled as the string[] | boolean union pnpm records, read through one shared BundledDependencies::from_manifest used by both the install writer and the env-installer writer.

  2. Bundled bins were never linked. The field's presence is what tells the installer a package carries a populated node_modules of its own whose bins belong in that package's node_modules/.bin (upstream: linkBinsOfPackages + the hasBundledDependencies branch in building/during-install and deps-restorer). Bundled packages are not lockfile children, so neither pacquet linker ever saw them: the isolated path's per-slot bin walk iterates snapshot.dependencies, and the hoisted path iterates graph nodes — has_bundled_dependencies was computed and stored on every hoisted node but had no reader at all. Both paths now get the second bin pass over the package's own node_modules.

Installing @pnpm.e2e/[email protected] on main produces no .bin directory inside the package; pnpm 11 writes node_modules/@pnpm.e2e/pkg-with-bundled-dependencies/node_modules/.bin/hello-world-js-bin.

Tests. installing/deps-installer/test/install/bundledDependencies.ts had no pnpm 12 counterpart, which is why neither gap was caught. It is ported as pnpm/crates/cli/tests/bundled_dependencies.rs, covering both manifest spellings, false, and the boolean form across a frozen reinstall (which is what exercises the lockfile round trip), plus a pacquet-only nodeLinker: hoisted case. Each test was verified to fail against the unfixed implementation. The two local-tarball cases from that suite still need .tgz fixtures and are listed as unported in plans/TEST_PORTING.md.

Related to #13326

Squash Commit Body

Investigating pnpm/pnpm#13326 showed its reproduction already matches
pnpm 11 byte for byte, fixed by eab73b3994 (pnpm/pnpm#13374) filtering
bundled names out of `extract_children`. Porting the upstream
`bundledDependencies` install suite — which had no pacquet counterpart,
and is why the original defect shipped — surfaced two gaps that fix did
not cover.

A manifest may declare `bundleDependencies: true` instead of a name
list, which npm and pnpm both read as "every entry of `dependencies`
ships inside this tarball". The lockfile writer only understood the list
form, and `PackageMetadata::bundled_dependencies` was typed
`Option<Vec<String>>`, so the boolean could neither be written nor read
back — a `pnpm-lock.yaml` written by pnpm 11 for such a package failed
to parse. Model the field as the `string[] | boolean` union pnpm
records, behind one shared `BundledDependencies::from_manifest` that
both the install and env-installer writers call.

The field's presence is also what tells the installer a package carries
a populated `node_modules` of its own whose bins belong in that
package's `node_modules/.bin`. Bundled packages are not lockfile
children, so neither linker reached them: the isolated path's per-slot
walk iterates `snapshot.dependencies`, and the hoisted path iterates
graph nodes — `has_bundled_dependencies` was computed and stored on
every hoisted node but had no reader. Both paths now run the second bin
pass upstream's `linkAllBins` and `building/during-install` run.

No platform gate is added to the resolver. The issue asks for one, but
pnpm 11 resolves the subtree of a platform-incompatible optional package
too (`[email protected]` on Linux, `@img/sharp-darwin-arm64`'s libvips
edge), and `skip_optional_dependency_that_does_not_support_the_current_os`
already asserts pacquet matches that.

Related to pnpm/pnpm#13326

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
    (pacquet-only: the TypeScript CLI already records the boolean form and
    links bundled bins. No TS change needed.)
  • 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

  • New Features

    • Improved handling of bundledDependencies / bundleDependencies in package metadata and lockfile output (including boolean true form and alternate spelling).
  • Bug Fixes

    • Bundled packages now link bundled dependency executables into the bundling package’s .bin directory correctly for both isolated and hoisted installs, including when a package includes its own node_modules.
  • Tests

    • Added/expanded end-to-end and lockfile metadata parsing/round-trip coverage for boolean, list, and disabled bundled-dependency cases.
  • Documentation

    • Updated bundled-dependency test porting-status notes.

zkochan added 2 commits July 26, 2026 22:43
A package may declare `bundleDependencies: true` instead of a name list,
which npm and pnpm both read as "every entry of `dependencies` ships
inside this tarball". pacquet's lockfile writer only understood the list
form, so the boolean was dropped from `packages:` — and the lockfile type
could not represent it at all, which made a `pnpm-lock.yaml` written by
pnpm 11 for such a package fail to parse.

The field's presence is also the signal that a package carries a
populated `node_modules` of its own, which the installer needs in order
to link the bins that come with it. pacquet never linked those bins for
either spelling: bundled packages are not lockfile children, so nothing
in the per-slot bin walk ever saw them, and `<slot>/node_modules/<pkg>`
was left without a `.bin` entry that pnpm 11 writes.

Model the field as the `string[] | boolean` union pnpm records, read it
through one shared constructor, and give a bundling slot a second bin
pass over the package's own `node_modules`.

Ports the upstream `bundledDependencies` install suite
(`installing/deps-installer/test/install/bundledDependencies.ts`), which
had no pacquet counterpart. It covers both manifest spellings, the
boolean form across a frozen reinstall, and `false`.

Refs #13326
The hoisted linker populates each `<parent>/node_modules/.bin` from the
graph nodes at that level. Packages a tarball ships in its own
`node_modules` are not graph nodes, so the pass never reached them and
`has_bundled_dependencies` — computed off the lockfile row and stored on
every node — had no reader at all.

Give a bundling node the same second bin pass upstream's `linkAllBins`
runs, over the package's own `node_modules`.
Copilot AI review requested due to automatic review settings July 26, 2026 20:57

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

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a254db5f-562e-41b3-9195-2d161f8583b5

📥 Commits

Reviewing files that changed from the base of the PR and between 8ab7d9c and dbb25f2.

📒 Files selected for processing (1)
  • pnpm/crates/cli/tests/bundled_dependencies.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/cli/tests/bundled_dependencies.rs

📝 Walkthrough

Walkthrough

Bundled dependency metadata now preserves list and boolean forms in the lockfile. Isolated and hoisted linkers discover binaries from bundled packages’ internal node_modules, with CLI coverage for lockfile round trips and linker behavior.

Changes

Bundled dependency support

Layer / File(s) Summary
Bundled dependency metadata
pnpm/crates/lockfile/src/package_metadata.rs, pnpm/crates/env-installer/src/manifest_lockfile.rs, pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs, pnpm/crates/lockfile/src/package_metadata/tests.rs
Introduces BundledDependencies for boolean and list forms, uses it when building lockfile metadata, and tests parsing and serialization behavior.
Bundled package bin linking
pnpm/crates/package-manager/src/link_bins.rs, pnpm/crates/package-manager/src/link_hoisted_modules.rs
Links binaries from bundled packages’ internal node_modules for isolated and hoisted linking.
Bundled dependency validation
pnpm/crates/cli/tests/bundled_dependencies.rs, .changeset/bundled-dependencies-true.md, pnpm/plans/TEST_PORTING.md
Adds end-to-end coverage for metadata, boolean round trips, false values, alternate spellings, and hoisted linking, alongside release and porting notes.

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

Possibly related PRs

  • pnpm/pnpm#13148: Addresses related bundledDependencies lockfile representation semantics.

Suggested labels: product: pacquet

Suggested reviewers: copilot

Sequence Diagram(s)

sequenceDiagram
  participant PackageManager
  participant Lockfile
  participant BinLinker
  participant PackageFilesystem
  PackageManager->>Lockfile: read bundled_dependencies metadata
  PackageManager->>BinLinker: provide bundling set
  BinLinker->>PackageFilesystem: inspect bundled package node_modules
  PackageFilesystem-->>BinLinker: return bundled binaries
  BinLinker->>PackageFilesystem: create node_modules/.bin links
Loading
✨ 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-13326

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 lockfile + bin linking for bundledDependencies (incl. boolean form)

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Preserve and round-trip bundledDependencies / bundleDependencies into pnpm-lock.yaml,
 including true.
• Link executables shipped inside a bundling package’s own node_modules for isolated and hoisted
 linkers.
• Add Rust e2e test coverage by porting pnpm’s upstream bundledDependencies suite.
Diagram

graph TD
  A[/"package.json"/] --> B["BundledDependencies::from_manifest"] --> C[("pnpm-lock.yaml")]
  C --> D["Virtual store bin linker"] --> F["<pkg>/.bin"]
  C --> E["Hoisted bin linker"] --> F
  G["CLI e2e tests"] --> C
  G --> F

  subgraph Legend
    direction LR
    _file[/"Input file"/] ~~~ _proc["Process" ] ~~~ _data[("Data")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Infer bundling by probing disk (`/node_modules`)
  • ➕ Doesn’t require lockfile metadata to be present/correct
  • ➕ Could work for legacy lockfiles that omit the field
  • ➖ Adds extra IO (read_dir) cost across many slots, especially in large installs
  • ➖ Can be flaky/incorrect for partially-installed or pruned directories
  • ➖ Still wouldn’t preserve the boolean bundleDependencies: true round-trip requirement
2. Store a derived `hasBundledDependencies` boolean in lockfile metadata
  • ➕ Simplifies consumer logic (only a single boolean check)
  • ➖ Does not round-trip pnpm’s recorded string[] | boolean shape
  • ➖ Loses information and risks future divergence from upstream lockfile semantics

Recommendation: Keep the PR’s approach: model bundledDependencies as pnpm’s string[] | boolean union and use its presence as the single signal for bundled-bin linking. This preserves lockfile compatibility (including true), avoids per-slot filesystem probing, and aligns both metadata writers (installer + env-installer) behind one constructor.

Files changed (8) +279 / -16

Bug fix (5) +110 / -16
manifest_lockfile.rsRead bundledDependencies via shared union constructor +2/-3

Read bundledDependencies via shared union constructor

• Switches env-installer lockfile metadata construction to use 'BundledDependencies::from_manifest' instead of only reading string lists. Ensures boolean 'true' is representable and recorded consistently.

pnpm/crates/env-installer/src/manifest_lockfile.rs

package_metadata.rsModel bundledDependencies as 'string[] | boolean' and add manifest parser +38/-1

Model bundledDependencies as 'string[] | boolean' and add manifest parser

• Changes 'PackageMetadata::bundled_dependencies' from 'Option<Vec<String>>' to 'Option<BundledDependencies>' and introduces the untagged enum. Adds 'from_manifest' to normalize both manifest spellings and to record only list/true (dropping false/invalid shapes).

pnpm/crates/lockfile/src/package_metadata.rs

dependencies_graph_to_lockfile.rsWrite bundledDependencies metadata using shared parser +6/-6

Write bundledDependencies metadata using shared parser

• Replaces ad-hoc list-only reading of 'bundledDependencies'/'bundleDependencies' with the shared 'BundledDependencies::from_manifest'. Ensures lockfile writer can emit the boolean form and stays aligned with env-installer behavior.

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

link_bins.rsLink bins from bundled node_modules in virtual store installs +49/-5

Link bins from bundled node_modules in virtual store installs

• Precomputes a set of bundling packages from lockfile metadata and threads it into lockfile-driven bin linking. Adds a second bin-source collection pass that scans the bundling package’s own 'node_modules' so bundled dependency executables are shimmed into the package’s '.bin'.

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

link_hoisted_modules.rsLink bundled bins under the hoisted node linker +15/-1

Link bundled bins under the hoisted node linker

• Adds an additional post-pass for hoisted installs: for packages marked as bundling, link bins from the package’s internal 'node_modules/.bin'. This mirrors pnpm behavior where bundled dependencies are not graph nodes but still ship executables.

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

Tests (1) +159 / -0
bundled_dependencies.rsPort upstream bundledDependencies install suite to Rust e2e tests +159/-0

Port upstream bundledDependencies install suite to Rust e2e tests

• Adds CLI-driven tests asserting (1) bundled deps are excluded from lockfile package entries, (2) 'bundleDependencies' spelling is normalized, (3) boolean 'true' round-trips and still drives bin linking on frozen installs, (4) behavior under the hoisted linker, and (5) 'false' does not set the bundled flag.

pnpm/crates/cli/tests/bundled_dependencies.rs

Documentation (2) +10 / -0
bundled-dependencies-true.mdAdd changeset documenting bundledDependencies lockfile + bin-link fixes +5/-0

Add changeset documenting bundledDependencies lockfile + bin-link fixes

• Introduces a patch changeset describing restored bundled bin linking and correct lockfile recording/reading of 'bundleDependencies: true'. Serves as release notes for the behavior fix.

.changeset/bundled-dependencies-true.md

TEST_PORTING.mdDocument ported bundledDependencies tests and remaining gaps +5/-0

Document ported bundledDependencies tests and remaining gaps

• Updates the test-porting plan with the newly ported bundledDependencies cases and notes remaining upstream scenarios requiring '.tgz' fixtures. Keeps parity tracking between the TypeScript and Rust suites.

pnpm/plans/TEST_PORTING.md

@greptile-apps

greptile-apps Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (5): Last reviewed commit: "test(cli): prove the hoisted bundled-bin..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
lockfile/parse_pnpm_lock       1.00     10.8±0.02ms    34.6 MB/sec    1.02     11.1±0.03ms    33.9 MB/sec
packument/parse                1.05     39.8±0.32µs  1665.6 MB/sec    1.00     37.9±0.08µs  1752.4 MB/sec
tarball/download_dependency    1.00      2.2±0.06ms  1937.6 KB/sec    1.00      2.2±0.09ms  1940.2 KB/sec

@qodo-code-review

qodo-code-review Bot commented Jul 26, 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


Remediation recommended

1. Hoisted mode unverified ✓ Resolved 🐞 Bug ☼ Reliability ⭐ New
Description
The hoisted-linker test configures nodeLinker: hoisted but never asserts that the install actually
ran in hoisted mode, so a config regression could make the test still pass while exercising the
isolated linker. This weakens regression detection for the newly-added hoisted bundled-bin behavior.
Code

pnpm/crates/cli/tests/bundled_dependencies.rs[R99-120]

+    // Both declaration shapes, because the hoisted linker reaches the bundling
+    // signal through `DependenciesGraphNode::has_bundled_dependencies` rather
+    // than the lockfile row the isolated linker reads.
+    pacquet
+        .with_args([
+            "add",
+            "@pnpm.e2e/[email protected]",
+            "@pnpm.e2e/[email protected]",
+        ])
+        .assert()
+        .success();
+
+    for bundling_pkg in
+        ["@pnpm.e2e/pkg-with-bundled-dependencies", "@pnpm.e2e/pkg-with-bundle-dependencies-true"]
+    {
+        assert_bin_linked(
+            &workspace
+                .join("node_modules")
+                .join(bundling_pkg)
+                .join("node_modules/.bin/hello-world-js-bin"),
+        );
+    }
Relevance

⭐⭐⭐ High

Team often accepts strengthening tests to avoid false-green/regressions; similar
robustness/assertion hardening changes were accepted.

PR-#13366
PR-#13378
PR-#13372

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new test runs pnpm add ... and only asserts that bundled bin shims exist for the two packages;
it does not check any hoisted-specific marker (like .modules.yaml) to ensure the hoisted linker
was actually selected. Existing hoisted-linker tests demonstrate a concrete, repo-standard way to
assert hoisted mode via .modules.yaml.

pnpm/crates/cli/tests/bundled_dependencies.rs[92-123]
pnpm/crates/cli/tests/hoisted_node_linker.rs[118-126]

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

## Issue description
`bundled_bins_are_linked_under_the_hoisted_linker` sets `nodeLinker: hoisted`, but its assertions only check for bundled bin shims under the package's own `node_modules/.bin`. That path can exist even if the install actually ran under the isolated linker, so the test doesn't prove it's covering the hoisted code path.

## Issue Context
Other hoisted-node-linker tests assert hoisted mode by checking `node_modules/.modules.yaml` contains `"nodeLinker": "hoisted"`.

## Fix Focus Areas
- pnpm/crates/cli/tests/bundled_dependencies.rs[99-120]

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


2. Windows shims untested ✓ Resolved 🐞 Bug ☼ Reliability
Description
assert_bin_linked() only checks the extensionless shim exists, so on Windows the new
bundledDependencies E2E tests could still pass even if the required .cmd/.ps1 launcher shims
were not created. This would mask a Windows-only regression where bins appear linked by the test but
are not invokable from typical shells.
Code

pnpm/crates/cli/tests/bundled_dependencies.rs[R129-138]

+/// Windows has no executable bit — `link_bins_of_packages` writes `.cmd` and
+/// `.ps1` siblings there instead — so only the shim's existence is portable.
+fn assert_bin_linked(shim: &Path) {
+    assert!(shim.exists(), "the bundled dependency's bin must be linked at {shim:?}");
+    #[cfg(unix)]
+    assert!(
+        pacquet_testing_utils::fs::is_path_executable(shim),
+        "the bundled dependency's bin shim at {shim:?} must be executable",
+    );
+}
Relevance

⭐⭐⭐ High

Team often accepts test hardening/coverage improvements; no close precedent rejecting
Windows-specific shim assertions.

PR-#13127
PR-#13372

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new helper explicitly says Windows gets .cmd/.ps1 siblings, but it only asserts
shim.exists(), so it doesn’t verify Windows’ actual launchers. The cmd-shim crate’s own tests
demonstrate that on Windows both .cmd and .ps1 are expected outputs, so the E2E helper should
assert them too to prevent Windows-only regressions from slipping through.

pnpm/crates/cli/tests/bundled_dependencies.rs[129-138]
pnpm/crates/cmd-shim/src/link_bins/tests.rs[48-56]

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 bundledDependencies E2E tests use `assert_bin_linked()` which only asserts that the extensionless shim path exists. On Windows, pacquet writes additional `.cmd` and `.ps1` shims, and those are the launcher artifacts typically used by `cmd.exe` / PowerShell.

### Issue Context
`pacquet_cmd_shim` explicitly treats `.cmd` and `.ps1` as required Windows shim flavors, so the E2E tests should validate them under `#[cfg(windows)]` to avoid missing Windows regressions.

### Fix Focus Areas
- pnpm/crates/cli/tests/bundled_dependencies.rs[129-139]

### Suggested fix
Extend `assert_bin_linked()` with a Windows-only block:
- `assert!(shim.with_extension("cmd").exists())`
- `assert!(shim.with_extension("ps1").exists())`
Keep the existing Unix executable-bit assertion as-is.

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


3. Empty bundle list treated bundled 🐞 Bug ≡ Correctness
Description
BundledDependencies::from_manifest returns Some(Names(vec![])) when the manifest value is an
array containing zero valid string entries, so PackageMetadata.bundled_dependencies.is_some()
becomes true even though the package bundles nothing. Downstream, the bin linkers and hoisted dep
graph use only is_some() as the bundling signal, causing extra per-package node_modules scans
and potentially linking bundled bins when the declaration is effectively empty/malformed.
Code

pnpm/crates/lockfile/src/package_metadata.rs[R77-90]

+    pub fn from_manifest(manifest: Option<&serde_json::Value>) -> Option<Self> {
+        ["bundledDependencies", "bundleDependencies"].into_iter().find_map(|key| {
+            match manifest?.get(key)? {
+                serde_json::Value::Array(items) => Some(BundledDependencies::Names(
+                    items
+                        .iter()
+                        .filter_map(serde_json::Value::as_str)
+                        .map(ToString::to_string)
+                        .collect(),
+                )),
+                serde_json::Value::Bool(true) => Some(BundledDependencies::Boolean(true)),
+                _ => None,
+            }
+        })
Relevance

⭐⭐⭐ High

Team previously accepted dropping malformed/empty bundledDependencies so empty arrays don’t mark
package as bundled.

PR-#13346

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new parser always returns Some(Names(...collect())) for any array, even when the collected
string list is empty; downstream code uses bundled_dependencies.is_some() as the bundling signal
and then scans <pkg>/node_modules to link bundled bins.

pnpm/crates/lockfile/src/package_metadata.rs[71-91]
pnpm/crates/package-manager/src/link_bins.rs[573-628]
pnpm/crates/package-manager/src/hoisted_dep_graph.rs[656-658]
PR-#13346

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

### Issue description
`BundledDependencies::from_manifest()` currently treats any JSON array value as a present `bundledDependencies` declaration, even if it contains no valid string entries. This causes `bundled_dependencies.is_some()` to become true for empty/malformed arrays, which downstream code interprets as “this package bundles a populated node_modules”.

### Issue Context
The presence of `bundledDependencies` is used as a boolean signal to trigger bundled-bin linking (disk scans of `<pkg>/node_modules`), so representing “bundles nothing” as `Some(Names([]))` is both semantically wrong and can add unnecessary filesystem work.

### Fix Focus Areas
- pnpm/crates/lockfile/src/package_metadata.rs[71-92]

### Suggested fix
- In the `Value::Array(items)` branch, collect string entries into a `Vec<String>`, then return `None` when the resulting vector is empty.
- Ensure that when `bundledDependencies` exists but yields no valid names (empty array / array of non-strings), the function returns `None` so the package is not classified as bundling.
- (Optional) Add a small unit/regression test covering `bundledDependencies: []` and `bundledDependencies: [123]` producing `None`.

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



Informational

4. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset only declares a pacquet bump and omits the required pnpm entry. This violates
the changeset requirement and can prevent the pnpm release from being correctly versioned for this
user-visible behavior change.
Code

.changeset/bundled-dependencies-true.md[R1-3]

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

⭐ Low

Multiple recent PRs rejected adding required pnpm entry to pacquet-only changesets.

PR-#13404
PR-#13346
PR-#13285

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires that each added/modified changeset explicitly includes a pnpm
entry with a valid bump type. The added changeset front-matter includes only "pacquet": patch and
omits pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/bundled-dependencies-true.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 `.changeset/bundled-dependencies-true.md` does not include a `pnpm` entry in its front-matter, but compliance requires explicitly declaring `pnpm` with a valid bump type.

## Issue Context
This PR changes user-visible lockfile/bin-linking behavior and already adds a changeset, so the changeset must also list `pnpm`.

## Fix Focus Areas
- .changeset/bundled-dependencies-true.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 dbb25f2

Results up to commit ec43ccb ⚖️ Balanced


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


Remediation recommended
1. Empty bundle list treated bundled 🐞 Bug ≡ Correctness
Description
BundledDependencies::from_manifest returns Some(Names(vec![])) when the manifest value is an
array containing zero valid string entries, so PackageMetadata.bundled_dependencies.is_some()
becomes true even though the package bundles nothing. Downstream, the bin linkers and hoisted dep
graph use only is_some() as the bundling signal, causing extra per-package node_modules scans
and potentially linking bundled bins when the declaration is effectively empty/malformed.
Code

pnpm/crates/lockfile/src/package_metadata.rs[R77-90]

+    pub fn from_manifest(manifest: Option<&serde_json::Value>) -> Option<Self> {
+        ["bundledDependencies", "bundleDependencies"].into_iter().find_map(|key| {
+            match manifest?.get(key)? {
+                serde_json::Value::Array(items) => Some(BundledDependencies::Names(
+                    items
+                        .iter()
+                        .filter_map(serde_json::Value::as_str)
+                        .map(ToString::to_string)
+                        .collect(),
+                )),
+                serde_json::Value::Bool(true) => Some(BundledDependencies::Boolean(true)),
+                _ => None,
+            }
+        })
Relevance

⭐⭐⭐ High

Team previously accepted dropping malformed/empty bundledDependencies so empty arrays don’t mark
package as bundled.

PR-#13346

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new parser always returns Some(Names(...collect())) for any array, even when the collected
string list is empty; downstream code uses bundled_dependencies.is_some() as the bundling signal
and then scans <pkg>/node_modules to link bundled bins.

pnpm/crates/lockfile/src/package_metadata.rs[71-91]
pnpm/crates/package-manager/src/link_bins.rs[573-628]
pnpm/crates/package-manager/src/hoisted_dep_graph.rs[656-658]
PR-#13346

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

### Issue description
`BundledDependencies::from_manifest()` currently treats any JSON array value as a present `bundledDependencies` declaration, even if it contains no valid string entries. This causes `bundled_dependencies.is_some()` to become true for empty/malformed arrays, which downstream code interprets as “this package bundles a populated node_modules”.

### Issue Context
The presence of `bundledDependencies` is used as a boolean signal to trigger bundled-bin linking (disk scans of `<pkg>/node_modules`), so representing “bundles nothing” as `Some(Names([]))` is both semantically wrong and can add unnecessary filesystem work.

### Fix Focus Areas
- pnpm/crates/lockfile/src/package_metadata.rs[71-92]

### Suggested fix
- In the `Value::Array(items)` branch, collect string entries into a `Vec<String>`, then return `None` when the resulting vector is empty.
- Ensure that when `bundledDependencies` exists but yields no valid names (empty array / array of non-strings), the function returns `None` so the package is not classified as bundling.
- (Optional) Add a small unit/regression test covering `bundledDependencies: []` and `bundledDependencies: [123]` producing `None`.

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



Informational
2. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset only declares a pacquet bump and omits the required pnpm entry. This violates
the changeset requirement and can prevent the pnpm release from being correctly versioned for this
user-visible behavior change.
Code

.changeset/bundled-dependencies-true.md[R1-3]

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

⭐ Low

Multiple recent PRs rejected adding required pnpm entry to pacquet-only changesets.

PR-#13404
PR-#13346
PR-#13285

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires that each added/modified changeset explicitly includes a pnpm
entry with a valid bump type. The added changeset front-matter includes only "pacquet": patch and
omits pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/bundled-dependencies-true.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 `.changeset/bundled-dependencies-true.md` does not include a `pnpm` entry in its front-matter, but compliance requires explicitly declaring `pnpm` with a valid bump type.

## Issue Context
This PR changes user-visible lockfile/bin-linking behavior and already adds a changeset, so the changeset must also list `pnpm`.

## Fix Focus Areas
- .changeset/bundled-dependencies-true.md[1-3]

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


Results up to commit 6dc760b ⚖️ Balanced


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


Remediation recommended
1. Windows shims untested ✓ Resolved 🐞 Bug ☼ Reliability
Description
assert_bin_linked() only checks the extensionless shim exists, so on Windows the new
bundledDependencies E2E tests could still pass even if the required .cmd/.ps1 launcher shims
were not created. This would mask a Windows-only regression where bins appear linked by the test but
are not invokable from typical shells.
Code

pnpm/crates/cli/tests/bundled_dependencies.rs[R129-138]

+/// Windows has no executable bit — `link_bins_of_packages` writes `.cmd` and
+/// `.ps1` siblings there instead — so only the shim's existence is portable.
+fn assert_bin_linked(shim: &Path) {
+    assert!(shim.exists(), "the bundled dependency's bin must be linked at {shim:?}");
+    #[cfg(unix)]
+    assert!(
+        pacquet_testing_utils::fs::is_path_executable(shim),
+        "the bundled dependency's bin shim at {shim:?} must be executable",
+    );
+}
Relevance

⭐⭐⭐ High

Team often accepts test hardening/coverage improvements; no close precedent rejecting
Windows-specific shim assertions.

PR-#13127
PR-#13372

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new helper explicitly says Windows gets .cmd/.ps1 siblings, but it only asserts
shim.exists(), so it doesn’t verify Windows’ actual launchers. The cmd-shim crate’s own tests
demonstrate that on Windows both .cmd and .ps1 are expected outputs, so the E2E helper should
assert them too to prevent Windows-only regressions from slipping through.

pnpm/crates/cli/tests/bundled_dependencies.rs[129-138]
pnpm/crates/cmd-shim/src/link_bins/tests.rs[48-56]

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 bundledDependencies E2E tests use `assert_bin_linked()` which only asserts that the extensionless shim path exists. On Windows, pacquet writes additional `.cmd` and `.ps1` shims, and those are the launcher artifacts typically used by `cmd.exe` / PowerShell.

### Issue Context
`pacquet_cmd_shim` explicitly treats `.cmd` and `.ps1` as required Windows shim flavors, so the E2E tests should validate them under `#[cfg(windows)]` to avoid missing Windows regressions.

### Fix Focus Areas
- pnpm/crates/cli/tests/bundled_dependencies.rs[129-139]

### Suggested fix
Extend `assert_bin_linked()` with a Windows-only block:
- `assert!(shim.with_extension("cmd").exists())`
- `assert!(shim.with_extension("ps1").exists())`
Keep the existing Unix executable-bit assertion as-is.

ⓘ 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 26, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13406      +/-   ##
==========================================
+ Coverage   87.53%   87.55%   +0.01%     
==========================================
  Files         542      544       +2     
  Lines       93294    93389      +95     
==========================================
+ Hits        81665    81763      +98     
+ Misses      11629    11626       -3     

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

`is_path_executable` is `#[cfg(unix)]`, so the ported suite failed to
compile on Windows. Windows has no executable bit — the shim writer
emits `.cmd` and `.ps1` siblings there instead — so assert the shim's
existence everywhere and its executable bit only on Unix.

Also pin `BundledDependencies::from_manifest` with unit tests, including
the two shapes a reviewer is most likely to want changed: an empty list
is recorded, matching what `pnpm install` writes for a package declaring
`"bundledDependencies": []`, and a `false` under the preferred key falls
through to the legacy spelling rather than vetoing it. Both round trip
through the lockfile.

@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/cli/tests/bundled_dependencies.rs (1)

98-115: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Unverified parity: hoisted linker's bundling signal vs. boolean bundleDependencies: true form, with no test to catch a mismatch. The isolated linker treats a package as bundling via bundled_dependencies.is_some() (true for both list and boolean forms), while the hoisted linker uses node.has_bundled_dependencies, whose population isn't visible in this review and isn't exercised by any test with the boolean form.

  • pnpm/crates/cli/tests/bundled_dependencies.rs#L98-L115: extend bundled_bins_are_linked_under_the_hoisted_linker (or add a case) to also install pkg-with-bundle-dependencies-true under nodeLinker: hoisted and assert its bin is linked.
  • pnpm/crates/package-manager/src/link_hoisted_modules.rs#L255-L268: confirm DependenciesGraphNode::has_bundled_dependencies is derived from "field present regardless of shape," matching BundledDependencies::from_manifest(...).is_some(), so the new hoisted test above actually passes.

As per path instructions ("REVIEW_GUIDE.md": "Tests—regression/e2e coverage must assert the actual lockfile field preservation and bin-link placement (including boolean/array/false forms and frozen reinstalls)" and "AGENTS.md": "pacquet (Rust) and the TypeScript pnpm CLI must be implemented together and kept behaviorally identical").

🤖 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/cli/tests/bundled_dependencies.rs` around lines 98 - 115, Extend
bundled_bins_are_linked_under_the_hoisted_linker in
pnpm/crates/cli/tests/bundled_dependencies.rs:98-115 to install
pkg-with-bundle-dependencies-true with nodeLinker set to hoisted and assert its
bundled bin is linked, preserving coverage for the existing package. In
pnpm/crates/package-manager/src/link_hoisted_modules.rs:255-268, update the
DependenciesGraphNode::has_bundled_dependencies derivation to treat the
bundled-dependencies field as present regardless of whether it is an array or
boolean, matching BundledDependencies::from_manifest(...).is_some().
🤖 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/cli/tests/bundled_dependencies.rs`:
- Around line 98-115: Extend bundled_bins_are_linked_under_the_hoisted_linker in
pnpm/crates/cli/tests/bundled_dependencies.rs:98-115 to install
pkg-with-bundle-dependencies-true with nodeLinker set to hoisted and assert its
bundled bin is linked, preserving coverage for the existing package. In
pnpm/crates/package-manager/src/link_hoisted_modules.rs:255-268, update the
DependenciesGraphNode::has_bundled_dependencies derivation to treat the
bundled-dependencies field as present regardless of whether it is an array or
boolean, matching BundledDependencies::from_manifest(...).is_some().

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d72845ff-4842-4af9-8832-c9c426f8a9ff

📥 Commits

Reviewing files that changed from the base of the PR and between 5de55a1 and ec43ccb.

📒 Files selected for processing (8)
  • .changeset/bundled-dependencies-true.md
  • pnpm/crates/cli/tests/bundled_dependencies.rs
  • pnpm/crates/env-installer/src/manifest_lockfile.rs
  • pnpm/crates/lockfile/src/package_metadata.rs
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs
  • pnpm/crates/package-manager/src/link_bins.rs
  • pnpm/crates/package-manager/src/link_hoisted_modules.rs
  • pnpm/plans/TEST_PORTING.md

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 26, 2026
Copilot AI review requested due to automatic review settings July 26, 2026 21:08

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.

The hoisted linker reaches the bundling signal through
`DependenciesGraphNode::has_bundled_dependencies` rather than the
lockfile row the isolated linker reads, so the two shapes need separate
coverage there. Narrowing that derivation to the name-list form now
fails the test.
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 6dc760b

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

Copilot AI review requested due to automatic review settings July 26, 2026 21:10

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.

On Windows nothing makes the extensionless shim invocable on its own —
the `.cmd` and `.ps1` launchers written beside it do. Asserting only the
shim's existence there would let a regression that stops emitting them
pass as a linked bin.
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit c82892d

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

Copilot AI review requested due to automatic review settings July 26, 2026 21:14

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.

@zkochan

zkochan commented Jul 26, 2026

Copy link
Copy Markdown
Member Author

Thanks — three findings, addressed in 8ab7d9c8cf and c82892d6dc.

"Windows shims untested" — fixed. assert_bin_linked now also asserts the .cmd and .ps1 launchers on Windows, since those (not the extensionless shim) are what make the bin invocable there. The Windows branch was compile-checked by temporarily re-gating it to unix and building on Linux, because the original Windows failure on this PR was exactly a #[cfg]-gated symbol that only surfaced in CI.

"Empty bundle list treated bundled" — declining, with evidence. Recording the empty list is what pnpm 11 does, so dropping it would create the divergence rather than remove one. updateLockfile.ts:152-156 gates on Array.isArray(pkg.additionalInfo.bundledDependencies), which [] passes, and the consumers (lockfileToDepGraph.ts:325, lockfileToHoistedDepGraph.ts:282) then read bundledDependencies != null, which [] also passes. Confirmed by running it — a package declaring "bundledDependencies": [], installed with pnpm 11.17.0:

packages:

  empty-bundle@file:pkg.tgz:
    resolution: {integrity: sha512-9DWMwILV36mc/…, tarball: file:pkg.tgz}
    version: 1.0.0
    bundledDependencies: []

The referenced #13346 precedent is about libc / cpu / os, where upstream drops empty and malformed values; bundledDependencies is gated differently upstream, so the two do not generalize to each other. The cost of matching pnpm here is one read_dir per such package that returns NotFound — the bin pass is skipped for every slot the lockfile doesn't mark as bundling. bundled_dependencies_keeps_an_empty_list pins the behavior with that rationale so it isn't "fixed" later by mistake.

CodeRabbit's hoisted-linker nitpick — partially applied. The derivation was already shape-agnostic (hoisted_dep_graph.rs:657 uses .is_some()), so no code change was needed there, but the test gap was real: bundled_bins_are_linked_under_the_hoisted_linker now installs the boolean-form fixture too. Narrowing that derivation to the name-list form makes it fail.


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

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@github-actions

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: dbb25f2f1d6d

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.511 ± 0.161 2.348 2.755 1.64 ± 0.17
pacquet@main 2.470 ± 0.117 2.352 2.727 1.61 ± 0.15
pnpr@HEAD 1.534 ± 0.126 1.364 1.746 1.00
pnpr@main 1.552 ± 0.144 1.351 1.750 1.01 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.51119193248,
      "stddev": 0.16063976737172167,
      "median": 2.47730886638,
      "user": 1.6439339399999997,
      "system": 1.32260736,
      "min": 2.34763042838,
      "max": 2.75489593038,
      "times": [
        2.38159550338,
        2.34763042838,
        2.34817800838,
        2.39319957438,
        2.56141815838,
        2.63840703438,
        2.75489593038,
        2.70107677738,
        2.36359030638,
        2.62192760338
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.4695472693800005,
      "stddev": 0.11725034769442531,
      "median": 2.4459926898799997,
      "user": 1.6376576399999998,
      "system": 1.2767208599999997,
      "min": 2.35193370538,
      "max": 2.72726542238,
      "times": [
        2.55952500038,
        2.56814288638,
        2.38487038538,
        2.35193370538,
        2.44255448438,
        2.36557239238,
        2.72726542238,
        2.45647361538,
        2.38970390638,
        2.44943089538
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.53353391588,
      "stddev": 0.1264802145738599,
      "median": 1.50137195588,
      "user": 1.19897714,
      "system": 1.12152226,
      "min": 1.36398566538,
      "max": 1.74626982538,
      "times": [
        1.60001261238,
        1.36398566538,
        1.48940573538,
        1.74626982538,
        1.7124095643800001,
        1.43071769938,
        1.59541286138,
        1.44033783138,
        1.51333817638,
        1.44344918738
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.55236459318,
      "stddev": 0.1442350867376007,
      "median": 1.55088066088,
      "user": 1.1899991399999998,
      "system": 1.13221136,
      "min": 1.3512023903800001,
      "max": 1.74960479838,
      "times": [
        1.5125968253800002,
        1.58916449638,
        1.47321494538,
        1.63368948138,
        1.3512023903800001,
        1.36838857338,
        1.74960479838,
        1.44466674038,
        1.7371698103800002,
        1.66394787038
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 250.7 ± 4.0 245.9 257.0 1.01 ± 0.03
pacquet@main 249.3 ± 6.7 242.4 265.1 1.00
pnpr@HEAD 264.4 ± 6.9 255.0 276.3 1.06 ± 0.04
pnpr@main 266.2 ± 3.1 260.4 271.1 1.07 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25073253310000004,
      "stddev": 0.004009322076334034,
      "median": 0.2514398641,
      "user": 0.19946585999999997,
      "system": 0.5003151799999999,
      "min": 0.24594856210000002,
      "max": 0.25704037910000005,
      "times": [
        0.2469535291,
        0.24594856210000002,
        0.25612273310000006,
        0.2506846971,
        0.2522751751,
        0.2521950311,
        0.25248613410000004,
        0.25704037910000005,
        0.2464315071,
        0.24718758310000002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.24932510189999996,
      "stddev": 0.006714424060014539,
      "median": 0.2472618411,
      "user": 0.20211036,
      "system": 0.50932798,
      "min": 0.2424051201,
      "max": 0.26505389110000005,
      "times": [
        0.2519434601,
        0.26505389110000005,
        0.2424051201,
        0.24671412310000002,
        0.2427563151,
        0.2450762341,
        0.2543879231,
        0.2468651191,
        0.25039027010000003,
        0.2476585631
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26438091700000005,
      "stddev": 0.006914765350008099,
      "median": 0.2614803976000001,
      "user": 0.20121926,
      "system": 0.51159718,
      "min": 0.2550244481,
      "max": 0.27632850910000006,
      "times": [
        0.2550244481,
        0.26028443810000007,
        0.25953989410000006,
        0.27632850910000006,
        0.26267635710000004,
        0.2717628731,
        0.26779705910000007,
        0.2601864601,
        0.27110919210000006,
        0.25909993910000007
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.26615996080000004,
      "stddev": 0.003109080603748466,
      "median": 0.26555140410000005,
      "user": 0.21379186,
      "system": 0.49760398000000006,
      "min": 0.2604312241,
      "max": 0.27105799810000003,
      "times": [
        0.2676337831,
        0.26513108910000005,
        0.2674473191,
        0.27031652010000007,
        0.27105799810000003,
        0.26597171910000006,
        0.26442047110000005,
        0.2647710401,
        0.26441844410000004,
        0.2604312241
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.763 ± 0.014 2.739 2.779 1.77 ± 0.17
pacquet@main 2.739 ± 0.017 2.706 2.765 1.75 ± 0.17
pnpr@HEAD 1.564 ± 0.154 1.428 1.841 1.00
pnpr@main 1.676 ± 0.142 1.463 1.869 1.07 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7627622071800007,
      "stddev": 0.01371224656658172,
      "median": 2.7652750517799998,
      "user": 1.84006262,
      "system": 1.36048804,
      "min": 2.7386488667799997,
      "max": 2.77933272378,
      "times": [
        2.75119168878,
        2.75314100478,
        2.76672659578,
        2.77424731978,
        2.77756102478,
        2.76382350778,
        2.77933272378,
        2.7723989697799998,
        2.7386488667799997,
        2.75055036978
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.7387918991799998,
      "stddev": 0.016925085673010643,
      "median": 2.73476881178,
      "user": 1.86300652,
      "system": 1.29232754,
      "min": 2.70637692678,
      "max": 2.76465098578,
      "times": [
        2.7530618317799997,
        2.75931822378,
        2.73461057878,
        2.76465098578,
        2.73492704478,
        2.73426139178,
        2.72808268778,
        2.73112639078,
        2.70637692678,
        2.7415029297799998
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.56406685478,
      "stddev": 0.153990465789278,
      "median": 1.50700458778,
      "user": 1.17557612,
      "system": 1.1566545399999997,
      "min": 1.4281476577799999,
      "max": 1.84104299178,
      "times": [
        1.84104299178,
        1.45785477578,
        1.55615439978,
        1.4281476577799999,
        1.4321390997799999,
        1.4476785907799998,
        1.7316841247800001,
        1.42874359778,
        1.58229776778,
        1.73492554178
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6762080650799998,
      "stddev": 0.14198967046418803,
      "median": 1.68743994178,
      "user": 1.17773982,
      "system": 1.15730954,
      "min": 1.46303853078,
      "max": 1.86855914278,
      "times": [
        1.86855914278,
        1.5102034307799999,
        1.6925534897799999,
        1.6335779067799998,
        1.85978286378,
        1.46303853078,
        1.53289558678,
        1.7839928187799998,
        1.7351504867799998,
        1.68232639378
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 593.9 ± 10.2 584.0 610.2 1.99 ± 0.06
pacquet@main 579.5 ± 14.6 560.1 608.8 1.94 ± 0.07
pnpr@HEAD 298.7 ± 7.1 289.5 308.5 1.00
pnpr@main 304.3 ± 6.3 296.0 313.7 1.02 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5939411783,
      "stddev": 0.010228697899014207,
      "median": 0.5908989249000001,
      "user": 0.69684346,
      "system": 0.6812757800000001,
      "min": 0.5839868524,
      "max": 0.6102368494000001,
      "times": [
        0.6030409724000001,
        0.5947541304,
        0.5842090204000001,
        0.5870437194000001,
        0.6072005854000001,
        0.5858944714000001,
        0.6102368494000001,
        0.5844876294000001,
        0.5839868524,
        0.5985575524000001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.5795149936,
      "stddev": 0.01463519570919841,
      "median": 0.5761742049,
      "user": 0.70129206,
      "system": 0.6638950799999999,
      "min": 0.5601469504000001,
      "max": 0.6087853344,
      "times": [
        0.5722283874,
        0.5682969484000001,
        0.5751595904000001,
        0.5601469504000001,
        0.6087853344,
        0.5986058334000001,
        0.5693411934000001,
        0.5812369654,
        0.5771888194000001,
        0.5841599134000001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2986604379,
      "stddev": 0.007130824887414514,
      "median": 0.2978018399000001,
      "user": 0.19925915999999996,
      "system": 0.4893331799999999,
      "min": 0.28954395340000005,
      "max": 0.30847589940000003,
      "times": [
        0.30071964940000007,
        0.29291506140000007,
        0.30674429640000006,
        0.30567604740000004,
        0.28954395340000005,
        0.29353232840000004,
        0.29488403040000005,
        0.30340728540000006,
        0.30847589940000003,
        0.29070582740000006
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30433140129999997,
      "stddev": 0.006256309140693784,
      "median": 0.30413477040000003,
      "user": 0.19151586,
      "system": 0.5022093799999999,
      "min": 0.29597254840000004,
      "max": 0.31365370840000006,
      "times": [
        0.30984418140000003,
        0.2993342124,
        0.3093614954,
        0.29597254840000004,
        0.2963234564,
        0.3036237574,
        0.3101924924,
        0.31365370840000006,
        0.30464578340000004,
        0.30036237740000005
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.906 ± 0.016 1.881 1.924 6.35 ± 0.18
pacquet@main 1.895 ± 0.009 1.874 1.905 6.31 ± 0.18
pnpr@HEAD 0.300 ± 0.008 0.289 0.313 1.00
pnpr@main 0.301 ± 0.005 0.293 0.307 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.90581104922,
      "stddev": 0.015522316910315243,
      "median": 1.90543867412,
      "user": 0.9335902399999998,
      "system": 0.7741174199999998,
      "min": 1.88083708612,
      "max": 1.92382747212,
      "times": [
        1.91644170412,
        1.89331398212,
        1.92223453312,
        1.91264906412,
        1.89630626112,
        1.88083708612,
        1.89822828412,
        1.89159315712,
        1.92382747212,
        1.92267894812
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.8948159347199998,
      "stddev": 0.009327455664683295,
      "median": 1.89505008812,
      "user": 0.9438118400000001,
      "system": 0.77531232,
      "min": 1.87382545712,
      "max": 1.90455764812,
      "times": [
        1.89887261412,
        1.9044694361199999,
        1.89635513312,
        1.89153769612,
        1.89209764312,
        1.90381628012,
        1.90455764812,
        1.88888239612,
        1.89374504312,
        1.87382545712
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30014028172,
      "stddev": 0.008357376824990104,
      "median": 0.29946205912,
      "user": 0.17697863999999996,
      "system": 0.5136155199999999,
      "min": 0.28939932312,
      "max": 0.31309162412,
      "times": [
        0.29609729712,
        0.29044685612000004,
        0.29244348012000004,
        0.30282682112000003,
        0.29598390812,
        0.30483285812,
        0.30898964912000004,
        0.31309162412,
        0.30729100012000005,
        0.28939932312
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30069986932000003,
      "stddev": 0.004507199350818047,
      "median": 0.30193278112,
      "user": 0.19500153999999997,
      "system": 0.49706031999999994,
      "min": 0.29288933112000004,
      "max": 0.30707129912000003,
      "times": [
        0.30390681212000004,
        0.29288933112000004,
        0.29961319012000004,
        0.30707129912000003,
        0.29780989812,
        0.30362629412000003,
        0.30116912712000005,
        0.30269643512,
        0.30377608312000004,
        0.29444022312
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 365.7 ± 8.5 355.0 384.0 4.12 ± 0.20
pacquet@main 371.8 ± 10.5 356.0 392.9 4.19 ± 0.22
pnpr@HEAD 88.7 ± 3.8 85.3 104.4 1.00
pnpr@main 88.7 ± 2.4 84.9 93.3 1.00 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.36571942252,
      "stddev": 0.008547263710353305,
      "median": 0.36448685432000005,
      "user": 0.35833136,
      "system": 0.06755448000000001,
      "min": 0.35498852132000003,
      "max": 0.38395601632000004,
      "times": [
        0.36981112032,
        0.35563104132,
        0.36663321832,
        0.37319735132000004,
        0.36335032132,
        0.36065292632,
        0.36418393732000004,
        0.35498852132000003,
        0.38395601632000004,
        0.36478977132
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.37176958232,
      "stddev": 0.010467598929014199,
      "median": 0.37072211032,
      "user": 0.35942265999999995,
      "system": 0.07085388,
      "min": 0.35596573732000003,
      "max": 0.39293999232000004,
      "times": [
        0.36026945232,
        0.37260446832000005,
        0.37307655032000003,
        0.39293999232000004,
        0.36883180332000004,
        0.36883975232000005,
        0.37687589932000004,
        0.35596573732000003,
        0.36711240632000003,
        0.38117976132000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08867432448129033,
      "stddev": 0.0038109092947860284,
      "median": 0.08726943632,
      "user": 0.020828343870967745,
      "system": 0.011012174193548387,
      "min": 0.08531644032,
      "max": 0.10444958932000001,
      "times": [
        0.08922382932,
        0.08968239932000001,
        0.09515218732000001,
        0.08788666632,
        0.08583963832000001,
        0.08632993432000001,
        0.08672489432000001,
        0.08649509232000001,
        0.08983107832000001,
        0.08753103332,
        0.08642726832,
        0.08871273132,
        0.09036270732000001,
        0.09052824932,
        0.08647021732,
        0.09185586532000001,
        0.08726943632,
        0.08551783232,
        0.10444958932000001,
        0.08758264032,
        0.08705128732,
        0.08647673632000001,
        0.08725484032000001,
        0.08673227432000001,
        0.08605196632,
        0.08989502032,
        0.09017268932000001,
        0.08531644032,
        0.08571279032000001,
        0.08629142732,
        0.09407529632
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08874133832000002,
      "stddev": 0.002407513958840812,
      "median": 0.08876656132,
      "user": 0.0211287975,
      "system": 0.010991623750000002,
      "min": 0.08493338432000001,
      "max": 0.09330954732,
      "times": [
        0.08634440032,
        0.08493338432000001,
        0.08596674532000001,
        0.08754682032000001,
        0.08730828532000001,
        0.09088621632,
        0.09071041832000001,
        0.09330954732,
        0.09167522032,
        0.08936681532,
        0.08674947732,
        0.08569623832,
        0.09239224732000001,
        0.08960429532000001,
        0.09168083932000001,
        0.08545402132,
        0.08710884632,
        0.09144323232000001,
        0.09077053932000001,
        0.08846502732,
        0.08906809532000001,
        0.08610410132,
        0.08636082132,
        0.08833283132000001,
        0.08997929232,
        0.09086130432,
        0.08612041832,
        0.09027328932,
        0.08798150932000001,
        0.08578475232,
        0.08936410632000001,
        0.09207968732
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.528 ± 0.151 4.424 4.835 1.30 ± 0.05
pacquet@main 4.488 ± 0.134 4.408 4.862 1.29 ± 0.04
pnpr@HEAD 3.602 ± 0.152 3.445 3.878 1.03 ± 0.05
pnpr@main 3.491 ± 0.059 3.434 3.614 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.52840329178,
      "stddev": 0.1510704555639454,
      "median": 4.44680996708,
      "user": 1.8357266600000002,
      "system": 1.4349689799999998,
      "min": 4.42360624408,
      "max": 4.83486941508,
      "times": [
        4.4368786700800005,
        4.447164030080001,
        4.83486941508,
        4.42360624408,
        4.43787401408,
        4.4464559040800005,
        4.747693868080001,
        4.450775618080001,
        4.43854759808,
        4.62016755608
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.4877442504800005,
      "stddev": 0.13388761276231373,
      "median": 4.44617460608,
      "user": 1.7887362600000003,
      "system": 1.4358067799999998,
      "min": 4.4083368300800005,
      "max": 4.86158963308,
      "times": [
        4.43540346108,
        4.4489075940800005,
        4.4083368300800005,
        4.44607238708,
        4.44627682508,
        4.5063840420800005,
        4.42064244308,
        4.443383063080001,
        4.86158963308,
        4.46044622608
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.6020590949799995,
      "stddev": 0.15187763588866204,
      "median": 3.53979814958,
      "user": 1.3031517599999998,
      "system": 1.2541222799999998,
      "min": 3.4454432810799998,
      "max": 3.87763098108,
      "times": [
        3.87763098108,
        3.62419843008,
        3.6978508300799997,
        3.4645507480799997,
        3.48514857908,
        3.52383851808,
        3.52054367108,
        3.8256281300799997,
        3.4454432810799998,
        3.55575778108
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.4908471515799997,
      "stddev": 0.05868962646084603,
      "median": 3.46414416408,
      "user": 1.26152856,
      "system": 1.30496078,
      "min": 3.43410455508,
      "max": 3.61369957008,
      "times": [
        3.45479286508,
        3.53139319708,
        3.61369957008,
        3.47971458408,
        3.45941963608,
        3.46886869208,
        3.43410455508,
        3.56204119608,
        3.45915842408,
        3.4452787960799998
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13406
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,738.65 ms
(+0.07%)Baseline: 2,736.76 ms
3,284.11 ms
(83.39%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,880.84 ms
(-0.60%)Baseline: 1,892.12 ms
2,270.54 ms
(82.84%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
583.99 ms
(+1.43%)Baseline: 575.77 ms
690.92 ms
(84.52%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
354.99 ms
(+1.11%)Baseline: 351.08 ms
421.29 ms
(84.26%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,347.63 ms
(-0.41%)Baseline: 2,357.40 ms
2,828.88 ms
(82.99%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,423.61 ms
(+0.01%)Baseline: 4,423.05 ms
5,307.66 ms
(83.34%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
245.95 ms
(-0.41%)Baseline: 246.95 ms
296.34 ms
(82.99%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13406
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,428.15 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
289.40 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
289.54 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
85.32 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,363.99 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,445.44 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
255.02 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit 5ed47dc into main Jul 26, 2026
33 checks passed
@zkochan
zkochan deleted the fix-13326 branch July 26, 2026 22:22
kairosci added a commit to kairosci/pnpm that referenced this pull request Jul 27, 2026
Investigating pnpm#13326 showed its reproduction already matches
pnpm 11 byte for byte, fixed by eab73b3 (pnpm#13374) filtering
bundled names out of `extract_children`. Porting the upstream
`bundledDependencies` install suite — which had no pacquet counterpart,
and is why the original defect shipped — surfaced two gaps that fix did
not cover.

A manifest may declare `bundleDependencies: true` instead of a name
list, which npm and pnpm both read as "every entry of `dependencies`
ships inside this tarball". The lockfile writer only understood the list
form, and `PackageMetadata::bundled_dependencies` was typed
`Option<Vec<String>>`, so the boolean could neither be written nor read
back — a `pnpm-lock.yaml` written by pnpm 11 for such a package failed
to parse. Model the field as the `string[] | boolean` union pnpm
records, behind one shared `BundledDependencies::from_manifest` that
both the install and env-installer writers call.

The field's presence is also what tells the installer a package carries
a populated `node_modules` of its own whose bins belong in that
package's `node_modules/.bin`. Bundled packages are not lockfile
children, so neither linker reached them: the isolated path's per-slot
walk iterates `snapshot.dependencies`, and the hoisted path iterates
graph nodes — `has_bundled_dependencies` was computed and stored on
every hoisted node but had no reader. Both paths now run the second bin
pass upstream's `linkAllBins` and `building/during-install` run.

No platform gate is added to the resolver. The issue asks for one, but
pnpm 11 resolves the subtree of a platform-incompatible optional package
too (`[email protected]` on Linux, `@img/sharp-darwin-arm64`'s libvips
edge), and `skip_optional_dependency_that_does_not_support_the_current_os`
already asserts pacquet matches that.

Related to pnpm#13326
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.

3 participants