Skip to content

fix(resolver): keep the children a reused subtree pinned - #13839

Merged
zkochan merged 1 commit into
mainfrom
fix-13837
Aug 12, 2026
Merged

zkochan merged 1 commit into
mainfrom
fix-13837

Conversation

@zkochan

@zkochan zkochan commented Aug 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Investigating the lockfile-reuse half of #13837 turned up a live bug rather than the ordering question I went looking for.

record_children says:

A recording the prior lockfile pinned outlives a fresh walk's different answer: the occurrences that reused the subtree keep it realized rather than re-resolving its open ranges, which is the churn the reuse existed to avoid.

The arm implementing it returns Published — which only suppresses the staleness signal — and then falls through to children.insert(...) like every other arm. So the fresh answer does replace the pinned children, and because no occurrence is flagged stale, the ones that realized the pinned subtree go on holding children the record no longer lists.

What it costs

Instrumented every recording that replaced an existing one with different edges, on a partially stale @teambit/bit lockfile (install --lockfile-only --no-prefer-frozen-lockfile, offline). 22 replacements per run, every one a pinned recording overwritten by a fresh walk (standing_prior=Some(…) incoming_prior=None):

[email protected]     pinned @babel/[email protected] → replaced with 7.29.7
[email protected]        pinned [email protected]    → replaced with 4.2.11
subscriptions-transport-ws     pinned [email protected]             → replaced with 7.5.13

The resulting lockfile moved 24 edges nothing had asked it to move, including @types/express-serve-static-core from 4.19.9 to 5.1.3 — a major version bump of a transitive dependency on a plain install.

The fix

A walk whose context carries no prior key publishes nothing over a pinned recording and reads the pinned children, like every occurrence that reused the subtree. The gate that decides whether to walk at all applies the same rule, so the fresh subtree is not resolved and then discarded. A walk under an update policy is exempt — re-resolving pins is what pnpm update is for.

On the ordering question in #13837

This also closes the reuse↔fresh contest the issue asks about: those recordings are no longer replaced, so there is nothing left for the two walks to race over. What I could not produce is a pinned-vs-pinned replacement — across three instrumented runs, all 22 replacements had incoming_prior=None. The hoist-wave and cross-importer half of the issue is unchanged and stays open there.

Measurements

  • Partially stale @teambit/bit lockfile: 3/3 identical lockfiles before the fix and 3/3 after; the 24 edges above now keep their pins.
  • Fresh resolve (no lockfile): 6/6 identical, byte-for-byte what main produces — this path has no pins to protect.
  • 8134 tests pass.

Tests

re_recording_reports_whether_the_child_edges_moved asserted Published for exactly this case while its own message said "a fresh walk does not unpin the subtree the lockfile-reusing occurrences realized". It never checked the stored edges, which is why the bug sat under a passing test. It now asserts the recording is declined and that the pinned children are what stands.

a_pinned_subtree_keeps_its_children_against_a_fresh_walk resolves a package reached both from a pinned subtree and from a fresh edge, under both interleavings, and asserts the pins stand and that the range they pinned is never re-resolved. It fails on main.

Squash Commit Body

`record_children` documents that "a recording the prior lockfile pinned
outlives a fresh walk's different answer", and then inserts the fresh
answer over it. The arm only suppressed the staleness signal, so the
occurrences that realized the pinned subtree went on holding children
the record no longer listed, and the lockfile took whichever answer
landed last.

Instrumented on a partially stale @teambit/bit lockfile, 22 recordings
per run were replaced this way, every one of them a pinned recording
overwritten by a fresh walk: enhanced-resolve lost its pinned
[email protected] for 4.2.11, subscriptions-transport-ws its [email protected]
for 7.5.13, and @types/express-serve-static-core moved a major version.
A plain install re-resolved 24 edges nothing had asked it to.

Make the rule the comment describes: a walk whose context carries no
prior key publishes nothing over a pinned recording, and reads the
pinned children like every occurrence that reused the subtree. The gate
that decides whether to walk at all applies the same rule, so the fresh
subtree is not resolved and thrown away. An update policy still
re-resolves pins — that is what it is for.

Related to pnpm/pnpm#13837.

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.

children_by_id and the recorded-children context are pacquet's own machinery; resolveDependencyTree.ts keeps a package's children per depPath with no equivalent replacement path, so there is nothing to mirror.


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

    • Fixed an issue where pnpm install could re-resolve dependencies within pinned subtrees.
    • Lockfile-pinned child dependencies now remain at their specified versions, regardless of resolution order.
    • Prevented installed dependency versions from diverging from the lockfile, including unintended major-version upgrades.
  • Documentation

    • Added a release note documenting the dependency-resolution fix.

Copilot AI lite review requested due to automatic review settings August 11, 2026 23:16

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: af283158-fc0b-47ae-b7a7-7fb625c8927b

📥 Commits

Reviewing files that changed from the base of the PR and between 74e549c and c334e04.

📒 Files selected for processing (2)
  • 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
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs

📝 Walkthrough

Walkthrough

The resolver preserves lockfile-pinned child subtrees when fresh dependency walks compete with reused resolutions. Tests cover peer-shadowing conditions, declined re-recording, and both completion orders. A patch changeset documents the fix.

Changes

Lockfile-pinned child preservation

Layer / File(s) Summary
Pin-aware child recording
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs
RecordedChildrenContext detects when a prior lockfile pin takes precedence. Child recording declines fresh non-update results that would overwrite the pinned subtree.
Pinned subtree regression coverage
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs, pnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs, .changeset/pinned-children-survive-a-fresh-walk.md
Tests verify peer-shadowing conditions, retained [email protected] and [email protected] children, and order-independent resolution. The changeset documents the patch release.

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

Possibly related issues

  • pnpm/pnpm issue 13837: The changes address lockfile reuse races where fresh walks replace pinned child recordings.

