Skip to content

fix(resolver): settle contested children under the owner's overlay - #13830

Merged
zkochan merged 2 commits into
mainfrom
fix-13685
Aug 11, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix-13685

Conversation

@zkochan

@zkochan zkochan commented Aug 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #13685.

Resolving the same project twice could produce different pnpm-lock.yaml files. Occurrences of one package race for the children-ownership claim: a worse-ranked occurrence that arrives while the claim is vacant walks the package's children and records them, resolved under its own level's preferred-versions overlay. When the deterministically better-placed occurrence claims afterwards, recorded_children_match waved it through — the overlay was deliberately left out of RecordedChildrenContext — so whichever occurrence's walk got there first decided the lockfile.

#13714 fixed the neighbouring half of this (a re-recording now stales the other occurrences' realized children) and explicitly left the recorded_children_match early return, the arrival-order dependence itself, untouched. This PR closes that.

The recorded context now carries the overlay projected down to the names the package's child edges look the overlay up under (alias, plus the npm: / jsr: target name — the same names resolve_node_seed puts in the per-wanted resolve cache key). That projection is the whole of the overlay chain a child edge's version pick can read, so:

  • two occurrences that agree on it resolve every child edge to the same package, and the later owner keeps the standing recording as before;
  • when they disagree, the owner walks its children again and records its own answer, so the children settle on the ranked owner's, not the first arriver's.

Comparing the overlay chains instead would mean requiring identical parents, which racing occurrences never have. The re-walk stays bounded — it stops descending wherever the projections agree — unlike the full re-walk on every claim win that #13574 reverted for exponential blowup.

Verified on the issue's @teambit/[email protected] repro (single importer, nodeLinker: hoisted, autoInstallPeers, dedupePeerDependents, peersSuffixMaxLength: 1000; offline, warm cache), repeated rm -rf node_modules pnpm-lock.yaml && pnpm install --lockfile-only --ignore-scripts --offline:

distinct lockfiles resolve time peak RSS
main 2 in 8 runs, 3 in 3 runs under load (the classnames and lodash flips from the issue) 4.35 s (5.10 s under load) 1.213 GB
this PR 1 in 8 runs, 1 in 3 runs under load 5.40 s (6.30 s under load) 1.210 GB

Repeat installs against the resulting lockfile are byte-stable, so the lockfile-reuse path does not churn. Storing the projections is not measurable in peak RSS.

The ~25% resolve-time cost on that graph splits about evenly between computing the projection (paid on every owner walk) and the added walks (the fix itself) — measured by running with the projection computed but excluded from the comparison. A follow-up could thread the projection out of the seed phase, which already computes the same per-child views for the resolve cache key, instead of recomputing it. All of this is on a deliberately pathological graph (~20k packages, peer-heavy, peersSuffixMaxLength: 1000).

Known residual: an occurrence only re-walks the children it records, so a subtree that stays lazy at every level below a matching projection is not re-checked against the owner's overlay. Closing that needs the projections of a whole subtree, not one level; the repro is deterministic across every run measured here.

Not mirrored in the TypeScript CLI: children ownership, the claim ranking and children_by_id are pacquet's own machinery, with no counterpart in resolveDependencies.

Squash Commit Body

Occurrences of one package race for the children-ownership claim. A
worse-ranked occurrence that arrives while the claim is vacant walks the
package's children and records them, resolved under its own level's
preferred-versions overlay; when the deterministically better-placed
occurrence claims afterwards it kept those children, because the overlay
was left out of the recorded resolution context. Which occurrence got
there first is thread timing, so identical inputs produced different
lockfiles run to run.

Record the overlay projected down to the names the package's child edges
look up — the whole of the overlay a child's version pick can read — as
part of that context. A later owner then keeps the recording only when
its own level offers those edges the same versions, and walks them again
otherwise, so the children settle on the ranked owner's answer. The
re-walk stays bounded: it stops descending wherever the projections
agree, unlike the full re-walk on every claim win reverted in
pnpm/pnpm#13574.

Verified on the issue's @teambit/bit repro (offline, warm cache): 8
identical resolves produced 2 distinct lockfiles before and 8 identical
ones after, at ~25% more resolve time on that graph (4.4s -> 5.4s), half
of it the projection and half the added walks.

Closes pnpm/pnpm#13685.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

Written by an agent (Claude Code, claude-opus-5[1m]).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes

    • Dependency resolution is now deterministic, regardless of concurrent resolution order.
    • Prevented inconsistent dependency versions and lockfiles when packages are reached through multiple dependency paths.
    • Ensured shared dependencies respect the appropriate preferred versions for each resolution context.
    • Improved consistency when resolving dependencies with overlapping version preferences.
  • Tests

    • Added regression coverage for concurrent traversal and preferred-version resolution scenarios.

Occurrences of one package race for the children-ownership claim. A
worse-ranked occurrence that arrives while the claim is vacant walks the
package's children and records them, resolved under its own level's
preferred-versions overlay; when the deterministically better-placed
occurrence claims afterwards it kept those children, because the overlay
was left out of the recorded resolution context. Which occurrence got
there first is thread timing, so identical inputs produced different
lockfiles run to run (issue #13685).

Record the overlay projected down to the names the package's child edges
look up — the whole of the overlay a child's version pick can read — as
part of that context. A later owner then keeps the recording only when
its own level offers those edges the same versions, and walks them again
otherwise, so the children settle on the ranked owner's answer. The
re-walk stays bounded: it stops descending wherever the projections
agree, unlike the full re-walk on every claim win reverted in
#13574.

Verified on the issue's `@teambit/bit` repro (offline, warm cache): 8
identical resolves produced 2 distinct lockfiles before and 8 identical
ones after, at ~25% more resolve time on that graph (4.4s -> 5.4s), half
of it the projection and half the added walks.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings August 11, 2026 13:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c2cf7d0d-9432-4162-a17a-a79ac0f1ad6c

📥 Commits

Reviewing files that changed from the base of the PR and between da02ac3 and 53b81fc.

📒 Files selected for processing (3)
  • pnpm/crates/resolving-deps-resolver/Cargo.toml
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs
  • pnpm/crates/resolving-deps-resolver/src/tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs

📝 Walkthrough

Walkthrough

The resolver now includes preferred-version overlays in recorded-child reuse matching. Child traversal derives overlay views before reuse checks. Regression tests cover concurrent traversal and deterministic child pinning.

Changes

Deterministic dependency resolution

Layer / File(s) Summary
Overlay-aware recorded child context
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs, pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs
RecordedChildrenContext stores ChildrenOverlayView. Context matching now requires equal overlay views. Test fixtures include the new field.
Overlay-aware child walking and reuse
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs, pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/reuse.rs
Child traversal prepares child specs, derives preferred-version overlays, and rewalks children when contexts differ. Reused snapshot children use an empty overlay view.
Concurrent traversal regression coverage
pnpm/crates/resolving-deps-resolver/src/tests.rs, pnpm/crates/resolving-deps-resolver/Cargo.toml, .changeset/deterministic-contested-children.md
Tests add an overlay-aware resolver and delayed traversal. The regression test verifies deterministic shared-child pinning. Tokio enables test-util, and the changeset documents the patch release.

Estimated code review effort: 4 (Complex) | ~45 minutes

Assessment against linked issues

Objective Addressed Explanation
[#13685] Make recorded children independent of within-importer occurrence arrival order ✅
[#13685] Keep dependency resolution and pnpm-lock.yaml output deterministic ✅

Sequence Diagram(s)

sequenceDiagram
  participant Occurrence
  participant ChildSpecResolver
  participant OverlayView
  participant RecordedChildren
  participant DependencyWalker
  Occurrence->>ChildSpecResolver: prepare child specs
  Occurrence->>OverlayView: derive preferred versions
  Occurrence->>RecordedChildren: compare recorded context
  RecordedChildren-->>Occurrence: reuse or rewalk
  Occurrence->>DependencyWalker: resolve child edges when context differs
Loading

Possibly related PRs

  • pnpm/pnpm#13562: Changes the same resolver context and child-walking components.
  • pnpm/pnpm#13564: Changes Rust dependency-tree traversal and recording logic.
  • pnpm/pnpm#13714: Addresses child-edge invalidation and ownership handover in the same resolver.

Suggested labels: product: pacquet

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix resolver nondeterminism by scoping recorded children to owner overlay

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Include a projected preferred-versions overlay in the recorded-children context.
• Rewalk/record children when competing occurrences disagree on that overlay view.
• Add regression coverage and a changeset for pnpm/pnpm#13685.
Diagram

graph TD
A["walk_node_children"] --> B["owned_child_specs"] --> C["children_overlay_view"] --> D["RecordedChildrenContext"] --> E{{"recorded_children_match?"}}
E --> F["Reuse recorded children"]
E --> G["Rewalk children"] --> H["record_children (new context)"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Always rewalk children on every claim win
  • ➕ Simpler mental model (claim win always recomputes)
  • ➕ Guarantees determinism without any overlay comparison logic
  • ➖ Can trigger redundant subtree walks and node duplication
  • ➖ Historically risks exponential blowup with peer-carrying chains (see referenced issue)
2. Compare full preferred-versions overlay chains
  • ➕ Most direct correctness check (exact overlay equivalence)
  • ➖ Overlay chains are per-occurrence and include ancestor-level state, so racing occurrences virtually never match
  • ➖ Would devolve into frequent rewalks even when child-visible preferences are identical
3. Serialize children ownership with a lock (single walker)
  • ➕ Eliminates arrival-order races by design
  • ➕ Avoids computing overlay projections
  • ➖ Reduces parallelism/throughput under concurrency
  • ➖ Introduces contention hotspots and potential performance regressions on large graphs

Recommendation: Keep the PR’s overlay-projection approach: it compares exactly what child edges can observe (cache-key-equivalent inputs) while remaining bounded (only rewalk when projections differ). It delivers determinism without reintroducing the historical exponential-walk risk from always rewalking on claim wins.

Files changed (6) +476 / -200

Bug fix (3) +256 / -196
reuse.rsSeed recorded-children context with an empty overlay view for snapshots +7/-3

Seed recorded-children context with an empty overlay view for snapshots

• Extends the snapshot-based recorded children context to include an empty overlay view, documenting that pinned snapshots cannot be affected by preferred-version overlays.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/reuse.rs

walk.rsRewalk contested children when owner overlay view differs +232/-185

Rewalk contested children when owner overlay view differs

• Refactors child-spec extraction into an owner-aware helper and adds computation of a projected preferred-versions overlay view per package’s child edges. Uses that view as part of the recorded-children context so later owners only reuse recordings when their child-visible overlay preferences match; otherwise they rewalk and re-record under their own overlay.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs

workspace_ctx.rsInclude overlay projection in recorded-children context equality +17/-8

Include overlay projection in recorded-children context equality

• Adds the ChildrenOverlayView type and stores it in RecordedChildrenContext. Updates the context comparison so recordings are only considered reusable when the overlay projections match as well.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs

Tests (2) +215 / -4
tests.rsUpdate recorded-children tests for new overlay_view field +10/-4

Update recorded-children tests for new overlay_view field

• Adjusts unit test helpers and contexts to populate overlay_view, keeping existing behavior assertions intact under the expanded RecordedChildrenContext.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs

tests.rsAdd regression test for contested children ownership under different overlays +205/-0

Add regression test for contested children ownership under different overlays

• Introduces an OverlayPickResolver stub that prefers overlay-pinned versions and a new Tokio test reproducing the arrival-order race. Asserts that the final recorded children follow the ranked owner occurrence rather than the first arriver.

pnpm/crates/resolving-deps-resolver/src/tests.rs

Documentation (1) +5 / -0
deterministic-contested-children.mdAdd changeset for deterministic contested-children resolution +5/-0

Add changeset for deterministic contested-children resolution

• Introduces a patch changeset noting that concurrent resolution order no longer affects lockfile output when multiple occurrences reach the same package.

.changeset/deterministic-contested-children.md

@greptile-apps

greptile-apps Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "test(resolver): order the contested-chil..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
pnpm/crates/resolving-deps-resolver/src/tests.rs (1)

446-448: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Replace dbg! with eprintln! before the assertion.

dbg! prints on every run, including passing runs, and adds file and line noise. The code style guide asks for logging complex values with eprintln! before a non-equality assertion so the failure output is readable.

♻️ Proposed change
-    dbg!(shared_children);
+    eprintln!("SHARED CHILDREN:\n{shared_children:#?}\n");
     assert_eq!(shared_children.len(), 1);

Based on learnings, pnpm Rust tests log rendered values with eprintln! before the assertion rather than using dbg!. As per path instructions, pnpm/CODE_STYLE_GUIDE.md states "log complex values before non-equality assertions".

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

In `@pnpm/crates/resolving-deps-resolver/src/tests.rs` around lines 446 - 448, In
the test around shared_children, replace the dbg!(shared_children) diagnostic
with an eprintln! that renders the value before the existing assertions. Keep
the assertions and their order unchanged.

Sources: Path instructions, Learnings

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs (1)

533-546: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

The new overlay_view equality term has no deterministic test guarding it. produces_same_children_as gained a fourth comparison term, but the unit test never varies overlay_view, and the only test that exercises the term end to end depends on a 50 ms wall-clock sleep to create the race. If the interleaving does not occur on a loaded machine, both tests still pass with the term removed.

  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs#L533-L546: add a RecordedChildrenContext case with a non-empty overlay_view and assert recorded_children_match returns false, alongside the existing shadow-set, update-policy, and snapshot-key cases.
  • pnpm/crates/resolving-deps-resolver/src/tests.rs#L329-L330: confirm deeper_occurrences_children_are_rewalked_by_the_owner fails on the pre-fix commit, and make the intended interleaving observable so a run that misses the race fails instead of passing silently.

As per path instructions, REVIEW_GUIDE.md requires "a meaningful regression test that fails without the fix".

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

In
`@pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs`
around lines 533 - 546, The equality test around recorded_children_match must
explicitly vary overlay_view and assert a non-empty overlay view returns false;
update
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs:533-546
alongside the existing context-mismatch cases. Strengthen
deeper_occurrences_children_are_rewalked_by_the_owner at
pnpm/crates/resolving-deps-resolver/src/tests.rs:329-330 so the intended
interleaving is deterministic and the test fails when the overlay_view
comparison is removed, rather than relying on a wall-clock sleep that can miss
the race.

Source: Path instructions

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

Nitpick comments:
In
`@pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs`:
- Around line 533-546: The equality test around recorded_children_match must
explicitly vary overlay_view and assert a non-empty overlay view returns false;
update
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs:533-546
alongside the existing context-mismatch cases. Strengthen
deeper_occurrences_children_are_rewalked_by_the_owner at
pnpm/crates/resolving-deps-resolver/src/tests.rs:329-330 so the intended
interleaving is deterministic and the test fails when the overlay_view
comparison is removed, rather than relying on a wall-clock sleep that can miss
the race.

In `@pnpm/crates/resolving-deps-resolver/src/tests.rs`:
- Around line 446-448: In the test around shared_children, replace the
dbg!(shared_children) diagnostic with an eprintln! that renders the value before
the existing assertions. Keep the assertions and their order unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5023c73d-7bb7-4758-8d73-5e293283c50e

📥 Commits

Reviewing files that changed from the base of the PR and between d25c634 and da02ac3.

📒 Files selected for processing (6)
  • .changeset/deterministic-contested-children.md
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/reuse.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/tests.rs

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

qodo-code-review Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Sleep-based test flakiness ✓ Resolved 🐞 Bug ☼ Reliability
Description
The new resolver test uses a wall-clock tokio::time::sleep(50ms) to force a race ordering and
includes dbg!(...) output; under CI load the intended ordering may not reliably hold and the debug
print adds noise to test logs. This can cause intermittent failures or reduce signal when tests fail
for unrelated reasons.
Code

pnpm/crates/resolving-deps-resolver/src/tests.rs[R132-134]

+            if delayed {
+                tokio::time::sleep(Duration::from_millis(50)).await;
+            }
Relevance

●●● Strong

Team often removes dbg! and hardens flaky tests; likely to replace sleep-based ordering.

PR-#13773
PR-#13375

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test explicitly delays one branch using tokio::time::sleep(Duration::from_millis(50)), which
is nondeterministic under scheduling jitter, and prints via dbg!, which is visible in test output.

pnpm/crates/resolving-deps-resolver/src/tests.rs[91-136]
pnpm/crates/resolving-deps-resolver/src/tests.rs[445-448]

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

### Issue description
The new concurrency regression test relies on real time (`tokio::time::sleep`) to force ordering and uses `dbg!`, both of which can make CI flaky/noisy.

### Issue Context
The test is validating order-independence under concurrent resolution; it should control scheduling deterministically rather than rely on timing.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/tests.rs[91-136]
- pnpm/crates/resolving-deps-resolver/src/tests.rs[318-449]

### Suggested fix directions
- Replace the `sleep`-based delay with deterministic synchronization, e.g.:
 - Use a `tokio::sync::Notify`/`Barrier`/oneshot channel inside `OverlayPickResolver` to block the "wrap" resolution until the other branch has reached a known point.
 - Alternatively, use `tokio::time::pause()` and `advance()` to make timing deterministic (if compatible with the test runtime setup).
- Remove `dbg!(shared_children)` (or gate it behind a feature/`#[cfg(test)]` logging mechanism that doesn’t spam normal test runs).

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


2. Overlay view extra overhead 🐞 Bug ➹ Performance
Description
children_overlay_view() builds a per-package overlay projection by repeatedly traversing
PreferredVersionsOverlay and allocating/sorting version lists; with many children and/or long
overlay chains this adds avoidable CPU and allocations on the resolver hot path. This PR increases
the call frequency of PreferredVersionsOverlay::versions_for() (which does O(n) duplicate checks
per pushed version), so worst-case graphs can become noticeably slower than necessary.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[R816-819]

+            let mut versions: Vec<String> =
+                overlay.versions_for(&name).into_iter().map(str::to_string).collect();
+            if versions.is_empty() {
+                continue;
Relevance

●● Moderate

Perf concerns are sometimes accepted but often treated as speculative without benchmarks.

PR-#13431
PR-#13388

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new overlay projection is built per owned node and calls versions_for() for each lookup name,
then allocates and sorts strings; versions_for() itself walks the entire overlay chain and
performs linear duplicate checks, so the combined work can grow quickly in larger graphs.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[562-576]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[800-826]
pnpm/crates/resolving-resolver-base/src/resolve.rs[154-190]

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

### Issue description
`children_overlay_view()` repeatedly calls `PreferredVersionsOverlay::versions_for()` and then allocates `String`s and sorts them. This runs for every owned-node walk and can add significant overhead for packages with large dependency fanout or long overlay chains.

### Issue Context
- `children_overlay_view()` is used to populate `RecordedChildrenContext::overlay_view` so races settle deterministically.
- `PreferredVersionsOverlay::versions_for()` traverses the overlay chain and deduplicates via `Vec::contains`, which is O(k) per inserted version and can become expensive when called many times.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[800-826]
- pnpm/crates/resolving-resolver-base/src/resolve.rs[154-190]

### Suggested fix directions
1. **Make `PreferredVersionsOverlay::versions_for` cheaper**:
  - Replace `Vec::contains` duplicate checks with a small `HashSet<&str>` (or `FxHashSet`) alongside the output vec to keep insertion-order while making dedup ~O(1).
2. **Reduce allocations in `children_overlay_view`**:
  - Avoid converting to `String` until necessary; if you only need deterministic equality, consider collecting into an ordered set (e.g., `BTreeSet<String>`) and only materialize a sorted `Vec<String>` once.
  - Consider adding a helper on `PreferredVersionsOverlay` that can build a projection for a provided set of names in a single chain traversal, rather than calling `versions_for()` per name.
3. **Keep determinism**:
  - Ensure whatever representation you store in `ChildrenOverlayView` remains order-stable so equality checks are deterministic across runs.

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


3. Changeset omits pnpm bump 📘 Rule violation § Compliance
Description
The new changeset only declares a version bump for pacquet even though the change is described as
affecting pnpm-lock.yaml output. This can cause the pnpm release/versioning process to miss the
intended bump classification for pnpm behavior changes.
Code

.changeset/deterministic-contested-children.md[R1-3]

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

●● Moderate

Mixed history on requiring pnpm entry; recent examples show both accepted and rejected
enforcement.

PR-#13748
PR-#13745

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires changeset front-matter to include an explicit pnpm entry 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/deterministic-contested-children.md[1-3]

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

## Issue description
The new changeset does not include a `pnpm` entry, which violates the requirement to explicitly declare the pnpm package bump type.

## Issue Context
This PR changes resolver behavior that is described as affecting `pnpm-lock.yaml` determinism, which is user-visible behavior.

## Fix Focus Areas
- .changeset/deterministic-contested-children.md[1-3]

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



Informational

4. Lockfile change not cross-synced 📘 Rule violation ⌂ Architecture
Description
This PR introduces a user-visible lockfile determinism behavior change in the Rust resolver without
any corresponding change in the TypeScript resolver implementation. This risks pnpm TypeScript vs
pacquet Rust divergence unless explicitly called out or ported.
Code

.changeset/deterministic-contested-children.md[5]

+Resolution no longer depends on the order in which concurrent resolutions of the same package finish. When one package was reached from several places, whichever occurrence happened to walk it first decided the versions its dependencies were recorded at, so repeated installs of the same project could produce different `pnpm-lock.yaml` files.
Relevance

● Weak

Close precedent: TS vs Rust divergence callout suggestion explicitly rejected before.

PR-#13594

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713428 requires user-visible behavior changes (including lockfile semantics) to be
kept in sync between pnpm TypeScript and pacquet Rust, or explicitly called out as a known
divergence. The changeset text indicates a lockfile behavior change, and the repository has a
TypeScript resolveDependencyTree implementation that is not modified in this PR.

Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
.changeset/deterministic-contested-children.md[5-5]
pnpm11/installing/deps-resolver/src/resolveDependencyTree.ts[180-206]

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 user-visible lockfile behavior change is being made in the Rust resolver, but there is no matching change in the TypeScript resolver implementation and no explicit documented divergence/porting note.

## Issue Context
The repo contains a TypeScript dependency-tree resolver implementation, so changes to resolver/lockfile semantics should be mirrored across pnpm TypeScript and pacquet Rust, or explicitly called out as a known divergence with follow-up work.

## Fix Focus Areas
- .changeset/deterministic-contested-children.md[5-5]
- pnpm11/installing/deps-resolver/src/resolveDependencyTree.ts[180-206]

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


Grey Divider

Context
✅ Compliance rules (platform): 26 rules

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.07     15.9±0.68ms    23.5 MB/sec    1.00     14.9±0.82ms    25.1 MB/sec
packument/parse                                  1.00     45.3±2.59µs  1463.6 MB/sec    1.07     48.3±3.02µs  1374.0 MB/sec
tarball/download_dependency                      1.01      3.2±0.44ms  1360.2 KB/sec    1.00      3.2±0.21ms  1370.5 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.14   258.4±24.66ms 61.9 KElem/sec    1.00    226.4±7.81ms 70.7 KElem/sec
workspace_resolution/hoist_heavy                 1.02   343.0±11.86ms        ? ?/sec    1.00   335.8±11.81ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Aug 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.39024% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.23%. Comparing base (1c7ad81) to head (53b81fc).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...-deps-resolver/src/resolve_dependency_tree/walk.rs 99.38% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #13830    +/-   ##
========================================
  Coverage   88.22%   88.23%            
========================================
  Files         625      625            
  Lines      102636   102839   +203     
========================================
+ Hits        90555    90744   +189     
- Misses      12081    12095    +14     

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

`start_paused` advances the clock only once the runtime has nothing
else to run, so the delayed branch resumes after the other one has
walked and recorded rather than after a wall-clock margin that CI load
can eat. Drops the `dbg!` the scalar assertions do not need, and the
scenario prose the table and the assertions already carry.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings August 11, 2026 13:28

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 Aug 11, 2026

Copy link
Copy Markdown
Member Author

Review round-up for the four findings, addressed in 53b81fc where they were actionable.

1. Sleep-based test flakiness / dbg! — fixed. The test now runs on #[tokio::test(start_paused = true)]: the paused clock only advances once the runtime has nothing else to run, so the delayed branch resumes after the other branch has walked and recorded, rather than after a wall-clock margin CI load can eat. Ordering is now a property of the runtime, not of timing, and the test went from 55 ms to 5 ms. The dbg! is gone — the assertions are scalar, which the style guide says needs no logging. Verified the test still fails on the pre-fix comparison ([email protected] vs [email protected]).

2. Changeset omits a pnpm bump — not applicable. pnpm in a changeset means the TypeScript CLI package, and AGENTS.md says explicitly: "Do not add "pnpm" to a Rust-only changeset". The implementation here is Rust-only, so the changeset targets pacquet alone. Same reason as #13748.

3. Overlay-view overhead — real, measured, and disclosed. The projection is roughly half the ~23 % resolve-time cost reported in the PR description (measured by computing it and excluding it from the comparison); the other half is the added walks, which are the fix. workspace_resolution/hoist_heavy in the micro-benchmark shows no regression. On the specific suggestions: the per-name version lists are 1–3 entries, so swapping Vec::contains for a hash set in versions_for would not pay for itself, and a single chain traversal over a name set trades names × depth map lookups for chain entries hash lookups — no clear win when levels are wide. The bounded follow-up already noted in the description is to thread the per-child views out of the seed phase, which computes exactly these projections for the resolve cache key today.

4. Not cross-synced with the TypeScript CLI — intended. Children ownership, the claim ranking and children_by_id are pacquet's own machinery; resolveDependencyTree.ts has no counterpart to change. The PR description states this. Same call as #13594.


Written by an agent (Claude Code, claude-opus-5[1m]).

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 53b81fc

@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: 53b81fc92847

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.534 ± 0.172 2.369 2.781 1.66 ± 0.20
pacquet@main 2.496 ± 0.168 2.355 2.784 1.64 ± 0.20
pnpr@HEAD 1.609 ± 0.166 1.358 1.815 1.06 ± 0.15
pnpr@main 1.523 ± 0.151 1.357 1.699 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5339454574599998,
      "stddev": 0.17203408434716716,
      "median": 2.4713777954599996,
      "user": 1.5761179999999997,
      "system": 1.289505,
      "min": 2.36853909446,
      "max": 2.78105032646,
      "times": [
        2.75590214146,
        2.78105032646,
        2.3874220454599997,
        2.37301162246,
        2.4966942524599998,
        2.36853909446,
        2.71002382346,
        2.36880894246,
        2.6519409874599997,
        2.44606133846
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.4963724172600004,
      "stddev": 0.16753073104349217,
      "median": 2.40886257296,
      "user": 1.5386581,
      "system": 1.327722,
      "min": 2.3554866134599997,
      "max": 2.7841854094599996,
      "times": [
        2.44176983246,
        2.52394852546,
        2.7092577834599996,
        2.68032838146,
        2.3554866134599997,
        2.3590406434599998,
        2.7841854094599996,
        2.37438915146,
        2.35936251846,
        2.37595531346
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6087128493600003,
      "stddev": 0.16615709471527895,
      "median": 1.66013765596,
      "user": 1.0397523999999998,
      "system": 1.1427956000000001,
      "min": 1.35768748746,
      "max": 1.8153267374600002,
      "times": [
        1.54428064846,
        1.35768748746,
        1.8153267374600002,
        1.7242149344600002,
        1.7452637454600002,
        1.6877114964600002,
        1.45955390446,
        1.75115465646,
        1.63256381546,
        1.3693710674600001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5228488988600002,
      "stddev": 0.15075448064055888,
      "median": 1.53836727446,
      "user": 1.0600473999999998,
      "system": 1.1401763999999999,
      "min": 1.35716782146,
      "max": 1.69939793946,
      "times": [
        1.69208889246,
        1.69939793946,
        1.36349141646,
        1.6688575894600002,
        1.38193341746,
        1.62913648446,
        1.45992222746,
        1.61681232146,
        1.35716782146,
        1.35968087846
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 250.1 ± 9.4 234.9 263.5 1.00
pacquet@main 254.4 ± 8.2 239.8 270.0 1.02 ± 0.05
pnpr@HEAD 271.9 ± 4.2 267.0 278.4 1.09 ± 0.04
pnpr@main 271.1 ± 7.7 253.8 282.2 1.08 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25006593378,
      "stddev": 0.009420415448721891,
      "median": 0.24974034418000002,
      "user": 0.21310120000000002,
      "system": 0.5006881199999998,
      "min": 0.23490004118000002,
      "max": 0.26349399618,
      "times": [
        0.25935803618000003,
        0.25258294918,
        0.26117806518000003,
        0.26349399618,
        0.25099366318000005,
        0.23905906318000003,
        0.24421887718000002,
        0.23490004118000002,
        0.24638762118000002,
        0.24848702518000002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.25438328008,
      "stddev": 0.008243793112528229,
      "median": 0.25416925418,
      "user": 0.21111899999999997,
      "system": 0.52170202,
      "min": 0.23976714318000003,
      "max": 0.26996275718,
      "times": [
        0.25484426718000003,
        0.25850353018000005,
        0.25100593618,
        0.25349424118,
        0.26064578618,
        0.25294992918000003,
        0.26996275718,
        0.25707331518000004,
        0.24558589518,
        0.23976714318000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27190073318,
      "stddev": 0.0042143044725916545,
      "median": 0.27150253468,
      "user": 0.22925209999999993,
      "system": 0.5364195199999999,
      "min": 0.26695721218,
      "max": 0.27838332718000003,
      "times": [
        0.27743265918000004,
        0.27277046218,
        0.27838332718000003,
        0.26695721218,
        0.26834662118,
        0.26728081018000005,
        0.27023460718000003,
        0.27357545418,
        0.27536278218000004,
        0.26866339618
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.27106303838,
      "stddev": 0.007682695557502602,
      "median": 0.27251224668000007,
      "user": 0.24755209999999997,
      "system": 0.50781842,
      "min": 0.25384464818,
      "max": 0.28223934018,
      "times": [
        0.27890776118000005,
        0.28223934018,
        0.26693479018000005,
        0.27296634018000004,
        0.27333552318000004,
        0.27360655218,
        0.27205815318000004,
        0.26787697918000003,
        0.25384464818,
        0.26886029618
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.633 ± 0.026 2.592 2.676 1.62 ± 0.15
pacquet@main 2.630 ± 0.025 2.591 2.679 1.61 ± 0.15
pnpr@HEAD 1.630 ± 0.149 1.457 1.831 1.00
pnpr@main 1.693 ± 0.181 1.465 1.927 1.04 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6333278610599997,
      "stddev": 0.026472149152065493,
      "median": 2.63453906426,
      "user": 1.67102534,
      "system": 1.3862373000000001,
      "min": 2.59195024426,
      "max": 2.67575876226,
      "times": [
        2.59195024426,
        2.67575876226,
        2.6175117812599997,
        2.63611012026,
        2.66819934026,
        2.65049934026,
        2.63296800826,
        2.63706445226,
        2.61744534026,
        2.60577122126
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.62995339916,
      "stddev": 0.025442692645939905,
      "median": 2.63036725226,
      "user": 1.66351464,
      "system": 1.4187459,
      "min": 2.59064509726,
      "max": 2.67861492226,
      "times": [
        2.63681446326,
        2.64266114626,
        2.60220392026,
        2.62392004126,
        2.59064509726,
        2.61180807126,
        2.67861492226,
        2.62313180126,
        2.63865199426,
        2.65108253426
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6296185314600002,
      "stddev": 0.14872385400558355,
      "median": 1.60672225026,
      "user": 1.2395896400000002,
      "system": 1.3211539,
      "min": 1.45738062226,
      "max": 1.83063772426,
      "times": [
        1.52527049526,
        1.78558410426,
        1.83063772426,
        1.49007346026,
        1.6821977112600002,
        1.45738062226,
        1.53124678926,
        1.81452396326,
        1.47900310326,
        1.70026734126
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.69339986106,
      "stddev": 0.18103216658863416,
      "median": 1.69770301426,
      "user": 1.30889254,
      "system": 1.4038252999999998,
      "min": 1.46463253226,
      "max": 1.9268436152600001,
      "times": [
        1.60619028226,
        1.48358267426,
        1.76858117026,
        1.8530127032600001,
        1.89802545826,
        1.62682485826,
        1.46463253226,
        1.9268436152600001,
        1.82021932026,
        1.48608599626
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 464.7 ± 18.4 430.6 484.6 1.21 ± 0.14
pacquet@main 450.4 ± 29.7 416.8 510.2 1.18 ± 0.15
pnpr@HEAD 382.7 ± 42.3 332.3 433.5 1.00
pnpr@main 407.6 ± 34.0 365.1 458.1 1.07 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.46473960546000004,
      "stddev": 0.018425281636722933,
      "median": 0.47027861796000003,
      "user": 0.6231472600000001,
      "system": 0.74372312,
      "min": 0.43056423046000003,
      "max": 0.48455796346,
      "times": [
        0.47436256346,
        0.43056423046000003,
        0.46619467246,
        0.48455796346,
        0.47778130446,
        0.46475287346,
        0.47781093146000003,
        0.47985520046,
        0.45317298446,
        0.43834333046
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.4503873435600001,
      "stddev": 0.029661806576752485,
      "median": 0.44551099396000005,
      "user": 0.6439779599999998,
      "system": 0.70080652,
      "min": 0.41676938946000003,
      "max": 0.51022511246,
      "times": [
        0.41676938946000003,
        0.42514623346,
        0.41956545146,
        0.45946546446000003,
        0.45075388146,
        0.46400369746000003,
        0.51022511246,
        0.48236885146,
        0.43530724746,
        0.44026810646000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.38265519016,
      "stddev": 0.042306559241195314,
      "median": 0.37271991946,
      "user": 0.27611775999999993,
      "system": 0.6261218199999999,
      "min": 0.33227323646,
      "max": 0.43354886546,
      "times": [
        0.33444992346,
        0.33227323646,
        0.43354886546,
        0.34141437546,
        0.36238377046,
        0.42790852246,
        0.43139601146,
        0.42177209646,
        0.38305606846,
        0.35834903146
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.40757264326,
      "stddev": 0.033961488402325275,
      "median": 0.39539481346,
      "user": 0.30059295999999996,
      "system": 0.68108232,
      "min": 0.36505166146,
      "max": 0.45806582546,
      "times": [
        0.40124437046,
        0.37153884646,
        0.38595031346,
        0.42320358546000003,
        0.38637594346,
        0.36505166146,
        0.45806582546,
        0.45123042546000003,
        0.38954525646,
        0.44352020446
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.006 ± 0.107 1.827 2.143 4.69 ± 0.29
pacquet@main 2.130 ± 0.059 2.070 2.202 4.98 ± 0.21
pnpr@HEAD 0.461 ± 0.064 0.405 0.616 1.08 ± 0.15
pnpr@main 0.427 ± 0.014 0.405 0.443 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.0056795422,
      "stddev": 0.10666234515643902,
      "median": 2.0223720136,
      "user": 1.31304834,
      "system": 1.0468677,
      "min": 1.8269657326000002,
      "max": 2.1433950846,
      "times": [
        2.0761511946,
        2.0115949616,
        1.8898148296000001,
        1.8269657326000002,
        1.8990404166000001,
        1.9714044036000002,
        2.0807565746,
        2.1245231586,
        2.1433950846,
        2.0331490656
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.1296623129,
      "stddev": 0.0586180994677484,
      "median": 2.1238430261000003,
      "user": 1.5242204400000001,
      "system": 1.1976730999999998,
      "min": 2.0697359446,
      "max": 2.2023363906,
      "times": [
        2.0710070226,
        2.1661439916000003,
        2.1856767296,
        2.2021284896,
        2.0697359446,
        2.0722394566,
        2.2023363906,
        2.1627485956,
        2.0796690516,
        2.0849374566
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.4611739952999999,
      "stddev": 0.06448237755195685,
      "median": 0.44120495260000003,
      "user": 0.35408683999999996,
      "system": 0.7239488,
      "min": 0.4049021516,
      "max": 0.6162339056,
      "times": [
        0.4328968526,
        0.4224313976,
        0.4410855336,
        0.4049021516,
        0.4480040576,
        0.4413243716,
        0.6162339056,
        0.4460783306,
        0.5343846906,
        0.4243986616
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.42748727459999997,
      "stddev": 0.013773306000124429,
      "median": 0.4309431536,
      "user": 0.34115503999999996,
      "system": 0.7081543,
      "min": 0.4051283066,
      "max": 0.4431725226,
      "times": [
        0.4214839476,
        0.4431725226,
        0.4367252346,
        0.4051283066,
        0.4063021516,
        0.4389966406,
        0.4306824136,
        0.4312038936,
        0.4409683426,
        0.4202092926
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 347.2 ± 42.6 284.4 413.8 2.84 ± 0.39
pacquet@main 370.8 ± 34.4 328.1 441.0 3.04 ± 0.34
pnpr@HEAD 128.8 ± 6.6 116.5 142.1 1.06 ± 0.08
pnpr@main 122.1 ± 7.6 105.3 134.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.34720542812,
      "stddev": 0.04264255191107285,
      "median": 0.34068091662,
      "user": 0.33576409999999995,
      "system": 0.10527388,
      "min": 0.28441902862,
      "max": 0.41379628962000004,
      "times": [
        0.28441902862,
        0.39687774362000006,
        0.38336906962,
        0.34717809462000004,
        0.30865280462,
        0.30940240262,
        0.32332944062,
        0.41379628962000004,
        0.33418373862,
        0.37084566862
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.37076713962,
      "stddev": 0.034351530312290574,
      "median": 0.36630893662,
      "user": 0.3552194,
      "system": 0.11300878,
      "min": 0.32811512962,
      "max": 0.44095318862000005,
      "times": [
        0.38574481262000004,
        0.32811512962,
        0.36227875662000003,
        0.36603000262,
        0.33434144462000004,
        0.33748536862,
        0.44095318862000005,
        0.36658787062000003,
        0.38566567362000004,
        0.40046914862000005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.1288316033342857,
      "stddev": 0.006557388805911507,
      "median": 0.12819852062,
      "user": 0.04312465238095237,
      "system": 0.02162233238095238,
      "min": 0.11650943462000002,
      "max": 0.14210766662000002,
      "times": [
        0.13285975362000002,
        0.13457969962000002,
        0.12785215962000002,
        0.13663909362,
        0.13416950462000002,
        0.12486664162000002,
        0.12403020062000002,
        0.11650943462000002,
        0.12681888862000001,
        0.12295696462000001,
        0.13300449662000002,
        0.14210766662000002,
        0.13184734262,
        0.12352804662000001,
        0.12317522462000001,
        0.13203191962000002,
        0.12313888562000001,
        0.12819852062,
        0.11816997262000001,
        0.13255213762,
        0.13642711562
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.12206334146615384,
      "stddev": 0.007616015416981321,
      "median": 0.12418074812000002,
      "user": 0.0412920076923077,
      "system": 0.016677303076923073,
      "min": 0.10527538262000001,
      "max": 0.13397596162,
      "times": [
        0.10702879562,
        0.10527538262000001,
        0.12417355962000001,
        0.11086923062000001,
        0.12566858762000002,
        0.13397596162,
        0.12407866162000002,
        0.12029158762000002,
        0.12877596362000002,
        0.11284915962000001,
        0.12440282062000002,
        0.12148184362000002,
        0.12436403762,
        0.11636060462000002,
        0.12811365062000002,
        0.11252587162000001,
        0.13256946962000002,
        0.12436513962000001,
        0.13053464762,
        0.12224685162000001,
        0.12604775062,
        0.12917479362,
        0.11791704862,
        0.12418793662000001,
        0.11722326462000002,
        0.12914425662
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.649 ± 0.311 1.174 2.263 1.13 ± 0.27
pacquet@main 1.460 ± 0.217 1.230 1.854 1.00
pnpm@HEAD 5.823 ± 0.477 5.170 6.482 3.99 ± 0.68
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.6487654686355557,
      "stddev": 0.31105035217684074,
      "median": 1.6011321870800002,
      "user": 1.6629376688888888,
      "system": 0.2534747711111111,
      "min": 1.1737954800800001,
      "max": 2.26325672208,
      "times": [
        1.1737954800800001,
        1.4134561630800002,
        2.26325672208,
        1.8401019810800001,
        1.5376195640800001,
        1.46605694008,
        1.75449200108,
        1.6011321870800002,
        1.7889781790800001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.4598063016355556,
      "stddev": 0.21662167287612394,
      "median": 1.42182799908,
      "user": 1.482655891111111,
      "system": 0.24857210444444444,
      "min": 1.2304011810800002,
      "max": 1.8541599180800001,
      "times": [
        1.8541599180800001,
        1.6747505030800003,
        1.61939792708,
        1.4868348500800002,
        1.2834507880800001,
        1.2304011810800002,
        1.29593168308,
        1.27150186508,
        1.42182799908
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 5.823309111191111,
      "stddev": 0.47691304872976437,
      "median": 5.83420219908,
      "user": 8.926150557777778,
      "system": 0.48045577111111104,
      "min": 5.17044929508,
      "max": 6.48227241008,
      "times": [
        5.83420219908,
        5.68556210008,
        5.17044929508,
        6.32465290708,
        5.8591537780800005,
        6.48227241008,
        6.28438001708,
        5.59643810508,
        5.17267118908
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.927 ± 0.285 4.515 5.542 1.39 ± 0.08
pacquet@main 4.561 ± 0.189 4.420 4.864 1.29 ± 0.06
pnpr@HEAD 3.543 ± 0.083 3.450 3.685 1.00 ± 0.03
pnpr@main 3.532 ± 0.063 3.459 3.643 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.9266563661,
      "stddev": 0.2846297536434879,
      "median": 4.8990537317000005,
      "user": 2.91363934,
      "system": 2.09453886,
      "min": 4.5152032107,
      "max": 5.5423304187,
      "times": [
        5.5423304187,
        4.9015714207,
        4.8965360427,
        4.8016417197,
        4.8876727217,
        5.0231323607,
        5.0330796557,
        5.0814990747,
        4.5838970357,
        4.5152032107
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.5610279143,
      "stddev": 0.18909618689923138,
      "median": 4.4539463781999995,
      "user": 1.77082434,
      "system": 1.38004696,
      "min": 4.4204300357,
      "max": 4.8638031417,
      "times": [
        4.4575957237,
        4.4387666317,
        4.4300777287,
        4.4737863787,
        4.4204300357,
        4.8520630287,
        4.8638031417,
        4.4416319237,
        4.4502970327,
        4.7818275177
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5425512194,
      "stddev": 0.08349798645052497,
      "median": 3.5211080877,
      "user": 1.1782311399999998,
      "system": 1.20683006,
      "min": 3.4497905737,
      "max": 3.6848208487000003,
      "times": [
        3.4705942747,
        3.4964845507,
        3.5073414567,
        3.6848208487000003,
        3.4497905737,
        3.5355880097,
        3.4669502197,
        3.5348747187000003,
        3.6586153717,
        3.6204521697
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5320939873,
      "stddev": 0.062548488607984,
      "median": 3.5169285662,
      "user": 1.20545934,
      "system": 1.22309896,
      "min": 3.4590347007,
      "max": 3.6426279187,
      "times": [
        3.6426279187,
        3.6051823147,
        3.4877431607,
        3.4750829977,
        3.4590347007,
        3.5357206777,
        3.4770567657,
        3.5698631557000002,
        3.5704917267000003,
        3.4981364547
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13830
Testbedpacquet

🚨 1 Alert

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
isolated-linker.peer-heavy-resolve.hot-cache.offlineLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
1,173.80 ms
(+56.63%)Baseline: 749.43 ms
899.31 ms
(130.52%)

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,591.95 ms
(-4.37%)Baseline: 2,710.45 ms
3,252.54 ms
(79.69%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,826.97 ms
(+0.14%)Baseline: 1,824.49 ms
2,189.39 ms
(83.45%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
430.56 ms
(-8.65%)Baseline: 471.36 ms
565.63 ms
(76.12%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
284.42 ms
(+19.28%)Baseline: 238.46 ms
286.15 ms
(99.40%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,368.54 ms
(-3.62%)Baseline: 2,457.56 ms
2,949.07 ms
(80.31%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,515.20 ms
(-0.87%)Baseline: 4,554.92 ms
5,465.91 ms
(82.61%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
234.90 ms
(-21.02%)Baseline: 297.41 ms
356.89 ms
(65.82%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
🚨 view alert (🔔)
1,173.80 ms
(+56.63%)Baseline: 749.43 ms
899.31 ms
(130.52%)

🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit d37f5c2 into main Aug 11, 2026
34 of 35 checks passed
@zkochan
zkochan deleted the fix-13685 branch August 11, 2026 14:16
zkochan added a commit that referenced this pull request Aug 11, 2026
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.

Single-importer resolution is nondeterministic: recorded children depend on occurrence arrival order

3 participants