Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version slug filtering to APIv3 #11275

Closed
wants to merge 3 commits into from
Closed

Conversation

agjohnson
Copy link
Contributor

Hopefully this doesn't collide with anything else, but I did notice the
results seem backwards while working on the version form. You can
reproduce this with:

https://beta.readthedocs.org/api/v3/projects/test-builds/versions/

I see the yaml-v2 branch first.

Hopefully this doesn't collide with anything else, but I did notice the
results seem backwards while working on the version form. You can
reproduce this with:

https://beta.readthedocs.org/api/v3/projects/test-builds/versions/

I see the `yaml-v2` branch first.

- Refs readthedocs/ext-theme#287
@humitos
Copy link
Member

humitos commented Apr 15, 2024

Can we make this change into the model itself instead of this view? Is there any reason to keep this reversed ordering

ordering = ["-verbose_name"]
?

@agjohnson
Copy link
Contributor Author

I had no clue how to answer that one myself, so just stuck with changing the API for now. I'd agree that's a better place to change it, but why would we have ordered versions like that at all?

@agjohnson agjohnson requested a review from humitos April 22, 2024 18:24
@humitos
Copy link
Member

humitos commented Apr 23, 2024

@stsewd do you see any blocker on changing the default sorting for versions instead only on the API response?

@stsewd
Copy link
Member

stsewd commented Apr 23, 2024

@stsewd do you see any blocker on changing the default sorting for versions instead only on the API response?

No that I can think of. Maybe API v2.

@agjohnson
Copy link
Contributor Author

If we have no clue why we did this, I am happy to make this change. However, if it cascades into fixing a lot of tests or we aren't 100% on the model change, I would prefer to merge this and address the model change later.

@agjohnson
Copy link
Contributor Author

agjohnson commented Apr 25, 2024

So yeah, a number of test failures here. But now some of the test failures (especially search unit tests) seem to imply the version list is backwards now:

image

https://app.circleci.com/pipelines/github/readthedocs/readthedocs.org/10217/workflows/902eefe5-cb97-4283-af40-31fd542317d0/jobs/25338?invite=true#step-107-370532_18

Are we somehow double reversing the ordering?

So yeah, I lean towards doing the easiest thing here first and just altering the API response for now. I'm only trying to affect the version listing in the version UI and API listing.

Okay to revert 11f78c7?

@agjohnson
Copy link
Contributor Author

@humitos @stsewd ping ^

I feel it's probably safe to only affect the API response for now. Something seems to be ordering versions (correctly) outside the API response (which is backwards).

@humitos
Copy link
Member

humitos commented May 17, 2024

Yes. Please, revert and merge the change for the API queryset for now. We can move forward with that and revisit later. Can you open an issue for this? It seems that most of the tests that fail are related with search, so maybe @stsewd can take a look at them.

@agjohnson
Copy link
Contributor Author

I ended up switching the version dropdown to not use our API, so this change also doesn't fix the ordering issue. readthedocs/ext-theme#343 now just uses a queryset from a FilterSet instead.

@agjohnson
Copy link
Contributor Author

So, though the API response is indeed backwards, this fix doesn't address the issue I noticed now. I will close this and we should fix this at the model level to resolve the issue everywhere. I opened #11339

@agjohnson agjohnson closed this May 22, 2024
@humitos humitos deleted the agj/api-v3-version-ordering branch May 22, 2024 08:56
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.

None yet

3 participants