Skip to content

Fix direct registry latest version selection - #53

Merged
andrew merged 2 commits into
git-pkgs:mainfrom
abhinavgautam01:issue-52-direct-latest-status-ordering
Jul 29, 2026
Merged

Fix direct registry latest version selection#53
andrew merged 2 commits into
git-pkgs:mainfrom
abhinavgautam01:issue-52-direct-latest-status-ordering

Conversation

@abhinavgautam01

Copy link
Copy Markdown
Contributor

Summary

Fixes #52.

This updates the direct registry fallback path for packages where LatestVersion is not populated by the registry response.

Changes

  • Exclude unavailable versions when computing fallback latest version:
    • yanked
    • deprecated
    • retracted
  • Use vers.CompareWithScheme with the PURL type instead of generic vers.Compare
  • Add tests for unavailable status filtering
  • Add coverage for scheme-specific ordering, including Debian-style versions

Testing

go test -run TestFindLatestVersion -v
go test ./...
git diff --check

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the direct-registry fallback logic used by RegistriesClient.BulkLookup when a registry response omits LatestVersion, ensuring “latest” selection respects both release availability and ecosystem-specific version ordering.

Changes:

  • Filters out unavailable versions (yanked, deprecated, retracted) when computing the fallback latest version.
  • Switches version comparison to vers.CompareWithScheme using the PURL type (ecosystem scheme).
  • Expands unit tests to cover unavailable-status filtering and scheme-specific ordering (including Debian-style versions).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
registries.go Computes fallback latest version using scheme-aware comparison and filters unavailable versions.
enrichment_test.go Adds table-driven tests for unavailable statuses and scheme-specific ordering behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread registries.go Outdated
@andrew
andrew merged commit 947d590 into git-pkgs:main Jul 29, 2026
2 checks passed
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.

direct: respect release status and ecosystem ordering when finding latest

3 participants