Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 4, 2025

The Version model's default ordering was set to -verbose_name (descending), causing versions to appear in reverse alphabetical order in UI dropdowns and API responses. Versions like yaml-v2 appeared before latest.

Changes

  • readthedocs/builds/models.py: Changed Meta.ordering from ["-verbose_name"] to ["verbose_name"]
  • readthedocs/builds/migrations/0066_alter_version_options.py: Migration for the ordering change
  • readthedocs/api/v3/tests/test_versions.py: Updated test assertions to expect correct alphabetical order (latest before v1.0)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • search
    • Triggering command: /home/REDACTED/.local/bin/pytest pytest readthedocs/search/tests/test_faceted_search.py -v git conf�� in.so /lto-wrapper cal/bin/rustc (dns block)
    • Triggering command: /home/REDACTED/.local/bin/pytest pytest readthedocs/rtd_tests/ readthedocs/api/ readthedocs/builds/ -v --ignore-glob=*search* --ignore=readthedocs/builds/tests/test_views.py d u/13/liblto_plugld _64-linux-gnu/13-t PJCaFZ.res ld -t -o /dev/null d /x86_64-linux-gnld /libexec/gcc/x86-t solution=/tmp/cc-o ld (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Version: queryset is ordered backwards</issue_title>
<issue_description>In #11275 I tried to fix this, but discovered that the Version model actually sorts the queryset descending for some reason.

We don't know why the ordering is descending, and more confusing is that tests seem to pass as we would expect already. Changing the ordering direction on the model actually breaks tests with results like stable ordered before latest.

This is still a bug, and I notice this on the project version filter dropdown, which uses the version queryset directly:

image

Though note, I might fix this at the filter to resolve the bug I noticed, but the underlying model is still backwards as you might notice in API responses too.</issue_description>

<agent_instructions>Research why the ordering is the way it is, see if we're forcing ordering anywhere, or if we should just update this by default in the model definition. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 4, 2025 21:12
Co-authored-by: ericholscher <25510+ericholscher@users.noreply.github.com>
Co-authored-by: ericholscher <25510+ericholscher@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix queryset ordering for Version model Fix Version model ordering from descending to ascending Dec 4, 2025
Copilot AI requested a review from ericholscher December 4, 2025 21:54
Copilot finished work on behalf of ericholscher December 4, 2025 21:54
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.

Version: queryset is ordered backwards

2 participants