Skip to content

revert: "fix(resolver): settle contested children under the owner's o… - #13833

Merged
zkochan merged 1 commit into
mainfrom
revert-13830
Aug 11, 2026
Merged

zkochan merged 1 commit into
mainfrom
revert-13830

Conversation

@zkochan

@zkochan zkochan commented Aug 11, 2026 •

Copy link
Copy Markdown
Member

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

Copilot AI lite review requested due to automatic review settings August 11, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@zkochan
zkochan merged commit 6536c01 into main Aug 11, 2026
11 checks passed
@zkochan
zkochan deleted the revert-13830 branch August 11, 2026 14:33
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Revert overlay-based handling of contested child resolution

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Revert resolver changes that tied recorded children to preferred-version overlay state.
• Simplify children recording/reuse context and remove overlay projection comparisons.
• Drop the associated regression test and changeset entry for the reverted behavior.
Diagram

graph TD
  A["Dependency walk (walk.rs)"] --> B{"Own children?"} --> C["Manifest child specs"] --> D[("children_specs_by_id") ] --> E["Resolve child nodes"] --> F[("children_by_id")]
  G["Lockfile reuse (reuse.rs)"] --> F
  H["Preferred versions overlay"] --> E
  subgraph Legend
    direction LR
    _p["Process/Module"] ~~~ _d{"Decision"} ~~~ _s[("Shared cache")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Feature-flag the overlay-settlement behavior
  • ➕ Allows quick rollback for affected users while preserving the newer deterministic behavior for testing
  • ➕ Enables bisecting regressions without reverting code entirely
  • ➖ Adds long-lived branching logic in a critical resolver path
  • ➖ Risk of divergent behaviors and extra maintenance/testing burden
2. Record children per overlay fingerprint (multi-entry children_by_id)
  • ➕ Preserves determinism and correctness when overlay materially affects child picks
  • ➕ Avoids forcing identical parents/overlays while still disambiguating truly different outcomes
  • ➖ Potential memory growth (more recorded variants per package id)
  • ➖ Requires careful key design and eviction/limits to prevent blowups
3. Serialize contested owner resolution (reduce concurrency for claim group)
  • ➕ Eliminates race-based nondeterminism without encoding overlay state into context
  • ➕ Keeps single recorded entry per package id
  • ➖ Could reduce performance on large graphs with many contested packages
  • ➖ Harder to implement without introducing deadlocks/lock contention

Recommendation: Given this is explicitly a revert of #13830, reverting is reasonable to restore prior behavior quickly if #13830 introduced regressions or instability. If determinism is still a goal, consider reintroducing it via an explicit strategy (feature flag or overlay-fingerprint recording) with targeted benchmarks and additional tests that cover both correctness and performance on contested-package graphs.

Files changed (6) +201 / -458

Bug fix (2) +188 / -234
reuse.rsStop attaching overlay-derived context when recording reused children +3/-7

Stop attaching overlay-derived context when recording reused children

• Removes the 'ChildrenOverlayView'/overlay-view field usage when creating 'RecordedChildrenContext' for lockfile reuse recordings, simplifying the recorded context to peer-shadowing/prior-key/update policy only.

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

walk.rsRemove overlay-view-based child context logic and simplify child spec handling +185/-227

Remove overlay-view-based child context logic and simplify child spec handling

• Eliminates the overlay-projection helpers and no longer includes overlay-derived data in recorded-children context comparisons. Inlines child-spec caching/filtering (including peer-shadow filtering and workspace catalog resolution) and keeps reuse gating based on the simplified context.

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

Refactor (1) +8 / -17
workspace_ctx.rsSimplify RecordedChildrenContext by removing overlay view state +8/-17

Simplify RecordedChildrenContext by removing overlay view state

• Removes 'ChildrenOverlayView' and the 'overlay_view' field from 'RecordedChildrenContext', and updates equality semantics to ignore preferred-version overlays when deciding whether a recorded children list matches.

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

Tests (2) +4 / -206
tests.rsUpdate workspace_ctx tests for simplified children context +4/-10

Update workspace_ctx tests for simplified children context

• Adjusts helpers and assertions to construct 'RecordedChildrenContext' without an overlay-view field and removes now-unused imports.

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

tests.rsRemove overlay-pick resolver and related regression test +0/-196

Remove overlay-pick resolver and related regression test

• Deletes the custom test resolver that varied picks via preferred-version overlays and removes the 'start_paused' regression test that depended on overlay-settlement behavior for contested children.

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

Other (1) +1 / -1
Cargo.tomlDrop tokio test-util feature from dev-dependencies +1/-1

Drop tokio test-util feature from dev-dependencies

• Removes the unnecessary 'tokio' 'test-util' feature from the crate’s dev-dependency configuration, aligning with removed start-paused test usage.

pnpm/crates/resolving-deps-resolver/Cargo.toml

@greptile-apps

greptile-apps Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 3/5

This PR should not merge until contested children remain deterministic across differing preferred-version overlays and the pacquet release metadata is restored.

The restored context comparison can reuse children selected under another occurrence's overlay, making dependency versions and lockfiles completion-order dependent, and the user-visible resolver change has no replacement changeset.

Files Needing Attention: pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs, pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs, pnpm/crates/resolving-deps-resolver/src/tests.rs, .changeset/deterministic-contested-children.md

Comments Outside Diff (1)

  1. .changeset/deterministic-contested-children.md

    P1 Pacquet release metadata is missing

    This PR changes user-visible dependency-resolution and lockfile behavior while deleting the only pacquet changeset, so the native release flow has no version bump or release-note entry for the reverted behavior.

    Context Used: CLAUDE.md (source)

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Reviews (1): Last reviewed commit: "revert: "fix(resolver): settle contested..." | Re-trigger Greptile

Comment on lines 186 to 190
pub(super) fn produces_same_children_as(&self, other: &Self) -> bool {
self.peer_shadowed == other.peer_shadowed
&& self.prior_key == other.prior_key
&& self.update_active == other.update_active
&& self.overlay_view == other.overlay_view
}

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.

P1 Overlay context no longer settles children

When the same package is reached concurrently through parents with different preferred-version overlays, produces_same_children_as treats those occurrences as equivalent and the later owner reuses children selected under the first occurrence's overlay, causing children_by_id and pnpm-lock.yaml to depend on completion order.

Knowledge Base Used: Resolving and Fetching Dependency Specifiers

Comment on lines 177 to +185
/// Two contexts produce the same children.
///
/// The preferred-versions overlay is deliberately not part of the
/// test. `children_by_id` records one child list per package id,
/// and every occurrence that does not own the children already
/// expands from it whatever its own overlay says — the overlay
/// only ever decides which occurrence's versions get *recorded*.
/// Requiring identical overlays here would mean requiring identical
/// parents, which the occurrences that race never have.

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.

P2 Narrative replaces overlay regression coverage

This comment asserts that excluding overlays from recorded-child matching is correct, while the same diff removes the focused test that exercised differing overlay selections; the non-obvious concurrency invariant is therefore documented as a claim rather than protected by executable coverage.

Context Used: Comments and docs in code are suspicious. Is test ... (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@github-actions

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     11.6±0.15ms    32.3 MB/sec    1.04     12.1±0.48ms    31.0 MB/sec
packument/parse                                  1.08     41.9±0.68µs  1582.0 MB/sec    1.00     38.8±0.12µs  1709.0 MB/sec
tarball/download_dependency                      1.11      2.5±0.18ms  1702.1 KB/sec    1.00      2.3±0.12ms  1891.6 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.16    218.8±7.60ms 73.1 KElem/sec    1.00    189.4±8.14ms 84.5 KElem/sec
workspace_resolution/hoist_heavy                 1.00    258.5±2.70ms        ? ?/sec    1.59  410.0±122.46ms        ? ?/sec

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13833      +/-   ##
==========================================
- Coverage   88.23%   88.23%   -0.01%     
==========================================
  Files         625      625              
  Lines      102839   102801      -38     
==========================================
- Hits        90742    90707      -35     
+ Misses      12097    12094       -3     

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

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Informational

1. Pacquet resolver change not synced 📘 Rule violation ⌂ Architecture
Description
This PR changes pacquet's Rust dependency-resolution behavior in ways that can affect user-visible
lockfile output, but the PR contains no corresponding pnpm TypeScript change and the PR description
does not call out the divergence. This risks pnpm vs pacquet behavioral drift for
installs/resolution.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[R576-578]

+    } else if !resolves_children_through_catalogs(&result)
+        && recorded_children_match(ctx, &id, &children_context())
+    {
Relevance

● Weak

Similar request to explicitly call out TS vs Rust resolver divergence was rejected previously.

PR-#13594

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires user-visible behavior changes in pnpm TypeScript and pacquet Rust to be kept
in sync (or explicitly called out as a known divergence). The Rust resolver now changes when it
reuses recorded children (potentially affecting resolution/lockfile outcomes) by altering the
reuse/match decision and by removing the overlay component from the recorded-children context
equivalence check.

Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[562-586]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[159-190]

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

## Issue description
The PR changes pacquet (Rust) resolver behavior that can impact user-visible resolution/lockfile output, but the change is not mirrored in pnpm's TypeScript implementation within the same PR and the PR description does not explicitly document the intended temporary divergence.

## Issue Context
Compliance requires pnpm TypeScript and pacquet Rust user-visible behavior changes to remain in sync, or for the PR description to clearly call out any intentional divergence and follow-up porting work.

## Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs[576-586]
- pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs[159-190]

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


Grey Divider

Context
✅ Compliance rules (platform): 26 rules

Grey Divider

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

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants