Use vers minimum version API - #36
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates version-constraint normalization for PURL generation by using vers.Range.MinimumVersion() to select the lowest included version from constraints, and preserving the original constraint string when no included minimum exists (e.g., exclusive lower bounds or certain Maven ranges).
Changes:
- Update
CleanVersionto useRange.MinimumVersion()instead of taking the first interval’s raw minimum bound. - Preserve the original constraint when an included minimum cannot be identified (e.g.,
>1.0.0,(1.0,2.0]). - Extend tests to cover exclusive bounds, unions, and proper escaping in generated PURLs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| makepurl.go | Switches constraint-to-version extraction to Range.MinimumVersion() and preserves original input when no included minimum exists. |
| makepurl_test.go | Adds coverage for exclusive constraints, union ordering, Maven exclusive-lower ranges, and PURL escaping for > constraints. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Use
Range.MinimumVersionwhen converting constraints to PURL versions. This avoids selecting excluded lower bounds and handles unions using ecosystem version ordering.Preserve the original constraint when no included minimum exists.