Skip to content

fix(uv): preserve extra/group names in conflict error messages#4

Open
beast-ofcourse wants to merge 3 commits into
mainfrom
fix/conflict-extras-19525
Open

fix(uv): preserve extra/group names in conflict error messages#4
beast-ofcourse wants to merge 3 commits into
mainfrom
fix/conflict-extras-19525

Conversation

@beast-ofcourse

@beast-ofcourse beast-ofcourse commented Jul 8, 2026

Copy link
Copy Markdown
Owner

The collapse_proxies function in error reporting was removing all proxy nodes (extra, group, and marker) from the derivation tree during error formatting. This caused conflict error messages to lose extra and group names, e.g. showing \A depends on B >= 1\ instead of \A[extra] depends on B >= 1.

This change restricts proxy collapsing to only Marker variants, since marker info is a resolution-internal detail. Extra and group variants carry user-meaningful information about which optional dependencies are involved in the conflict.

Fixes astral-sh#19525

Summary by CodeRabbit

  • Bug Fixes
    • Improved simplification of dependency resolution failures to reduce noisy or misleading details.
    • Made proxy pruning more precise: when collapsing proxy-related incompatibilities, only marker-only proxies are removed, preserving Extra and Group proxy packages in edge cases.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d1b14118-ea56-43b0-943f-cf131693b365

📥 Commits

Reviewing files that changed from the base of the PR and between 595d11d and 4534a93.

📒 Files selected for processing (1)
  • crates/uv-resolver/src/error.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/uv-resolver/src/error.rs

📝 Walkthrough

Walkthrough

collapse_proxies now removes only marker proxies from External::FromDependencyOf branches, and the tests assert that extra and group proxy packages are preserved.

Changes

Proxy Detection Update

Layer / File(s) Summary
Marker-only proxy pruning and coverage
crates/uv-resolver/src/error.rs
Narrows proxy removal to PubGrubPackageInner::Marker, adds GroupName for test construction, and verifies extra and group proxies survive collapse_proxies.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: preserving extra and group names in conflict error messages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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/conflict-extras-19525

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
crates/uv-resolver/src/error.rs (1)

483-497: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Doc comment is now stale.

Line 484 says this collapses incompatibilities wrapping an PubGrubPackageInner::Extra package, but the predicate now only targets Marker (per the new is_proxy_package helper). Worth updating the comment to avoid confusing future readers, since Extra/Group are now intentionally excluded.

📝 Suggested doc fix
     /// Given a [`DerivationTree`], collapse any [`External::FromDependencyOf`] incompatibilities
-    /// wrap an [`PubGrubPackageInner::Extra`] package.
+    /// wrap an internal [`PubGrubPackageInner::Marker`] proxy package. `Extra` and `Group`
+    /// proxies are intentionally preserved since they carry user-meaningful context.
     pub(crate) fn collapse_proxies(derivation_tree: ErrorTree) -> ErrorTree {

The rest of the logic change (narrowing to Marker only) is well-supported by the enum documentation in crates/uv-resolver/src/pubgrub/package.rs and correctly aligns with the PR's stated intent of preserving Extra/Group context in error trees.

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

In `@crates/uv-resolver/src/error.rs` around lines 483 - 497, The doc comment for
collapse_proxies is stale and still mentions collapsing
External::FromDependencyOf incompatibilities wrapping
PubGrubPackageInner::Extra, but the new is_proxy helper only matches
PubGrubPackageInner::Marker. Update the comment to describe that this function
collapses marker-only proxy dependencies and intentionally preserves Extra and
Group context, so the documentation matches the current behavior of
collapse_proxies and is_proxy_package.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/uv-resolver/src/error.rs`:
- Around line 483-497: The doc comment for collapse_proxies is stale and still
mentions collapsing External::FromDependencyOf incompatibilities wrapping
PubGrubPackageInner::Extra, but the new is_proxy helper only matches
PubGrubPackageInner::Marker. Update the comment to describe that this function
collapses marker-only proxy dependencies and intentionally preserves Extra and
Group context, so the documentation matches the current behavior of
collapse_proxies and is_proxy_package.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c6279488-d8b6-418e-b0d2-c87cdfa15f47

📥 Commits

Reviewing files that changed from the base of the PR and between 51a283b and 550dcf3.

📒 Files selected for processing (1)
  • crates/uv-resolver/src/error.rs

@beast-ofcourse beast-ofcourse force-pushed the fix/conflict-extras-19525 branch from 550dcf3 to 22a4923 Compare July 8, 2026 06:45
Beast-ofcourse added 2 commits July 8, 2026 13:14
- marker: None -> marker: None.into() (MarkerTree, not Option<MarkerTree>)
- pubgrub::Range::any() -> pubgrub::Range::full() (removed associated fn)
- &**p -> &***p (extra deref through Arc<PubGrubPackageInner>)
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.

Package conflicts do not include extras

1 participant