From f72a0076cd29fb8eaf7fae1ec03ed031848098b5 Mon Sep 17 00:00:00 2001 From: Mason Mines Date: Wed, 22 Jul 2026 09:56:21 -0400 Subject: [PATCH] Add default descending semver ordering to collection version search The cross-repo search endpoint returns versions in arbitrary order when no order_by parameter is passed. Add default descending version ordering in get_queryset so versions display newest-first. Explicit order_by and full-text search ordering replace it. Fixes: AAP-78435 Co-Authored-By: Claude Opus 4.6 (1M context) (cherry picked from commit b8794efa07af1786c592f62b87a79d790362a047) --- CHANGES/2571.bugfix | 1 + pulp_ansible/app/galaxy/v3/viewsets.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 CHANGES/2571.bugfix diff --git a/CHANGES/2571.bugfix b/CHANGES/2571.bugfix new file mode 100644 index 000000000..848f6ceea --- /dev/null +++ b/CHANGES/2571.bugfix @@ -0,0 +1 @@ +Add default descending semver ordering to the collection version search endpoint when no explicit ordering is requested. diff --git a/pulp_ansible/app/galaxy/v3/viewsets.py b/pulp_ansible/app/galaxy/v3/viewsets.py index b2f7fb90d..c4ce566ce 100644 --- a/pulp_ansible/app/galaxy/v3/viewsets.py +++ b/pulp_ansible/app/galaxy/v3/viewsets.py @@ -85,7 +85,7 @@ def get_queryset(self): if hasattr(permission_class, "scope_queryset"): qs = permission_class.scope_queryset(self, qs) - return qs + return qs.order_by("-collection_version__version") def rebuild(self, request, *args, **kwargs): async_result = dispatch(