Filtering Recent Changes by tool + unpatrolled, or list + unpatrolled works just fine, but if I want to see a list of all unpatrolled revisions, i.e. filtering by unpatrolled but leaving the Type selector blank, I get a 500 error. Is this expected behavior?
Description
Details
Event Timeline
@Slst2020 for some reason I can't seem to reproduce this issue. Can you share a screenshot and maybe the error log on your machine about this?
I think this must have had something to do with my local dev environment. I did a docker system prune and rebuilt my containers, and now I can't reproduce it either.
Well, I don't know what's going on. After rebuilding the containers again, the error is back. At first, I thought it had something to do with Django 3.0 that I have been testing, but the first time I got this error, I hadn't tried upgrading Django yet.
Basically, calling /api/recent with type=tool works fine, but leaving type blank or setting it to toollist doesn't.
2022-04-06T08:40:58Z [fe3762e239e4404fa0191be98c208d16] django.request ERROR: Internal Server Error: /api/recent/ Traceback (most recent call last): File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(*args, **kwargs) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/rest_framework/viewsets.py", line 125, in view return self.dispatch(request, *args, **kwargs) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/drf_spectacular/drainage.py", line 144, in wrapped_method return method(self, request, *args, **kwargs) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/rest_framework/mixins.py", line 43, in list return self.get_paginated_response(serializer.data) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/rest_framework/serializers.py", line 768, in data ret = super().data File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/rest_framework/serializers.py", line 253, in data self._data = self.to_representation(self.instance) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/rest_framework/serializers.py", line 687, in to_representation self.child.to_representation(item) for item in iterable File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/rest_framework/serializers.py", line 687, in <listcomp> self.child.to_representation(item) for item in iterable File "/srv/app/toolhub/apps/versioned/serializers.py", line 123, in to_representation ret = super().to_representation(instance) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/rest_framework/serializers.py", line 522, in to_representation ret[field.field_name] = field.to_representation(attribute) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/rest_framework/fields.py", line 1886, in to_representation return method(value) File "/srv/app/toolhub/apps/versioned/serializers.py", line 140, in get_parent_id return self._get_parent_and_child_ids(instance)[0] File "/srv/app/toolhub/apps/versioned/serializers.py", line 111, in _get_parent_and_child_ids ids = self._get_revision_ids(instance) File "/srv/app/toolhub/apps/versioned/serializers.py", line 101, in _get_revision_ids ).objects.get(pk=instance.object_id) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/opt/lib/poetry/toolhub-2uZo5AhP-py3.7/lib/python3.7/site-packages/django/db/models/query.py", line 408, in get self.model._meta.object_name toolhub.apps.lists.models.ToolList.DoesNotExist: ToolList matching query does not exist. 2022-04-06T08:40:58Z [fe3762e239e4404fa0191be98c208d16] django.server ERROR: "GET /api/recent/?page=1 HTTP/1.1" 500 25836
This happens when a tool or list that has been deleted is present in the recent changes feed. Both models should only be "soft deleted" meaning we should still be able to find them in the DB. I will look into this more because I think wrote/re-wrote all the parts that are crashing here. :)
Change 777885 had a related patch set uploaded (by BryanDavis; author: Bryan Davis):
[wikimedia/toolhub@main] bug(recent changes): guard against dereferencing deleted models
Change 777885 merged by jenkins-bot:
[wikimedia/toolhub@main] bug(recent changes): guard against dereferencing deleted models
Change 786342 had a related patch set uploaded (by BryanDavis; author: Bryan Davis):
[operations/deployment-charts@master] toolhub: Bump container version to 2022-04-21-215651-production
Change 786342 merged by jenkins-bot:
[operations/deployment-charts@master] toolhub: Bump container version to 2022-04-21-215651-production