Skip to content

feat: implement conflict promotion logic in requirement selection#3751

Merged
frostming merged 2 commits intomainfrom
feat/provider-conflicts
Mar 21, 2026
Merged

feat: implement conflict promotion logic in requirement selection#3751
frostming merged 2 commits intomainfrom
feat/provider-conflicts

Conversation

@frostming
Copy link
Collaborator

@frostming frostming commented Mar 21, 2026

Signed-off-by: Frost Ming [email protected]

Related link: pypa/pip#13859

Pull Request Checklist

  • A news fragment is added in news/ describing what is new.
  • Test cases added for changed code.

Describe what you have changed in this PR.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9970fa8dcf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +119 to +122
if name not in resolutions:
self._conflict_counts[name] += 1
if self._conflict_counts[name] >= _CONFLICT_PRIORITY_THRESHOLD:
self._conflict_promoted.add(name)

Choose a reason for hiding this comment

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

P2 Badge Count promotions only on new backtracks

This increments _conflict_counts every time narrow_requirement_selection() runs with the last backtrack_causes, but resolvelib keeps that same backtrack_causes list across subsequent successful rounds. In practice, a package that conflicted once can cross the threshold after a few unrelated pins and get added to _conflict_promoted permanently. That turns this into a “stale last conflict” heuristic instead of a “repeated conflicts” heuristic, which can reorder later rounds badly enough to hit resolve_max_rounds on otherwise-solvable dependency sets.

Useful? React with 👍 / 👎.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How to fix this? @codex

Choose a reason for hiding this comment

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

@codecov
Copy link

codecov bot commented Mar 21, 2026

Codecov Report

❌ Patch coverage is 90.62500% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.12%. Comparing base (d14eebc) to head (5681f28).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/pdm/resolver/providers.py 90.62% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3751      +/-   ##
==========================================
+ Coverage   86.09%   86.12%   +0.03%     
==========================================
  Files         118      118              
  Lines       12374    12406      +32     
  Branches     2060     2071      +11     
==========================================
+ Hits        10653    10685      +32     
  Misses       1150     1150              
  Partials      571      571              
Flag Coverage Δ
unittests 85.98% <90.62%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@frostming frostming merged commit 2520466 into main Mar 21, 2026
33 checks passed
@frostming frostming deleted the feat/provider-conflicts branch March 21, 2026 09:08
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.

1 participant