readthedocs / ext-theme

Read the Docs drop in replacement site templates
2 stars 2 forks source link

`NoReverseMatch` when hitting builds listing page #412

Closed humitos closed 2 weeks ago

humitos commented 2 months ago

Go to https://app.readthedocs.org/projects/pycampes/builds/ and/or https://app.readthedocs.org/projects/pygsp2/builds/ and you will get a 500.

Sentry error: https://read-the-docs.sentry.io/issues/5564576585/

Front logo Front conversations

humitos commented 1 month ago

This happens at this line https://github.com/readthedocs/ext-theme/blob/bbff088c5b1edd13d15c52b1b348ec1dc7c5265c/readthedocsext/theme/templates/builds/partials/build_list.html#L39

The reason is that there are Build objects that don't have a Version attached to it. This is because when a Version object is deleted, the builds associated to them are not deleted: https://github.com/readthedocs/readthedocs.org/blob/80271b3c0fb424082f9919a24dd89f6373fa13fc/readthedocs/builds/models.py#L714

humitos commented 1 month ago

This is how it looks this list now. We may need to do some extra work now to display them in a better way cc @agjohnson

Image

humitos commented 1 month ago

This is another example

Image

humitos commented 1 month ago

It seems we are still hitting this issue in other places: https://read-the-docs.sentry.io/issues/5690482287/?project=161479&query=is%3Aunresolved+%21message%3A%22%21message%3A%22%21message%3A%22SystemExit%22+%21message%3A%22frame-ancestors%22&referrer=issue-stream&statsPeriod=14d&stream_index=0

humitos commented 3 weeks ago

The same user hit this again 🙃 , https://read-the-docs.sentry.io/issues/5608420288/?project=161479&query=is%3Aunresolved+%21message%3A%22%21message%3A%22%21message%3A%22SystemExit%22+%21message%3A%22frame-ancestors%22&referrer=issue-stream&statsPeriod=14d&stream_index=5

agjohnson commented 3 weeks ago

This is on the dashboard, it looks like a different issue entirely maybe. The dashboard is loading now for the user, so I don't know exactly how to test this though.

This event is on /dashboard/ and would have been the included build chip template. However, there is logic around the chip to avoid displaying the chip if there is no associated build:

https://github.com/readthedocs/ext-theme/blob/c6c883cabe4496e738149ed00a377c7266b05874/readthedocsext/theme/templates/projects/partials/project_list.html#L95-L99

So with has_good_build and get_latest_build, how are we passing a build to the build chip template where build.project.pk and build.pk are both none? I'm guessing the fact that this is a translation is a clue. Is it possible there is a timing issue as a project is created and before the build finishes?

humitos commented 2 weeks ago

So with has_good_build and get_latest_build, how are we passing a build to the build chip template where build.project.pk and build.pk are both none?

I think what could be happening here is that has_good_build is returning True, but get_latest_build is returning None. We should probably put get_latest_build in the if condition as well.

https://github.com/readthedocs/readthedocs.org/blob/9ef753323822eafdd9c72cb57e6f2ef6b60b305e/readthedocs/projects/models.py#L1022-L1038

agjohnson commented 2 weeks ago

Yeah, that was my guess as well and the fix that I added. :+1:

I don't have any proof of this though, besides the null arguments passed in to the url tag. :shrug:

agjohnson commented 2 weeks ago

I tried the projects from the reporting user and the list and detail views look correct now. Still haven't been able to reproduce the error on the project listing view though, but I think we can mark these resolved.