[bug] strip_report_status_data errors when trying to resolve/close a reopened closed report #712
Labels
No labels
approved, awaiting change
bug
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs docs
needs tests
not a bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma#712
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Your setup
OTP
Extra details
Debian 12
Version
2024.11 stable / 3.11.0
PostgreSQL version
15
What were you trying to do?
Close or resolve a report.
The report was closed, but i wanted to move it to resolved reports. The report has no posts attached.
What did you expect to happen?
The issue to resolve or close normally.
What actually happened?
HTTP Error 500, and the issue cannot be closed or resolved.
Logs
Severity
I cannot use the software
Have you searched for this issue?
I see that #665 fixes this, but its been sitting for 3 months
hmmm, I’m not sure replacing other entries with
nil
(or keeping themnil
) for later processing like #665 does is the best idea. Akkoma generates and seems to expect an empty list here for reports without activities andnil
s might now or in the future trip up something else.Filtering them out might be better and with how stuff is currently arranged this is prob better done in
transmofirifer.ex
— though to deal with already existing entries we’ll need amix
task or duplicate the filtering here for a couple releases(going further into bikeshed territory, i’m wondering whether to only filter out
nil
s so we’ll notice if any other software start generating reports in a funny way, or filter out everything not matching our expectations so reports can at least be dealt with by admins even if they might have lost some info)Do you know which server software generated those reports with a
nil
entry?The local server, it was done in a test to see if reports work with remote post references.
For some reason, the remote post didnt show up in the local or remote instance of the report, it may be a race condition, or bug when fetching posts (or something to that degree).
oh, good to know. If we generate those ourselves, doing anything in the transmogrifier is pointless and ideally we shouldn’t put
nil
s in the list to begin withAt first glance, i can’t spot anything resulting in
nil
s being inserted. Is this reproducible and if so can you describe how?No idea, its possible that some action or the likes inserts a
nil
when trying to reference a post, wrt:error
/:ok
, i have near to no information here, but this was all generated locally :/The newness of the instance might play a role, the instance was less than 24 hours old, and i was referencing some heavily-connected users/posts, i tried to report one of my own posts on a remote instance, which might've caused this.
Would it be possible the problem sits with receiving JSON from the api, that it sends
null
somewhere?Good(?) news, in testing locally i got this to reproduce and think i understand the problem(s) now:
After creation posts are already stripped (i was expecting/hoping it for some, but all of them disappeared). At this point the in-database form looked like:
This showed up as 0 reports in the admin dashboard and I was still able to change the state (
deleted: true
entries get filtered at some point iirc).However, trying to change the state again failed and now the DB content assumed the below problematic form
There are two issues here:
{id: "something", deleted: true}
to just"something"
when changing state instrip_report_status_data
(the easy part)id
is null/nil after creationHow come the id is nil? Well, in my case, since the local instance doesn’t federate (and can’t fetch from authfetch hosts), the posts in question were manually loaded by putting their URL into the search box. I’m guessing the same is true for you and presumably the post for the report from #665 was also manually fetched by some user.
If a post gets fetched this way we directly get the Note object without seeing the original Create activity. We still put a dummy Create activity down, but as it turns out those fabricated activities don’t have an ActivityPub
id
. Since the report builder wants to normalise everything to activity AP IDs it ends up reading backnil
(and presumably then thinks they’ve must already been deleted) (inbuild_flag_object
?).In an ideal setup, perhaps we wouldn’t need to fabricate Create activities for notes, but unfortunately *oma like to refer to notes by the database ID of their Create activity in several public places like URLs and API. I guess we either need to (retroactively) create dummy AP IDs for fabricated activities, or allow the note object’s AP ID to remain and query both tables if the first doesn’t yield a match.
The first may potentially fix more yet-unknown similar issues but is more invasive and might break stuff on its own, the latter is simpler and unlikely to break something, but feels like a kludge.
Or maybe replace the internal representation of reported statuses everywhere with
%{ap_uri: "https://...", api_id: <db id of create activity>}
withap_uri
just being the received, unchanged URI for remote reports, and for local reports always put the note object uri to avoid the pitfall of fabricated Create activities. Will need a DB migration and possibly affect custom MRFs though; not sure what stability guarantees custom MRFs are promisedI’ll think about it a bit more and prob ask on IRC for opinions or better ideas, but yeah
Thanks for reporting and providing details for identifying the issue!
Yes, the posts were fetched manually as they're pinned posts.
Objects indeed get wrapped in an activity, but when i check my server, the activities do have an
id
. This is also what I expect to happen. Am I misunderstanding something?Here's how I look for such activities
And here a random example, you can use the activity
id
in a browser nad it will open my instance and show the object, which is a remote post.I remember reading about this behaviour in the spec, but it's only for client-to-server federation, https://www.w3.org/TR/activitypub/#object-without-create so I guess it's a pleroma-specific thing.
You’re probably understanding correctly, but we just get different results. On my local test server no activity for manually fetched posts has an ID (note you can’t fetch the
ipv6.camp
samples atm without changing config or applying #708):e.g.
I haven’t checked the code creating those "fake" activities. If it should get an ID then that’s the best fix (though as a side note, the internal report representation might benefit from a cleanup anyway; I’ve seen three different ways notes are represented).
Does your server still create IDs when you manually fetch something now and if not do you recall which version you were using the last time it worked?
oh, you're correct o.o I should've noticed that yesterday. Indeed the last activity I find where the
id
was filled in is from 2021-10-03 21:50:14.000.I also find those with
id
NULL
[1], most recent one is today (2024-03-03 05:52:30.000)[2].The oldest one with
id
NULL
is 2020-08-31 05:35:21.000, but starting 2021-10-04 07:33:22.000 I'm seeing multiple per day. So it seems something in 2020-08 made it sometimes not be filled in, and then in 2021-10 theid
was never filled in any more :/ Both are from before Akkoma.The last Pleroma release before having the
id
always beNULL
was 2.4.1, released 2021-08-21[3]. But I have no idea when I did the update and if I used stable or develop at the time. So I'm unsure if that release introduced it or was still OK.[1]
[2]
[3] https://git.pleroma.social/pleroma/pleroma/-/tree/v2.4.1?ref_type=tags
fwiw, after checking Pleroma merges, they encountered the same issue and initially just ignored
nil
s as a quick fix.Then pleroma#3788 switched things up to prefer object ids. Unfortunately (as so often) there’s no explanation or discussion around the approach itself, so idk if they knew why activities have
nil
ids aand chose to keep this, or if this was just a workaround for mysteriousnil
s.Sidenote: more recently Pleroma also fixed an issue with handling reports of an already deactivated users in pleroma#3915, we might want to check if this also applies to us.