Skip to content

perf(pacquet): resolve add selectors concurrently - #13097

Merged
zkochan merged 6 commits into
mainfrom
fix-13089
Jul 17, 2026
Merged

zkochan merged 6 commits into
mainfrom
fix-13089

Conversation

@zkochan

@zkochan zkochan commented Jul 17, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Resolve multiple pacquet add package selectors concurrently while sharing the packument metadata cache and fetch locks.
  • Buffer catalog warnings and replay resolution results in selector order so warning and error behavior remains deterministic.
  • Add regression coverage for overlapping registry requests, selector-ordered warnings, and selector-ordered errors.
  • The TypeScript CLI already resolves selectors concurrently with Promise.all, so no TypeScript change is needed.
  • Restrict Rust CI's pnpm cache to CAS files so Windows never restores invalid global-virtual-store junctions.

Closes #13089.

The integrated benchmark used four selectors, 80 ms simulated registry latency, two warmups, and ten measured runs:

Metadata cache Serial Concurrent Improvement
Warm 7.435 s 7.245 s 2.6%
Cold 10.798 s 10.090 s 6.6%

Validation:

  • just ready
  • Full pre-push hook, including TypeScript compile/lint/bundle, Rustfmt, Clippy, Rustdoc, Dylint, typos, and Taplo

Squash Commit Body

Resolve package selectors concurrently during pacquet add instead of waiting for
each selector's registry request before starting the next one.

Share packument metadata state across the concurrent resolutions. Buffer catalog
warnings and process the completed results in selector order to keep warnings and
error selection deterministic.

Add regression coverage that proves registry requests overlap while preserving
selector-ordered warnings and errors.

Restrict the Rust CI pnpm cache to CAS files so Windows runners do not restore
invalid global-virtual-store junctions.

Closes pnpm/pnpm#13089.

Checklist

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

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


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Performance
    • Improved pacquet add by resolving multiple package selectors concurrently and reusing shared resolution work.
  • Bug Fixes
    • Improved catalog-mode handling so catalog warnings are produced reliably and in the correct selector order.
    • More robust behavior when catalog decisions differ or when early resolution errors occur.
  • Tests
    • Added async coverage for concurrent resolution overlap, shared packument reuse, warning ordering, invalid metadata failures, and early-error behavior.
  • Chores
    • Updated CI to cache pnpm’s content-addressable store only.

Copilot AI review requested due to automatic review settings July 17, 2026 11:38

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 17, 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
📝 Walkthrough

Walkthrough

pacquet add now resolves multiple package selectors concurrently, shares resolver state, preserves selector-ordered warnings and errors, and adds concurrency tests. A patch changeset documents the update, while CI caching is narrowed to pnpm CAS files.

Changes

Concurrent pacquet add resolution

Layer / File(s) Summary
Catalog decision outcomes
pnpm/crates/package-manager/src/catalog_mode.rs
Catalog decisions return optional warnings separately while preserving catalog selection and mismatch behavior.
Concurrent selector resolution
pnpm/crates/package-manager/src/add.rs
Add::run resolves selectors concurrently with shared metadata and fetch state, then emits warnings in selector order.
Concurrency and ordering validation
pnpm/crates/package-manager/src/add/tests.rs, .changeset/pacquet-concurrent-add-resolution.md
Tests cover overlapping requests, shared packment state, ordered warnings, error ordering, early termination, and generalized fixtures; a patch changeset records the release note.

CI cache update

Layer / File(s) Summary
CAS-only pnpm cache
.github/workflows/pacquet-ci.yml
The pacquet CI cache stores only pnpm content-addressable files under a new cache key.

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

Sequence Diagram(s)

sequenceDiagram
  participant AddRun
  participant Resolver
  participant Registry
  participant Catalog
  participant Reporter
  AddRun->>Resolver: resolve selectors concurrently
  Resolver->>Registry: fetch package metadata
  Resolver->>Catalog: decide catalog outcome
  Catalog-->>Resolver: decision and optional warning
  Resolver-->>AddRun: ordered resolution results
  AddRun->>Reporter: emit warnings in selector order
Loading

Assessment against linked issues

