Skip to content

perf(resolver): build the children SCC table once per hoist round - #16348

Merged
zkochan merged 32 commits into
mainfrom
claude/determined-allen-wjiv3n-followups
Oct 1, 2026
Merged

zkochan merged 32 commits into
mainfrom
claude/determined-allen-wjiv3n-followups

Conversation

@KSXGitHub

@KSXGitHub KSXGitHub commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two follow-ups to #16345 in the peer resolver. Base is main; the commit list still shows the base PR's own commits, which main carries as the squash a949da4. The diff against main is 27 files (+365, -332): the two changes below, their tests, a changeset and a one-line clippy fix.

1. Build the children SCC table once per discovery tree view

  • Before: every peer-hoist discovery pass created a Walker, and each walker rebuilt the children-graph SCC table behind the canonical cycle gate on first use. One pass per importer per hoist round meant hundreds of rebuilds of the same table per round: 19 percent of the CPU time and 3.3 million allocations of the peer-heavy profile behind perf(resolver): share package ids across the walk and the peer pass #16345.
  • Now: the table lives on PeerDiscoveryCaches, in a new CanonicalCycleGate next to the canonical back-edge occurrences of the same gate, and every walker over one tree view shares it. The final peer pass starts from fresh caches and builds it once, as before.
  • Invariant: the table is a function of the view's children_by_id, so it must never outlive the view it was built from. The cell is private; CanonicalCycleGate::table is the only way to fill it, from the tree it is given, and it stamps the table with the engine's view generation. That generation is a ViewGeneration newtype whose only operations are advance and equality: PeerHoistDiscovery advances it whenever it refreshes or rebuilds its view, and a read under a different generation rebuilds the table, so nothing depends on remembering to drop it.
  • Tests: three unit tests run the gate on a mutual dependency (one SCC, exactly the edge back to its canonically first member cut; one table per view generation, rebuilt from the current view under a newer one) and the engine through a hoist round that installs a dependency cycle (the refreshed gate knows the cycle, and the round's walk over it completes). Each test was checked to fail, on the assertion that names the break, under a gate that ignores the generation, a gate that never caches, an engine that keeps its generation, a gate that cuts the wrong edge, and an SCC pass that finds no cycles.
  • Also: the provider-children index and the peer names it was built under, which the walker already refreshed together, are one PeerProviderIndex on the same caches, with the peer names private to it.

2. Drop the unread ancestor ids of lazy children

  • TreeChildren::Lazy carried an AncestorIds chain meant for a per-occurrence cycle break. The peer walk's cycle break is the canonical SCC gate (Walker::cuts_cycle_edge), which cuts the same edges at every occurrence, and nothing read the chain: base_ids and appended_ids had no callers.
  • Removed: AncestorIds (public type), the node_parent_ids_by_id map and the remember_node_parent_ids and lazy_children helpers in the dependency walk, the chain fields on the peer walk's realization and deferred-child state, and the undo state that restored the chain. Lazy is a unit variant; the ownership handover flips non-owner occurrences to lazy directly, without collecting their chains under a second lock.
  • Behavior is unchanged: the gate decided the edges before and decides them now. Test fixtures were updated for the unit variant; no assertion changed. The files this PR touches import TreeChildren instead of spelling out crate::resolved_tree::TreeChildren at each use.

Not in this PR

A CI benchmark for the lockfile-reuse resolution path. It needs a fixture-backed wanted lockfile built through pnpm-package-manager, which is a benchmark-harness change of its own.

Measurements

One machine, idle, three runs each of micro-benchmark --full-workspace-resolution (331 importers, 5,000 packages) plus the CI criterion group. "Base" is the head of #16345 at the time.

scenario base with change 1 with changes 1 and 2
plain shape (dependency walk alone) 0.44 / 0.50 / 0.45 s 0.47 / 0.41 / 0.42 s 0.49 / 0.49 / 0.45 s
peer-heavy shape 2.94 / 2.94 / 2.61 s 1.80 / 1.69 / 2.04 s 2.08 / 1.82 / 1.70 s
hoist-heavy shape 4.25 / 3.94 / 3.71 s 2.87 / 2.90 / 3.03 s 3.21 / 2.76 / 2.86 s
whole run (real) 7.78 / 7.51 / 6.90 s 5.27 / 5.12 / 5.63 s 5.92 / 5.21 / 5.14 s
workspace_resolution/hoist_heavy (criterion) 549.0 ± 42.4 ms 480.1 ± 19.1 ms 477.8 ± 15.5 ms

Change 1 takes 26 to 39 percent off the two peer shapes on that machine; change 2 moves no measured time. CI's own micro-benchmark, main against the PR on one runner, has varied between heads: one run showed the criterion group unchanged (318 ms against 324 ms), a later run showed it 17 percent faster (252 ms against 209 ms). CI does not run the full-size peer shapes.

Verification

Run locally on the merged tree: pinned rustfmt, taplo format --check, typos, cargo check, cargo clippy -- -D warnings, cargo doc with -D warnings and private items (with and without --all-features), cargo dylint, cargo deny check; pnpm test:rust -p pnpm-resolving-deps-resolver 429 passed; pnpm test:rust-affected 1,315 passed, 1 skipped, smoke profile 23 passed. Main was merged up to 2f41427 with chore(git) commits; the squash of #16345 made this branch's resolver files conflict once, each was resolved to this branch's version, and the crate's diff against main was checked byte-identical to the diff against the previous base. The branch briefly carried its own split of deploy/target.rs below the 400-line file limit; main's #16480 made the same split, and the merge takes main's version, so the CLI crate is identical to main.

Squash Commit Body

Two follow-ups of the package-id sharing in the resolver.

Build the children SCC table once per discovery tree view. Every
peer-hoist discovery pass creates a Walker, and every walker built the
children-graph SCC table behind the canonical cycle gate from scratch
on first use: with one pass per importer per hoist round, the same
table was rebuilt hundreds of times per round (19 percent of the CPU
time and 3.3 million allocations of the peer-heavy profile behind
pnpm/pnpm#16345). The table is a function of the tree view's
children_by_id, so it now lives on PeerDiscoveryCaches as part of
CanonicalCycleGate, next to the canonical back-edge occurrences of the
same gate, and every walker over one view shares it. The cell is
private: CanonicalCycleGate::table fills it from the tree it is given
and stamps it with the engine's ViewGeneration, a newtype that only
advances and compares equal, which PeerHoistDiscovery advances whenever
it refreshes or rebuilds its view, so a read under a different
generation rebuilds the table and a stale one cannot be served. The
provider-children index and the peer names it was built under,
refreshed together already, are one PeerProviderIndex on the same
caches. The final peer pass starts from fresh caches and builds the
table once, as before. Unit tests run the gate on a mutual dependency
and the engine through a hoist round that installs a cycle. On the
profiling machine the peer-heavy and hoist-heavy shapes of the
full-size scenario drop by 39 and 26 percent.

Drop the unread ancestor ids of lazy children. TreeChildren::Lazy
carried an AncestorIds chain for a per-occurrence cycle break the peer
walk does not perform: its cycle break is the canonical SCC gate
(Walker::cuts_cycle_edge), which cuts the same edges at every
occurrence, and nothing read the chain. The walk still built it for
every lazy node, kept a copy per node in node_parent_ids_by_id for the
ownership handover, and the peer walk pushed a new one per lazy
realization and per previewed provider child. Lazy is now a unit
variant; the per-node map, the chain fields of the realization state
and the undo state that restored the chain are gone, and the handover
flips non-owner occurrences to lazy directly. AncestorIds leaves the
crate's public surface. Behavior is unchanged: the gate decided the
edges before and decides them now.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW

Checklist

  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version. (pnpm v12 resolver performance
    and cleanup only.)
  • 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. (The resolver, package-manager and smoke suites
    cover both changes; fixtures were updated for the unit Lazy variant,
    no assertion changed; three unit tests cover the cycle gate and the
    engine's refresh of it, each checked against a broken implementation.)

Written by an agent (Claude Code, Claude Fable 5.1).

🤖 Generated with Claude Code

https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW


Generated by Claude Code

Profiling a 331-importer, 5,000-package workspace resolution (perf and
heaptrack on the micro-benchmark's --full-workspace-resolution runner)
put 35 percent of the CPU time in the allocator and 13 percent in memcmp.
Almost all of it came from copying immutable identity strings: the
dependency walk cloned the whole ancestor-id Vec<String> for every node
it seeded (7.5 million of the run's 42 million allocations), copied the
package id into every DirectDep, tree node and children-owner claim, and
the peer walk re-rendered each package's name and version on every visit
and pushed a fresh String onto its ancestor chain per node.

Every holder of a pkgIdWithPatchHash now shares the package table's own
Arc<str>: ancestor chains are Arc<Vec<Arc<str>>>, DirectDep::id,
PendingNodeIdentity::id and the provider index carry the shared id,
register_seeded_package and register_reused_package hand it back, and
the tree, children and owner maps clone the pointer where they used to
re-allocate. ResolvedPackage gains name and version, rendered once by
ResolvedPackage::new, and the peer walk reads them instead of calling
pkg_name_version per visit; its chains and caches are keyed by the same
Arc<str>. Content-based hashing and ordering are unchanged, so lockfile
output is identical.

Measured on the same machine, idle, three runs each: the plain shape of
the full-size scenario (the dependency walk alone) drops from 0.88 s to
0.45 s, the peer-heavy and hoist-heavy shapes by 12 percent, and the CI
group workspace_resolution/hoist_heavy from 596 ms to 549 ms.

A representation study on the fixture lockfile's keys (String, Arc<str>,
string_cache atoms, smol_str) showed that a global interner would cost 2
to 3 times more on construction, 2 to 3 times more under concurrent
construction and 5 to 6 times more on borrowed-text lookups, for an
equality speedup the resolver does not need once its comparisons hit
Arc's pointer-equality fast path. No new dependency is introduced.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
…view

Every peer-hoist discovery pass created a Walker, and every Walker built
the children-graph SCC table behind the canonical cycle gate from scratch
on first use. With one pass per importer per hoist round, the same table
was recomputed hundreds of times per round: 19 percent of the CPU time
and 3.3 million of the allocations of the peer-heavy full-workspace
resolution profiled for #16345.

The table is a pure function of the tree view's children_by_id, which
only changes when the discovery engine refreshes its view between
rounds. It now lives on PeerDiscoveryCaches, next to the canonical
back-edge occurrences that belong to the same gate, so every walker of
one round shares it, and the engine drops it whenever it re-syncs or
rebuilds the view. A walker over fresh caches (the final peer pass)
still builds it once, as before.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
TreeChildren::Lazy carried an AncestorIds chain, documented as the input
of a per-occurrence cycle break the peer walk would apply when it
expanded the node's children. That cycle break lives in the canonical
SCC gate (Walker::cuts_cycle_edge), which cuts the same edges at every
occurrence, and nothing reads the chain: AncestorIds::base_ids and
appended_ids have no callers. The walk still built the chain for every
lazy node it inserted, kept a copy per node in node_parent_ids_by_id so
an ownership handover could rebuild it, and the peer walk pushed a new
one per lazy realization and per previewed provider child.

Lazy is now a unit variant, the per-node chain map and the realization
undo state that restored the chain are gone, and the ownership handover
flips non-owner occurrences to lazy directly. Behavior is unchanged: the
gate decided the edges before and decides them now.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
The release note for the cached children SCC table, which lands with
the same pull request as the cache itself.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
With its ancestor chain gone, LazyProviders is no longer consumed by
lazy_provider_children, which clippy's needless_pass_by_value reports.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration

Configuration used: Repository: pnpm/pnpm/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 03c129c4-6bc4-4319-bf07-0ac099e4cc30

📥 Commits

Reviewing files that changed from the base of the PR and between 5edce86 and 0b46981.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: pnpm/pnpm/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: f2ac8937-33f8-4ee6-b506-d03a80d8c403

📥 Commits

Reviewing files that changed from the base of the PR and between 2cf8173 and 5edce86.

📒 Files selected for processing (4)
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/cache.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/discovery.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/discovery/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolved_tree.rs
💤 Files with no reviewable changes (1)
  • pnpm/crates/resolving-deps-resolver/src/resolve_peers/cache.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The resolver removes ancestor IDs from lazy dependency-tree nodes and deferred peer-walk data. Peer discovery now shares a cached SCC table and canonical back-edge nodes across peer-hoisting rounds.

Changes

Peer cycle resolution

Layer / File(s) Summary
Lazy tree contract and ownership
pnpm/crates/resolving-deps-resolver/src/resolved_tree.rs, lib.rs, resolve_dependency_tree/..., pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests/resolution.rs
TreeChildren::Lazy is now a unit variant. Dependency-tree ownership, reuse, and walking no longer store parent IDs. Associated tests use the updated variant.
Peer-walk child data
pnpm/crates/resolving-deps-resolver/src/resolve_peers/walker/..., pnpm/crates/resolving-deps-resolver/src/resolve_peers/cache.rs
Discovery child edges and deferred-child contexts no longer carry ancestor IDs. The missing-peer alias filter uses the child edges directly.
Shared cycle gate and realization
pnpm/crates/resolving-deps-resolver/src/resolve_peers/{discovery.rs,cache.rs,walker.rs}, resolve_peers/cache/*, resolve_peers/tests/*, pnpm/crates/resolving-deps-resolver/src/tests/peers/behavior.rs, .changeset/cache-children-cycle-table.md
The SCC table and canonical back-edge nodes are held in CanonicalCycleGate. Child realization uses that gate instead of parent-chain cycle state. Tests cover cycle identification, cache reuse and refresh, and peer walking. The changeset describes reduced cycle-table recomputation during peer-hoisting rounds.

Priority: ➖ Normal

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

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant PeerHoistDiscovery
  participant CanonicalCycleGate
  participant Walker
  PeerHoistDiscovery->>CanonicalCycleGate: Advance view generation after tree refresh
  Walker->>CanonicalCycleGate: Read or rebuild SCC table for current generation
  Walker->>CanonicalCycleGate: Read or store canonical back-edge node
Loading

Suggested labels: product: pacquet

Merge Risk: ⚪ Minimal · up to 5edce

The change reduces repeated cycle-table computation and removes unused ancestry metadata. No concrete merge-blocking issue is established; merge after normal checks pass.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 5edce

The reviewed paths preserve protections against cyclic dependency inputs and refresh cached decisions when inputs change. No introduced security issue was identified, but compatibility with external consumers and broader security coverage remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Dependency metadata can influence graph traversal and resolved dependency output across importers sharing a discovery view. The inspected change affects that resolution scope; it does not demonstrate a new cross-service privilege transition. External uses of the exported tree contract remain outside the available coverage.

Trust Boundaries and Controls

  • inferred — For attacker-influenced cyclic package graphs, the inspected control remains canonical SCC filtering rather than occurrence ancestry. Lazy realization, provider matching, deferred traversal, and final back-edge resolution consume that control. Moving its table into shared storage did not reveal a bypass in those paths.

Resilience and Maintainability Implications

  • observed — Supported realization undo paths remove newly inserted nodes and associated per-node state, then restore the parent to Lazy. Canonical back-edge reuse checks that its node still exists. Realization changes occurrence nodes rather than children_by_id, so these temporary mutations do not invalidate the SCC table. The inspected flow is synchronous and mutably owned; no separate panic-resume contract was established.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     13.4±0.11ms    27.9 MB/sec    1.04     13.9±0.76ms    26.9 MB/sec
packument/parse                                  1.01     46.3±0.34µs  1431.7 MB/sec    1.00     45.7±1.07µs  1450.8 MB/sec
tarball/download_dependency                      1.03      4.9±0.21ms   881.2 KB/sec    1.00      4.8±0.37ms   906.4 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    235.8±4.21ms 67.9 KElem/sec    1.07    252.1±4.50ms 63.5 KElem/sec
version_pick/repeated_ranges_file                1.00      4.8±0.16ms  6.5 KElem/sec    1.02      4.9±0.12ms  6.4 KElem/sec
version_pick/repeated_ranges_raw                 1.00      4.8±0.20ms  6.5 KElem/sec    1.02      4.9±0.11ms  6.4 KElem/sec
workspace_resolution/hoist_heavy                 1.03    256.9±3.53ms        ? ?/sec    1.00   249.2±15.39ms        ? ?/sec
workspace_sort/chained_projects                  1.00     16.8±1.85ms        ? ?/sec    1.02     17.2±1.74ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.19%. Comparing base (2f41427) to head (0b46981).

Files with missing lines Patch % Lines
...resolve_dependency_tree/reuse/snapshot_children.rs 80.00% 1 Missing ⚠️
...ver/src/resolve_dependency_tree/walk/level_walk.rs 85.71% 1 Missing ⚠️
...ependency_tree/workspace_ctx/children_ownership.rs 90.90% 1 Missing ⚠️
...esolving-deps-resolver/src/resolve_peers/walker.rs 85.71% 1 Missing ⚠️
...rates/resolving-deps-resolver/src/resolved_tree.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16348      +/-   ##
==========================================
- Coverage   92.20%   92.19%   -0.01%     
==========================================
  Files        1526     1526              
  Lines      205424   205390      -34     
==========================================
- Hits       189409   189369      -40     
- Misses      16015    16021       +6     

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

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

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Same-run regression check

HEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval.

Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2386.36 ms 2396.92 ms 0.4% 119.32 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1488.55 ms 1483.38 ms -0.3% 74.43 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 317.35 ms 320.16 ms 0.9% 15.87 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 370.91 ms 380.43 ms 2.6% 18.55 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 10.83 ms 12.29 ms 13.5% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 11.25 ms 11.87 ms 5.5% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 8.27 ms 15.94 ms 92.7% 2.00 ms Inconclusive (overlapping samples)
isolated-repeat-install-cold-cache-hot-store pnpr 8.34 ms 8.16 ms -2.2% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2671.98 ms 2672.23 ms 0.0% 133.60 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1594.71 ms 1530.17 ms -4.0% 79.74 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 492.25 ms 477.58 ms -3.0% 24.61 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 329.93 ms 309.58 ms -6.2% 16.50 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1646.93 ms 1825.61 ms 10.8% 82.35 ms Inconclusive (overlapping samples)
isolated-fresh-install-cold-cache-hot-store pnpr 319.18 ms 294.58 ms -7.7% 15.96 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 248.40 ms 246.47 ms -0.8% 12.42 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 113.72 ms 96.89 ms -14.8% 5.69 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 236.39 ms 243.56 ms 3.0% 11.82 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 206.00 ms 210.20 ms 2.0% 10.30 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4658.78 ms 4512.85 ms -3.1% 232.94 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3650.20 ms 3572.68 ms -2.1% 182.51 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 134.65 ms 143.95 ms 6.9% 6.73 ms Inconclusive (overlapping samples)
gvs-fresh-restore-hot-cache-hot-store pnpr 154.41 ms 143.75 ms -6.9% 7.72 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: 0b4698169b2c

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

The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.457 ± 0.188 2.266 2.815 1.65 ± 0.19
pacquet@main 2.390 ± 0.106 2.271 2.595 1.60 ± 0.16
pnpr@HEAD 1.514 ± 0.134 1.319 1.737 1.02 ± 0.13
pnpr@main 1.490 ± 0.131 1.320 1.704 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.45651057006,
      "stddev": 0.18806967451729864,
      "median": 2.39692307006,
      "user": 1.56568688,
      "system": 1.5125753599999998,
      "min": 2.2656074035600002,
      "max": 2.81498880956
    },
    {
      "command": "pacquet@main",
      "mean": 2.3904360067600003,
      "stddev": 0.10572093124949684,
      "median": 2.38635587006,
      "user": 1.44205388,
      "system": 1.43297476,
      "min": 2.27098795656,
      "max": 2.59527126156
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.51393733546,
      "stddev": 0.1335456708006067,
      "median": 1.48337899656,
      "user": 1.4396016799999998,
      "system": 1.5293484600000002,
      "min": 1.3188095415599999,
      "max": 1.73660777456
    },
    {
      "command": "pnpr@main",
      "mean": 1.4895392044599998,
      "stddev": 0.13129906065862051,
      "median": 1.48854981606,
      "user": 1.5062842799999996,
      "system": 1.43245336,
      "min": 1.3199216915599998,
      "max": 1.70437642256
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 320.1 ± 15.4 289.3 343.4 1.00
pacquet@main 321.4 ± 14.4 307.3 349.5 1.00 ± 0.07
pnpr@HEAD 386.2 ± 40.2 336.1 430.9 1.21 ± 0.14
pnpr@main 364.8 ± 17.4 336.1 383.6 1.14 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.32011679032,
      "stddev": 0.015387460160098615,
      "median": 0.32016347372,
      "user": 0.38405249999999996,
      "system": 0.79276988,
      "min": 0.28933992822,
      "max": 0.34343195922
    },
    {
      "command": "pacquet@main",
      "mean": 0.32142630542000006,
      "stddev": 0.014392210270111509,
      "median": 0.31735271672,
      "user": 0.3643640999999999,
      "system": 0.82638688,
      "min": 0.30727795522,
      "max": 0.34952039222
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.38617124862,
      "stddev": 0.04021244235171656,
      "median": 0.38043348522,
      "user": 0.4283118999999999,
      "system": 0.9437237799999998,
      "min": 0.33607782622,
      "max": 0.43094168922000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.36483858051999996,
      "stddev": 0.017374520194790067,
      "median": 0.37091124622,
      "user": 0.4038653,
      "system": 0.8638785800000001,
      "min": 0.33612295822,
      "max": 0.38360121322
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 12.9 ± 2.1 10.5 22.4 1.16 ± 0.26
pacquet@main 11.1 ± 1.7 7.9 17.7 1.00
pnpr@HEAD 11.9 ± 2.3 8.0 21.9 1.08 ± 0.26
pnpr@main 11.5 ± 1.6 9.1 18.8 1.04 ± 0.21
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.012880828288421053,
      "stddev": 0.0021325355782682892,
      "median": 0.01229249502,
      "user": 0.006996229473684208,
      "system": 0.007047030526315791,
      "min": 0.01048757252,
      "max": 0.022361614520000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.01107322846146342,
      "stddev": 0.0017198031419848575,
      "median": 0.010833071520000001,
      "user": 0.006390893658536586,
      "system": 0.005549599999999998,
      "min": 0.00786630152,
      "max": 0.017702702520000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.0119402027442647,
      "stddev": 0.0022512113298440634,
      "median": 0.011865520519999999,
      "user": 0.006815560588235291,
      "system": 0.006125795588235299,
      "min": 0.00804471752,
      "max": 0.021927053520000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.011530764200272109,
      "stddev": 0.001553677099772894,
      "median": 0.011248438520000001,
      "user": 0.007096642721088432,
      "system": 0.005427994557823129,
      "min": 0.00913421052,
      "max": 0.01882103552
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 15.5 ± 4.1 7.6 25.8 1.81 ± 0.54
pacquet@main 8.6 ± 1.1 7.3 14.8 1.01 ± 0.19
pnpr@HEAD 8.5 ± 1.2 7.4 14.4 1.00
pnpr@main 8.8 ± 1.5 7.3 15.4 1.03 ± 0.22
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.015471475480740744,
      "stddev": 0.004100628514452825,
      "median": 0.01593802214,
      "user": 0.008055927999999999,
      "system": 0.00890698444444444,
      "min": 0.007627861140000001,
      "max": 0.02575985214
    },
    {
      "command": "pacquet@main",
      "mean": 0.008609418846349212,
      "stddev": 0.0011257672838272865,
      "median": 0.008270972640000002,
      "user": 0.004836237619047619,
      "system": 0.004768256746031745,
      "min": 0.007322192140000001,
      "max": 0.014762994140000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.008536631947843144,
      "stddev": 0.0011600661023688954,
      "median": 0.00815890214,
      "user": 0.0044340170980392175,
      "system": 0.005050336862745098,
      "min": 0.007448138140000001,
      "max": 0.01435005014
    },
    {
      "command": "pnpr@main",
      "mean": 0.008809582542010055,
      "stddev": 0.0014691551627135572,
      "median": 0.008341901140000002,
      "user": 0.004792502110552765,
      "system": 0.005030227135678394,
      "min": 0.0072636461400000015,
      "max": 0.015371070140000002
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.698 ± 0.116 2.634 3.021 1.73 ± 0.13
pacquet@main 2.664 ± 0.031 2.619 2.708 1.70 ± 0.11
pnpr@HEAD 1.564 ± 0.100 1.430 1.805 1.00
pnpr@main 1.608 ± 0.091 1.491 1.749 1.03 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6984192924999997,
      "stddev": 0.11597319605479951,
      "median": 2.6722254053,
      "user": 2.4858232599999996,
      "system": 1.9115951,
      "min": 2.6338221268,
      "max": 3.0209292698
    },
    {
      "command": "pacquet@main",
      "mean": 2.6642691415999997,
      "stddev": 0.03100468947780665,
      "median": 2.6719777118000003,
      "user": 2.37868266,
      "system": 1.8483011999999994,
      "min": 2.6187810538,
      "max": 2.7082473568
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5638149359,
      "stddev": 0.10029698690564627,
      "median": 1.5301690632999998,
      "user": 1.4549001599999998,
      "system": 1.5722300999999999,
      "min": 1.4301760527999998,
      "max": 1.8051966477999999
    },
    {
      "command": "pnpr@main",
      "mean": 1.6082356498,
      "stddev": 0.09080477490761915,
      "median": 1.5947134938,
      "user": 1.5102761599999999,
      "system": 1.5834350999999998,
      "min": 1.4909189658,
      "max": 1.7491498887999999
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 501.0 ± 73.7 437.1 658.5 1.65 ± 0.26
pacquet@main 540.7 ± 104.7 431.4 672.4 1.78 ± 0.35
pnpr@HEAD 303.6 ± 14.4 270.7 318.7 1.00
pnpr@main 328.3 ± 19.5 294.9 369.0 1.08 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5010280669800001,
      "stddev": 0.07374359406835468,
      "median": 0.47758189058000006,
      "user": 0.7035124799999999,
      "system": 0.77532344,
      "min": 0.43710744058000006,
      "max": 0.65846286258
    },
    {
      "command": "pacquet@main",
      "mean": 0.5406980511799999,
      "stddev": 0.10469042761496815,
      "median": 0.49225124708,
      "user": 0.7545178799999999,
      "system": 0.8633071400000001,
      "min": 0.43137577458000004,
      "max": 0.67237842958
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30360506357999995,
      "stddev": 0.014362833142672907,
      "median": 0.30957915308000006,
      "user": 0.24632237999999998,
      "system": 0.61473224,
      "min": 0.27065186058,
      "max": 0.31867727558000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.32827582898,
      "stddev": 0.019511263063029187,
      "median": 0.32993373758000005,
      "user": 0.27710808,
      "system": 0.6298973400000001,
      "min": 0.29485884858000005,
      "max": 0.36895202158000007
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.819 ± 0.046 1.762 1.906 6.11 ± 0.40
pacquet@main 1.657 ± 0.032 1.606 1.712 5.57 ± 0.35
pnpr@HEAD 0.298 ± 0.018 0.278 0.340 1.00
pnpr@main 0.322 ± 0.018 0.301 0.348 1.08 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8190344982000002,
      "stddev": 0.0458967117937587,
      "median": 1.8256106420000002,
      "user": 1.2599269199999998,
      "system": 1.0355917,
      "min": 1.7618161715000002,
      "max": 1.9060020885
    },
    {
      "command": "pacquet@main",
      "mean": 1.6567643190999999,
      "stddev": 0.032397338235940785,
      "median": 1.646931197,
      "user": 0.97931802,
      "system": 0.8893375999999998,
      "min": 1.6063156655000002,
      "max": 1.7124880775
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29760061280000005,
      "stddev": 0.017771798552476393,
      "median": 0.294580253,
      "user": 0.26090062,
      "system": 0.5885135999999999,
      "min": 0.2781526245,
      "max": 0.3397450705
    },
    {
      "command": "pnpr@main",
      "mean": 0.32241809320000003,
      "stddev": 0.0180611337705798,
      "median": 0.319184177,
      "user": 0.27867632000000003,
      "system": 0.6218351999999999,
      "min": 0.3013422155,
      "max": 0.3481459335
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 246.7 ± 12.4 231.1 279.0 2.55 ± 0.15
pacquet@main 252.8 ± 15.3 232.9 283.9 2.61 ± 0.17
pnpr@HEAD 96.9 ± 2.7 91.7 103.5 1.00
pnpr@main 115.2 ± 19.2 92.9 147.0 1.19 ± 0.20
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24668180564666672,
      "stddev": 0.01243195358606403,
      "median": 0.24646594198,
      "user": 0.2256045833333333,
      "system": 0.09312710333333334,
      "min": 0.23109997598,
      "max": 0.27901726798000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.25281630564666663,
      "stddev": 0.015261126305195386,
      "median": 0.24840448898,
      "user": 0.22350258333333337,
      "system": 0.09359960333333332,
      "min": 0.23285128798000002,
      "max": 0.28386238598
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09691928535931035,
      "stddev": 0.002739662964342763,
      "median": 0.09689374498,
      "user": 0.03813706896551723,
      "system": 0.014595053793103451,
      "min": 0.09168419298000001,
      "max": 0.10353866398
    },
    {
      "command": "pnpr@main",
      "mean": 0.11518499038000005,
      "stddev": 0.019177412705017282,
      "median": 0.11371594348,
      "user": 0.05069286666666666,
      "system": 0.024365053333333338,
      "min": 0.09285571698,
      "max": 0.14701378198
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 239.1 ± 10.8 221.4 251.8 1.00
pacquet@main 241.5 ± 12.1 230.2 265.0 1.01 ± 0.07
pnpm@HEAD 4228.8 ± 163.4 4031.7 4544.7 17.69 ± 1.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2390739751533334,
      "stddev": 0.010785941219068597,
      "median": 0.24355929782000002,
      "user": 0.2398257755555555,
      "system": 0.06942744666666666,
      "min": 0.22144346382000002,
      "max": 0.25178644082
    },
    {
      "command": "pacquet@main",
      "mean": 0.24148365226444446,
      "stddev": 0.012090270218552877,
      "median": 0.23638963782000003,
      "user": 0.24448966444444442,
      "system": 0.06638066888888888,
      "min": 0.23021180882000003,
      "max": 0.26500468982
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.228762255042223,
      "stddev": 0.16335255995018885,
      "median": 4.20928809082,
      "user": 6.280630997777778,
      "system": 0.5727426688888888,
      "min": 4.03172281482,
      "max": 4.54471650282
    }
  ]
}

Scenario: Isolated linker: linked-workspace resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 210.3 ± 3.4 206.1 217.4 1.02 ± 0.02
pacquet@main 205.8 ± 1.6 203.3 209.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.21026629699846155,
      "stddev": 0.0034041114066480378,
      "median": 0.21020348046,
      "user": 0.16587962615384616,
      "system": 0.07964972000000001,
      "min": 0.20610507446,
      "max": 0.21739537346
    },
    {
      "command": "pacquet@main",
      "mean": 0.20577795274571434,
      "stddev": 0.0015858345036541212,
      "median": 0.20599608896,
      "user": 0.15840663714285716,
      "system": 0.08184679142857143,
      "min": 0.20329311746,
      "max": 0.20976152946
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.574 ± 0.166 4.438 4.910 1.26 ± 0.06
pacquet@main 4.705 ± 0.161 4.477 5.013 1.30 ± 0.06
pnpr@HEAD 3.622 ± 0.113 3.523 3.874 1.00
pnpr@main 3.644 ± 0.057 3.539 3.735 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.57432383854,
      "stddev": 0.1657670648145571,
      "median": 4.512850394539999,
      "user": 1.9079318399999998,
      "system": 2.1055204800000005,
      "min": 4.43799502504,
      "max": 4.9099699680399995
    },
    {
      "command": "pacquet@main",
      "mean": 4.7050643477400005,
      "stddev": 0.16108308047478517,
      "median": 4.65877856704,
      "user": 1.9687197399999998,
      "system": 2.07214088,
      "min": 4.47710536704,
      "max": 5.01325781904
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.62241050364,
      "stddev": 0.1133899839046266,
      "median": 3.57267804704,
      "user": 1.7855764399999998,
      "system": 1.9293135799999999,
      "min": 3.5232640640399997,
      "max": 3.87373813004
    },
    {
      "command": "pnpr@main",
      "mean": 3.644146929339999,
      "stddev": 0.056786653718453796,
      "median": 3.65019612554,
      "user": 1.91928084,
      "system": 1.95680138,
      "min": 3.53895031704,
      "max": 3.73498052204
    }
  ]
}

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

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 144.6 ± 11.5 127.5 181.6 1.06 ± 0.09
pacquet@main 135.8 ± 4.6 128.6 145.7 1.00
pnpr@HEAD 147.0 ± 8.2 134.8 169.8 1.08 ± 0.07
pnpr@main 176.3 ± 45.1 128.9 243.8 1.30 ± 0.34
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.14459077839999995,
      "stddev": 0.011454169824766576,
      "median": 0.1439499524,
      "user": 0.18530584315789472,
      "system": 0.14737678105263158,
      "min": 0.12752097340000002,
      "max": 0.1816080504
    },
    {
      "command": "pacquet@main",
      "mean": 0.1357932969,
      "stddev": 0.004637861250031063,
      "median": 0.13464998290000002,
      "user": 0.17299646888888887,
      "system": 0.13854147111111115,
      "min": 0.1285859184,
      "max": 0.1456811174
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.14702580534736845,
      "stddev": 0.008214767420587613,
      "median": 0.1437458604,
      "user": 0.1758641063157895,
      "system": 0.14671630736842103,
      "min": 0.1348169404,
      "max": 0.16983378740000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.1762628295666667,
      "stddev": 0.04510164773349919,
      "median": 0.1544062394,
      "user": 0.20472616333333335,
      "system": 0.17933385999999998,
      "min": 0.1288823044,
      "max": 0.2437798844
    }
  ]
}

…entity private

ResolvedPackage::name and ::version are rendered from ::result once, in
ResolvedPackage::new, and nothing else may set them. With the three
fields public that was a convention, not a guarantee: a caller holding
a &mut ResolvedPackage (the package table hands them out for the
optional AND-fold) could assign a new result or Arc::make_mut the
existing one and leave the rendered pair stale, and two peer tests did
exactly that to turn a registry fixture into a tarball provider.

The three fields are private now and read through result(), name() and
version(). name() and version() return the &Arc<str> so the peer walk
keeps sharing them into ParentRef and NodeEntry by Arc::clone and
derefs to the &str everywhere else. The tarball tests build the
mutated ResolveResult first and wrap it with ResolvedPackage::new, and
the one struct-update fixture sets its peer dependencies after
construction instead.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
ResolvedPackage::new took five positional arguments ending in two
bools, so a construction site read `false, false` or `true, true`
without saying which value was `optional` and which `is_leaf`. It now
takes a ResolvedPackageInput carrying the same values as named fields,
which every construction site spells out. The constructor still renders
name and version from the input's result once. The type follows the
crate's existing input structs (ImporterPeerInput,
ImporterResolutionInputs) in name.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
…group

The workspace-context tests imported ResolvedPackageInput through a
second `use crate::...` item next to the file's existing
`use crate::{..}` group, which perfectionist's
import_granularity_mismatch lint rejects in the pre-push hook. The name
now sits in that group.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
…allen-wjiv3n-followups

# Conflicts:
#	pnpm/crates/resolving-deps-resolver/src/lib.rs
Brings in the 16 commits main gained since this branch was started, up
to d162953 (#16362). Four of them touch files this branch also
changes (resolve_peers.rs, resolve_peers/finalize.rs,
finalize/final_paths.rs and resolve_peers/walker.rs, from the
peer-dependent dedupe work in #16359 and #16361); git
merged them without conflicts, and none of main's new code reads the
ResolvedPackage fields this branch made private.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
Drop the prose that restated the code or recorded the reasons for a
change: the paragraph on ResolvedPackage repeating that its fields are
private, the field notes on ParentRef::version and
ChildrenOwner::parent_path, the allocation-sharing clauses on
AncestorPkgIds, DirectDep::id and the two package-table registrations,
the module doc and the rationale in package_identity.rs, and the doc on
the tarball test helper. What stays states a contract: which Arc a
registration answers with, and which name and version the accessors
yield.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
…branch

Brings the base branch's merge of main (up to d162953, #16362)
and its comment trim into the follow-ups. The trial merge was clean:
main's resolver changes and the SCC-cache and lazy-ancestor commits
touch different code.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
Base automatically changed from claude/determined-allen-wjiv3n to main September 29, 2026 15:17
Brings in main up to 417ab35, which carries the squash merge of
#16345 (a949da4), the base this branch was stacked on. The
squash re-applies that PR's changes on top of main, so every resolver
file this branch modified further conflicted against content it already
holds; each is resolved to this branch's version, and the base PR's
changeset takes main's wording. Check: the resolver crate's diff against
main after the merge equals the diff this branch had against 747ef0b.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
The release note reported benchmark timings, which vary by machine and
by workspace shape; it now says what the resolver does differently,
as asked in the review of #16345.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
@zkochan

zkochan commented Sep 29, 2026

Copy link
Copy Markdown
Member

Review Summary

  • Type: perf(resolver)
  • Key Changes: Reuses the children SCC table within each hoist round rather than recomputing it for unchanged subgraphs.
  • Evaluation:
    • Correctness & Performance: Cache is invalidated on discovery tree refresh, preventing stale cycles. 420 resolver tests passed.
    • CI & Tests: Clean rebase onto origin/main, 100% CI pass rate.
  • Verdict: Approved. Applied label reviewed: zoltan's agent.

Reviewed by Antigravity Agent per pnpm review guide.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Sep 30, 2026
Brings in main up to 28814c6 before the cycle-gate encapsulation commits;
none of the new commits touches a file this branch changes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
CanonicalCycleGate::sccs is private. CanonicalCycleGate::table builds
the table from the tree it is given and shares it until
CanonicalCycleGate::invalidate, which the discovery engine calls when
it refreshes or rebuilds its view. Before, the cell was pub(super), any
code under resolve_peers could fill or clear it, and the walker filled
it in place, so the invariant that the table matches the view rested
on convention. The builder stays in walker/missing_names.rs and is
re-exported to the gate.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
…neration

The discovery engine counts its view refreshes and rebuilds in
PeerDiscoveryCaches::view_generation. CanonicalCycleGate::table records
the generation it built the table under and rebuilds when read under a
newer one, so a stale table cannot be served even if a future refresh
path forgets to drop it; CanonicalCycleGate::invalidate is gone. The
generation belongs to the view, so any other cache derived from the
view can validate against it the same way.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
…e-exports

The ordering lint wants every re-export above the module declarations;
the one added for the cycle gate sat below them. It joins the walker's
existing missing_names re-export, so the builder is pub(crate) like its
neighbours.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
The provider-children index and the peer names it was built under were
two fields refreshed together by a free function in the walker. They
are one PeerProviderIndex now, refreshed by its own method, and the
peer names, the index's validity key, are private to it. This also
keeps PeerDiscoveryCaches within the field limit after view_generation.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
The dependency-tree modules and the peer-resolution tests spelled the
type out as crate::resolved_tree::TreeChildren at every use, while the
peer-resolution modules import it. The files this PR touches now import
it through the same use-super chains their other names come through,
and the Arc::new calls on those lines drop their std::sync:: prefix.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
Brings main up to 17e8a01 (#16460). None of the merged
commits touch the resolver crate; the merge is conflict-free.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
The two tests added for the cycle gate's view-generation stamp ran on
empty trees, so they only pinned pointer identity and a counter. They
now run on a mutual dependency: one test checks that the gate groups
the cycle and cuts exactly its back-edge, one checks that reads under
one view generation share the table and a newer generation rebuilds it
from the current view, and one drives the discovery engine through a
hoist round that installs a dependency cycle and checks that the
refreshed gate knows the cycle and the walk over it completes.

Each test was checked against a broken implementation (a gate that
ignores the generation, a gate that never caches, an engine that keeps
its generation, a gate that cuts the wrong edge, and an SCC pass that
finds no cycles) and fails on the assertion that names the break.

The ring fixture's edge and lazy-direct-dep helpers move to the shared
test support so both test modules build trees the same way.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
PeerDiscoveryCaches::view_generation was a u64 whose only mutation is
the increment in PeerHoistDiscovery::discover; the gate stamps its SCC
table with it and compares for equality. ViewGeneration offers exactly
that: advance() and equality, no arithmetic and no construction from a
number, so a generation cannot be confused with any other count. The
doc that explained the generation on the field now lives on the type.

The two generation mutations (a gate that ignores the generation, an
engine that never advances it) still fail the discovery tests on the
assertions that name them.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
The doc on PeerProviderIndex::peer_names restated the rule that
PeerProviderIndex::refresh documents (rebuild when the tree's peer
names differ from the ones the index was built under) and gave the
reason, which had no other home. The reason now sits on the type, next
to what the index is, and both fields stand on their names.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
The docs this PR added narrated mechanism that other items already
state: the cut rule on CanonicalCycleGate::sccs repeated
Walker::cuts_cycle_edge, the build-share-rebuild lifecycle appeared on
ViewGeneration, on the sccs field and on CanonicalCycleGate::table, and
realize_children listed the steps of its body. Each doc now says what
the item is and links the item that holds the rule, so a rename fails
the doc build instead of leaving prose behind. The test comments give
the reason for the step they precede, and the Lazy variant's doc no
longer argues for the state it does not carry.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW

@KSXGitHub KSXGitHub left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There might have been some diff noises.

claude added 2 commits October 1, 2026 11:14
The documentation review reduced two docs that main already had and
this PR edits only where the ancestor chain went away: the step list
on realize_children and the second sentence of merge_realize_undo.
Reducing them is diff noise, so both return to their wording before
the review, as the PR review asked.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
@KSXGitHub
KSXGitHub marked this pull request as ready for review October 1, 2026 12:05
Copilot AI balanced review requested due to automatic review settings October 1, 2026 12:05
@KSXGitHub
KSXGitHub requested a review from zkochan as a code owner October 1, 2026 12:05

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 review overview

🔵 Needs a closer look

The core peer-resolution cycle and cache invariants are sufficiently intricate to warrant final human validation despite focused regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Optimizes the Rust v12 peer resolver by caching the canonical SCC table per discovery-tree generation and removing unused lazy-node ancestor chains.

Changes:

  • Shares one generation-validated cycle table across walkers.
  • Simplifies TreeChildren::Lazy to a unit variant.
  • Adds focused cycle-gate tests and a pacquet changeset.
File Description
.changeset/​cache-children-cycle-table.md Records the resolver performance improvement.
pnpm/​crates/​package-manager/​src/​dependencies_graph_to_lockfile/​tests/​resolution.rs Updates a lazy-node fixture.
pnpm/​crates/​resolving-deps-resolver/​src/​lib.rs Removes the obsolete public AncestorIds export.
pnpm/​crates/​resolving-deps-resolver/​src/​resolved_tree.rs Removes ancestor-chain storage from lazy children.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_dependency_tree/​reuse.rs Stops recording unused parent IDs.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_dependency_tree/​reuse/​snapshot_children.rs Uses unit lazy children during reuse.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_dependency_tree/​walk.rs Updates imports for simplified lazy children.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_dependency_tree/​walk/​level_walk.rs Creates lazy nodes without ancestor chains.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_dependency_tree/​workspace_ctx.rs Removes parent-ID workspace storage.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_dependency_tree/​workspace_ctx/​children_ownership.rs Simplifies ownership handovers to unit lazy nodes.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_dependency_tree/​workspace_ctx/​tests.rs Updates ownership and lazy-node assertions.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​cache.rs Removes ancestor state from realization contexts.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​cache/​fast_match.rs Uses the consolidated provider index and unit variant.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​cache/​realize_children.rs Applies the canonical gate without ancestor chains.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​discovery.rs Adds generation-aware SCC and provider caches.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​discovery/​tests.rs Tests SCC cuts, caching, and view refreshes.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​test_support.rs Adds reusable lazy-node and edge fixtures.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​tests.rs Refactors peer-cycle fixtures to shared helpers.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​tests/​behavior.rs Updates a lazy-node fixture.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​tests/​peer_dependencies_own_peer_is_resolved.rs Updates cycle-test lazy nodes.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​tests/​resolution_order.rs Updates resolution-order fixtures.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​walker.rs Reads SCCs and back-edge nodes from shared caches.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​walker/​child_walk.rs Removes ancestor propagation from deferred walks.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​walker/​missing_names.rs Exposes SCC construction to discovery caching.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​walker/​node_walk.rs Simplifies deferred-child inputs.
pnpm/​crates/​resolving-deps-resolver/​src/​resolve_peers/​walker/​walk_context.rs Simplifies deferred walk state and exposes indexing.
pnpm/​crates/​resolving-deps-resolver/​src/​tests/​peers/​behavior.rs Updates lazy-child matching assertions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

claude added 2 commits October 1, 2026 13:02
deploy/target.rs reached 403 lines of code after the recent deploy
fixes, above perfectionist's limit of 400, which fails the dylint job
on every pull request that includes them. The lexical path comparison
(same_path, ProjectPathKey, has_path_prefix, the component helpers,
relative_components_from_child and relative_path) is a leaf concern
the rest of target.rs and deploy.rs call, so it moves to
deploy/paths.rs, a sibling module like the others under deploy/. No
function body changes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
Copilot AI balanced review requested due to automatic review settings October 1, 2026 13:02

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 review overview

🟡 Changes recommended

The unrelated deploy refactor should be split or reverted, and the changeset should omit internal implementation detail.

Review effort: Balanced
Findings: 2 Low severity

Open (2)

Comment thread pnpm/crates/cli/src/cli_args/deploy.rs Resolved
Brings main up to 2f41427, whose refactor moves the deploy path
comparison out of target.rs into path_compare.rs, the same split this
branch made in c1ddbfb under the name paths.rs. The conflicts in
deploy.rs and target.rs are resolved to main's version and the branch's
paths.rs is removed, so the CLI crate is identical to main again.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYTBQo8HY7xD2iz6hjo1CW
Copilot AI balanced review requested due to automatic review settings October 1, 2026 13:09

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 review overview

🔵 Needs a closer look

Core resolver cycle handling and persistent cache invalidation warrant final human review despite strong targeted coverage.

Review effort: Balanced
Findings: 2 Low severity

Open (2)

@zkochan
zkochan merged commit 4573db8 into main Oct 1, 2026
58 checks passed
@zkochan
zkochan deleted the claude/determined-allen-wjiv3n-followups branch October 1, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants