Centralize latest version selection - #69
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR centralizes “latest version” selection into a shared policy function so single-version and bulk helpers behave consistently across registries, prioritizing registry-advertised “latest” when available and otherwise choosing the most recent active release.
Changes:
- Implement shared
SelectLatestVersionpolicy and routeFetchLatestVersionthrough it (including advertised-latest precedence and timestamp/version-order fallback). - Add unit tests covering advertised-latest behavior, active filtering, timestamp ordering, and ecosystem version ordering.
- Update public API wrappers and README usage examples to reflect the new policy.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
registries.go |
Updates exported wrapper docs and adds an exported SelectLatestVersion wrapper. |
internal/core/helpers.go |
Introduces shared latest-version selection logic and updates FetchLatestVersion to use advertised-latest + fallback policy. |
internal/core/helpers_test.go |
Adds focused tests for the new selection policy and FetchLatestVersion behavior. |
README.md |
Updates examples to describe/use the shared latest-version policy. |
go.mod |
Promotes github.com/git-pkgs/vers to a direct dependency. |
💡 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.
Adds a shared latest-version selector used by the single and bulk helpers. Registry-advertised versions take precedence; otherwise inactive releases are filtered and candidates are ordered by publication time with ecosystem version ordering as the fallback.