Objective Addressed Explanation
Concurrent resolution of multiple selectors [#13089] ✅
Deterministic warning and error ordering [#13089] ✅
Performance measurement for cold and warm metadata caches [#13089] ❌ No benchmark or measurement is included.

Out-of-scope changes

Code Change Explanation
CAS-only pnpm CI caching (.github/workflows/pacquet-ci.yml:132-141) The linked issue concerns selector resolution behavior and does not specify CI cache changes.

Possibly related PRs

Suggested labels: product: pacquet

Suggested reviewers: copilot

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-13089

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

Resolve pacquet add selectors concurrently with deterministic warnings/errors

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Resolve multiple pacquet add selectors concurrently with shared metadata cache and fetch locks.
• Buffer catalog warnings and replay results in selector order for deterministic output.
• Add regression tests for overlapping registry requests and selector-ordered warnings/errors.
Diagram

graph TD
A["pacquet add"] --> B["Resolve selectors (concurrent)"] --> C["Pick/resolve packages"] --> D["Replay ordered results"] --> E["Write manifest/lockfile"]
C --> R{{"Registry HTTP"}}
B -.-> M["Shared meta cache"]
B -.-> L["Shared fetch locks"]
D --> K["Catalog decision outcome"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Bounded concurrency (buffer_unordered / semaphore)
  • ➕ Avoids issuing N simultaneous registry requests for large selector lists
  • ➕ Reduces risk of rate limiting and local resource spikes
  • ➖ May reduce peak speedup for small selector counts
  • ➖ Adds tuning surface (default concurrency) and more complexity
2. FuturesOrdered for ordered replay without a second pass
  • ➕ Naturally yields results in selector order
  • ➕ Can start processing earlier results while preserving ordering guarantees
  • ➖ Still needs careful buffering of warnings vs. errors
  • ➖ May complicate shared-state borrowing/lifetimes vs. collect-then-iterate

Recommendation: The chosen approach (join all resolutions concurrently, then iterate results in selector order emitting buffered warnings) is a good fit for the stated goals: real concurrency while preserving deterministic user-visible behavior. If very large selector lists are common, consider a follow-up to cap concurrency with a small default limit to reduce registry pressure; otherwise, the current implementation is straightforward and aligns with the performance intent.

Files changed (4) +352 / -64

Enhancement (1) +48 / -37
add.rsResolve add selectors concurrently with shared packument state +48/-37

Resolve add selectors concurrently with shared packument state

• Switches selector resolution from serial to concurrent ('join_all') and shares a single in-memory packument metadata cache plus a shared fetch locker across tasks. Captures catalog warnings per selector and replays them in selector order while preserving deterministic error selection behavior.

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

Refactor (1) +51 / -19
catalog_mode.rsRefactor catalog decision to return buffered warning outcome +51/-19

Refactor catalog decision to return buffered warning outcome

• Introduces 'CatalogDecisionOutcome' and 'decide_catalog_outcome()' to compute catalog decisions without emitting. Keeps the existing 'decide_catalog()' API by delegating to the new function and emitting the buffered warning for non-concurrent callers.

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

Tests (1) +248 / -8
tests.rsAdd regression tests for concurrency and deterministic reporting order +248/-8

Add regression tests for concurrency and deterministic reporting order

• Adds async tests that assert registry 'latest' requests overlap (true concurrency) and that catalog mismatch warnings are emitted in selector order. Adds a test ensuring resolution errors are surfaced deterministically in selector order even when responses complete out of order.

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

Documentation (1) +5 / -0
pacquet-concurrent-add-resolution.mdAdd changeset note for concurrent 'pacquet add' selector resolution +5/-0

Add changeset note for concurrent 'pacquet add' selector resolution

• Introduces a patch changeset describing improved performance when adding multiple selectors by resolving them concurrently.

.changeset/pacquet-concurrent-add-resolution.md

@greptile-apps

greptile-apps Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge. The concurrent resolution is correctly ordered via FuturesOrdered, the shared cache/locker are properly reference-counted, and the four new tests directly validate concurrency overlap, deduplication, warning order, and early-error cancellation.

The change is a well-contained performance optimization. The concurrency primitive (FuturesOrdered) is the right choice for ordered delivery with parallel execution. Shared state (meta_cache, fetch_locker) is managed through Arc with no aliased mutation. The OnceCell correctly serialises lazy LatestPicker initialisation across concurrent callers. Warning buffering via CatalogDecisionOutcome is a clean, minimal change to catalog_mode.rs. The tests are thorough: they exercise the actual HTTP layer with mockito, check timing (max_active == selectors), and verify that a fast-failing first selector does not wait for a 3-second second selector. No logic regression paths were found.

No files require special attention.

Reviews (5): Last reviewed commit: "fix(package-manager): share add selector..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@pnpm/crates/package-manager/src/add/tests.rs`:
- Around line 130-181: Update the concurrency test around the package setup loop
and request mocks to include multiple overlapping selectors for the same
package, rather than only distinct packages. Configure the shared packument mock
for that package with an exact single-request expectation, then assert
resolution succeeds while concurrent selectors reuse the shared packument cache
and fetch lock, causing the packument endpoint to be requested only once.
🪄 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: 8e569410-f785-432b-a364-f486f4af2379

📥 Commits

Reviewing files that changed from the base of the PR and between e7138af and 3ebe9db.

📒 Files selected for processing (4)
  • .changeset/pacquet-concurrent-add-resolution.md
  • pnpm/crates/package-manager/src/add.rs
  • pnpm/crates/package-manager/src/add/tests.rs
  • pnpm/crates/package-manager/src/catalog_mode.rs

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (4) 📘 Rule violations (1) 📎 Requirement gaps (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 18 rules

Grey Divider


Remediation recommended

1. Lockfile-only dry_run bypassed 🐞 Bug ≡ Correctness ⭐ New
Description
resolve_added_dependency now calls LatestPicker::resolve(package_name, false) and
resolve_explicit_registry_spec hard-codes PickPackageOptions.dry_run: false, so
--lockfile-only no longer affects the pre-resolution picker/caching behavior. This diverges from
LatestPicker’s documented dry-run contract and from the update path that still forwards
lockfile_only, changing cache write-back/side-effect behavior for lockfile-only adds.
Code

pnpm/crates/package-manager/src/add.rs[R390-408]

                    let latest = latest_picker
-                        .as_ref()
-                        .expect("picker initialized above")
-                        .resolve(package_name, lockfile_only)
+                        .get_or_try_init(|| {
+                            std::future::ready(
+                                PickPolicy::from_config(config)
+                                    .map(|policy| {
+                                        LatestPicker::new(
+                                            config,
+                                            http_client,
+                                            policy,
+                                            std::sync::Arc::clone(meta_cache),
+                                            std::sync::Arc::clone(fetch_locker),
+                                        )
+                                    })
+                                    .map_err(AddError::MinimumReleaseAgeExclude),
+                            )
+                        })
+                        .await?
+                        .resolve(package_name, false)
                        .await
Evidence
The new add code hard-codes false for the dry-run controls in both latest-tag and explicit-spec
resolution, while the picker API docs define these booleans as the dry-run/lockfile-only switches
and update continues to pass lockfile_only through to LatestPicker::resolve.

pnpm/crates/package-manager/src/add.rs[389-408]
pnpm/crates/package-manager/src/add.rs[498-525]
pnpm/crates/package-manager/src/resolve_latest.rs[71-80]
pnpm/crates/package-manager/src/update.rs[743-753]
pnpm/crates/resolving-npm-resolver/src/pick_package.rs[293-298]

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

### Issue description
`pacquet add --lockfile-only` no longer propagates its dry-run intent into the pre-resolution picker paths:
- brand-new deps call `LatestPicker::resolve(..., false)`
- explicit registry specs set `PickPackageOptions.dry_run = false`

This makes `add` inconsistent with the documented `LatestPicker::resolve` dry-run behavior and with `update`, which still forwards `lockfile_only`.

### Issue Context
`LatestPicker::resolve` explicitly documents that its boolean parameter is `dry_run` and that it is used for `--lockfile-only` behavior. `PickPackageOptions::dry_run` is similarly documented as the dry-run/lockfile-only switch for cache write-back behavior.

### Fix Focus Areas
- pnpm/crates/package-manager/src/add.rs[390-408]
- pnpm/crates/package-manager/src/add.rs[509-525]

### Suggested fix
1. Re-thread `lockfile_only` through `resolve_added_dependency` (and into `resolve_explicit_registry_spec`).
2. Use it when invoking the picker:
  - `LatestPicker::resolve(package_name, lockfile_only)`
  - `PickPackageOptions { dry_run: lockfile_only, .. }`
3. If the intentional design is to *always* allow cache write-back even in lockfile-only mode for performance, then make that explicit and consistent:
  - update the `LatestPicker::resolve` / `PickPackageOptions::dry_run` documentation to match the new behavior, and
  - consider aligning `update` with the same policy so the commands behave consistently.

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


2. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset only declares a bump for pacquet and does not include an entry for pnpm, which
violates the changeset policy requiring an explicit pnpm bump declaration. This can lead to
incomplete or incorrect release metadata for pnpm.
Code

.changeset/pacquet-concurrent-add-resolution.md[R1-3]

+---
+"pacquet": patch
+---
Evidence
PR Compliance ID 713436 requires newly added/modified changesets to explicitly include the pnpm
package with a valid bump type. The added changeset front-matter only includes pacquet and omits
pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/pacquet-concurrent-add-resolution.md[1-3]

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

## Issue description
The changeset front-matter is missing an explicit `pnpm` package entry.

## Issue Context
Compliance requires that changesets explicitly declare the `pnpm` package and a valid bump type (`patch`/`minor`/`major`). This PR introduces a new changeset file that currently only lists `pacquet`.

## Fix Focus Areas
- .changeset/pacquet-concurrent-add-resolution.md[1-3]

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


3. Blocking mock response sleeps 🐞 Bug ☼ Reliability
Description
New tokio async tests block threads inside mockito response callbacks via std::thread::sleep (and
a Condvar wait), which can increase test-suite latency and become timing-sensitive under heavy
parallel CI load.
Code

pnpm/crates/package-manager/src/add/tests.rs[R156-174]

+            .with_chunked_body(move |writer| {
+                let (lock, ready) = &*state;
+                let mut requests = lock.lock().unwrap();
+                requests.active += 1;
+                requests.started += 1;
+                requests.max_active = requests.max_active.max(requests.active);
+                ready.notify_all();
+                let (mut requests, _) = ready
+                    .wait_timeout_while(requests, Duration::from_secs(2), |requests| {
+                        requests.started < packages.len()
+                    })
+                    .unwrap();
+                drop(requests);
+                std::thread::sleep(Duration::from_millis(response_delay_ms));
+                requests = lock.lock().unwrap();
+                requests.active -= 1;
+                drop(requests);
+                writer.write_all(response_body.as_bytes())
+            })
Evidence
The new tests are async (#[tokio::test]) yet introduce multiple std::thread::sleep(...) calls
and a Condvar::wait_timeout_while(...) inside mock response closures, which are synchronous
blocking operations and directly contribute fixed latency and potential timing sensitivity.

pnpm/crates/package-manager/src/add/tests.rs[99-177]
pnpm/crates/package-manager/src/add/tests.rs[285-303]
pnpm/crates/package-manager/src/add/tests.rs[355-463]

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

### Issue description
Several newly added `#[tokio::test]` cases block threads in mock server response handlers using `std::thread::sleep` and a `Condvar` wait. Even if the blocking occurs on mock server worker threads (not necessarily Tokio workers), it still adds fixed latency and can become timing-sensitive when tests run in parallel and resources are contended.

### Issue Context
These sleeps are used to force overlap and ordering behavior, but the approach relies on wall-clock delays (including a 3s delay) and a fixed 2s `Condvar` timeout, which can be brittle on slower CI.

### Fix Focus Areas
- pnpm/crates/package-manager/src/add/tests.rs[156-177]
- pnpm/crates/package-manager/src/add/tests.rs[289-302]
- pnpm/crates/package-manager/src/add/tests.rs[384-390]
- pnpm/crates/package-manager/src/add/tests.rs[458-463]

### Suggested fix
- Prefer mockito features that introduce response delay without blocking a thread (if available in this repo’s mockito version), or reduce the delays substantially.
- Replace long fixed sleeps with deterministic coordination from the test task (e.g., count/notify that requests started, then immediately respond) and assert overlap via shared state, minimizing wall-clock waiting.
- If you must keep delays, shorten them and raise the `wait_timeout_while` threshold or make it proportional to CI slowness to reduce flakes.

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


View more (3)
4. Cache excludes index.db 🐞 Bug ➹ Performance
Description
The workflow now caches only <store>/v11/files, omitting <store>/v11/index.db which is part of
the pnpm v11 store layout and is used as the per-package index. This can cause package-level store
lookups to miss and re-download/rebuild index state even when the Actions cache restores
successfully, reducing cache effectiveness and increasing CI time/network usage.
Code

.github/workflows/pacquet-ci.yml[R135-141]

+          # Cache only the CAS content. Caching the store root also archives
+          # the global-virtual-store `links/` tree despite a negative path
+          # entry, and tar can't round-trip its Windows junctions.
+          key: ci-pnpm-v11-cas-only-${{ matrix.os }}
          path: |
-            ${{ env.PNPM_HOME }}/store/v11
-            !${{ env.PNPM_HOME }}/store/v11/links
-            ${{ env.HOME }}/.local/share/pnpm/store/v11
-            !${{ env.HOME }}/.local/share/pnpm/store/v11/links
+            ${{ env.PNPM_HOME }}/store/v11/files
+            ${{ env.HOME }}/.local/share/pnpm/store/v11/files
Evidence
The workflow change caches only .../store/v11/files. Pacquet’s own store-dir docs state the v11
layout is files/... plus index.db, and the store-index implementation notes that missing index
rows lead to re-downloads—so excluding index.db can materially reduce cache reuse.

.github/workflows/pacquet-ci.yml[132-143]
pnpm/crates/store-dir/src/store_dir.rs[12-31]
pnpm/crates/store-dir/src/store_index.rs[16-26]
pnpm/crates/store-dir/src/store_index.rs[40-58]

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 pnpm cache step caches only the CAS `files/` directory and omits the sibling `index.db` SQLite store index. That can reduce cache effectiveness because the package index is needed to recognize/reuse cached content without re-downloading.

### Issue Context
The pnpm v11 store layout includes both `files/` and `index.db`. The store index is explicitly described as a best-effort cache whose misses trigger re-downloads.

### Fix Focus Areas
- .github/workflows/pacquet-ci.yml[135-141]

### Suggested change
Include the index DB (and WAL/SHM sidecars) in the cached paths while still excluding `links/`, e.g.:
```yaml
path: |
 ${{ env.PNPM_HOME }}/store/v11/files
 ${{ env.PNPM_HOME }}/store/v11/index.db*
 ${{ env.HOME }}/.local/share/pnpm/store/v11/files
 ${{ env.HOME }}/.local/share/pnpm/store/v11/index.db*
```
(Or explicitly list `index.db`, `index.db-wal`, `index.db-shm` if you prefer no globs.)

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


5. Unbounded selector futures 🐞 Bug ➹ Performance
Description
Add::run enqueues one resolve future per selector into FuturesOrdered before awaiting any results,
so memory and scheduling overhead grow linearly with selector count even though actual network I/O
is throttled. Large scripted adds (hundreds/thousands of selectors) can incur avoidable memory
pressure and slower startup.
Code

pnpm/crates/package-manager/src/add.rs[R171-177]

+        let resolved_dependencies = {
+            let mut resolution_futures = FuturesOrdered::new();
+            for package_name in package_names {
+                resolution_futures.push_back(resolve_added_dependency(
                    package_name,
                    config,
                    manifest,
Evidence
The new code constructs a FuturesOrdered and push_backs one future per selector before consuming
any results, which retains all future state at once. The config already has a network_concurrency
knob suitable for bounding in-flight work while keeping ordered output.

pnpm/crates/package-manager/src/add.rs[169-200]
pnpm/crates/config/src/lib.rs[1082-1096]

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

### Issue description
`Add::run` currently pushes *all* selector-resolution futures into a `FuturesOrdered` before driving the stream. This retains N futures (and their captured state) concurrently, which can become expensive for very large selector lists.

### Issue Context
- Network concurrency is already configurable via `Config::network_concurrency`, but the number of *queued* selector futures is not bounded.
- We still need deterministic (selector-ordered) warnings and error selection.

### Fix Focus Areas
- pnpm/crates/package-manager/src/add.rs[169-200]

### Suggested fix
Replace the `FuturesOrdered` fan-out with a bounded ordered buffer.

One approach is:
- build a stream over `package_names`
- `.map(|name| resolve_added_dependency(...))`
- apply `.buffered(limit)` where `limit = config.network_concurrency.min(package_names.len())` (or a smaller cap if desired)
- iterate results in order, emitting buffered warnings and returning the first selector-ordered error

This preserves deterministic ordering while preventing unbounded in-memory queued futures.

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


6. Non-failfast add resolution ✓ Resolved 🐞 Bug ☼ Reliability
Description
Add::run now awaits future::join_all for all selector resolutions before propagating the first
selector-ordered error, so a slow/hung later selector can delay failure even when an earlier
selector is the error that will be reported. This also performs registry requests for later
selectors on failure paths (confirmed by the new regression test asserting both mocks are hit
despite an error).
Code

pnpm/crates/package-manager/src/add.rs[R169-197]

+        let meta_cache = InMemoryPackageMetaCache::default();
+        let fetch_locker = shared_packument_fetch_locker();
+        let resolution_results = future::join_all(package_names.iter().map(|package_name| {
+            resolve_added_dependency(
+                package_name,
+                config,
+                manifest,
+                lockfile,
+                http_client,
+                &http_client_arc,
+                pinned_version,
+                save_catalog_name.as_deref(),
+                &catalogs,
+                &prefix,
+                lockfile_only,
+                &dependency_groups,
+                &meta_cache,
+                &fetch_locker,
+            )
+        }))
+        .await;
+        let mut resolved_dependencies = Vec::with_capacity(resolution_results.len());
+        for result in resolution_results {
+            let dependency = result?;
+            if let Some(warning) = &dependency.warning {
+                Reporter::emit(warning);
+            }
+            resolved_dependencies.push(dependency);
        }
Evidence
join_all(...).await forces waiting for every selector resolution to complete before any result?
is evaluated, so failures cannot return until the slowest resolution completes. The new error-order
test asserts both registry mocks were called even though the command errors, demonstrating the extra
work on failure paths.

pnpm/crates/package-manager/src/add.rs[169-197]
pnpm/crates/package-manager/src/add/tests.rs[253-323]

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

## Issue description
`Add::run` currently uses `futures_util::future::join_all` to resolve all selectors concurrently, then iterates the resulting `Vec<Result<...>>` and returns on the first `Err` in selector order. Because `join_all(...).await` only completes after *all* futures finish, the command no longer fails fast: it can wait for unrelated slow selectors and will still perform their network requests even when an earlier selector is the error that will ultimately be returned.

## Issue Context
This PR aims to keep warnings/errors deterministic (selector order) while resolving concurrently.

## Fix Focus Areas
- pnpm/crates/package-manager/src/add.rs[169-197]

## Suggested fix
Replace `join_all(...).await` with an ordered concurrent driver that yields results in selector order and allows early return on the first selector-ordered error.

A good fit is `futures_util::stream::FuturesOrdered`:
- Push one `resolve_added_dependency(...)` future per selector (preserving selector order).
- Iterate the stream; for each yielded result in order, `?`-propagate errors immediately.
- Emit the buffered warning for each successful dependency before pushing it.
- Dropping the stream on error cancels remaining in-flight futures (best-effort), restoring fail-fast behavior while keeping deterministic warning/error selection.

Pseudo-shape:
```rust
use futures_util::stream::{FuturesOrdered, StreamExt};

let mut futs = FuturesOrdered::new();
for package_name in package_names {
 futs.push(resolve_added_dependency(/* ... */));
}

let mut resolved_dependencies = Vec::with_capacity(package_names.len());
while let Some(result) = futs.next().await {
 let dep = result?;
 if let Some(w) = &dep.warning { Reporter::emit(w); }
 resolved_dependencies.push(dep);
}
```

If the intent is to keep doing all work even on error, then the current behavior should also replay warnings for completed earlier selectors and consider aggregating/reporting multiple errors; as written it pays the cost without improving error output.

ⓘ 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 bb07e0f

Results up to commit 3ebe9db


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


Remediation recommended
1. Non-failfast add resolution ✓ Resolved 🐞 Bug ☼ Reliability
Description
Add::run now awaits future::join_all for all selector resolutions before propagating the first
selector-ordered error, so a slow/hung later selector can delay failure even when an earlier
selector is the error that will be reported. This also performs registry requests for later
selectors on failure paths (confirmed by the new regression test asserting both mocks are hit
despite an error).
Code

pnpm/crates/package-manager/src/add.rs[R169-197]

+        let meta_cache = InMemoryPackageMetaCache::default();
+        let fetch_locker = shared_packument_fetch_locker();
+        let resolution_results = future::join_all(package_names.iter().map(|package_name| {
+            resolve_added_dependency(
+                package_name,
+                config,
+                manifest,
+                lockfile,
+                http_client,
+                &http_client_arc,
+                pinned_version,
+                save_catalog_name.as_deref(),
+                &catalogs,
+                &prefix,
+                lockfile_only,
+                &dependency_groups,
+                &meta_cache,
+                &fetch_locker,
+            )
+        }))
+        .await;
+        let mut resolved_dependencies = Vec::with_capacity(resolution_results.len());
+        for result in resolution_results {
+            let dependency = result?;
+            if let Some(warning) = &dependency.warning {
+                Reporter::emit(warning);
+            }
+            resolved_dependencies.push(dependency);
        }
Evidence
join_all(...).await forces waiting for every selector resolution to complete before any result?
is evaluated, so failures cannot return until the slowest resolution completes. The new error-order
test asserts both registry mocks were called even though the command errors, demonstrating the extra
work on failure paths.

pnpm/crates/package-manager/src/add.rs[169-197]
pnpm/crates/package-manager/src/add/tests.rs[253-323]

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

## Issue description
`Add::run` currently uses `futures_util::future::join_all` to resolve all selectors concurrently, then iterates the resulting `Vec<Result<...>>` and returns on the first `Err` in selector order. Because `join_all(...).await` only completes after *all* futures finish, the command no longer fails fast: it can wait for unrelated slow selectors and will still perform their network requests even when an earlier selector is the error that will ultimately be returned.

## Issue Context
This PR aims to keep warnings/errors deterministic (selector order) while resolving concurrently.

## Fix Focus Areas
- pnpm/crates/package-manager/src/add.rs[169-197]

## Suggested fix
Replace `join_all(...).await` with an ordered concurrent driver that yields results in selector order and allows early return on the first selector-ordered error.

A good fit is `futures_util::stream::FuturesOrdered`:
- Push one `resolve_added_dependency(...)` future per selector (preserving selector order).
- Iterate the stream; for each yielded result in order, `?`-propagate errors immediately.
- Emit the buffered warning for each successful dependency before pushing it.
- Dropping the stream on error cancels remaining in-flight futures (best-effort), restoring fail-fast behavior while keeping deterministic warning/error selection.

Pseudo-shape:
```rust
use futures_util::stream::{FuturesOrdered, StreamExt};

let mut futs = FuturesOrdered::new();
for package_name in package_names {
 futs.push(resolve_added_dependency(/* ... */));
}

let mut resolved_dependencies = Vec::with_capacity(package_names.len());
while let Some(result) = futs.next().await {
 let dep = result?;
 if let Some(w) = &dep.warning { Reporter::emit(w); }
 resolved_dependencies.push(dep);
}
```

If the intent is to keep doing all work even on error, then the current behavior should also replay warnings for completed earlier selectors and consider aggregating/reporting multiple errors; as written it pays the cost without improving error output.

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


Results up to commit f92693c


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


Remediation recommended
1. Unbounded selector futures 🐞 Bug ➹ Performance
Description
Add::run enqueues one resolve future per selector into FuturesOrdered before awaiting any results,
so memory and scheduling overhead grow linearly with selector count even though actual network I/O
is throttled. Large scripted adds (hundreds/thousands of selectors) can incur avoidable memory
pressure and slower startup.
Code

pnpm/crates/package-manager/src/add.rs[R171-177]

+        let resolved_dependencies = {
+            let mut resolution_futures = FuturesOrdered::new();
+            for package_name in package_names {
+                resolution_futures.push_back(resolve_added_dependency(
                    package_name,
                    config,
                    manifest,
Evidence
The new code constructs a FuturesOrdered and push_backs one future per selector before consuming
any results, which retains all future state at once. The config already has a network_concurrency
knob suitable for bounding in-flight work while keeping ordered output.

pnpm/crates/package-manager/src/add.rs[169-200]
pnpm/crates/config/src/lib.rs[1082-1096]

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

### Issue description
`Add::run` currently pushes *all* selector-resolution futures into a `FuturesOrdered` before driving the stream. This retains N futures (and their captured state) concurrently, which can become expensive for very large selector lists.

### Issue Context
- Network concurrency is already configurable via `Config::network_concurrency`, but the number of *queued* selector futures is not bounded.
- We still need deterministic (selector-ordered) warnings and error selection.

### Fix Focus Areas
- pnpm/crates/package-manager/src/add.rs[169-200]

### Suggested fix
Replace the `FuturesOrdered` fan-out with a bounded ordered buffer.

One approach is:
- build a stream over `package_names`
- `.map(|name| resolve_added_dependency(...))`
- apply `.buffered(limit)` where `limit = config.network_concurrency.min(package_names.len())` (or a smaller cap if desired)
- iterate results in order, emitting buffered warnings and returning the first selector-ordered error

This preserves deterministic ordering while preventing unbounded in-memory queued futures.

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


Results up to commit b5fce30


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


Remediation recommended
1. Cache excludes index.db 🐞 Bug ➹ Performance
Description
The workflow now caches only <store>/v11/files, omitting <store>/v11/index.db which is part of
the pnpm v11 store layout and is used as the per-package index. This can cause package-level store
lookups to miss and re-download/rebuild index state even when the Actions cache restores
successfully, reducing cache effectiveness and increasing CI time/network usage.
Code

.github/workflows/pacquet-ci.yml[R135-141]

+          # Cache only the CAS content. Caching the store root also archives
+          # the global-virtual-store `links/` tree despite a negative path
+          # entry, and tar can't round-trip its Windows junctions.
+          key: ci-pnpm-v11-cas-only-${{ matrix.os }}
          path: |
-            ${{ env.PNPM_HOME }}/store/v11
-            !${{ env.PNPM_HOME }}/store/v11/links
-            ${{ env.HOME }}/.local/share/pnpm/store/v11
-            !${{ env.HOME }}/.local/share/pnpm/store/v11/links
+            ${{ env.PNPM_HOME }}/store/v11/files
+            ${{ env.HOME }}/.local/share/pnpm/store/v11/files
Evidence
The workflow change caches only .../store/v11/files. Pacquet’s own store-dir docs state the v11
layout is files/... plus index.db, and the store-index implementation notes that missing index
rows lead to re-downloads—so excluding index.db can materially reduce cache reuse.

.github/workflows/pacquet-ci.yml[132-143]
pnpm/crates/store-dir/src/store_dir.rs[12-31]
pnpm/crates/store-dir/src/store_index.rs[16-26]
pnpm/crates/store-dir/src/store_index.rs[40-58]

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 pnpm cache step caches only the CAS `files/` directory and omits the sibling `index.db` SQLite store index. That can reduce cache effectiveness because the package index is needed to recognize/reuse cached content without re-downloading.

### Issue Context
The pnpm v11 store layout includes both `files/` and `index.db`. The store index is explicitly described as a best-effort cache whose misses trigger re-downloads.

### Fix Focus Areas
- .github/workflows/pacquet-ci.yml[135-141]

### Suggested change
Include the index DB (and WAL/SHM sidecars) in the cached paths while still excluding `links/`, e.g.:
```yaml
path: |
 ${{ env.PNPM_HOME }}/store/v11/files
 ${{ env.PNPM_HOME }}/store/v11/index.db*
 ${{ env.HOME }}/.local/share/pnpm/store/v11/files
 ${{ env.HOME }}/.local/share/pnpm/store/v11/index.db*
```
(Or explicitly list `index.db`, `index.db-wal`, `index.db-shm` if you prefer no globs.)

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


Results up to commit 5ac2da1


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


Remediation recommended
1. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset only declares a bump for pacquet and does not include an entry for pnpm, which
violates the changeset policy requiring an explicit pnpm bump declaration. This can lead to
incomplete or incorrect release metadata for pnpm.
Code

.changeset/pacquet-concurrent-add-resolution.md[R1-3]

+---
+"pacquet": patch
+---
Evidence
PR Compliance ID 713436 requires newly added/modified changesets to explicitly include the pnpm
package with a valid bump type. The added changeset front-matter only includes pacquet and omits
pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/pacquet-concurrent-add-resolution.md[1-3]

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

## Issue description
The changeset front-matter is missing an explicit `pnpm` package entry.

## Issue Context
Compliance requires that changesets explicitly declare the `pnpm` package and a valid bump type (`patch`/`minor`/`major`). This PR introduces a new changeset file that currently only lists `pacquet`.

## Fix Focus Areas
- .changeset/pacquet-concurrent-add-resolution.md[1-3]

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


2. Blocking mock response sleeps 🐞 Bug ☼ Reliability
Description
New tokio async tests block threads inside mockito response callbacks via std::thread::sleep (and
a Condvar wait), which can increase test-suite latency and become timing-sensitive under heavy
parallel CI load.
Code

pnpm/crates/package-manager/src/add/tests.rs[R156-174]

+            .with_chunked_body(move |writer| {
+                let (lock, ready) = &*state;
+                let mut requests = lock.lock().unwrap();
+                requests.active += 1;
+                requests.started += 1;
+                requests.max_active = requests.max_active.max(requests.active);
+                ready.notify_all();
+                let (mut requests, _) = ready
+                    .wait_timeout_while(requests, Duration::from_secs(2), |requests| {
+                        requests.started < packages.len()
+                    })
+                    .unwrap();
+                drop(requests);
+                std::thread::sleep(Duration::from_millis(response_delay_ms));
+                requests = lock.lock().unwrap();
+                requests.active -= 1;
+                drop(requests);
+                writer.write_all(response_body.as_bytes())
+            })
Evidence
The new tests are async (#[tokio::test]) yet introduce multiple std::thread::sleep(...) calls
and a Condvar::wait_timeout_while(...) inside mock response closures, which are synchronous
blocking operations and directly contribute fixed latency and potential timing sensitivity.

pnpm/crates/package-manager/src/add/tests.rs[99-177]
pnpm/crates/package-manager/src/add/tests.rs[285-303]
pnpm/crates/package-manager/src/add/tests.rs[355-463]

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

### Issue description
Several newly added `#[tokio::test]` cases block threads in mock server response handlers using `std::thread::sleep` and a `Condvar` wait. Even if the blocking occurs on mock server worker threads (not necessarily Tokio workers), it still adds fixed latency and can become timing-sensitive when tests run in parallel and resources are contended.

### Issue Context
These sleeps are used to force overlap and ordering behavior, but the approach relies on wall-clock delays (including a 3s delay) and a fixed 2s `Condvar` timeout, which can be brittle on slower CI.

### Fix Focus Areas
- pnpm/crates/package-manager/src/add/tests.rs[156-177]
- pnpm/crates/package-manager/src/add/tests.rs[289-302]
- pnpm/crates/package-manager/src/add/tests.rs[384-390]
- pnpm/crates/package-manager/src/add/tests.rs[458-463]

### Suggested fix
- Prefer mockito features that introduce response delay without blocking a thread (if available in this repo’s mockito version), or reduce the delays substantially.
- Replace long fixed sleeps with deterministic coordination from the test task (e.g., count/notify that requests started, then immediately respond) and assert overlap via shared state, minimizing wall-clock waiting.
- If you must keep delays, shorten them and raise the `wait_timeout_while` threshold or make it proportional to CI slowness to reduce flakes.

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


Qodo Logo

@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve lockfile-only resolution semantics

Restore the lockfile_only parameter in resolve_added_dependency and
resolve_explicit_registry_spec.

pnpm/crates/package-manager/src/add.rs [320-521]

 async fn resolve_added_dependency<'a>(
     ...
     prefix: &str,
+    lockfile_only: bool,
     dependency_groups: &[DependencyGroup],
     ...
 ) -> Result<ResolvedAddedDependency, AddError> {
     ...
-                    .resolve(package_name, false)
+                    .resolve(package_name, lockfile_only)
     ...
 }
 
 async fn resolve_explicit_registry_spec(
     ...
     pinned_version: PinnedVersion,
+    lockfile_only: bool,
     lockfile: Option<&Lockfile>,
     manifest: &PackageManifest,
     ...
 ) -> Result<Option<String>, AddError> {
     ...
-    dry_run: false,
+    dry_run: lockfile_only,
     ...
 };

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The PR unintentionally drops the lockfile_only parameter and hardcodes false in the resolution paths, which breaks the expected dry-run behavior of pnpm add --lockfile-only.

High
  • More

@github-actions

github-actions Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
lockfile/parse_pnpm_lock       1.01     12.5±0.69ms    30.0 MB/sec    1.00     12.3±0.78ms    30.4 MB/sec
packument/parse                1.00     43.7±1.31µs  1517.7 MB/sec    1.08     47.2±3.48µs  1406.0 MB/sec
tarball/download_dependency    1.35      3.3±0.45ms  1316.1 KB/sec    1.00      2.4±0.08ms  1771.5 KB/sec

@codecov-commenter

codecov-commenter commented Jul 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.02913% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.48%. Comparing base (068a4cc) to head (bb07e0f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/package-manager/src/catalog_mode.rs 97.61% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13097      +/-   ##
==========================================
+ Coverage   85.47%   85.48%   +0.01%     
==========================================
  Files         502      502              
  Lines       80771    80820      +49     
==========================================
+ Hits        69039    69093      +54     
+ Misses      11732    11727       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@github-actions

github-actions Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: bb07e0fc58e6

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.695 ± 0.135 2.557 2.944 1.60 ± 0.18
pacquet@main 2.758 ± 0.191 2.427 2.986 1.63 ± 0.20
pnpr@HEAD 1.687 ± 0.166 1.408 2.012 1.00
pnpr@main 1.912 ± 0.176 1.621 2.093 1.13 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6949577376399994,
      "stddev": 0.13504956089126113,
      "median": 2.63587505924,
      "user": 2.3535603600000004,
      "system": 1.7934202400000003,
      "min": 2.55718052124,
      "max": 2.9439657492399998,
      "times": [
        2.7187535282399997,
        2.66265994724,
        2.9439657492399998,
        2.60447956424,
        2.55718052124,
        2.79907263724,
        2.5972732392399998,
        2.58132704924,
        2.60909017124,
        2.87577496924
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.7576054882400003,
      "stddev": 0.19080870305598127,
      "median": 2.7975221567399995,
      "user": 2.22250646,
      "system": 1.7358979399999999,
      "min": 2.42706476024,
      "max": 2.98640692524,
      "times": [
        2.98640692524,
        2.6117940742399997,
        2.8542166812399996,
        2.74082763224,
        2.73133385524,
        2.89545836724,
        2.9303000292399997,
        2.89791912924,
        2.42706476024,
        2.50073342824
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6873909734399999,
      "stddev": 0.16593821018079194,
      "median": 1.65538236074,
      "user": 1.7847429600000002,
      "system": 1.86401884,
      "min": 1.4081102492400002,
      "max": 2.0119069382399997,
      "times": [
        1.64180203324,
        1.8649684372400002,
        1.4081102492400002,
        1.74429679724,
        1.57776531924,
        1.73272994624,
        1.64236106524,
        2.0119069382399997,
        1.58156529224,
        1.66840365624
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.9115668620399997,
      "stddev": 0.17595691446069578,
      "median": 1.95426211974,
      "user": 2.13019686,
      "system": 2.19167584,
      "min": 1.62073667924,
      "max": 2.0925666002399996,
      "times": [
        1.62073667924,
        2.05387296924,
        1.97304974124,
        2.0925666002399996,
        2.09171832824,
        2.03595125424,
        1.7565791132400002,
        1.93547449824,
        1.89827409224,
        1.6574453442400001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 505.9 ± 47.7 404.1 556.7 1.16 ± 0.14
pacquet@main 459.6 ± 30.3 411.2 518.9 1.05 ± 0.10
pnpr@HEAD 516.2 ± 46.6 448.2 614.5 1.18 ± 0.14
pnpr@main 437.8 ± 30.8 407.7 503.3 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.50588672164,
      "stddev": 0.047693983262875224,
      "median": 0.51730887164,
      "user": 0.4462423199999999,
      "system": 0.92441368,
      "min": 0.40405970064,
      "max": 0.55667081264,
      "times": [
        0.52661132364,
        0.52753403164,
        0.50136384764,
        0.5080064196399999,
        0.54445782964,
        0.55667081264,
        0.5501901566399999,
        0.48691941164,
        0.45305368264,
        0.40405970064
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.45957850363999997,
      "stddev": 0.030305569494993988,
      "median": 0.45462005864,
      "user": 0.41043172000000006,
      "system": 0.85967688,
      "min": 0.41123597664,
      "max": 0.5188870436399999,
      "times": [
        0.44522281364000005,
        0.5188870436399999,
        0.45644202564,
        0.46449606464000004,
        0.44906217464000003,
        0.49405313664000006,
        0.47056844264000003,
        0.45279809164,
        0.41123597664,
        0.43301926664
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.5162247525400001,
      "stddev": 0.046643213737857105,
      "median": 0.51065983814,
      "user": 0.44867771999999995,
      "system": 0.9181478799999999,
      "min": 0.44817978264,
      "max": 0.61451714964,
      "times": [
        0.44817978264,
        0.5043012206399999,
        0.46316991664,
        0.49781407064000005,
        0.54688665364,
        0.51693277364,
        0.54620645264,
        0.61451714964,
        0.51985260264,
        0.50438690264
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.43783844303999997,
      "stddev": 0.030819002884111952,
      "median": 0.42625412864,
      "user": 0.39261391999999995,
      "system": 0.83021518,
      "min": 0.40766794664,
      "max": 0.50327908564,
      "times": [
        0.50327908564,
        0.43062581764,
        0.40766794664,
        0.44773953364,
        0.47794428664000005,
        0.43862739064,
        0.41704158164000005,
        0.42018494264,
        0.42188243964000005,
        0.41339140564000004
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.179 ± 0.198 3.023 3.703 2.11 ± 0.22
pacquet@main 2.899 ± 0.202 2.705 3.289 1.92 ± 0.21
pnpr@HEAD 1.506 ± 0.123 1.387 1.701 1.00
pnpr@main 1.610 ± 0.219 1.388 1.920 1.07 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.1786915489400003,
      "stddev": 0.19803087413480888,
      "median": 3.14438706484,
      "user": 2.8661177799999997,
      "system": 2.0192273,
      "min": 3.02291664334,
      "max": 3.70297410334,
      "times": [
        3.20714463434,
        3.18533421734,
        3.12112291534,
        3.20598637734,
        3.02809415634,
        3.15173640534,
        3.02456831234,
        3.13703772434,
        3.02291664334,
        3.70297410334
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.89858230444,
      "stddev": 0.20170388145761253,
      "median": 2.82462688984,
      "user": 2.17497728,
      "system": 1.5577126,
      "min": 2.70468040034,
      "max": 3.28899322434,
      "times": [
        3.28899322434,
        3.21529890234,
        2.96421692834,
        2.81350612034,
        2.74297131234,
        2.70468040034,
        2.75649021634,
        2.77256311334,
        2.83574765934,
        2.89135516734
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5058015337399997,
      "stddev": 0.12291812481913693,
      "median": 1.4781547283399998,
      "user": 1.03513278,
      "system": 1.1470757,
      "min": 1.3865685163400001,
      "max": 1.70107068634,
      "times": [
        1.3865685163400001,
        1.41252379934,
        1.38969174834,
        1.62207376934,
        1.39590056134,
        1.70107068634,
        1.60608803234,
        1.38995272934,
        1.54378565734,
        1.6103598373399999
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6098370324400002,
      "stddev": 0.21854238070759707,
      "median": 1.5661931018400002,
      "user": 1.1296692800000003,
      "system": 1.2752142000000002,
      "min": 1.38798324134,
      "max": 1.9200600033400002,
      "times": [
        1.43256589534,
        1.80491494834,
        1.38956681334,
        1.9200600033400002,
        1.9060247613399999,
        1.38798324134,
        1.6485165183400001,
        1.48386968534,
        1.39390376134,
        1.73096469634
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 549.2 ± 11.1 528.4 562.9 1.89 ± 0.06
pacquet@main 540.6 ± 12.6 517.7 561.6 1.86 ± 0.06
pnpr@HEAD 291.0 ± 6.5 281.9 306.2 1.00
pnpr@main 293.1 ± 2.5 289.2 296.2 1.01 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.54921181608,
      "stddev": 0.0111033803515128,
      "median": 0.5497369198800001,
      "user": 0.6564744199999999,
      "system": 0.6855176199999999,
      "min": 0.52843741988,
      "max": 0.5629238358800001,
      "times": [
        0.5392012538800001,
        0.5474335838800001,
        0.5439630188800001,
        0.55941256588,
        0.5629238358800001,
        0.55821676488,
        0.5592937318800001,
        0.5411957298800001,
        0.52843741988,
        0.55204025588
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.5406020490800001,
      "stddev": 0.012593264490091401,
      "median": 0.54045477988,
      "user": 0.63505522,
      "system": 0.67213342,
      "min": 0.51770620588,
      "max": 0.5615798968800001,
      "times": [
        0.5529251418800001,
        0.54668998388,
        0.5473561478800001,
        0.53788810288,
        0.5615798968800001,
        0.53280258888,
        0.52857439788,
        0.54302145688,
        0.5374765678800001,
        0.51770620588
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2910162767800001,
      "stddev": 0.006539101094522044,
      "median": 0.29074729738000005,
      "user": 0.18911881999999997,
      "system": 0.5203091199999998,
      "min": 0.28193109988000004,
      "max": 0.30623951488,
      "times": [
        0.29310242088000005,
        0.29432375988000004,
        0.28878086488000004,
        0.28793049488,
        0.29161822688,
        0.29008987988,
        0.28193109988000004,
        0.29140471488,
        0.30623951488,
        0.28474179088
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.29306608808,
      "stddev": 0.0025053370658176303,
      "median": 0.29396148338000005,
      "user": 0.17038302,
      "system": 0.54582652,
      "min": 0.28920904188,
      "max": 0.29620396088,
      "times": [
        0.29430804188000004,
        0.28951346388000004,
        0.29038743988000004,
        0.29533189988,
        0.29402408688000004,
        0.29389887988,
        0.29620396088,
        0.29496884588,
        0.28920904188,
        0.29281521988000003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.841 ± 0.022 1.825 1.900 6.09 ± 0.19
pacquet@main 1.882 ± 0.037 1.838 1.969 6.23 ± 0.21
pnpr@HEAD 0.306 ± 0.017 0.287 0.334 1.01 ± 0.06
pnpr@main 0.302 ± 0.008 0.287 0.316 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8410527547800002,
      "stddev": 0.02194049043416328,
      "median": 1.8352382678799999,
      "user": 0.9062967399999999,
      "system": 0.7340064399999999,
      "min": 1.82504222238,
      "max": 1.90016438238,
      "times": [
        1.83495681838,
        1.83551971738,
        1.83559476838,
        1.83028295938,
        1.84165104138,
        1.82529265338,
        1.82504222238,
        1.83327685538,
        1.90016438238,
        1.84874612938
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.88205879548,
      "stddev": 0.03650001974683175,
      "median": 1.87591553938,
      "user": 0.97809024,
      "system": 0.7624121399999999,
      "min": 1.83799945638,
      "max": 1.9685560613800002,
      "times": [
        1.83799945638,
        1.90099778138,
        1.87707902938,
        1.86339822438,
        1.87475204938,
        1.84519993338,
        1.87744795438,
        1.90064389438,
        1.9685560613800002,
        1.87451357038
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30599424068000003,
      "stddev": 0.017143517184129452,
      "median": 0.30303947888000005,
      "user": 0.20593714,
      "system": 0.5391065399999999,
      "min": 0.28739991438,
      "max": 0.33381479238,
      "times": [
        0.28739991438,
        0.28769181538,
        0.28821643238,
        0.30567753638,
        0.30629781438000003,
        0.31925818438000003,
        0.30005692438000003,
        0.33112757138000004,
        0.30040142138000003,
        0.33381479238
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30221018548,
      "stddev": 0.008465424808239138,
      "median": 0.30215626088,
      "user": 0.18654493999999996,
      "system": 0.5687934399999999,
      "min": 0.28720643938,
      "max": 0.31592894638,
      "times": [
        0.30039877638,
        0.29622966338,
        0.29532306638,
        0.30391374538,
        0.30722964138000003,
        0.31592894638,
        0.30411251938,
        0.29930192938,
        0.31245712738000003,
        0.28720643938
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 411.0 ± 54.2 359.3 501.2 4.90 ± 0.66
pacquet@main 375.3 ± 18.4 345.1 405.2 4.48 ± 0.26
pnpr@HEAD 83.8 ± 2.6 79.4 90.8 1.00
pnpr@main 87.1 ± 5.2 79.9 97.2 1.04 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.41099407976,
      "stddev": 0.054197835469545964,
      "median": 0.39251524696000006,
      "user": 0.40795899999999996,
      "system": 0.06464326000000001,
      "min": 0.35932571246,
      "max": 0.50123515846,
      "times": [
        0.50123515846,
        0.44337293946000006,
        0.49596656646000004,
        0.36948190046,
        0.38077056146000005,
        0.40425993246,
        0.42721199046,
        0.36751487546,
        0.36080116046000005,
        0.35932571246
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.37530265215999997,
      "stddev": 0.018394726649825457,
      "median": 0.37446671846,
      "user": 0.3622935,
      "system": 0.07000236,
      "min": 0.34511790246,
      "max": 0.40520500246,
      "times": [
        0.36265368046,
        0.34511790246,
        0.36618831746,
        0.37356757546,
        0.39294655346,
        0.40520500246,
        0.39514995546000004,
        0.37826121146,
        0.37536586146,
        0.35857046146000005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08380917809636365,
      "stddev": 0.002625883167136771,
      "median": 0.08286602346000001,
      "user": 0.016473175757575755,
      "system": 0.010327660606060605,
      "min": 0.07939603646000001,
      "max": 0.09078607746000002,
      "times": [
        0.08474316446,
        0.08259005546,
        0.08313271346000001,
        0.08606012346000001,
        0.08778357646000001,
        0.08466183246000002,
        0.08206783746000001,
        0.08098906346000001,
        0.08220536446000001,
        0.08120034046,
        0.08187561646000001,
        0.08223550046000001,
        0.08178138846,
        0.08286602346000001,
        0.08094949046000001,
        0.08165274946000001,
        0.08836928446000002,
        0.09078607746000002,
        0.08548364246000001,
        0.08326252646000001,
        0.08503328846000001,
        0.08126294846000001,
        0.08370879446000001,
        0.08648154446,
        0.07939603646000001,
        0.08158543146000001,
        0.08252201846000001,
        0.08270562346000002,
        0.08243390446000001,
        0.08721662346,
        0.08758206846000001,
        0.08429228846,
        0.08678593546
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08710661371806452,
      "stddev": 0.005198124663784028,
      "median": 0.08634519846000001,
      "user": 0.019576309677419353,
      "system": 0.010362343870967738,
      "min": 0.07993589746000002,
      "max": 0.09724467046000002,
      "times": [
        0.08955550946000002,
        0.09440280146,
        0.09724467046000002,
        0.08781259146,
        0.09276126246000001,
        0.09618313846000001,
        0.09627905846000001,
        0.09170219546000001,
        0.09314647546000002,
        0.08928023346000001,
        0.09311295146000001,
        0.08671716646000001,
        0.08502902146,
        0.08237000446000001,
        0.08203179946000001,
        0.08584835746000001,
        0.08634519846000001,
        0.08091521546000001,
        0.08150921846,
        0.08090638846,
        0.08311350846000001,
        0.08056044046000001,
        0.08266267146,
        0.08368983846000001,
        0.08804007846,
        0.08332196846,
        0.07993589746000002,
        0.08249281446000001,
        0.08592062346000001,
        0.08735875946,
        0.09005516646000002
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.889 ± 0.271 4.540 5.419 1.30 ± 0.10
pacquet@main 4.750 ± 0.102 4.538 4.909 1.26 ± 0.07
pnpr@HEAD 3.758 ± 0.190 3.495 4.160 1.00
pnpr@main 3.817 ± 0.067 3.734 3.908 1.02 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.88934177774,
      "stddev": 0.2707964698974787,
      "median": 4.86877642724,
      "user": 2.7314743399999997,
      "system": 2.0508759,
      "min": 4.54020623274,
      "max": 5.419458710740001,
      "times": [
        4.54020623274,
        5.134850801740001,
        4.99210722874,
        5.419458710740001,
        4.695750585740001,
        4.75288108074,
        5.032595248740001,
        4.622052889740001,
        4.7188432247400005,
        4.984671773740001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.74953362874,
      "stddev": 0.10196638465075342,
      "median": 4.75447109224,
      "user": 2.78145574,
      "system": 2.1205646000000002,
      "min": 4.538037813740001,
      "max": 4.90896907874,
      "times": [
        4.73558868074,
        4.70240144374,
        4.66538211674,
        4.84086843774,
        4.80576078074,
        4.77335350374,
        4.90896907874,
        4.79005759174,
        4.538037813740001,
        4.73491683974
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.75776593644,
      "stddev": 0.18977667385282904,
      "median": 3.73952658324,
      "user": 1.7595016399999999,
      "system": 1.7602213,
      "min": 3.49467434874,
      "max": 4.15974994974,
      "times": [
        3.64315543274,
        3.74788919574,
        3.49467434874,
        3.91754658974,
        3.5642392947399997,
        3.69787300274,
        3.75061141374,
        3.87075616574,
        4.15974994974,
        3.73116397074
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.8174919381400003,
      "stddev": 0.06684265472892541,
      "median": 3.81180820524,
      "user": 2.16583484,
      "system": 2.1512428999999997,
      "min": 3.73359520174,
      "max": 3.90757162274,
      "times": [
        3.79182645674,
        3.8733032707399997,
        3.83178995374,
        3.90309367974,
        3.73359520174,
        3.86210189574,
        3.75890082674,
        3.73566124674,
        3.77707522674,
        3.90757162274
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13097
Testbedpacquet

🚨 1 Alert

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
isolated-linker.fresh-restore.hot-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
505.89 ms
(+74.32%)Baseline: 290.21 ms
348.25 ms
(145.26%)

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
3,178.69 ms
(+8.96%)Baseline: 2,917.40 ms
3,500.88 ms
(90.80%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,841.05 ms
(-12.95%)Baseline: 2,114.97 ms
2,537.97 ms
(72.54%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
549.21 ms
(-26.35%)Baseline: 745.73 ms
894.88 ms
(61.37%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
410.99 ms
(-7.27%)Baseline: 443.23 ms
531.87 ms
(77.27%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,694.96 ms
(+0.13%)Baseline: 2,691.37 ms
3,229.65 ms
(83.44%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,889.34 ms
(+1.95%)Baseline: 4,795.69 ms
5,754.83 ms
(84.96%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
505.89 ms
(+74.32%)Baseline: 290.21 ms
348.25 ms
(145.26%)

🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13097
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,580.50 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
362.93 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
405.59 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
87.73 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,653.72 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,686.07 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
358.91 ms
🐰 View full continuous benchmarking report in Bencher

Copilot AI review requested due to automatic review settings July 17, 2026 12:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@zkochan

zkochan commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Addressed the non-failfast resolution finding in f92693c. Add now drives concurrent selector work with FuturesOrdered, preserving selector-order warnings and errors while dropping remaining in-flight work as soon as the first selector-ordered error is available. A timeout regression verifies that a slow later selector no longer delays that failure.

Validation includes 734 package-manager tests, touched-package Clippy, formatting, and the full pre-push gate.


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

@qodo-code-review

Copy link
Copy Markdown

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

@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve lockfile-only resolution semantics

Restore the lockfile_only parameter in resolve_added_dependency and
resolve_explicit_registry_spec.

pnpm/crates/package-manager/src/add.rs [320-521]

 async fn resolve_added_dependency<'a>(
     ...
     prefix: &str,
+    lockfile_only: bool,
     dependency_groups: &[DependencyGroup],
     ...
 ) -> Result<ResolvedAddedDependency, AddError> {
     ...
-                    .resolve(package_name, false)
+                    .resolve(package_name, lockfile_only)
     ...
 }
 
 async fn resolve_explicit_registry_spec(
     ...
     pinned_version: PinnedVersion,
+    lockfile_only: bool,
     lockfile: Option<&Lockfile>,
     manifest: &PackageManifest,
     ...
 ) -> Result<Option<String>, AddError> {
     ...
-    dry_run: false,
+    dry_run: lockfile_only,
     ...
 };

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The PR unintentionally drops the lockfile_only parameter and hardcodes false in the resolution paths, which breaks the expected dry-run behavior of pnpm add --lockfile-only.

High
  • More

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

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.

@qodo-code-review

Copy link
Copy Markdown

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

@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve lockfile-only resolution semantics

Restore the lockfile_only parameter in resolve_added_dependency and
resolve_explicit_registry_spec.

pnpm/crates/package-manager/src/add.rs [320-521]

 async fn resolve_added_dependency<'a>(
     ...
     prefix: &str,
+    lockfile_only: bool,
     dependency_groups: &[DependencyGroup],
     ...
 ) -> Result<ResolvedAddedDependency, AddError> {
     ...
-                    .resolve(package_name, false)
+                    .resolve(package_name, lockfile_only)
     ...
 }
 
 async fn resolve_explicit_registry_spec(
     ...
     pinned_version: PinnedVersion,
+    lockfile_only: bool,
     lockfile: Option<&Lockfile>,
     manifest: &PackageManifest,
     ...
 ) -> Result<Option<String>, AddError> {
     ...
-    dry_run: false,
+    dry_run: lockfile_only,
     ...
 };

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The PR unintentionally drops the lockfile_only parameter and hardcodes false in the resolution paths, which breaks the expected dry-run behavior of pnpm add --lockfile-only.

High
  • More

Copilot AI review requested due to automatic review settings July 17, 2026 13:30

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 added 4 commits July 17, 2026 15:31
Share packument metadata state across selector resolutions.

Preserve selector-ordered warnings and deterministic error selection.
Preserve selector-order reporting while returning once the first ordered error is available.

Cover same-package packument fetch coalescing.
@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve lockfile-only resolution semantics

Restore the lockfile_only parameter in resolve_added_dependency and
resolve_explicit_registry_spec.

pnpm/crates/package-manager/src/add.rs [320-521]

 async fn resolve_added_dependency<'a>(
     ...
     prefix: &str,
+    lockfile_only: bool,
     dependency_groups: &[DependencyGroup],
     ...
 ) -> Result<ResolvedAddedDependency, AddError> {
     ...
-                    .resolve(package_name, false)
+                    .resolve(package_name, lockfile_only)
     ...
 }
 
 async fn resolve_explicit_registry_spec(
     ...
     pinned_version: PinnedVersion,
+    lockfile_only: bool,
     lockfile: Option<&Lockfile>,
     manifest: &PackageManifest,
     ...
 ) -> Result<Option<String>, AddError> {
     ...
-    dry_run: false,
+    dry_run: lockfile_only,
     ...
 };

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The PR unintentionally drops the lockfile_only parameter and hardcodes false in the resolution paths, which breaks the expected dry-run behavior of pnpm add --lockfile-only.

High
  • More

Copilot AI review requested due to automatic review settings July 17, 2026 13:37

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/package-manager/src/add.rs`:
- Around line 172-194: Update LatestPicker::new and all selector-resolution
paths, including resolve_added_dependency, to reuse the operation-scoped
meta_cache and fetch_locker instead of creating separate state. Ensure
lockfile_only/dry_run retains fetched metadata in memory so duplicate explicit
selectors do not refetch packuments. Add a regression test that asserts the
exact number of registry requests for implicit and duplicate explicit selectors.
🪄 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: 4ca5e858-e79d-49b9-80db-e6e697a1b988

📥 Commits

Reviewing files that changed from the base of the PR and between 9a63ae7 and e50fb14.

📒 Files selected for processing (5)
  • .changeset/pacquet-concurrent-add-resolution.md
  • .github/workflows/pacquet-ci.yml
  • pnpm/crates/package-manager/src/add.rs
  • pnpm/crates/package-manager/src/add/tests.rs
  • pnpm/crates/package-manager/src/catalog_mode.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • .changeset/pacquet-concurrent-add-resolution.md
  • .github/workflows/pacquet-ci.yml
  • pnpm/crates/package-manager/src/add/tests.rs
  • pnpm/crates/package-manager/src/catalog_mode.rs

Comment thread pnpm/crates/package-manager/src/add.rs Resolved
@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve lockfile-only resolution semantics

Restore the lockfile_only parameter in resolve_added_dependency and
resolve_explicit_registry_spec.

pnpm/crates/package-manager/src/add.rs [320-521]

 async fn resolve_added_dependency<'a>(
     ...
     prefix: &str,
+    lockfile_only: bool,
     dependency_groups: &[DependencyGroup],
     ...
 ) -> Result<ResolvedAddedDependency, AddError> {
     ...
-                    .resolve(package_name, false)
+                    .resolve(package_name, lockfile_only)
     ...
 }
 
 async fn resolve_explicit_registry_spec(
     ...
     pinned_version: PinnedVersion,
+    lockfile_only: bool,
     lockfile: Option<&Lockfile>,
     manifest: &PackageManifest,
     ...
 ) -> Result<Option<String>, AddError> {
     ...
-    dry_run: false,
+    dry_run: lockfile_only,
     ...
 };

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The PR unintentionally drops the lockfile_only parameter and hardcodes false in the resolution paths, which breaks the expected dry-run behavior of pnpm add --lockfile-only.

High
  • More

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 5ac2da1

@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve lockfile-only resolution semantics

Restore the lockfile_only parameter in resolve_added_dependency and
resolve_explicit_registry_spec.

pnpm/crates/package-manager/src/add.rs [320-521]

 async fn resolve_added_dependency<'a>(
     ...
     prefix: &str,
+    lockfile_only: bool,
     dependency_groups: &[DependencyGroup],
     ...
 ) -> Result<ResolvedAddedDependency, AddError> {
     ...
-                    .resolve(package_name, false)
+                    .resolve(package_name, lockfile_only)
     ...
 }
 
 async fn resolve_explicit_registry_spec(
     ...
     pinned_version: PinnedVersion,
+    lockfile_only: bool,
     lockfile: Option<&Lockfile>,
     manifest: &PackageManifest,
     ...
 ) -> Result<Option<String>, AddError> {
     ...
-    dry_run: false,
+    dry_run: lockfile_only,
     ...
 };

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The PR unintentionally drops the lockfile_only parameter and hardcodes false in the resolution paths, which breaks the expected dry-run behavior of pnpm add --lockfile-only.

High
  • More

Copilot AI review requested due to automatic review settings July 17, 2026 14:20

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.

@qodo-code-review

Copy link
Copy Markdown

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

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve lockfile-only resolution semantics

Restore the lockfile_only parameter in resolve_added_dependency and
resolve_explicit_registry_spec.

pnpm/crates/package-manager/src/add.rs [320-521]

 async fn resolve_added_dependency<'a>(
     ...
     prefix: &str,
+    lockfile_only: bool,
     dependency_groups: &[DependencyGroup],
     ...
 ) -> Result<ResolvedAddedDependency, AddError> {
     ...
-                    .resolve(package_name, false)
+                    .resolve(package_name, lockfile_only)
     ...
 }
 
 async fn resolve_explicit_registry_spec(
     ...
     pinned_version: PinnedVersion,
+    lockfile_only: bool,
     lockfile: Option<&Lockfile>,
     manifest: &PackageManifest,
     ...
 ) -> Result<Option<String>, AddError> {
     ...
-    dry_run: false,
+    dry_run: lockfile_only,
     ...
 };

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The PR unintentionally drops the lockfile_only parameter and hardcodes false in the resolution paths, which breaks the expected dry-run behavior of pnpm add --lockfile-only.

High
  • More

@zkochan
zkochan merged commit 2719b33 into main Jul 17, 2026
33 of 34 checks passed
@zkochan
zkochan deleted the fix-13089 branch July 17, 2026 14:55
MannXo added a commit to MannXo/pnpm that referenced this pull request Jul 17, 2026
The rebase onto main brought in tests added by pnpm#13097 that
still used the pre-refactor list_dependency_groups closure form; git's
merge kept them as-is since they didn't textually overlap with the one
test this branch had already updated. Rename them to match.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pacquet: add resolves package selectors serially, one network round trip per selector

3 participants