Possibly related PRs

  • pnpm/pnpm#13714: Both PRs modify workspace_ctx.rs and child recording to preserve pinned subtrees during fresh resolution.
  • pnpm/pnpm#13575: Both PRs extend context-aware recorded-child reuse and publication logic.
  • pnpm/pnpm#13830: Both PRs modify recorded-child ownership and reuse behavior for deterministic dependency resolution.

Suggested labels: product: pacquet

Suggested reviewers: ayush442842q

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

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: preserve pinned children when a fresh walk reaches reused subtree

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Prevent fresh dependency walks from overwriting lockfile-pinned subtree children during reuse.
• Align recording and “should we walk” decisions so pins remain authoritative outside updates.
• Add regression tests for pinned-vs-fresh recording order and document behavior change.
Diagram

graph TD
  A["resolve_workspace"] --> B["dep tree walk"] --> C["record_children"] --> D[("children_by_id")]
  B --> E{""context has prior_key?""}
  E -->|"yes (pinned)"| F["reuse pinned children"] --> D
  E -->|"no (fresh)"| G{""pins_children_over?""}
  G -->|"yes (and not update)"| H["decline publish"] --> D
  G -->|"no / update"| I["publish children"] --> D
  subgraph Legend
    direction LR
    _proc["Process"] ~~~ _dec{"Decision"} ~~~ _db[("State store")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Store separate recordings per context (pinned vs fresh)
  • ➕ Eliminates special-case precedence rules by design
  • ➕ Makes the provenance of recorded children explicit and queryable
  • ➖ Higher memory and complexity (multiple child-edge sets per pkg id)
  • ➖ Requires changes in lookup logic and invalidation semantics beyond this bug fix
2. Always mark pinned-vs-fresh overwrite as stale and force re-read
  • ➕ Keeps a single recording while avoiding silent inconsistency
  • ➕ Could surface more diagnostics for lockfile churn
  • ➖ Still allows pinned children to be overwritten, which is the core regression
  • ➖ May increase churn by encouraging unnecessary re-resolution or updates

Recommendation: The PR’s approach (explicit precedence: pinned recording wins over fresh context unless updating, enforced both at the “walk?” gate and at record_children) is the smallest change that matches the documented intent and directly prevents lockfile churn/inconsistency. More structural alternatives (multi-record storage) seem unjustified for the specific bug and would broaden scope/risk.

Files changed (4) +139 / -11

Bug fix (1) +23 / -10
workspace_ctx.rsPrevent fresh walks from overwriting pinned recorded children +23/-10

Prevent fresh walks from overwriting pinned recorded children

• Adds 'RecordedChildrenContext::pins_children_over' to formalize when a pinned (prior lockfile) context should dominate a fresh walk. Updates the recorded-children match gate to treat pinned-vs-fresh as a match, and changes 'record_children' to early-return 'Declined' rather than publishing over pinned children (unless an update policy is active).

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

Tests (2) +111 / -1
tests.rsUpdate unit test to assert pinned children are not replaced +10/-1

Update unit test to assert pinned children are not replaced

• Adjusts the re-recording test to expect 'ChildrenRecording::Declined' when a fresh walk encounters an existing pinned recording. Verifies the stored 'children_by_id' edges remain the pinned set that all reuse occurrences should read.

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

tests.rsAdd regression test for pinned-vs-fresh recording race ordering +101/-0

Add regression test for pinned-vs-fresh recording race ordering

• Adds an async test reproducing pnpm/pnpm#13837 by resolving a graph where a pinned (lockfile-reused) subtree and a fresh edge reach the same package with divergent resolutions. Ensures the pinned children win regardless of which walk records first, and asserts the fresh alternative version is not resolved into the tree.

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

Documentation (1) +5 / -0
pinned-children-survive-a-fresh-walk.mdAdd changeset documenting pinned-subtree preservation on install +5/-0

Add changeset documenting pinned-subtree preservation on install

• Introduces a patch changeset explaining that installs no longer re-resolve dependencies inside a lockfile-pinned reused subtree. Highlights the prior inconsistency where node_modules remained pinned while pnpm-lock.yaml could drift (including major transitive bumps).

.changeset/pinned-children-survive-a-fresh-walk.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 (3): Last reviewed commit: "fix(resolver): keep the children a reuse..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In
`@pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs`:
- Around line 1392-1401: In workspace_ctx.rs lines 1392-1401, check
recorded.context.pins_children_over(&context) before accepting the equal-edge
branch so pinned children remain protected and the result returns Declined. In
workspace_ctx/tests.rs lines 631-644, after recording pinned, add a fresh
[email protected] recording assertion expecting Declined, while retaining the existing
differing-edge assertion and verifying stored children remain pinned.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d826f066-af1f-4206-a356-4fc45ec9ead7

📥 Commits

Reviewing files that changed from the base of the PR and between 746ce63 and 64b6457.

📒 Files selected for processing (4)
  • .changeset/pinned-children-survive-a-fresh-walk.md
  • 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/resolve_workspace/tests.rs

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. Pins ignore peer shadow ✓ Resolved 🐞 Bug ≡ Correctness
Description
recorded_children_match() now treats a pinned recording as reusable for a fresh walk via
pins_children_over() even when peer_shadowed differs between the two contexts. Because peer_shadowed
changes which dependencies are filtered out (and affects computed peer_dependencies), the fresh
occurrence can expand from an incompatible pinned child list and produce an incorrect dependency
tree/peer resolution.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[R1317-1320]

+    lock_recoverable(&ctx.workspace.children_by_id).get(pkg_id).is_some_and(|recorded| {
+        recorded.context.produces_same_children_as(context)
+            || recorded.context.pins_children_over(context)
+    })
Relevance

●● Moderate

Correctness concern about reuse predicate/context mismatch; no close precedent specifically about
peer_shadowed vs pin reuse.

PR-#13575

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR adds a new fallback (pins_children_over) that bypasses produces_same_children_as, even
though the context’s peer_shadowed set is explicitly documented as changing which children the
walk produces. Since peer_shadowed is derived from parent_pkg_aliases (which varies by
occurrence), and the walk filters child specs and recomputes peer dependencies using it, reusing
pinned children across different peer_shadowed contexts can yield the wrong child edges/peer
split.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[164-201]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[176-186]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[1312-1321]
pnpm/crates/resolving-deps-resolver/src/parent_pkg_aliases.rs[57-79]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[436-441]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[848-858]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[632-650]

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

### Issue description
`RecordedChildrenContext::pins_children_over()` is used as a fallback match in `recorded_children_match()`. It currently ignores `peer_shadowed`, which is context-sensitive and directly affects which child edges are produced (dependencies can be filtered out when shadowed by peers). This can cause a fresh occurrence under a different `peer_shadowed` set to skip walking and later expand from pinned children recorded under a different peer-shadow context.

### Issue Context
- `peer_shadowed` depends on `parent_pkg_aliases` and can vary between occurrences of the same package id.
- The walk filters `child_specs` based on `claim.peer_shadowed`.
- The owner also recomputes `peer_dependencies` based on `claim.peer_shadowed`.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[176-186]
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[1312-1321]
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[632-650]
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[848-858]
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs[509-545]

### Suggested change
Tighten `pins_children_over()` (or the fallback in `recorded_children_match()`) to only pin-override when the peer-shadowing context is compatible, e.g. require `self.peer_shadowed == other.peer_shadowed` in addition to the prior_key/update checks.

### Regression test
Add a test where a pinned recording exists under one `peer_shadowed` set and a fresh context has a different `peer_shadowed`; assert `recorded_children_match()` is false and/or that the fresh walk is not incorrectly suppressed.

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



Remediation recommended

2. Changeset missing pnpm bump 📘 Rule violation § Compliance
Description
The new changeset documents a user-visible pnpm install behavior change but only bumps pacquet,
omitting the required pnpm entry. This can cause the pnpm release to miss the fix or be versioned
incorrectly.
Code

.changeset/pinned-children-survive-a-fresh-walk.md[2]

+"pacquet": patch
Relevance

●●● Strong

Recent precedent: missing required pnpm entry in changeset front-matter is typically fixed to
satisfy policy.

PR-#13748
PR-#13403

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance ID 713436 requires changesets to explicitly list pnpm with a correct bump type when
pnpm behavior is affected. The added changeset front-matter lists only pacquet, while the body
explicitly states a pnpm install behavior change.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/pinned-children-survive-a-fresh-walk.md[1-5]

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

## Issue description
The changeset describes a `pnpm install` behavior fix but the front-matter only declares a version bump for `pacquet`. Per policy, the changeset must explicitly include the `pnpm` package with a valid bump type.

## Issue Context
This PR changes install/lockfile behavior described in the changeset body, which is user-visible and should be released under the `pnpm` package.

## Fix Focus Areas
- .changeset/pinned-children-survive-a-fresh-walk.md[1-3]

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



Informational

3. Extra HashSet equality cost 🐞 Bug ➹ Performance ⭐ New
Description
RecordedChildrenContext::pins_children_over() compares peer_shadowed HashSets before checking
prior_key/update_active, so it can do an O(n) set equality even when prior_key=None (common) makes
the result false. This predicate is evaluated from recorded_children_match() on the dependency-tree
walk hot path, adding avoidable CPU work during installs.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[R184-187]

+    pub(super) fn pins_children_over(&self, other: &Self) -> bool {
+        self.peer_shadowed == other.peer_shadowed
+            && self.prior_key.is_some()
+            && other.prior_key.is_none()
Relevance

●●● Strong

Team often accepts small hot-path short-circuit/fast-path optimizations; this is local, low-risk
reordering.

PR-#13510
PR-#13589
PR-#13172

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The code evaluates HashSet equality first inside pins_children_over(), and this function is invoked
from recorded_children_match() during the main walk loop, so the ordering can add avoidable per-node
work.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[184-189]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[1315-1323]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[686-691]

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

### Issue description
`RecordedChildrenContext::pins_children_over()` currently evaluates `self.peer_shadowed == other.peer_shadowed` before cheaper boolean predicates (`prior_key` / `update_active`). When `self.prior_key.is_none()` (the common non-pinned case), the function must return `false` and the `HashSet` equality check is wasted work.

### Issue Context
`recorded_children_match()` calls `pins_children_over()` during the tree walk’s frontier-building loop, so any extra per-node work can matter on large graphs.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[184-189]

### Suggested change
Reorder the conjunction to short-circuit on cheap checks first, e.g.:
```rust
self.prior_key.is_some()
   && other.prior_key.is_none()
   && !other.update_active
   && self.peer_shadowed == other.peer_shadowed
```
(Exact ordering is flexible; the key is to avoid `HashSet` equality when pin/update predicates already decide the outcome.)

ⓘ 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 enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous review results

Review updated until commit c334e04

Results up to commit 64b6457 ⚖️ Balanced


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


Action required
1. Pins ignore peer shadow ✓ Resolved 🐞 Bug ≡ Correctness
Description
recorded_children_match() now treats a pinned recording as reusable for a fresh walk via
pins_children_over() even when peer_shadowed differs between the two contexts. Because peer_shadowed
changes which dependencies are filtered out (and affects computed peer_dependencies), the fresh
occurrence can expand from an incompatible pinned child list and produce an incorrect dependency
tree/peer resolution.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[R1317-1320]

+    lock_recoverable(&ctx.workspace.children_by_id).get(pkg_id).is_some_and(|recorded| {
+        recorded.context.produces_same_children_as(context)
+            || recorded.context.pins_children_over(context)
+    })
Relevance

●● Moderate

Correctness concern about reuse predicate/context mismatch; no close precedent specifically about
peer_shadowed vs pin reuse.

PR-#13575

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR adds a new fallback (pins_children_over) that bypasses produces_same_children_as, even
though the context’s peer_shadowed set is explicitly documented as changing which children the
walk produces. Since peer_shadowed is derived from parent_pkg_aliases (which varies by
occurrence), and the walk filters child specs and recomputes peer dependencies using it, reusing
pinned children across different peer_shadowed contexts can yield the wrong child edges/peer
split.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[164-201]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[176-186]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[1312-1321]
pnpm/crates/resolving-deps-resolver/src/parent_pkg_aliases.rs[57-79]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[436-441]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[848-858]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[632-650]

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

### Issue description
`RecordedChildrenContext::pins_children_over()` is used as a fallback match in `recorded_children_match()`. It currently ignores `peer_shadowed`, which is context-sensitive and directly affects which child edges are produced (dependencies can be filtered out when shadowed by peers). This can cause a fresh occurrence under a different `peer_shadowed` set to skip walking and later expand from pinned children recorded under a different peer-shadow context.

### Issue Context
- `peer_shadowed` depends on `parent_pkg_aliases` and can vary between occurrences of the same package id.
- The walk filters `child_specs` based on `claim.peer_shadowed`.
- The owner also recomputes `peer_dependencies` based on `claim.peer_shadowed`.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[176-186]
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[1312-1321]
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[632-650]
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[848-858]
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs[509-545]

### Suggested change
Tighten `pins_children_over()` (or the fallback in `recorded_children_match()`) to only pin-override when the peer-shadowing context is compatible, e.g. require `self.peer_shadowed == other.peer_shadowed` in addition to the prior_key/update checks.

### Regression test
Add a test where a pinned recording exists under one `peer_shadowed` set and a fresh context has a different `peer_shadowed`; assert `recorded_children_match()` is false and/or that the fresh walk is not incorrectly suppressed.

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



Remediation recommended
2. Changeset missing pnpm bump 📘 Rule violation § Compliance
Description
The new changeset documents a user-visible pnpm install behavior change but only bumps pacquet,
omitting the required pnpm entry. This can cause the pnpm release to miss the fix or be versioned
incorrectly.
Code

.changeset/pinned-children-survive-a-fresh-walk.md[2]

+"pacquet": patch
Relevance

●●● Strong

Recent precedent: missing required pnpm entry in changeset front-matter is typically fixed to
satisfy policy.

PR-#13748
PR-#13403

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance ID 713436 requires changesets to explicitly list pnpm with a correct bump type when
pnpm behavior is affected. The added changeset front-matter lists only pacquet, while the body
explicitly states a pnpm install behavior change.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/pinned-children-survive-a-fresh-walk.md[1-5]

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

## Issue description
The changeset describes a `pnpm install` behavior fix but the front-matter only declares a version bump for `pacquet`. Per policy, the changeset must explicitly include the `pnpm` package with a valid bump type.

## Issue Context
This PR changes install/lockfile behavior described in the changeset body, which is user-visible and should be released under the `pnpm` package.

## Fix Focus Areas
- .changeset/pinned-children-survive-a-fresh-walk.md[1-3]

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


Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@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.16     13.6±0.49ms    27.5 MB/sec    1.00     11.7±0.06ms    32.0 MB/sec
packument/parse                                  1.16     43.5±1.40µs  1523.7 MB/sec    1.00     37.6±0.08µs  1762.2 MB/sec
tarball/download_dependency                      1.23      2.9±0.14ms  1518.7 KB/sec    1.00      2.3±0.09ms  1874.7 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.24    213.4±6.01ms 75.0 KElem/sec    1.00    171.8±4.21ms 93.1 KElem/sec
workspace_resolution/hoist_heavy                 1.19   284.6±10.50ms        ? ?/sec    1.00    239.4±3.34ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Aug 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.23%. Comparing base (2f76f98) to head (c334e04).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13839      +/-   ##
==========================================
- Coverage   88.25%   88.23%   -0.02%     
==========================================
  Files         625      627       +2     
  Lines      103024   103279     +255     
==========================================
+ Hits        90920    91130     +210     
- Misses      12104    12149      +45     

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

@zkochan

zkochan commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

Both addressed in 74e549c.

Preserve the pin before accepting equal child edges — correct, and a real hole in the fix as posted. A fresh walk that lands on the same edges took the equal-edge arm, republished, and carried its unpinned context onto the record; the pin marker was gone, so the next fresh walk with different edges found nothing holding it back and overwrote the locked children. The check now runs before the equal-edge arm, with the reason recorded there.

The unit test gained the case that catches it: after the pinned recording, a fresh walk with equal edges must also be declined. Putting the equal-edge arm back in front fails on that assertion — the differing-edge one alone does not, which is why the hole survived my first pass.

Duplicated test narration — trimmed. The test's comment keeps only what the code cannot say (why publishing over pins is wrong, plus the issue anchor), and the helper's is down to what slow selects, which is the one non-obvious knob in the fixture.

Re-verified after both changes: the partially stale @teambit/bit repro resolves to the same lockfile as before, 3/3 identical, and 8134 tests plus the pre-push gates pass.


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

Copilot AI review requested due to automatic review settings August 11, 2026 23:29

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.

greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 11, 2026
@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 11, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 74e549c

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

`record_children` documents that "a recording the prior lockfile pinned
outlives a fresh walk's different answer", and then inserts the fresh
answer over it. The arm only suppressed the staleness signal, so the
occurrences that realized the pinned subtree went on holding children
the record no longer listed, and the lockfile took whichever answer
landed last.

Instrumented on a partially stale `@teambit/bit` lockfile, 22 recordings
per run were replaced this way, every one of them a pinned recording
overwritten by a fresh walk: `enhanced-resolve` lost its pinned
`[email protected]` for `4.2.11`, `subscriptions-transport-ws` its
`[email protected]` for `7.5.13`, and `@types/express-serve-static-core` moved a
major version. A plain install re-resolved 24 edges nothing had asked it
to.

Make the rule the comment describes: a walk whose context carries no
prior key publishes nothing over a pinned recording, and reads the
pinned children like every occurrence that reused the subtree. The gate
that decides whether to walk at all applies the same rule, so the fresh
subtree is not resolved and thrown away. An update policy still
re-resolves pins — that is what it is for.

Related to issue #13837.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@zkochan

zkochan commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

Pins ignore peer shadow — taken, in 74e549c (amended). pins_children_over now also requires the two shadow sets to agree.

Worth recording why it is worth taking even though the failure mode cannot fire through the path that motivated the fix: a reuse-made recording always carries an empty shadow set, and snapshot_child_refs already drops every peer-named entry from the snapshot before it is recorded — so exactly the names where shadowing could disagree (a package's own dependencies ∩ its peerDependencies) are never in a pinned child list to begin with. What the finding does reach is a recording pinned by a fresh walk, whose children were filtered under that occurrence's set; before this change a later occurrence with a different set would have re-walked, and my first cut let it read them instead.

Measured before adopting: with the shadow sets required to agree, the partially stale @teambit/bit repro resolves to a byte-identical lockfile (90620698594da2ee) — all 24 edges that keep their pins are contested by occurrences whose shadow sets already match, so the tightening costs nothing and closes the case that could differ.

Covered by a_pin_stands_in_only_for_a_walk_that_shadows_the_same_dependencies, which also pins the update-policy exemption.

Changeset missing pnpm bump — not applicable. pnpm in a changeset is the TypeScript CLI package, and AGENTS.md says plainly: "Do not add "pnpm" to a Rust-only changeset." This implementation is Rust-only, so it targets pacquet alone — same answer as on #13830 and #13835.

8135 tests and the pre-push gates pass.


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

Copilot AI review requested due to automatic review settings August 11, 2026 23:39
@greptile-apps
greptile-apps Bot dismissed their stale review August 11, 2026 23:39

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

Copy link
Copy Markdown

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

@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: c334e046c7cb

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.684 ± 0.225 2.385 3.043 1.73 ± 0.22
pacquet@main 2.704 ± 0.184 2.456 2.942 1.74 ± 0.20
pnpr@HEAD 1.582 ± 0.114 1.449 1.840 1.02 ± 0.12
pnpr@main 1.554 ± 0.146 1.419 1.800 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.68384332096,
      "stddev": 0.22478547937909682,
      "median": 2.7341245805599996,
      "user": 2.4785825600000004,
      "system": 1.84088852,
      "min": 2.3847362895599997,
      "max": 3.04271223256,
      "times": [
        2.89316639756,
        2.77901130756,
        2.6914104595599997,
        2.40524434656,
        2.3847362895599997,
        2.79966711256,
        2.67116964956,
        3.04271223256,
        2.77683870156,
        2.39447671256
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.7036226806599997,
      "stddev": 0.18445847783126962,
      "median": 2.73444230306,
      "user": 2.30535756,
      "system": 1.76733302,
      "min": 2.45578999356,
      "max": 2.9418355795599997,
      "times": [
        2.45578999356,
        2.56390021656,
        2.86397282456,
        2.66273586256,
        2.88800851456,
        2.9418355795599997,
        2.45641927956,
        2.80614874356,
        2.83190721256,
        2.56550857956
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5822100478599999,
      "stddev": 0.11398911809739762,
      "median": 1.58825682806,
      "user": 1.7970310600000001,
      "system": 1.59768112,
      "min": 1.4492675325600002,
      "max": 1.83978184756,
      "times": [
        1.61693224756,
        1.45658584356,
        1.64844814656,
        1.58483330256,
        1.55401076056,
        1.5916803535600001,
        1.4492675325600002,
        1.83978184756,
        1.48052162056,
        1.60003882356
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5541508590600004,
      "stddev": 0.14588900445151476,
      "median": 1.51879714106,
      "user": 1.5744306599999995,
      "system": 1.43520102,
      "min": 1.41874132156,
      "max": 1.7999660765600003,
      "times": [
        1.42014334156,
        1.7893583545600003,
        1.48423354956,
        1.7999660765600003,
        1.5795611035600001,
        1.41874132156,
        1.62712488656,
        1.4378985825600001,
        1.4311206415600002,
        1.55336073256
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 285.5 ± 8.0 276.4 300.1 1.00
pacquet@main 290.8 ± 10.7 276.8 312.6 1.02 ± 0.05
pnpr@HEAD 336.6 ± 13.2 314.5 355.4 1.18 ± 0.06
pnpr@main 343.4 ± 46.2 310.8 466.2 1.20 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2855266263800001,
      "stddev": 0.007999343242914514,
      "median": 0.28538438088000007,
      "user": 0.24646999999999997,
      "system": 0.5606355599999999,
      "min": 0.27636911788,
      "max": 0.30012616288000005,
      "times": [
        0.28139504888000005,
        0.27826940188000004,
        0.27638679188000004,
        0.29081869188000004,
        0.28554492888000005,
        0.27636911788,
        0.28522383288000003,
        0.28573221388000003,
        0.29540007288000003,
        0.30012616288000005
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.29083862408,
      "stddev": 0.010694876570702174,
      "median": 0.29149207438,
      "user": 0.2648517,
      "system": 0.55401446,
      "min": 0.27683383188000005,
      "max": 0.31255030088,
      "times": [
        0.29266766088,
        0.28295718088000005,
        0.27683383188000005,
        0.28115817488000006,
        0.29330256388000003,
        0.29031648788000003,
        0.29627065888000004,
        0.28203628788,
        0.31255030088,
        0.30029309288000006
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33664528248000003,
      "stddev": 0.013236411295902905,
      "median": 0.33516817888000006,
      "user": 0.2913603,
      "system": 0.6332989600000001,
      "min": 0.31445411788000005,
      "max": 0.35538817988000004,
      "times": [
        0.33319420188000004,
        0.33257068088,
        0.34949934188000004,
        0.31445411788000005,
        0.34489475088000004,
        0.31820532988000005,
        0.35538817988000004,
        0.33517282388,
        0.34790986388000006,
        0.33516353388000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.34337832388,
      "stddev": 0.046160361854497026,
      "median": 0.32444846538000005,
      "user": 0.28230659999999996,
      "system": 0.6851596600000001,
      "min": 0.31084813688,
      "max": 0.46624434488000005,
      "times": [
        0.46624434488000005,
        0.35847622488,
        0.34051028388000004,
        0.32354889788,
        0.35430821188000006,
        0.32534803288,
        0.32075032288000005,
        0.31288294288,
        0.32086583988000006,
        0.31084813688
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.796 ± 0.031 2.763 2.861 1.61 ± 0.14
pacquet@main 2.731 ± 0.026 2.696 2.770 1.57 ± 0.14
pnpr@HEAD 1.742 ± 0.140 1.555 1.896 1.00 ± 0.12
pnpr@main 1.739 ± 0.151 1.489 1.933 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7959136235599997,
      "stddev": 0.030709448287575464,
      "median": 2.78727744926,
      "user": 2.06420012,
      "system": 1.63076416,
      "min": 2.7625382842599997,
      "max": 2.86090582826,
      "times": [
        2.80768271026,
        2.78430970226,
        2.8200539702599996,
        2.76982940426,
        2.77858214426,
        2.86090582826,
        2.7625382842599997,
        2.79024519626,
        2.81756973126,
        2.76741926426
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.7305604983599996,
      "stddev": 0.02562420736394646,
      "median": 2.72688945376,
      "user": 1.8525150200000002,
      "system": 1.4863164599999998,
      "min": 2.6964950382599997,
      "max": 2.76997991626,
      "times": [
        2.7441487302599996,
        2.76997991626,
        2.7029935202599997,
        2.7120465932599997,
        2.6964950382599997,
        2.73321176326,
        2.74580332226,
        2.76647987126,
        2.72056714426,
        2.71387908426
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.74201084866,
      "stddev": 0.13980263277255361,
      "median": 1.7988041517600002,
      "user": 1.3236887199999998,
      "system": 1.30510456,
      "min": 1.55531912126,
      "max": 1.89634581626,
      "times": [
        1.89634581626,
        1.65760371526,
        1.55531912126,
        1.57651633026,
        1.7670763142600001,
        1.83117419026,
        1.83053198926,
        1.85466427426,
        1.88832244026,
        1.56255429526
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.73893178376,
      "stddev": 0.15133550824775485,
      "median": 1.75675926026,
      "user": 1.50154992,
      "system": 1.4621712600000003,
      "min": 1.48892189026,
      "max": 1.93302430826,
      "times": [
        1.6781509162600001,
        1.48892189026,
        1.9177646652600002,
        1.76869540426,
        1.51379790926,
        1.74482311626,
        1.69032086126,
        1.93302430826,
        1.80665381526,
        1.8471649512600001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 520.9 ± 49.1 465.4 604.5 1.68 ± 0.18
pacquet@main 450.7 ± 19.0 429.7 483.5 1.45 ± 0.10
pnpr@HEAD 310.5 ± 16.3 291.4 336.8 1.00
pnpr@main 329.4 ± 12.3 310.1 345.3 1.06 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5208630897,
      "stddev": 0.049087618715483526,
      "median": 0.5175551513000001,
      "user": 0.6957120800000001,
      "system": 0.83802836,
      "min": 0.4653735923,
      "max": 0.6045217163000001,
      "times": [
        0.5626004143000001,
        0.5802210243000001,
        0.6045217163000001,
        0.5128573593000001,
        0.5306019233000001,
        0.5222529433,
        0.49179192430000007,
        0.4653735923,
        0.4692842313000001,
        0.4691257683000001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.4506760811,
      "stddev": 0.01899077335981581,
      "median": 0.44851039930000003,
      "user": 0.57350308,
      "system": 0.72288486,
      "min": 0.42966813630000006,
      "max": 0.48345300830000004,
      "times": [
        0.45287367030000003,
        0.44476440530000005,
        0.45225639330000006,
        0.43186747230000005,
        0.47988421430000006,
        0.42966813630000006,
        0.48345300830000004,
        0.43149507530000003,
        0.45775773430000005,
        0.44274070130000004
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.31054941020000004,
      "stddev": 0.01633084111578699,
      "median": 0.3066665478,
      "user": 0.21661397999999998,
      "system": 0.51407336,
      "min": 0.29139662930000004,
      "max": 0.33678237930000005,
      "times": [
        0.2942756483,
        0.2938870733,
        0.33678237930000005,
        0.29139662930000004,
        0.32934974730000005,
        0.32606608630000006,
        0.30076708630000004,
        0.30695050130000007,
        0.31963635630000004,
        0.30638259430000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3293754004000001,
      "stddev": 0.012276201575602986,
      "median": 0.33214965180000006,
      "user": 0.22745727999999996,
      "system": 0.5759258600000001,
      "min": 0.31010058730000006,
      "max": 0.34534100230000003,
      "times": [
        0.33645409130000004,
        0.34534100230000003,
        0.33511381730000006,
        0.32519008230000007,
        0.31010058730000006,
        0.3202107813,
        0.32918548630000005,
        0.3374882303,
        0.31198566330000005,
        0.34268426230000004
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.965 ± 0.048 1.884 2.041 5.91 ± 0.24
pacquet@main 1.922 ± 0.042 1.864 1.989 5.78 ± 0.22
pnpr@HEAD 0.338 ± 0.020 0.307 0.367 1.02 ± 0.07
pnpr@main 0.333 ± 0.011 0.318 0.351 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.96465824874,
      "stddev": 0.04830165049151708,
      "median": 1.96915151464,
      "user": 1.02217612,
      "system": 0.9519992799999999,
      "min": 1.88400144614,
      "max": 2.04131063214,
      "times": [
        1.91417807014,
        2.01892746814,
        2.04131063214,
        1.92944953914,
        1.99088728914,
        1.9752418621399999,
        1.96306116714,
        1.94151665114,
        1.88400144614,
        1.98800836214
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.92219048764,
      "stddev": 0.04191118825314634,
      "median": 1.92735373164,
      "user": 0.9019591199999999,
      "system": 0.9234756799999998,
      "min": 1.86424041414,
      "max": 1.98854161814,
      "times": [
        1.93957013414,
        1.88566343814,
        1.90891408014,
        1.86424041414,
        1.8644030331399999,
        1.91955393814,
        1.93515352514,
        1.94881197014,
        1.9670527251399998,
        1.98854161814
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33847922034,
      "stddev": 0.020446898872350912,
      "median": 0.34248848714,
      "user": 0.24791742,
      "system": 0.56900118,
      "min": 0.30658081914,
      "max": 0.36687144314,
      "times": [
        0.36687144314,
        0.35473816514,
        0.34188601514,
        0.35095274814,
        0.34309095914,
        0.35561846414,
        0.33676090914,
        0.31578246214,
        0.30658081914,
        0.31251021814
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.33266558234000004,
      "stddev": 0.010548137881300091,
      "median": 0.33344300814,
      "user": 0.23904152,
      "system": 0.5683516799999999,
      "min": 0.31826529414,
      "max": 0.35133321314,
      "times": [
        0.34488975114,
        0.33264341714,
        0.33556800714,
        0.32411939814,
        0.33544005414,
        0.33175804614,
        0.35133321314,
        0.33424259914,
        0.31826529414,
        0.31839604314
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 260.9 ± 33.8 219.7 305.6 2.55 ± 0.36
pacquet@main 243.3 ± 17.5 224.1 287.1 2.37 ± 0.22
pnpr@HEAD 102.5 ± 5.9 94.6 115.3 1.00
pnpr@main 106.4 ± 7.1 95.0 121.0 1.04 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2608549254,
      "stddev": 0.03383144321827674,
      "median": 0.24589172990000002,
      "user": 0.20887403999999998,
      "system": 0.09089598,
      "min": 0.2196767329,
      "max": 0.3055970369,
      "times": [
        0.27782352590000003,
        0.30281603790000006,
        0.30441946890000005,
        0.3055970369,
        0.2421552969,
        0.2420219779,
        0.2431520489,
        0.24863141090000002,
        0.2196767329,
        0.2222557169
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.24330668223333332,
      "stddev": 0.017523152289407328,
      "median": 0.24043560790000001,
      "user": 0.19387835666666667,
      "system": 0.07429036333333332,
      "min": 0.2241177039,
      "max": 0.28708415890000005,
      "times": [
        0.2371252929,
        0.2656825359,
        0.2419329829,
        0.2265621419,
        0.2326311439,
        0.2319074679,
        0.2462010049,
        0.2389382329,
        0.2435622569,
        0.2241177039,
        0.2439352639,
        0.28708415890000005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10248089862413792,
      "stddev": 0.005925747050895344,
      "median": 0.10143699390000001,
      "user": 0.02866100896551724,
      "system": 0.016151711034482756,
      "min": 0.0946041229,
      "max": 0.11534151090000001,
      "times": [
        0.0957209259,
        0.1107770339,
        0.1017673629,
        0.10638678890000001,
        0.10085150590000001,
        0.09821334590000001,
        0.0970247089,
        0.0976538289,
        0.09498572190000001,
        0.09591087590000001,
        0.1056036369,
        0.09688186890000001,
        0.0967408579,
        0.09676850290000001,
        0.11061950290000001,
        0.11534151090000001,
        0.11132919790000001,
        0.10143699390000001,
        0.1053984879,
        0.10483938690000001,
        0.11419616190000001,
        0.1026885349,
        0.1074588669,
        0.10464003190000001,
        0.10117863590000001,
        0.10363418890000001,
        0.0996608729,
        0.09963259790000001,
        0.0946041229
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.1064421824862069,
      "stddev": 0.007091316350844333,
      "median": 0.10589932390000001,
      "user": 0.02877414689655173,
      "system": 0.01936243517241379,
      "min": 0.0949638019,
      "max": 0.12097086990000001,
      "times": [
        0.09826813290000001,
        0.09638367490000001,
        0.0949638019,
        0.0979948419,
        0.1017033209,
        0.09900716890000001,
        0.1000189199,
        0.1065163989,
        0.09836879590000001,
        0.1050945729,
        0.11018273690000001,
        0.1104095469,
        0.1094638579,
        0.09886805890000001,
        0.1054718909,
        0.10478201790000001,
        0.1038575399,
        0.1014946599,
        0.10918157190000001,
        0.1089728679,
        0.11811830390000001,
        0.1139418969,
        0.11314816590000001,
        0.11711639790000002,
        0.12097086990000001,
        0.1165935899,
        0.10589932390000001,
        0.10732330790000001,
        0.1127070579
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 806.1 ± 68.8 746.9 956.0 1.13 ± 0.24
pacquet@main 713.2 ± 136.9 442.5 855.8 1.00
pnpm@HEAD 3744.5 ± 270.2 3394.0 4061.1 5.25 ± 1.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.8060777783466667,
      "stddev": 0.06876718733208399,
      "median": 0.77761491668,
      "user": 0.8079054777777777,
      "system": 0.18279393333333332,
      "min": 0.74686796268,
      "max": 0.9559798256800001,
      "times": [
        0.74686796268,
        0.9559798256800001,
        0.74893443268,
        0.75852539768,
        0.77761491668,
        0.78696736168,
        0.84770294968,
        0.77592029568,
        0.85618686268
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.7132228009022222,
      "stddev": 0.13688698429490076,
      "median": 0.6914286456800001,
      "user": 0.7113394777777776,
      "system": 0.15098237777777776,
      "min": 0.44254698968,
      "max": 0.85577266068,
      "times": [
        0.80122409268,
        0.67275963968,
        0.6914286456800001,
        0.85577266068,
        0.85231500768,
        0.8321986826800001,
        0.44254698968,
        0.6148730476800001,
        0.65588644168
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.7445045749022228,
      "stddev": 0.2701644358903244,
      "median": 3.77496378768,
      "user": 5.4460106999999995,
      "system": 0.38991504444444447,
      "min": 3.39396635468,
      "max": 4.06105537468,
      "times": [
        4.06105537468,
        3.9784314646800003,
        4.017034997680001,
        3.96179605968,
        3.39396635468,
        3.42306116268,
        3.77496378768,
        3.52445604068,
        3.5657759316799997
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.657 ± 0.147 4.520 4.979 1.30 ± 0.05
pacquet@main 4.757 ± 0.206 4.543 5.124 1.33 ± 0.06
pnpr@HEAD 3.700 ± 0.144 3.563 3.953 1.03 ± 0.05
pnpr@main 3.579 ± 0.080 3.516 3.750 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.65656159666,
      "stddev": 0.14731939315171522,
      "median": 4.60764974986,
      "user": 2.7739945599999993,
      "system": 1.95575722,
      "min": 4.51972572786,
      "max": 4.97906927186,
      "times": [
        4.60787277586,
        4.64279905086,
        4.59725480786,
        4.607426723860001,
        4.61356350786,
        4.57246555386,
        4.97906927186,
        4.51972572786,
        4.86903927786,
        4.55639926886
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.7573714778600005,
      "stddev": 0.20578109868929684,
      "median": 4.69032572886,
      "user": 2.785498059999999,
      "system": 2.07138942,
      "min": 4.54270054186,
      "max": 5.12367413886,
      "times": [
        4.9359356968600006,
        5.12367413886,
        4.71132384886,
        4.63193879786,
        4.61052557186,
        5.04097940986,
        4.669327608860001,
        4.753277074860001,
        4.54270054186,
        4.5540320888600005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.7004704628600003,
      "stddev": 0.1440615244228845,
      "median": 3.63356451736,
      "user": 1.93280016,
      "system": 1.72869772,
      "min": 3.56306918886,
      "max": 3.9526559908600003,
      "times": [
        3.63418827886,
        3.8076438388600002,
        3.9526559908600003,
        3.58927044686,
        3.63003718586,
        3.56306918886,
        3.9338500938600003,
        3.59668735786,
        3.63294075586,
        3.66436149086
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5791154601599997,
      "stddev": 0.07966696434009986,
      "median": 3.53762988336,
      "user": 1.6562036599999999,
      "system": 1.4979694199999998,
      "min": 3.51588927886,
      "max": 3.74982144886,
      "times": [
        3.6771577948600003,
        3.53896122186,
        3.51906618286,
        3.52738536486,
        3.53629854486,
        3.56576748786,
        3.5331702488600003,
        3.62763702786,
        3.74982144886,
        3.51588927886
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13839
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,762.54 ms
(+2.06%)Baseline: 2,706.81 ms
3,248.17 ms
(85.05%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,884.00 ms
(+3.56%)Baseline: 1,819.32 ms
2,183.18 ms
(86.30%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
465.37 ms
(+1.41%)Baseline: 458.92 ms
550.71 ms
(84.50%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
219.68 ms
(-4.22%)Baseline: 229.35 ms
275.22 ms
(79.82%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,384.74 ms
(-4.03%)Baseline: 2,484.93 ms
2,981.91 ms
(79.97%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,519.73 ms
(-0.20%)Baseline: 4,528.68 ms
5,434.42 ms
(83.17%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
276.37 ms
(-8.17%)Baseline: 300.96 ms
361.15 ms
(76.53%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
746.87 ms
(+6.05%)Baseline: 704.23 ms
845.08 ms
(88.38%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13839
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,555.32 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
306.58 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
291.40 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
94.60 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,449.27 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,563.07 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
314.45 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit cdc14c6 into main Aug 12, 2026
34 checks passed
@zkochan
zkochan deleted the fix-13837 branch August 12, 2026 04:48
zkochan added a commit that referenced this pull request Oct 13, 2026
…ges a peer

A children owner with no prior lockfile key reads the children the
lockfile pinned for its package (#13839). When the owner's
scope provides a name a pinned package lists both as a dependency and
as an optional peer, the split the pins record no longer applies, but
the lockfile entry cannot say so: an entry that kept the dependency
omits the peer. So adding a dependency whose optional peers hoist a
parent of such a package kept the old split, while installing
everything at once, and pnpm v11 in both cases, wrote the peer.

Before reading the pins, such an owner walks the pinned subtree. For a
package with a locked dependency or peer whose presence in scope
differs from the scope the pins were recorded under, it reads the
package's metadata and compares the split under the new scope with the
locked one. When any differs, the owner resolves its children instead
of reading the pins. A plain reinstall has no such owner; adding a
dependency to the reproduction from #16901 checked 14 owners
and read the metadata of one package.

Closes the follow-up of #16901.
zkochan added a commit that referenced this pull request Oct 14, 2026
…comes a peer (#16912)

A newly resolved package reads the children the prior lockfile pinned
for it (#13839). When the scope it resolves them in provides a
name that a pinned package lists both as a dependency and as an optional
peer, the pinned split no longer applies, but the lockfile entry cannot
say so: an entry that kept the dependency omits the peer. So installing
in two steps kept the old split, while installing everything at once,
and pnpm v11 in both cases, wrote the peer.

Before reading the pins, the owner walks the pinned subtree. For a
package with a locked dependency or peer whose presence in scope
differs from the scope the pins were recorded under, it reads the
package's metadata and compares the split under the new scope with the
locked one. When any differs, the owner resolves its children instead.
A plain reinstall has no such owner.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants