Repository navigation
Conversation
Avoid treating a synthesized 0.dev0 lower bound as a prerelease opt-in. Preserve explicit bounds and prerelease admission during set operations. Keep generous advisory matching unchanged and cover union edge cases. Fixes google#419.
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.
Fixes #419. Thanks to @trackoor and the UCSB PLSE research group for the report and reproduction.
PyPI constraints such as
<2.0use an internal lower bound of0.dev0. The matcher currently treats that synthetic bound as an explicit request for prereleases, so ordinary upper bounds can admit versions such as2.0.0.dev4or1.5rc1.This distinguishes the implicit minimum from a lower bound written by the caller. Explicit development/prerelease bounds keep their existing behavior, including
>=0dev0in either conjunction order. Generous matching used for vulnerability ranges remains unchanged. Set operations preserve the distinction without preventing stable-bound unions from merging.The internal provenance follows the existing treatment of the synthetic SemVer minimum. Textual set notation still cannot distinguish an omitted minimum from an explicit
0.dev0. AfterSet.String()/ParseSetConstraint()roundtripping, the displayed0.dev0is interpreted as an explicit bound and can admit prereleases again. The same provenance limitation exists for the synthetic SemVer minimum; this patch does not change the set format.Tests cover upper-only constraints, prerelease/development variants, epochs, stable and post releases, explicit zero-development bounds, generous matching, and union/intersection behavior. Nine direct prerelease regression cases and a closed-bound union case fail on the original source and pass with the fix. All five util-module suites and seven Go example builds passed locally with Go 1.27.4, along with semver race tests and
go vet.AI assistance was used for analysis, implementation, and tests.