Skip to content

Key already returned dependencies on repo and package - #59

Merged
ericmj merged 1 commit into
mainfrom
fix-already-returned-key
Oct 12, 2026
Merged

ericmj merged 1 commit into
mainfrom
fix-already-returned-key

Conversation

@ericmj

@ericmj ericmj commented Oct 12, 2026

Copy link
Copy Markdown
Member

PackageLister.dependencies_as_incompatibilities/4 reads already_returned with a {repo, package} key but writes it with the package name, so the lookup never matches. The read side changed to {repo, package} in 2bbdcd4 and the write side didn't. When the solver backtracks to another version of a package, it adds that version's dependency incompatibilities again even when one it already added covers the version.

I traced a solve through Hex's vendored copy that backtracks from foo 2.0.0 to 1.0.0. It added 7 incompatibilities, one a duplicate of every version of "foo" depends on "bar ~> 1.0". With the key fixed it adds 6 and finds the same solution. The new PackageLister test fails without the fix.

PackageLister.dependencies_as_incompatibilities/4 read already_returned
with a {repo, package} key but wrote it with the package name, so the
lookup never matched. Revisiting a version of a package returned the
same dependency incompatibilities again, and the solver added the
duplicates to its incompatibility set during backtracking.
@ericmj
ericmj merged commit 8197d42 into main Oct 12, 2026
20 checks passed
@ericmj
ericmj deleted the fix-already-returned-key branch October 12, 2026 23:16
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