Skip to content

feat(napi): add returnListOfDepsRequiringBuild install option - #13532

Merged
zkochan merged 5 commits into
mainfrom
fix-napi-deps-requiring-build
Jul 31, 2026
Merged

zkochan merged 5 commits into
mainfrom
fix-napi-deps-requiring-build

Conversation

@zkochan

@zkochan zkochan commented Jul 31, 2026 •

Copy link
Copy Markdown
Member

Summary

Bit hit a regression after migrating to the napi engine (teambit/bit#10508): every bit install wiped the bit.depsRequiringBuild block from pnpm-lock.yaml. The napi InstallResult.depsRequiringBuild only carried blocked builds (accumulated from pnpm:ignored-scripts events), while the TypeScript engine's returnListOfDepsRequiringBuild option — which the pre-migration Bit passed — reports every package whose files carry install scripts, regardless of the allow-build policy. Bit allows dependency builds to run, so the napi list was always empty, and Bit overwrote its recorded block with [] on every install.

This PR implements returnListOfDepsRequiringBuild in the napi binding with the TypeScript engine's semantics:

  • When set, the fresh-resolve path collects the dep path of every non-skipped package with requiresBuild (from the store-index-backed requires_build_by_snapshot map) into a sink threaded through Install → InstallWithFreshLockfile, and the install result returns the sorted list — even when empty.
  • Installs served from the frozen-lockfile path (and lockfileOnly runs) leave depsRequiringBuild undefined, matching the TS engine, where only a fresh resolve computes the list (the frozen path returns no depsRequiringBuild), so the embedder keeps its previously recorded list.
  • Skipped snapshots (unsupported platform, failed optional fetches) are excluded, matching the TS engine, which cannot read requiresBuild off a package it never fetched.
  • Without the option, the result keeps the existing blocked-builds behavior.

The Bit-side consumer change is teambit/bit#10551.

Squash Commit Body

The napi install result populated depsRequiringBuild from the ignored-
builds accumulation only, so an embedder that allows dependency builds
to run (Bit) always received an empty list and wiped its recorded
bit.depsRequiringBuild lockfile block on every install.

Mirror the TypeScript engine's returnListOfDepsRequiringBuild option:
when set, the fresh-resolve path reports every non-skipped package
whose files carry install scripts, regardless of the allow-build
policy, through a sink threaded into the install pipeline. Installs
served from the frozen-lockfile path leave the field undefined so the
embedder keeps its previously recorded list, matching the TS engine,
which only computes the list from a fresh resolve's fetch results.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust pnpm/ port, or the description notes what still needs porting. (The TypeScript engine already has returnListOfDepsRequiringBuild; this ports it to the napi binding.)
  • Added a changeset (pnpm changeset) if this PR changes any published package.
  • Added or updated tests.

Written by an agent (Claude Code, claude-fable-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

    • Added an option to report dependencies requiring build scripts after a fresh installation.
    • Results include dependency paths for packages with install scripts, whether builds are permitted or blocked.
    • Results remain undefined for lockfile-only and other non-materializing installs.
  • Documentation

    • Clarified the option and result behavior in the API documentation.
  • Tests

    • Added coverage for fresh installs, blocked builds, empty results, and non-materializing installs.

zkochan and others added 2 commits July 31, 2026 14:34
The napi install result populated depsRequiringBuild from the ignored-
builds accumulation only, so an embedder that allows dependency builds
to run (Bit) always received an empty list and wiped its recorded
bit.depsRequiringBuild lockfile block on every install.

Mirror the TypeScript engine's returnListOfDepsRequiringBuild option:
when set, the fresh-resolve path reports every non-skipped package
whose files carry install scripts, regardless of the allow-build
policy, through a sink threaded into the install pipeline. Installs
served from the frozen-lockfile path leave the field undefined so the
embedder keeps its previously recorded list, matching the TS engine,
which only computes the list from a fresh resolve's fetch results.

Co-Authored-By: Claude Fable 5 <[email protected]>
The singular is already listed; the plural appears in the changeset for
the napi returnListOfDepsRequiringBuild option.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 31, 2026 12:55

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

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The NAPI install API adds returnListOfDepsRequiringBuild. Fresh materialization collects dependency paths that require builds. Existing install paths initialize the optional sink as unset.

Changes

Dependency build reporting

Layer / File(s) Summary
NAPI reporting option
pnpm/crates/napi/src/install.rs, pnpm/npm/napi/index.d.ts, .changeset/..., cspell.json
Adds the reporting option and defines when InstallResult.depsRequiringBuild is populated or undefined.
Fresh-resolution sink
pnpm/crates/package-manager/src/install.rs, pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
Threads an optional sink through fresh resolution and records non-skipped packages that require builds.
Install path initialization
pnpm/crates/cli/src/cli_args/*, pnpm/crates/package-manager/src/{add,remove,update}.rs, pnpr/crates/pnpr/src/resolver/resolve.rs
Initializes the new Install field across CLI, package-manager, and pnpr paths.
Install reporting tests
pnpm/crates/napi/src/install/tests.rs, pnpm/crates/package-manager/src/install/tests.rs
Tests fresh-install reporting, fallback behavior, uncomputed results, and updated Install fixtures.

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

Sequence Diagram(s)

sequenceDiagram
  participant Embedder
  participant NAPI
  participant PackageManager
  participant FreshLockfileInstall
  Embedder->>NAPI: Enable returnListOfDepsRequiringBuild
  NAPI->>PackageManager: Pass optional build sink
  PackageManager->>FreshLockfileInstall: Forward sink on fresh resolution
  FreshLockfileInstall-->>NAPI: Record requiring-build dependency paths
  NAPI-->>Embedder: Return depsRequiringBuild
Loading

Possibly related PRs

  • pnpm/pnpm#13150: Both changes modify install/build tracking in InstallWithFreshLockfile.
  • pnpm/pnpm#13152: Both changes modify Install::run_inner and install-path dispatch.
  • pnpm/pnpm#13488: Both changes modify NAPI install handling and EngineMode dispatch.

Suggested labels: product: pacquet, product: pnpr

Suggested reviewers: copilot

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

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

Add returnListOfDepsRequiringBuild option to N-API install results

🐞 Bug fix ✨ Enhancement 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Add returnListOfDepsRequiringBuild to match TypeScript engine install semantics.
• On fresh resolves, return all requiresBuild dep paths (not just blocked builds).
• Keep depsRequiringBuild undefined on frozen/lockfileOnly installs to preserve prior state.
Diagram

graph TD
  A["Embedder"] --> B["napi install"] --> C["Install pipeline"] --> D{Fresh resolve?} --> E["Fresh lockfile"] --> F["Deps sink"] --> H["InstallResult"]
  D --> G["Frozen/lockfileOnly"] --> H
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Always compute depsRequiringBuild on frozen installs
  • ➕ Embedder always receives a value (less conditional logic at call sites).
  • ➕ Avoids relying on previous persisted value when repeating installs.
  • ➖ Frozen/lockfileOnly paths intentionally avoid resolve/fetch work; computing would require extra I/O or data plumbing.
  • ➖ Would diverge from TypeScript engine semantics the PR aims to mirror.
2. Derive depsRequiringBuild from lockfile (instead of fetch metadata)
  • ➕ Could make frozen installs return a stable list without extra network/store reads.
  • ➕ Moves responsibility to a persisted artifact.
  • ➖ Lockfile does not reliably encode requiresBuild for all snapshots in a way that matches pnpm behavior.
  • ➖ Risks drift from TS engine behavior and from what was actually fetched/skipped.

Recommendation: Current approach is the best fit: it mirrors the TypeScript engine’s returnListOfDepsRequiringBuild contract by computing the full list only on fresh resolves (where fetch metadata exists) and leaving it undefined on frozen/lockfileOnly runs so embedders retain prior state. Alternatives either add work to frozen paths or risk semantic drift.

Files changed (20) +250 / -9

Enhancement (2) +34 / -0
install.rsIntroduce DepsRequiringBuildSink and thread it through Install +16/-0

Introduce DepsRequiringBuildSink and thread it through Install

• Adds the DepsRequiringBuildSink type and a new optional deps_requiring_build_sink field on Install. Ensures the sink is cloned and forwarded into nested install invocations so the fresh-resolve path can populate it.

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

install_with_fresh_lockfile.rsPopulate depsRequiringBuild sink from requiresBuild snapshot metadata +18/-0

Populate depsRequiringBuild sink from requiresBuild snapshot metadata

• Adds deps_requiring_build_sink to the fresh-lockfile installer and fills it from requires_build_by_snapshot, excluding skipped snapshots. This makes the computed list reflect only packages that were actually fetched/materialized, matching the TS engine’s behavior.

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

Bug fix (1) +39 / -5
install.rsAdd option and conditional depsRequiringBuild semantics to N-API install +39/-5

Add option and conditional depsRequiringBuild semantics to N-API install

• Adds InstallOptions.return_list_of_deps_requiring_build and conditionally allocates a DepsRequiringBuildSink when enabled. Threads the sink into run_install_inner and maps InstallResult.deps_requiring_build to either the computed list (even when empty), or the legacy blocked-build list when the option is off; frozen/lockfileOnly runs yield undefined when the option is on.

pnpm/crates/napi/src/install.rs

Refactor (12) +17 / -0
dedupe.rsInitialize depsRequiringBuild sink to None for dedupe CLI +1/-0

Initialize depsRequiringBuild sink to None for dedupe CLI

• Extends the CLI install configuration to include the new deps_requiring_build_sink field, defaulting to None for CLI usage.

pnpm/crates/cli/src/cli_args/dedupe.rs

deploy.rsInitialize depsRequiringBuild sink to None for deploy CLI +1/-0

Initialize depsRequiringBuild sink to None for deploy CLI

• Wires the new deps_requiring_build_sink field into deploy’s install configuration, set to None.

pnpm/crates/cli/src/cli_args/deploy.rs

fetch.rsInitialize depsRequiringBuild sink to None for fetch CLI +1/-0

Initialize depsRequiringBuild sink to None for fetch CLI

• Updates fetch’s install configuration struct initialization to include deps_requiring_build_sink: None.

pnpm/crates/cli/src/cli_args/fetch.rs

import.rsInitialize depsRequiringBuild sink to None for import CLI +1/-0

Initialize depsRequiringBuild sink to None for import CLI

• Adds deps_requiring_build_sink: None to the import command’s install configuration initialization.

pnpm/crates/cli/src/cli_args/import.rs

install.rsInitialize depsRequiringBuild sink to None for install CLI paths +3/-0

Initialize depsRequiringBuild sink to None for install CLI paths

• Plumbs deps_requiring_build_sink: None through multiple install CLI entry points to satisfy the expanded Install struct configuration.

pnpm/crates/cli/src/cli_args/install.rs

link.rsInitialize depsRequiringBuild sink to None for link CLI +1/-0

Initialize depsRequiringBuild sink to None for link CLI

• Extends link’s install configuration initialization to include deps_requiring_build_sink: None.

pnpm/crates/cli/src/cli_args/link.rs

prune.rsInitialize depsRequiringBuild sink to None for prune CLI +1/-0

Initialize depsRequiringBuild sink to None for prune CLI

• Adds deps_requiring_build_sink: None to prune’s install configuration initialization.

pnpm/crates/cli/src/cli_args/prune.rs

rebuild.rsInitialize depsRequiringBuild sink to None for rebuild CLI +1/-0

Initialize depsRequiringBuild sink to None for rebuild CLI

• Updates the rebuild flow to pass deps_requiring_build_sink: None when constructing install inputs.

pnpm/crates/cli/src/cli_args/rebuild.rs

add.rsDefault depsRequiringBuild sink to None for add operations +2/-0

Default depsRequiringBuild sink to None for add operations

• Extends add flows to include deps_requiring_build_sink: None when constructing Install inputs (CLI behavior).

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

remove.rsDefault depsRequiringBuild sink to None for remove operations +2/-0

Default depsRequiringBuild sink to None for remove operations

• Extends remove flows to include deps_requiring_build_sink: None when constructing Install inputs.

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

update.rsDefault depsRequiringBuild sink to None for update operations +2/-0

Default depsRequiringBuild sink to None for update operations

• Adds deps_requiring_build_sink: None to update flows that construct Install inputs.

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

resolve.rsInitialize depsRequiringBuild sink to None in pnpr resolver +1/-0

Initialize depsRequiringBuild sink to None in pnpr resolver

• Updates pnpr’s Install construction to include deps_requiring_build_sink: None after the package-manager Install struct change.

pnpr/crates/pnpr/src/resolver/resolve.rs

Tests (2) +138 / -3
tests.rsAdd N-API test covering fresh-only depsRequiringBuild behavior +51/-3

Add N-API test covering fresh-only depsRequiringBuild behavior

• Updates test helpers for the new run_install_inner signature. Adds a regression test verifying that returnListOfDepsRequiringBuild reports on the first (fresh) install and stays unset on a frozen-path repeat install.

pnpm/crates/napi/src/install/tests.rs

tests.rsUpdate package-manager install tests for new Install field +87/-0

Update package-manager install tests for new Install field

• Updates many test install configurations to include deps_requiring_build_sink: None after the Install struct change.

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

Documentation (2) +21 / -1
tidy-moons-repeat.mdAdd changeset for new N-API install option +5/-0

Add changeset for new N-API install option

• Introduces a minor-version changeset for @pnpm/napi. Documents the new returnListOfDepsRequiringBuild behavior and its fresh-resolve-only computation semantics.

.changeset/tidy-moons-repeat.md

index.d.tsExpose returnListOfDepsRequiringBuild in N-API TypeScript types +16/-1

Expose returnListOfDepsRequiringBuild in N-API TypeScript types

• Adds the returnListOfDepsRequiringBuild option to InstallOptions and clarifies depsRequiringBuild’s dual meaning (full list vs blocked list) depending on the option.

pnpm/npm/napi/index.d.ts

Other (1) +1 / -0
cspell.jsonAllow "embedders" spelling +1/-0

Allow "embedders" spelling

• Adds the plural "embedders" to the cspell dictionary to avoid spellcheck noise in docs/comments.

cspell.json

@greptile-apps

greptile-apps Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains, and no prior inline Greptile thread was available to anchor an eligible follow-up finding.

Reviews (4): Last reviewed commit: "refactor(napi): align the depsRequiringB..." | 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: 2

🤖 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/napi/src/install.rs`:
- Around line 257-284: Add focused test cases to validate the NAPI install()
function's return value for the returnListOfDepsRequiringBuild field. Create
tests that cover sorted nonempty dependency outputs, explicit empty lists
(confirming an empty tree has no build-needing packages), behavior differences
between blocked and permitted builds, frozenLockfile repeat install scenarios,
and lockfileOnly mode behavior where the field should return undefined. Ensure
these tests exercise the result path shown in the deps_requiring_build match
expression that selects between the sink-returned list and the fallback
stats-based list.

In `@pnpm/crates/napi/src/install/tests.rs`:
- Around line 227-272: Expand
return_list_of_deps_requiring_build_reports_fresh_resolves_only to cover
multiple install-script dependencies and assert their reported entries are
alphabetically ordered, then add a separate install variant without
dangerously_allow_all_builds or an explicit allow-list entry to verify
blocked-but-not-skipped packages still populate DepsRequiringBuildSink. Preserve
the existing fresh-resolution and frozen-path assertions.
🪄 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: 12b821bf-ec32-4361-922a-4db59f1d0792

📥 Commits

Reviewing files that changed from the base of the PR and between 536b7a2 and 7331dcf.

📒 Files selected for processing (20)
  • .changeset/tidy-moons-repeat.md
  • cspell.json
  • pnpm/crates/cli/src/cli_args/dedupe.rs
  • pnpm/crates/cli/src/cli_args/deploy.rs
  • pnpm/crates/cli/src/cli_args/fetch.rs
  • pnpm/crates/cli/src/cli_args/import.rs
  • pnpm/crates/cli/src/cli_args/install.rs
  • pnpm/crates/cli/src/cli_args/link.rs
  • pnpm/crates/cli/src/cli_args/prune.rs
  • pnpm/crates/cli/src/cli_args/rebuild.rs
  • pnpm/crates/napi/src/install.rs
  • pnpm/crates/napi/src/install/tests.rs
  • pnpm/crates/package-manager/src/add.rs
  • pnpm/crates/package-manager/src/install.rs
  • pnpm/crates/package-manager/src/install/tests.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/remove.rs
  • pnpm/crates/package-manager/src/update.rs
  • pnpm/npm/napi/index.d.ts
  • pnpr/crates/pnpr/src/resolver/resolve.rs

Comment thread pnpm/crates/napi/src/install.rs Resolved
Comment thread pnpm/crates/napi/src/install/tests.rs Resolved
@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.23     14.5±2.35ms    25.8 MB/sec    1.00     11.8±1.23ms    31.8 MB/sec
packument/parse                                  1.05     41.1±5.10µs  1614.4 MB/sec    1.00     39.0±0.21µs  1698.9 MB/sec
tarball/download_dependency                      1.01      2.5±0.21ms  1702.8 KB/sec    1.00      2.5±0.14ms  1711.8 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00   198.4±13.77ms 80.6 KElem/sec    1.02   202.6±18.88ms 79.0 KElem/sec

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 32 rules

Grey Divider


Remediation recommended

1. dbg! left in test 📘 Rule violation ⚙ Maintainability ⭐ New
Description
A dbg!(&seeded) statement was added to a Rust test even though it is unrelated to the regression
fix, and it will print internal state to stderr on every test run. This violates the requirement to
avoid unrelated changes in bug-fix PRs and makes CI logs noisier (potentially leaking
environment-specific temp paths).
Code

pnpm/crates/napi/src/install/tests.rs[340]

+    dbg!(&seeded);
Relevance

●●● Strong

Unconditional dbg! noise has been removed/criticized before; accepted in PR #13329 and #13293.

PR-#13329
PR-#13293
PR-#12703

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The compliance rule requires bug-fix changes to avoid unrelated modifications, and the cited test
code adds a standalone dbg!(&seeded); immediately before assertions in
return_list_of_deps_requiring_build_is_uncomputed_without_a_fresh_materialization, meaning it will
always execute during test/CI runs. Because this debug-only line does not contribute to the test’s
assertions or fix behavior, its presence is purely for printing state and will emit extra output
each run.

Rule 2255067: Bug fix changes must not include unrelated refactors or reformatting
pnpm/crates/napi/src/install/tests.rs[339-341]
pnpm/crates/napi/src/install/tests.rs[336-342]

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

## Issue description
A `dbg!(&seeded)` debug print was committed in a Rust unit test. It is unrelated to the bug/regression fix, will emit to stderr on every run (creating noisy CI logs), and can potentially leak environment-specific temp paths.

## Issue Context
The PR is addressing a regression/bug in `depsRequiringBuild` / `returnListOfDepsRequiringBuild` behavior. The new test should remain deterministic and quiet; debug prints are not required for correctness and violate the expectation to avoid unrelated changes in bug-fix PRs.

## Fix Focus Areas
- pnpm/crates/napi/src/install/tests.rs[339-341]

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


2. Stats accumulator test race 🐞 Bug ☼ Reliability
Description
return_list_of_deps_requiring_build_includes_packages_whose_builds_were_blocked uses the
process-global begin_stats()/take_stats() accumulator without holding the engine-call
serialization lock, so parallel tests can clobber or consume each other’s stats and make assertions
flaky/incorrect.
Code

pnpm/crates/napi/src/install/tests.rs[R305-309]

+    begin_stats();
+    run_install_inner(&options, None, EngineMode::Install, Some(std::sync::Arc::clone(&sink)))
+        .expect("install");
+    let blocked = take_stats().deps_requiring_build;
+
Relevance

●●● Strong

Team often fixes cross-test global-state leaks/flakes (accepted resets/serialization in PRs #13256,
#11804).

PR-#13256
PR-#11804

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new test starts/stops stats accumulation around an install without any engine-call
serialization, but the stats accumulator is explicitly process-global and documented as safe only
because production engine calls are serialized by engine_call_lock(). Another unit test also uses
the same global accumulator, making parallel interference realistic.

pnpm/crates/napi/src/install/tests.rs[300-322]
pnpm/crates/napi/src/reporter_bridge.rs[70-90]
pnpm/crates/napi/src/install.rs[199-217]
pnpm/crates/napi/src/reporter_bridge/tests.rs[4-20]

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

### Issue description
`begin_stats()` / `take_stats()` mutate a **process-global** accumulator that is only safe when installs are serialized behind the NAPI engine-call lock. The new test invokes `run_install_inner()` directly and reads the global stats without any such serialization, so concurrently-running tests can corrupt the observed `deps_requiring_build` vector.

### Issue Context
- Production calls that collect stats are serialized via `engine_call_lock()`.
- Unit tests run in parallel by default, and there is already at least one other test using `begin_stats()/take_stats()`.

### Fix Focus Areas
- pnpm/crates/napi/src/install/tests.rs[300-322]
- pnpm/crates/napi/src/reporter_bridge/tests.rs[4-20]
- pnpm/crates/napi/src/install.rs[199-217]
- pnpm/crates/napi/src/reporter_bridge.rs[70-90]

### Suggested fix
Pick one of:
1. **Add a shared test-only lock** (e.g., `#[cfg(test)] static STATS_TEST_LOCK: Mutex<()>`) and acquire it around every `begin_stats() .. take_stats()` block in tests (including this new test and `reporter_bridge` tests).
2. **Reuse the production serialization** by acquiring `engine_call_lock()` in tests (e.g., via `blocking_lock()` if available) before `begin_stats()` and releasing after `take_stats()`.

Either ensures stats collection is single-threaded in the test runner and prevents cross-test interference.

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


3. Missing TypeScript mirror test 📘 Rule violation ▣ Testability
Description
The PR adds/changes Rust-side behavior and tests for the returnListOfDepsRequiringBuild contract
(including that frozen-path repeat installs leave the field undefined), but there is no mirrored
TypeScript test covering the same frozen-path/undefined behavior.
Code

pnpm/crates/napi/src/install/tests.rs[R227-272]

+/// `returnListOfDepsRequiringBuild` reports every package whose files
+/// carry install scripts — even ones allowed to build — and leaves the
+/// field undefined on a repeat install served from the frozen path, so
+/// an embedder keeps its previously recorded list instead of wiping it.
+#[test]
+fn return_list_of_deps_requiring_build_reports_fresh_resolves_only() {
+    let registry = TestRegistry::start();
+    let temp_dir = tempfile::tempdir().expect("tempdir");
+    let project_dir = temp_dir.path().join("project");
+    std::fs::create_dir(&project_dir).expect("create project dir");
+    std::fs::write(project_dir.join("package.json"), "{}\n").expect("write package.json");
+
+    let project_dir_string = project_dir.to_string_lossy().into_owned();
+    let mut options = install_options();
+    options.dir = project_dir_string.clone();
+    options.projects = vec![NodeApiProject {
+        root_dir: project_dir_string,
+        manifest: serde_json::json!({
+            "dependencies": {
+                "@pnpm.e2e/pre-and-postinstall-scripts-example": "1.0.0"
+            }
+        }),
+        dependency_manifest: None,
+    }];
+    options.store_dir = Some(temp_dir.path().join("store").to_string_lossy().into_owned());
+    options.registries = Some(HashMap::from([("default".to_string(), registry.url())]));
+    options.dangerously_allow_all_builds = Some(true);
+    options.return_list_of_deps_requiring_build = Some(true);
+
+    let sink = pacquet_package_manager::DepsRequiringBuildSink::default();
+    run_install_inner(&options, None, EngineMode::Install, Some(std::sync::Arc::clone(&sink)))
+        .expect("first install");
+    let first = sink.lock().expect("lock sink").take();
+    assert_eq!(
+        first,
+        Some(std::collections::BTreeSet::from([
+            "@pnpm.e2e/[email protected]".to_string()
+        ])),
+    );
+
+    let sink = pacquet_package_manager::DepsRequiringBuildSink::default();
+    run_install_inner(&options, None, EngineMode::Install, Some(std::sync::Arc::clone(&sink)))
+        .expect("second install");
+    let second = sink.lock().expect("lock sink").take();
+    assert_eq!(second, None, "the frozen-path repeat install must not compute the list");
+}
Relevance

●● Moderate

No direct history on enforcing Rust+TS mirrored tests; cross-stack PRs often add both test suites
(e.g. #13120).

PR-#13120

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires mirrored tests across Rust and TypeScript for cross-stack behavior changes.
The PR adds a Rust test that asserts the fresh-only vs frozen-path behavior, while the existing
TypeScript test suite only asserts the fresh list behavior and does not cover the
frozen-path/undefined contract.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm/crates/napi/src/install/tests.rs[227-272]
pnpm11/installing/deps-installer/test/install/lifecycleScripts.ts[70-97]
pnpm11/installing/deps-installer/src/install/index.ts[1196-1236]

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

## Issue description
Rust now has a test asserting `returnListOfDepsRequiringBuild` is computed only on fresh resolves (and is `undefined` on frozen-path repeats), but the TypeScript test suite does not cover the same frozen-path/undefined behavior.

## Issue Context
This is a cross-stack, user-visible contract that should be protected by mirrored tests in both Rust and TypeScript.

## Fix Focus Areas
- pnpm/crates/napi/src/install/tests.rs[227-272]
- pnpm11/installing/deps-installer/test/install/lifecycleScripts.ts[70-97]

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



Informational

4. Inefficient BTreeSet collection 🐞 Bug ➹ Performance
Description
When returnListOfDepsRequiringBuild is enabled, the fresh-resolve path collects dep paths into a
BTreeSet, which is O(n log n) insertion work even though the source keys are already unique. This
adds avoidable CPU overhead on the (opt-in) fresh-install hot path; you can preserve deterministic
ordering with a Vec + sort instead.
Code

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[R2637-2644]

+        if let Some(sink) = &deps_requiring_build_sink {
+            let deps_requiring_build = requires_build_by_snapshot
+                .iter()
+                .filter(|(snapshot_key, requires_build)| {
+                    **requires_build && !skipped.contains(snapshot_key)
+                })
+                .map(|(snapshot_key, _)| snapshot_key.to_string())
+                .collect();
Relevance

● Weak

Performance micro-optimizations removing allocations/sorting overhead are frequently rejected (e.g.
#13368, #13455).

PR-#13368
PR-#13455

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The sink type forces ordered-set accumulation, and the fresh-resolve path uses .collect() into
that sink, creating per-item ordered insert overhead.

pnpm/crates/package-manager/src/install.rs[100-107]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[2635-2647]
pnpm/crates/napi/src/install.rs[261-284]

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

### Issue description
With `returnListOfDepsRequiringBuild`, the fresh-resolve path builds the result via a `BTreeSet<String>` sink, which incurs ordered-tree insertion cost.

### Issue Context
The dep-paths come from iterating `requires_build_by_snapshot` (a map keyed by snapshot), so the keys are already unique; the remaining requirement is stable/deterministic ordering.

### Fix Focus Areas
- pnpm/crates/package-manager/src/install.rs[100-107]
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[2635-2647]
- pnpm/crates/napi/src/install.rs[271-284]

### Suggested change
1. Change `DepsRequiringBuildSink` to store `Option<Vec<String>>` instead of `Option<BTreeSet<String>>`.
2. In `install_with_fresh_lockfile.rs`, collect into a `Vec<String>`, then `sort_unstable()` (or `sort()` if you need locale/total ordering guarantees) before storing into the sink.
3. In `napi/src/install.rs`, remove the `into_iter().collect()` conversion and return the already-sorted `Vec` directly.

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


5. Comment references past behavior ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
A new inline comment describes historical usage (e.g., "before the explicit option existed") instead
of stating the current contract, which violates the no-historical-comments rule and can become
stale/misleading over time.
Code

pnpm/crates/napi/src/install.rs[R279-283]

+        // Option off: report the blocked builds accumulated from
+        // `pnpm:ignored-scripts` events, matching how embedders that
+        // gate builds themselves consumed this field before the
+        // explicit option existed.
+        None => (!stats.deps_requiring_build.is_empty()).then_some(stats.deps_requiring_build),
Relevance

● Weak

Similar “remove historical phrasing” comment suggestions were rejected in #13492 and #13513.

PR-#13492
PR-#13513

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The rule forbids comments that reference past behavior. The added comment block includes the phrase
"before the explicit option existed," which is historical framing rather than describing the current
contract.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/napi/src/install.rs[279-283]

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

## Issue description
A newly added comment uses historical phrasing ("before ... existed") instead of documenting current behavior/contract.

## Issue Context
Inline comments should describe current behavior and invariants so they stay accurate as code evolves.

## Fix Focus Areas
- pnpm/crates/napi/src/install.rs[279-283]

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


Grey Divider

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

Previous review results

Review updated until commit c832d48

Results up to commit 7331dcf ⚖️ Balanced


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


Remediation recommended
1. Missing TypeScript mirror test 📘 Rule violation ▣ Testability
Description
The PR adds/changes Rust-side behavior and tests for the returnListOfDepsRequiringBuild contract
(including that frozen-path repeat installs leave the field undefined), but there is no mirrored
TypeScript test covering the same frozen-path/undefined behavior.
Code

pnpm/crates/napi/src/install/tests.rs[R227-272]

+/// `returnListOfDepsRequiringBuild` reports every package whose files
+/// carry install scripts — even ones allowed to build — and leaves the
+/// field undefined on a repeat install served from the frozen path, so
+/// an embedder keeps its previously recorded list instead of wiping it.
+#[test]
+fn return_list_of_deps_requiring_build_reports_fresh_resolves_only() {
+    let registry = TestRegistry::start();
+    let temp_dir = tempfile::tempdir().expect("tempdir");
+    let project_dir = temp_dir.path().join("project");
+    std::fs::create_dir(&project_dir).expect("create project dir");
+    std::fs::write(project_dir.join("package.json"), "{}\n").expect("write package.json");
+
+    let project_dir_string = project_dir.to_string_lossy().into_owned();
+    let mut options = install_options();
+    options.dir = project_dir_string.clone();
+    options.projects = vec![NodeApiProject {
+        root_dir: project_dir_string,
+        manifest: serde_json::json!({
+            "dependencies": {
+                "@pnpm.e2e/pre-and-postinstall-scripts-example": "1.0.0"
+            }
+        }),
+        dependency_manifest: None,
+    }];
+    options.store_dir = Some(temp_dir.path().join("store").to_string_lossy().into_owned());
+    options.registries = Some(HashMap::from([("default".to_string(), registry.url())]));
+    options.dangerously_allow_all_builds = Some(true);
+    options.return_list_of_deps_requiring_build = Some(true);
+
+    let sink = pacquet_package_manager::DepsRequiringBuildSink::default();
+    run_install_inner(&options, None, EngineMode::Install, Some(std::sync::Arc::clone(&sink)))
+        .expect("first install");
+    let first = sink.lock().expect("lock sink").take();
+    assert_eq!(
+        first,
+        Some(std::collections::BTreeSet::from([
+            "@pnpm.e2e/[email protected]".to_string()
+        ])),
+    );
+
+    let sink = pacquet_package_manager::DepsRequiringBuildSink::default();
+    run_install_inner(&options, None, EngineMode::Install, Some(std::sync::Arc::clone(&sink)))
+        .expect("second install");
+    let second = sink.lock().expect("lock sink").take();
+    assert_eq!(second, None, "the frozen-path repeat install must not compute the list");
+}
Relevance

●● Moderate

No direct history on enforcing Rust+TS mirrored tests; cross-stack PRs often add both test suites
(e.g. #13120).

PR-#13120

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires mirrored tests across Rust and TypeScript for cross-stack behavior changes.
The PR adds a Rust test that asserts the fresh-only vs frozen-path behavior, while the existing
TypeScript test suite only asserts the fresh list behavior and does not cover the
frozen-path/undefined contract.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm/crates/napi/src/install/tests.rs[227-272]
pnpm11/installing/deps-installer/test/install/lifecycleScripts.ts[70-97]
pnpm11/installing/deps-installer/src/install/index.ts[1196-1236]

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

## Issue description
Rust now has a test asserting `returnListOfDepsRequiringBuild` is computed only on fresh resolves (and is `undefined` on frozen-path repeats), but the TypeScript test suite does not cover the same frozen-path/undefined behavior.

## Issue Context
This is a cross-stack, user-visible contract that should be protected by mirrored tests in both Rust and TypeScript.

## Fix Focus Areas
- pnpm/crates/napi/src/install/tests.rs[227-272]
- pnpm11/installing/deps-installer/test/install/lifecycleScripts.ts[70-97]

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



Informational
2. Comment references past behavior ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
A new inline comment describes historical usage (e.g., "before the explicit option existed") instead
of stating the current contract, which violates the no-historical-comments rule and can become
stale/misleading over time.
Code

pnpm/crates/napi/src/install.rs[R279-283]

+        // Option off: report the blocked builds accumulated from
+        // `pnpm:ignored-scripts` events, matching how embedders that
+        // gate builds themselves consumed this field before the
+        // explicit option existed.
+        None => (!stats.deps_requiring_build.is_empty()).then_some(stats.deps_requiring_build),
Relevance

● Weak

Similar “remove historical phrasing” comment suggestions were rejected in #13492 and #13513.

PR-#13492
PR-#13513

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The rule forbids comments that reference past behavior. The added comment block includes the phrase
"before the explicit option existed," which is historical framing rather than describing the current
contract.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/napi/src/install.rs[279-283]

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

## Issue description
A newly added comment uses historical phrasing ("before ... existed") instead of documenting current behavior/contract.

## Issue Context
Inline comments should describe current behavior and invariants so they stay accurate as code evolves.

## Fix Focus Areas
- pnpm/crates/napi/src/install.rs[279-283]

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


3. Inefficient BTreeSet collection 🐞 Bug ➹ Performance
Description
When returnListOfDepsRequiringBuild is enabled, the fresh-resolve path collects dep paths into a
BTreeSet, which is O(n log n) insertion work even though the source keys are already unique. This
adds avoidable CPU overhead on the (opt-in) fresh-install hot path; you can preserve deterministic
ordering with a Vec + sort instead.
Code

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[R2637-2644]

+        if let Some(sink) = &deps_requiring_build_sink {
+            let deps_requiring_build = requires_build_by_snapshot
+                .iter()
+                .filter(|(snapshot_key, requires_build)| {
+                    **requires_build && !skipped.contains(snapshot_key)
+                })
+                .map(|(snapshot_key, _)| snapshot_key.to_string())
+                .collect();
Relevance

● Weak

Performance micro-optimizations removing allocations/sorting overhead are frequently rejected (e.g.
#13368, #13455).

PR-#13368
PR-#13455

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The sink type forces ordered-set accumulation, and the fresh-resolve path uses .collect() into
that sink, creating per-item ordered insert overhead.

pnpm/crates/package-manager/src/install.rs[100-107]
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[2635-2647]
pnpm/crates/napi/src/install.rs[261-284]

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

### Issue description
With `returnListOfDepsRequiringBuild`, the fresh-resolve path builds the result via a `BTreeSet<String>` sink, which incurs ordered-tree insertion cost.

### Issue Context
The dep-paths come from iterating `requires_build_by_snapshot` (a map keyed by snapshot), so the keys are already unique; the remaining requirement is stable/deterministic ordering.

### Fix Focus Areas
- pnpm/crates/package-manager/src/install.rs[100-107]
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[2635-2647]
- pnpm/crates/napi/src/install.rs[271-284]

### Suggested change
1. Change `DepsRequiringBuildSink` to store `Option<Vec<String>>` instead of `Option<BTreeSet<String>>`.
2. In `install_with_fresh_lockfile.rs`, collect into a `Vec<String>`, then `sort_unstable()` (or `sort()` if you need locale/total ordering guarantees) before storing into the sink.
3. In `napi/src/install.rs`, remove the `into_iter().collect()` conversion and return the already-sorted `Vec` directly.

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


Results up to commit f88f20d ⚖️ Balanced


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


Remediation recommended
1. Stats accumulator test race 🐞 Bug ☼ Reliability
Description
return_list_of_deps_requiring_build_includes_packages_whose_builds_were_blocked uses the
process-global begin_stats()/take_stats() accumulator without holding the engine-call
serialization lock, so parallel tests can clobber or consume each other’s stats and make assertions
flaky/incorrect.
Code

pnpm/crates/napi/src/install/tests.rs[R305-309]

+    begin_stats();
+    run_install_inner(&options, None, EngineMode::Install, Some(std::sync::Arc::clone(&sink)))
+        .expect("install");
+    let blocked = take_stats().deps_requiring_build;
+
Relevance

●●● Strong

Team often fixes cross-test global-state leaks/flakes (accepted resets/serialization in PRs #13256,
#11804).

PR-#13256
PR-#11804

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new test starts/stops stats accumulation around an install without any engine-call
serialization, but the stats accumulator is explicitly process-global and documented as safe only
because production engine calls are serialized by engine_call_lock(). Another unit test also uses
the same global accumulator, making parallel interference realistic.

pnpm/crates/napi/src/install/tests.rs[300-322]
pnpm/crates/napi/src/reporter_bridge.rs[70-90]
pnpm/crates/napi/src/install.rs[199-217]
pnpm/crates/napi/src/reporter_bridge/tests.rs[4-20]

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

### Issue description
`begin_stats()` / `take_stats()` mutate a **process-global** accumulator that is only safe when installs are serialized behind the NAPI engine-call lock. The new test invokes `run_install_inner()` directly and reads the global stats without any such serialization, so concurrently-running tests can corrupt the observed `deps_requiring_build` vector.

### Issue Context
- Production calls that collect stats are serialized via `engine_call_lock()`.
- Unit tests run in parallel by default, and there is already at least one other test using `begin_stats()/take_stats()`.

### Fix Focus Areas
- pnpm/crates/napi/src/install/tests.rs[300-322]
- pnpm/crates/napi/src/reporter_bridge/tests.rs[4-20]
- pnpm/crates/napi/src/install.rs[199-217]
- pnpm/crates/napi/src/reporter_bridge.rs[70-90]

### Suggested fix
Pick one of:
1. **Add a shared test-only lock** (e.g., `#[cfg(test)] static STATS_TEST_LOCK: Mutex<()>`) and acquire it around every `begin_stats() .. take_stats()` block in tests (including this new test and `reporter_bridge` tests).
2. **Reuse the production serialization** by acquiring `engine_call_lock()` in tests (e.g., via `blocking_lock()` if available) before `begin_stats()` and releasing after `take_stats()`.

Either ensures stats collection is single-threaded in the test runner and prevents cross-test interference.

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

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.05085% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.92%. Comparing base (53ba59e) to head (c832d48).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/napi/src/install.rs 66.66% 10 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13532   +/-   ##
=======================================
  Coverage   87.91%   87.92%           
=======================================
  Files         550      550           
  Lines       96399    96449   +50     
=======================================
+ Hits        84752    84803   +51     
+ Misses      11647    11646    -1     

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

Extract the result assembly into deps_requiring_build_result so the
empty-list-versus-uncomputed distinction and the sorted output are
testable without the napi threadsafe-function symbols that the addon
entry point needs (a test binary cannot link them).

Cover, per CodeRabbit review on #13532: sorted multi-entry
output, an explicit empty list, the pre-option blocked-builds fallback,
packages whose builds the default policy blocked, and the three runs
that compute no list (repeat install, frozenLockfile, lockfileOnly).

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 31, 2026 13:11

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.

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/napi/src/install/tests.rs`:
- Around line 230-294: Extend the install-level coverage around
return_list_of_deps_requiring_build_reports_every_script_bearing_package and the
existing install fixtures. Add a fresh-install fixture with no script-bearing
packages and assert the sink reports a computed empty list, then add a
script-bearing package made non-installable and assert it is excluded while
other eligible packages remain. Preserve the distinction between computed Some
results and an uncomputed None result.
🪄 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: e3388019-7d13-40f3-87cf-509d3caca6c8

📥 Commits

Reviewing files that changed from the base of the PR and between 7331dcf and f88f20d.

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

Comment thread pnpm/crates/napi/src/install/tests.rs Resolved
@qodo-code-review

Copy link
Copy Markdown

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

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

Assert the empty list end to end (a tree whose packages carry no install
scripts) and that a script-bearing package this install skips stays out,
rather than only constructing the empty set in the helper test.

Drop the skipped-snapshot filter from the sink fill. It could never
match: CreateVirtualStore keeps both cache-key passes free of skipped
snapshots, and a cold snapshot whose fetch failed records the failure
instead of a requiresBuild entry, so the map holds only what the install
put on disk. State that invariant where the list is built instead of
implying a case that cannot occur.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 31, 2026 13:33

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.

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 50bce22

@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: 50bce22e4d0c

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 3.050 ± 0.162 2.782 3.292 1.97 ± 0.16
pacquet@main 2.811 ± 0.213 2.474 3.191 1.82 ± 0.18
pnpr@HEAD 1.637 ± 0.167 1.398 1.887 1.06 ± 0.13
pnpr@main 1.549 ± 0.097 1.401 1.695 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.05004748768,
      "stddev": 0.16182310830547936,
      "median": 3.06762515048,
      "user": 3.300314,
      "system": 2.36489896,
      "min": 2.78173534198,
      "max": 3.29229538998,
      "times": [
        3.1188541789800004,
        3.0573694869800003,
        3.07679887998,
        3.05845142098,
        3.29229538998,
        2.83222207798,
        3.20434159298,
        2.78173534198,
        2.92100638098,
        3.15740012598
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.8114996095800002,
      "stddev": 0.2126725272124156,
      "median": 2.8006786259800003,
      "user": 2.9143777999999996,
      "system": 2.11940496,
      "min": 2.4742743759800003,
      "max": 3.1912469379800004,
      "times": [
        3.1912469379800004,
        2.8147523149800002,
        2.7175715189800003,
        2.7866049369800003,
        3.0834920409800004,
        2.84488100198,
        2.76157806398,
        2.5695282509800004,
        2.87106665298,
        2.4742743759800003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.63686778368,
      "stddev": 0.1674474011513326,
      "median": 1.62216168548,
      "user": 1.6338192,
      "system": 1.4894844599999997,
      "min": 1.39769831998,
      "max": 1.8865668339800001,
      "times": [
        1.63494059598,
        1.39769831998,
        1.59736363398,
        1.82085285998,
        1.7351775069800002,
        1.77861476298,
        1.60938277498,
        1.8865668339800001,
        1.45112385998,
        1.45695668798
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5486793641800003,
      "stddev": 0.0965614750213917,
      "median": 1.5479552279800002,
      "user": 1.6873047999999997,
      "system": 1.6321703599999995,
      "min": 1.40148323598,
      "max": 1.69503520198,
      "times": [
        1.45856503898,
        1.69503520198,
        1.40148323598,
        1.67341482098,
        1.5513079009800002,
        1.54460255498,
        1.56687700998,
        1.44310840798,
        1.62167586398,
        1.53072360598
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 350.5 ± 14.8 333.6 382.9 1.00
pacquet@main 351.7 ± 23.0 299.4 381.2 1.00 ± 0.08
pnpr@HEAD 362.3 ± 47.6 313.2 459.8 1.03 ± 0.14
pnpr@main 367.0 ± 13.8 335.3 386.5 1.05 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.35052581204000005,
      "stddev": 0.014797158196567135,
      "median": 0.34959276644000004,
      "user": 0.28833622,
      "system": 0.6859304199999998,
      "min": 0.33357520894000003,
      "max": 0.38292265894,
      "times": [
        0.35839872994,
        0.33942034394000004,
        0.35470036394000004,
        0.33357520894000003,
        0.33544022494000003,
        0.34210981494000003,
        0.35491461794,
        0.38292265894,
        0.34448516894000003,
        0.35929098794000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.35168548984,
      "stddev": 0.023009895481728746,
      "median": 0.35251827694000004,
      "user": 0.28570182,
      "system": 0.69130272,
      "min": 0.29935045494,
      "max": 0.38123792394,
      "times": [
        0.37071376094,
        0.35716081794000004,
        0.35334342494000004,
        0.38123792394,
        0.34320662794,
        0.35169312894,
        0.34467388094,
        0.34094925394000003,
        0.29935045494,
        0.37452562394
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.36230663864,
      "stddev": 0.04761558553964392,
      "median": 0.34733640344000005,
      "user": 0.29772731999999996,
      "system": 0.66769302,
      "min": 0.31317062894000003,
      "max": 0.45977993594,
      "times": [
        0.45977993594,
        0.42622960494,
        0.37939646194000004,
        0.33204550294,
        0.33237688194000004,
        0.32226361794,
        0.31317062894000003,
        0.35846590294,
        0.33620690394,
        0.36313094494000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.36698163674,
      "stddev": 0.013762354454344594,
      "median": 0.36847458844000003,
      "user": 0.30140231999999995,
      "system": 0.6951853200000001,
      "min": 0.33527407694,
      "max": 0.38654476594000003,
      "times": [
        0.36943207594,
        0.36204904594000004,
        0.33527407694,
        0.36061783294,
        0.36751710094,
        0.38654476594000003,
        0.37921057494000004,
        0.37585916894000004,
        0.36375356694,
        0.36955815794
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.951 ± 0.058 2.885 3.068 1.74 ± 0.14
pacquet@main 2.766 ± 0.040 2.695 2.820 1.63 ± 0.13
pnpr@HEAD 1.695 ± 0.128 1.568 1.984 1.00
pnpr@main 1.765 ± 0.147 1.517 1.969 1.04 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.95098181766,
      "stddev": 0.058458297314754715,
      "median": 2.93763607236,
      "user": 2.8053571799999997,
      "system": 2.2149423599999998,
      "min": 2.88510507786,
      "max": 3.06840995186,
      "times": [
        2.91374293086,
        2.89772469786,
        2.91325430886,
        3.06840995186,
        2.9057495538600002,
        3.00479783186,
        2.96809103886,
        2.88510507786,
        2.99141357086,
        2.96152921386
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.7663002514600006,
      "stddev": 0.04045766209109048,
      "median": 2.76152141436,
      "user": 2.41817868,
      "system": 1.9046718599999999,
      "min": 2.69541648786,
      "max": 2.82041409686,
      "times": [
        2.82041409686,
        2.74959947586,
        2.79838670486,
        2.7905918508600003,
        2.7308432158600002,
        2.7403419488600003,
        2.77344335286,
        2.81666777986,
        2.69541648786,
        2.74729760086
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.69519609006,
      "stddev": 0.12827517209526965,
      "median": 1.67788939486,
      "user": 1.78275598,
      "system": 1.74146106,
      "min": 1.56839978286,
      "max": 1.98449991686,
      "times": [
        1.60390443886,
        1.69903605486,
        1.65674273486,
        1.56839978286,
        1.80010350186,
        1.59349684886,
        1.70461774686,
        1.5815852168600002,
        1.98449991686,
        1.75957465786
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.7652887198600002,
      "stddev": 0.1470649467011214,
      "median": 1.78358663436,
      "user": 1.62936868,
      "system": 1.6025011599999999,
      "min": 1.5166168078600002,
      "max": 1.96863773186,
      "times": [
        1.80704937986,
        1.8751121188600002,
        1.55588514486,
        1.76012388886,
        1.96863773186,
        1.68354929586,
        1.84431292486,
        1.9065132238600002,
        1.73508668186,
        1.5166168078600002
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 509.7 ± 79.0 418.9 642.3 1.45 ± 0.23
pacquet@main 450.3 ± 35.3 384.8 487.4 1.28 ± 0.11
pnpr@HEAD 350.6 ± 12.2 333.3 370.3 1.00
pnpr@main 389.7 ± 24.4 355.6 419.0 1.11 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5096791193600001,
      "stddev": 0.07898994862568326,
      "median": 0.50210642206,
      "user": 0.72171592,
      "system": 0.86133566,
      "min": 0.41888556706,
      "max": 0.64227804006,
      "times": [
        0.50387264406,
        0.53011070906,
        0.50034020006,
        0.52496052206,
        0.63953381306,
        0.64227804006,
        0.45963198206000005,
        0.43217577306000005,
        0.41888556706,
        0.44500194306
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.45026005656000007,
      "stddev": 0.0353238208986657,
      "median": 0.4609060085600001,
      "user": 0.6262165199999998,
      "system": 0.76392336,
      "min": 0.38475767206000006,
      "max": 0.48738042106000007,
      "times": [
        0.40777575306,
        0.45336691406000007,
        0.47977067506000004,
        0.46429573306000005,
        0.45751628406000006,
        0.46607281606000006,
        0.48738042106000007,
        0.38475767206000006,
        0.48529713706000005,
        0.41636716006
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3506449560600001,
      "stddev": 0.012163421585390839,
      "median": 0.35017016206000007,
      "user": 0.23598032,
      "system": 0.6095497599999999,
      "min": 0.33332208806,
      "max": 0.37032023206000003,
      "times": [
        0.36170329406,
        0.34122636306000004,
        0.34299539906000004,
        0.36075174606000004,
        0.33731063306000003,
        0.34610526906000005,
        0.35423505506,
        0.37032023206000003,
        0.35847948106000005,
        0.33332208806
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.38971749086,
      "stddev": 0.024397976480447656,
      "median": 0.39530386656000005,
      "user": 0.28567712,
      "system": 0.6664764599999999,
      "min": 0.35561839206,
      "max": 0.41900420806000005,
      "times": [
        0.37947618506,
        0.36120344206000005,
        0.39132344606,
        0.39928428706,
        0.41754624806,
        0.40960744606000005,
        0.41900420806000005,
        0.40483055406,
        0.35561839206,
        0.35928070006
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.835 ± 0.028 1.786 1.883 4.99 ± 0.30
pacquet@main 1.856 ± 0.022 1.828 1.898 5.05 ± 0.30
pnpr@HEAD 0.369 ± 0.014 0.350 0.393 1.00 ± 0.07
pnpr@main 0.368 ± 0.021 0.334 0.397 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8347296624200002,
      "stddev": 0.028087287424848027,
      "median": 1.83501675262,
      "user": 1.02964914,
      "system": 0.9269649799999998,
      "min": 1.7864674976200001,
      "max": 1.8833775256200003,
      "times": [
        1.82358832762,
        1.8833775256200003,
        1.8421944096200003,
        1.85404629662,
        1.8112066646200002,
        1.8622788436200002,
        1.8278390956200001,
        1.8139214256200002,
        1.7864674976200001,
        1.84237653762
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.85618770452,
      "stddev": 0.02215930908252592,
      "median": 1.8510202591200002,
      "user": 1.07186584,
      "system": 0.9861319799999999,
      "min": 1.8279976056200002,
      "max": 1.8980710796200002,
      "times": [
        1.84937123062,
        1.8604851476200002,
        1.8980710796200002,
        1.8690697736200002,
        1.84793365662,
        1.8526692876200002,
        1.8835826246200003,
        1.8396150756200003,
        1.83308156362,
        1.8279976056200002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.36918809672,
      "stddev": 0.014326878195306373,
      "median": 0.36721269012,
      "user": 0.25487114,
      "system": 0.6539296799999998,
      "min": 0.34973323662000005,
      "max": 0.39301237562,
      "times": [
        0.35750788662000005,
        0.35983117762000005,
        0.36095760562,
        0.39301237562,
        0.37933473762000003,
        0.38616787262,
        0.37346777462,
        0.34973323662000005,
        0.35647984462000004,
        0.37538845562000006
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.36785810882000003,
      "stddev": 0.021110646844300404,
      "median": 0.36892849012000006,
      "user": 0.25674993999999995,
      "system": 0.65568698,
      "min": 0.33431670362000004,
      "max": 0.39684931662000006,
      "times": [
        0.33431670362000004,
        0.34413921562000005,
        0.39684931662000006,
        0.35962806562000005,
        0.34940116362,
        0.36621379262000003,
        0.37164318762000004,
        0.37962870562000006,
        0.38219466562000004,
        0.39456627162
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 257.0 ± 10.7 236.1 267.9 2.45 ± 0.17
pacquet@main 247.8 ± 25.1 221.3 282.1 2.36 ± 0.27
pnpr@HEAD 106.1 ± 5.0 98.5 116.6 1.01 ± 0.07
pnpr@main 105.1 ± 5.9 95.0 118.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2570126041363637,
      "stddev": 0.010663323106448526,
      "median": 0.2610452215,
      "user": 0.2652949018181818,
      "system": 0.10289517272727272,
      "min": 0.23611636550000004,
      "max": 0.2679073075,
      "times": [
        0.2557838465,
        0.23611636550000004,
        0.2659322825,
        0.2641916735,
        0.2610452215,
        0.2674821995,
        0.2492123185,
        0.2679073075,
        0.2644210285,
        0.2512249925,
        0.24382140950000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.24778221760000002,
      "stddev": 0.025098172254825243,
      "median": 0.23845835950000002,
      "user": 0.24878561999999999,
      "system": 0.10283609999999999,
      "min": 0.22134554150000002,
      "max": 0.2820704575,
      "times": [
        0.2820704575,
        0.2803253675,
        0.24275630250000002,
        0.2811721915,
        0.23018852150000002,
        0.22904079450000003,
        0.2552985735,
        0.23416041650000002,
        0.22146400950000003,
        0.22134554150000002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10605549431481484,
      "stddev": 0.0050252729049745076,
      "median": 0.1060958785,
      "user": 0.028465349629629624,
      "system": 0.01959393703703704,
      "min": 0.09853658150000001,
      "max": 0.11656010050000001,
      "times": [
        0.1011644985,
        0.1026379805,
        0.1016219945,
        0.10861161750000001,
        0.1107248645,
        0.1071538825,
        0.11054701750000001,
        0.1121049365,
        0.1123115895,
        0.10050532150000001,
        0.11439098650000001,
        0.11656010050000001,
        0.10036494650000001,
        0.10885963150000001,
        0.1118158125,
        0.10092237750000001,
        0.1012862575,
        0.1007377225,
        0.1053322785,
        0.1089437065,
        0.10325856150000001,
        0.1063299505,
        0.10124601450000001,
        0.1060958785,
        0.10869922450000001,
        0.1027346125,
        0.09853658150000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.10507338731481483,
      "stddev": 0.005949145691506574,
      "median": 0.10413391350000001,
      "user": 0.029355682962962953,
      "system": 0.0175939,
      "min": 0.0949743665,
      "max": 0.11859146150000001,
      "times": [
        0.1021732505,
        0.0976824845,
        0.0949743665,
        0.1113032075,
        0.1071455045,
        0.11319625750000001,
        0.10413391350000001,
        0.11859146150000001,
        0.1050554885,
        0.10261344750000001,
        0.10864744750000001,
        0.1096315365,
        0.11587154150000001,
        0.10581596650000001,
        0.1027895905,
        0.1087011575,
        0.10838547650000001,
        0.09837767750000001,
        0.10005298750000001,
        0.1016273475,
        0.10742554350000001,
        0.09957463350000001,
        0.1120383625,
        0.10281873050000001,
        0.09999308150000001,
        0.0969634585,
        0.10139753650000001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.686 ± 0.124 4.576 4.991 1.24 ± 0.05
pacquet@main 4.771 ± 0.208 4.627 5.249 1.26 ± 0.06
pnpr@HEAD 3.833 ± 0.127 3.641 4.045 1.01 ± 0.04
pnpr@main 3.779 ± 0.099 3.647 3.958 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.68608097756,
      "stddev": 0.12390009569702831,
      "median": 4.6664791697600005,
      "user": 2.82202448,
      "system": 2.05481348,
      "min": 4.57606889726,
      "max": 4.99136032926,
      "times": [
        4.75353354726,
        4.57606889726,
        4.71601523326,
        4.99136032926,
        4.64891580326,
        4.70678753526,
        4.57752493426,
        4.59597884126,
        4.61058211826,
        4.68404253626
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.77067336286,
      "stddev": 0.20783409539360453,
      "median": 4.670990098760001,
      "user": 3.0298792800000003,
      "system": 2.32492968,
      "min": 4.62669549526,
      "max": 5.24940233426,
      "times": [
        4.67147341126,
        4.62916338726,
        4.63401536626,
        4.84918105926,
        5.00972448226,
        5.24940233426,
        4.62669549526,
        4.654238518260001,
        4.670506786260001,
        4.71233278826
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.8325858105600004,
      "stddev": 0.1265127964134564,
      "median": 3.81406275526,
      "user": 2.08575658,
      "system": 1.8923819800000001,
      "min": 3.6408627892600003,
      "max": 4.04510221526,
      "times": [
        3.7982335602600004,
        3.87349518226,
        3.8298919502600004,
        3.97216447026,
        4.04510221526,
        3.78766769026,
        3.6408627892600003,
        3.68658898426,
        3.75621296726,
        3.9356382962600005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.7794824491599996,
      "stddev": 0.09949996671040845,
      "median": 3.7672769837600004,
      "user": 2.15141288,
      "system": 1.9329062799999999,
      "min": 3.6470556392600004,
      "max": 3.9584531812600003,
      "times": [
        3.7932844142600004,
        3.6972524732600003,
        3.9584531812600003,
        3.68421828026,
        3.8600768492600004,
        3.7137865762600004,
        3.8758936902600003,
        3.6470556392600004,
        3.7412695532600004,
        3.82353383426
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13532
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,885.11 ms
(+6.27%)Baseline: 2,714.83 ms
3,257.80 ms
(88.56%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,786.47 ms
(-3.91%)Baseline: 1,859.23 ms
2,231.07 ms
(80.07%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
418.89 ms
(-18.54%)Baseline: 514.20 ms
617.04 ms
(67.89%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
236.12 ms
(-5.94%)Baseline: 251.03 ms
301.24 ms
(78.38%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,781.74 ms
(+14.11%)Baseline: 2,437.86 ms
2,925.44 ms
(95.09%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,576.07 ms
(+0.95%)Baseline: 4,533.16 ms
5,439.79 ms
(84.12%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
333.58 ms
(+15.38%)Baseline: 289.10 ms
346.92 ms
(96.15%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13532
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,568.40 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
349.73 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
333.32 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
98.54 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,397.70 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,640.86 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
313.17 ms
🐰 View full continuous benchmarking report in Bencher

Carry the out-slot on EngineMode::Install instead of a fourth positional
parameter, so an unrelated mode cannot be paired with a sink and the enum
doc's claim about per-mode payloads holds again. Rename the accessor to
take_deps_requiring_build, matching take_stats next to it and naming the
take() it performs.

Clone the Option<Arc<_>> through Arc::clone so the refcount bump is
visible; clippy::clone_on_ref_ptr does not see through Option. Import
DepsRequiringBuildSink, Arc, and Path rather than qualifying them inline,
drop the call-site comment that repeated the sink's own documentation,
shrink the fill-site comment that re-derived CreateVirtualStore's
internals, log the sink before the non-assert_eq assertion, and rewrite
the added prose without em dashes per the writing-style guide.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 31, 2026 14: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.

@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 @.changeset/tidy-moons-repeat.md:
- Line 2: The changeset file currently targets "`@pnpm/napi`" separately, but
according to the fixed release group configuration, Rust/N-API changes must use
"pacquet" as the package identifier since pacquet and pnpm/napi publish
together. Replace "`@pnpm/napi`": minor with pacquet: minor in the changeset to
correctly identify this change to the Rust stack.
🪄 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: 7344c80f-bd2d-423f-bda7-197c2aed4650

📥 Commits

Reviewing files that changed from the base of the PR and between 50bce22 and c832d48.

📒 Files selected for processing (5)
  • .changeset/tidy-moons-repeat.md
  • pnpm/crates/napi/src/install.rs
  • pnpm/crates/napi/src/install/tests.rs
  • pnpm/crates/package-manager/src/install.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • pnpm/crates/napi/src/install/tests.rs
  • pnpm/crates/package-manager/src/install.rs
  • pnpm/crates/napi/src/install.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs

Comment thread .changeset/tidy-moons-repeat.md Resolved
@qodo-code-review

Copy link
Copy Markdown

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

@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 c2b7cfb into main Jul 31, 2026
40 checks passed
@zkochan
zkochan deleted the fix-napi-deps-requiring-build branch July 31, 2026 14:29
zkochan added a commit to zkochan/bit that referenced this pull request Aug 1, 2026
… again

beta.3 is the first release carrying `returnListOfDepsRequiringBuild`
(pnpm/pnpm#13532), so the option this branch already passes now takes effect:
a fresh resolve reports every package whose files carry install scripts
instead of only the blocked ones. Verified in this repo, where the block had
already been wiped to `[]` on master: a fresh resolve restores all twelve
entries, and a repeat install leaves them untouched.

Drop three version bridges the bump makes unnecessary. The `InstallOptions`
intersection for `returnListOfDepsRequiringBuild` and the `ReadPackageHook`
cast for the `resolvedDir` parameter are both in the published typings now,
and `explicitSettings` is no longer optional, so getNetworkConfig can read it
without a structural cast.

The lockfile shrinks by about 6700 lines. 704 of the 758 removed keys carry
peer suffixes, which is beta.3 deduplicating peer variants rather than
dropping packages; install and compile both pass against the result.

Co-Authored-By: Claude Fable 5 <[email protected]>
zkochan added a commit to teambit/bit that referenced this pull request Aug 1, 2026
…lls (#10551)

## Summary

After the pnpm-v12/napi migration (#10508), every `bit
install` wiped the `bit.depsRequiringBuild` block from `pnpm-lock.yaml`:

```diff
 bit:
-  depsRequiringBuild:
-    - '@apollo/[email protected]'
-    - '@parcel/[email protected]'
-    ...
+  depsRequiringBuild: []
```

Root cause: the migration dropped the `returnListOfDepsRequiringBuild:
true` install option (the napi engine did not implement it), so
`installResult.depsRequiringBuild` only carried *blocked* builds. Bit
allows dependency builds to run, so the list was always empty — and lynx
wrote that empty list over the recorded block on every install.

The fix:

- Preserve the previously recorded list whenever the engine returns no
list (`depsRequiringBuild` undefined): frozen-path repeat installs, and
engines that predate the option. Verified against the currently pinned
`@pnpm/napi` 12.0.0-beta.2 — a repeat install in this repo now leaves
the block byte-identical.
- Pass `returnListOfDepsRequiringBuild: true` again. Engine support was
added in pnpm/pnpm#13532, so the next `@pnpm/napi` release reports the
full list (every package whose files carry install scripts, regardless
of the allow-build policy) on fresh resolves — the same semantics the
pre-migration TypeScript engine had.

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

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet product: pnpr reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants