Repository navigation
Stop the upgrade pass trading a root's final for a pre-release - #108
Merged
Merged
Conversation
The pass scored only levels and versions behind, so a root dropping to a pre-release cost a version or two and a level gained elsewhere outweighed it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Collaborator
Author
|
Merging at Reviews:
Left as-is, all low:
No exported API changed. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
UpgradeRootspass could trade a root's final release for a pre-release and keep the result, because a level gained by another root outweighed the versions the first root lost. The pass's score now puts "roots moved from a final release to a pre-release" first, so such an answer is never kept.Fixes #106
What changed
resolver/upgrade.go: the score is now (roots moved final → pre-release, levels behind, versions behind), compared in that order. The last two are unchanged.How each case is handled
A stricter rule, "never keep an answer that lowers any root", was tried and not taken: it fails 25 existing
TestUpgrade*tests, since lowering one root to raise another further is what the pass is for (TestUpgradeRootsRaisesARootThatIsMajorsBehind).Proof
New test
TestUpgradeRootsRootMovingDownchecks the pass's decision on each candidate (kept or not), then the pins.Before the fix:
After the fix, all six pass.
Real data: PyPI snapshot of 2026-11-12, roots
tensorflow==2.13.*andnumpy, CPython 3.11 on Linux x86_64,UpgradeRoots=40(a two-root cut of the issue's example, run by hand with a throwaway test).go test ./...,go test -race ./...,go vet ./...,gofmt -l .andgolangci-lintv2.11.2 are clean.🤖 Generated with Claude Code