Skip to content

avoid spurious empty-constraint conflict with duplicates across extras#10943

Open
dimbleby wants to merge 1 commit into
python-poetry:mainfrom
dimbleby:fix-10447
Open

avoid spurious empty-constraint conflict with duplicates across extras#10943
dimbleby wants to merge 1 commit into
python-poetry:mainfrom
dimbleby:fix-10447

Conversation

@dimbleby

@dimbleby dimbleby commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

I think this is probably right - the testcase is good anyway, and the fix looks likely...


When duplicate dependencies on the same package had different extras (e.g. the package appeared in multiple project.optional-dependencies entries and was also required with an extra by a dependency group), _resolve_overlapping_markers synthesised a 'not required' empty-constraint dependency for the leftover marker space of each subgroup. That synthetic dep conflicted with the sibling subgroup, causing 'depends on both X (*) and X ()' resolution failures.

Make the leftover-marker-space placeholder opt-in via a new cover_leftover_marker_space flag, and only enable it for the single-complete-name caller that actually needs it.

Fixes #10447

… across extras

When duplicate dependencies on the same package had different extras
(e.g. the package appeared in multiple project.optional-dependencies
entries and was also required with an extra by a dependency group),
_resolve_overlapping_markers synthesised a 'not required'
empty-constraint dependency for the leftover marker space of each
subgroup. That synthetic dep conflicted with the sibling subgroup,
causing 'depends on both X (*) and X (<empty>)' resolution failures.

Make the leftover-marker-space placeholder opt-in via a new
`cover_leftover_marker_space` flag, and only enable it for the
single-complete-name caller that actually needs it.

Fixes python-poetry#10447

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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

Hey - I've left some high level feedback:

  • The new cover_leftover_marker_space flag introduces a subtle behavioral fork in _resolve_overlapping_markers; consider either documenting its semantics and intended callers more explicitly in the docstring or splitting into two dedicated helpers to avoid boolean-flag-driven behavior.
  • The comment in the non-single_complete_name branch explains why cover_leftover_marker_space must be false there; it might be helpful to add a short in-code assertion or helper naming to enforce that assumption and make future regressions around leftover marker space harder to reintroduce.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `cover_leftover_marker_space` flag introduces a subtle behavioral fork in `_resolve_overlapping_markers`; consider either documenting its semantics and intended callers more explicitly in the docstring or splitting into two dedicated helpers to avoid boolean-flag-driven behavior.
- The comment in the non-`single_complete_name` branch explains why `cover_leftover_marker_space` must be false there; it might be helpful to add a short in-code assertion or helper naming to enforce that assumption and make future regressions around leftover marker space harder to reintroduce.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dosubot

dosubot Bot commented Jun 6, 2026

Copy link
Copy Markdown

Related Knowledge

1 document with suggested updates is ready for review.

Python Poetry

CHANGELOG /poetry/blob/main/CHANGELOG.md — ⏳ Awaiting Merge

How did I do? Any feedback?  Join Discord

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.

Version solving fails for dependency in optional-dependencies and group.

1 participant