Page MenuHomePhabricator

Transfer ownership of the instantdiffs toolinfo record to Serhio Magpie
Closed, ResolvedPublic

Assigned To
Authored By
SerDIDG
Jun 1 2025, 3:49 AM
Referenced Files
F61313680: image.png
Jun 3 2025, 1:28 AM
F61313668: image.png
Jun 3 2025, 1:28 AM
F61313613: image.png
Jun 3 2025, 1:28 AM

Description

Hi. As discussed on the Talk page: https://meta.wikimedia.org/wiki/Talk:Toolhub#User_Rights, I would like to claim ownership of this page: https://toolhub.wikimedia.org/tools/instantdiffs. As the sole author of the tool, I would like full control over its Toolhub page. Thanks!

Event Timeline

I used the Toolhub admin pages to change the Created by field of the instantdiffs toolinfo record to point to the Serhio Magpie user record instead of the Iniquity user record. I believe this will allow @SerDIDG to edit the core tool info fields now.

Please reopen if that is not the case.

@bd808 Editing works fine in most cases now, thanks, but it seems the history page is broken.

image.png (1×1 px, 125 KB)

Also, the localization list updates are not shown on the page, but I think that’s an unrelated bug.

image.png (121×1 px, 12 KB)

image.png (104×277 px, 4 KB)

@bd808 Editing works fine in most cases now, thanks, but it seems the history page is broken.

image.png (1×1 px, 125 KB)

I noticed this but didn't follow up to figure out why. I will.

Also, the localization list updates are not shown on the page, but I think that’s an unrelated bug.

image.png (121×1 px, 12 KB)

image.png (104×277 px, 4 KB)

This does seem like a bug and I think I agree it is unrelated. Would you mind creating a separate bug report?

The history view is broken because of this failure while processing /api/tools/instantdiffs/revisions/:

File "/opt/lib/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/opt/lib/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/lib/venv/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/opt/lib/venv/lib/python3.9/site-packages/rest_framework/viewsets.py", line 125, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/lib/venv/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/opt/lib/venv/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/opt/lib/venv/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/opt/lib/venv/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/opt/lib/venv/lib/python3.9/site-packages/drf_spectacular/drainage.py", line 144, in wrapped_method
    return method(self, request, *args, **kwargs)
  File "/opt/lib/venv/lib/python3.9/site-packages/rest_framework/mixins.py", line 43, in list
    return self.get_paginated_response(serializer.data)
  File "/opt/lib/venv/lib/python3.9/site-packages/rest_framework/serializers.py", line 768, in data
    ret = super().data
  File "/opt/lib/venv/lib/python3.9/site-packages/rest_framework/serializers.py", line 253, in data
    self._data = self.to_representation(self.instance)
  File "/opt/lib/venv/lib/python3.9/site-packages/rest_framework/serializers.py", line 686, in to_representation
    return [
  File "/opt/lib/venv/lib/python3.9/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 156, in to_representation
    if self._should_hide_details(instance):
  File "/srv/app/toolhub/apps/versioned/serializers.py", line 91, in _should_hide_details
    return instance.revision.meta.suppressed and not (
  File "/opt/lib/venv/lib/python3.9/site-packages/django/db/models/fields/related_descriptors.py", line 421, in __get__
    raise self.RelatedObjectDoesNotExist(

I think I will need to step through the live data to figure out what relation constraint I broke when I changed the based object's owner.

I'm still not quite sure how the data got corrupted, but the issue was that one of the saved revisions of the toolinfo data was missing its expected RevisionMetadata object. I did some truly horrible surgery to fix that using an interactive python session that looked a bit like:

from toolhub.apps.toolinfo.models import Tool
instantdiffs = Tool.objects.get(name="instantdiffs")

from reversion.models import Version
qs = Version.objects.select_related("revision","revision__user","revision__meta")
qs = qs.get_for_object(instantdiffs)

from toolhub.apps.versioned.models import RevisionMetadata
for m in qs:
    print(m.revision_id)
    try:
        print(m.revision.meta)
    except reversion.models.Revision.meta.RelatedObjectDoesNotExist:
        meta = RevisionMetadata(revision=m.revision)
        meta.save()
        print(m.revision.meta)

I'm still not quite sure how the data got corrupted, but the issue was that one of the saved revisions of the toolinfo data was missing its expected RevisionMetadata object. I did some truly horrible surgery to fix that using an interactive python session that looked a bit like:

Oh, I’m really sorry for giving you extra work. But it’s kind of a demo version of how the frontend development works :) Thanks a lot!