Skip to content

Add default descending semver ordering to collection version search - #2571

Merged
mdellweg merged 1 commit into
pulp:mainfrom
MasonMines2006:AAP-78435-default-semver-ordering
Jul 22, 2026
Merged

Add default descending semver ordering to collection version search#2571
mdellweg merged 1 commit into
pulp:mainfrom
MasonMines2006:AAP-78435-default-semver-ordering

Conversation

@MasonMines2006

Copy link
Copy Markdown
Contributor

The cross-repo search endpoint (v3/plugin/ansible/search/collection-versions/)
returns versions in arbitrary order when no order_by parameter is passed.
This causes version dropdowns to display 4.7.10 before 4.7.5 (string sorting).

Adds a filter_queryset override that applies descending semver ordering
using the existing SemanticVersionOrderingFilter when no explicit ordering
is requested. Explicit order_by and full-text search ?q= ordering are
preserved.

Fixes: AAP-78435
Also addresses: AAP-56212

Tested on AAP 2.6-next using aap-dev. Verified:

  • Default (no order_by): returns correct descending semver
  • Explicit order_by=version: returns correct ascending semver
  • Explicit order_by=-version: returns correct descending semver
  • ?q= search: preserves relevance ordering

Comment thread pulp_ansible/app/galaxy/v3/viewsets.py Outdated
@@ -87,6 +90,12 @@ def get_queryset(self):

return qs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What if you return qs.order_by("-version") here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I meant "here". I don't think you need to introduce a whole new codepath.

@MasonMines2006
MasonMines2006 requested a review from mdellweg July 21, 2026 18:38
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) <noreply@anthropic.com>
@mdellweg
mdellweg enabled auto-merge (rebase) July 22, 2026 14:26
@mdellweg
mdellweg merged commit b8794ef into pulp:main Jul 22, 2026
13 of 14 checks passed
@MasonMines2006
MasonMines2006 deleted the AAP-78435-default-semver-ordering branch July 24, 2026 13:08
@patchback

patchback Bot commented Jul 29, 2026

Copy link
Copy Markdown

Backport to 0.29: 💚 backport PR created

✅ Backport PR branch: patchback/backports/0.29/b8794efa07af1786c592f62b87a79d790362a047/pr-2571

Backported as #2603

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback

patchback Bot commented Jul 29, 2026

Copy link
Copy Markdown

Backport to 0.25: 💚 backport PR created

✅ Backport PR branch: patchback/backports/0.25/b8794efa07af1786c592f62b87a79d790362a047/pr-2571

Backported as #2604

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback

patchback Bot commented Jul 29, 2026

Copy link
Copy Markdown

Backport to 0.28: 💚 backport PR created

✅ Backport PR branch: patchback/backports/0.28/b8794efa07af1786c592f62b87a79d790362a047/pr-2571

Backported as #2605

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback

patchback Bot commented Jul 29, 2026

Copy link
Copy Markdown

Backport to 0.30: 💚 backport PR created

✅ Backport PR branch: patchback/backports/0.30/b8794efa07af1786c592f62b87a79d790362a047/pr-2571

Backported as #2606

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants