LemmyNet/lemmy

[Bug]: Reports are no longer sent to user's home instance in 0.19.4-beta.6

Nothing4You opened this issue · 8 comments

Requirements

  • Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • Did you check to see if this issue already exists?
  • Is this only a single bug? Do not put multiple bugs in one issue.
  • Do you agree to follow the rules in our Code of Conduct?
  • Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Summary

Since #4305, reports of posts and comments are supposed to also be sent to the user's home instance.

My tests on 0.19.4-beta.6 show this is no longer being the case.

Steps to Reproduce

  1. Have 3 different instances
  2. Create community on instance A
  3. Post from instance B to community on instance A
  4. Report post from instance C

Technical Details

7c4tx1.lem.rocks is running 0.19.3.
f3heh9.lem.rocks and gbngug.lem.rocks are running 0.19.4-beta.6.

Scenario 1:

A user on gbngug.lem.rocks (0.19.4-beta.6) commented in https://f3heh9.lem.rocks/c/0194, a community on another 0.19.4-beta.6 instance.
A user on 7c4tx1.lem.rocks (0.19.3) reports this comment.
The report gets sent to and received by both the community instance and also the creator's instance.

sent activity from db
select json_agg(r)->0 as activity from (select send_inboxes, data from sent_activity order by published desc limit 1) as r;
{
  "send_inboxes": [
    "https://f3heh9.lem.rocks/inbox",
    "https://gbngug.lem.rocks/inbox"
  ],
  "data": {
    "actor": "https://7c4tx1.lem.rocks/u/bad_actor",
    "to": [
      "https://f3heh9.lem.rocks/c/0194"
    ],
    "object": "https://gbngug.lem.rocks/comment/15",
    "summary": "reporting from 0.19.3",
    "content": null,
    "type": "Flag",
    "id": "https://7c4tx1.lem.rocks/activities/flag/a49c1780-11ef-4a0a-b7dd-1325ce2cd746",
    "audience": "https://f3heh9.lem.rocks/c/0194"
  }
}

Scenario 2:

A user on 7c4tx1.lem.rocks (0.19.3) commented in https://f3heh9.lem.rocks/c/0194, a community on another 0.19.4-beta.6 instance.
A user on gbngug.lem.rocks (0.19.4-beta.6) reports this comment.
The report gets sent to and received by only the community instance.

sent activity from db
select json_agg(r)->0 as activity from (select send_inboxes, data from sent_activity order by published desc limit 1) as r;
{
  "send_inboxes": [
    "https://f3heh9.lem.rocks/inbox"
  ],
  "data": {
    "actor": "https://gbngug.lem.rocks/u/another_bad_actor",
    "to": [
      "https://f3heh9.lem.rocks/c/0194"
    ],
    "object": "https://7c4tx1.lem.rocks/comment/15",
    "summary": "reporting from remote 0.19.4-beta.6 instance",
    "content": null,
    "type": "Flag",
    "id": "https://gbngug.lem.rocks/activities/flag/c089b189-dbbb-467b-9bd7-10c0c960df0c",
    "audience": "https://f3heh9.lem.rocks/c/0194"
  }
}

The obvious difference between these two is the lack of the creator's home instance being in the send_inboxes column.
As I understand it, this is populated when the activity is created in the database.

Version

0.19.4-beta.6

Lemmy Instance URL

No response

This is going to be a tough one to test and add integration tests for, considering its on different lemmy versions.

@Nutomic might be more familiar with a change that caused this.

I don't think the versions are relevant for federating reports, I just had this setup as I was comparing the outcomes.

I'm mostly sure that test case is handled here

If I'm reading that test case correctly, it does the following:

  1. a user on beta is creating a post in a community on beta
  2. a user on alpha is reporting the post
  3. it checks that the report arrives on beta

This part is still working on 0.19.4-beta.6.

What we'd need a test case for is this:

  1. a user on alpha is creating a post in a community on beta
  2. a user on gamma is reporting the post
  3. it checks that the report arrives on beta and alpha

I wrote an api test to cover this in #4711 and its passing just fine. I also dont see any changes in the relevant code since 0.19.3

All 3 instances here are 0.19.4-beta.6 and it works for both posts and comments:

{
  "send_inboxes": [
    "https://gbngug.lem.rocks/inbox",
    "https://f3heh9.lem.rocks/inbox"
  ],
  "data": {
    "actor": "https://i6q7wn.lem.rocks/u/admin",
    "to": [
      "https://f3heh9.lem.rocks/c/0194"
    ],
    "object": "https://gbngug.lem.rocks/post/5",
    "summary": "test report all 0.19.4-beta.6",
    "content": null,
    "type": "Flag",
    "id": "https://i6q7wn.lem.rocks/activities/flag/57dc5b63-9a94-4fe9-98af-4f1f7d3dbd67",
    "audience": "https://f3heh9.lem.rocks/c/0194"
  }
}
{
  "send_inboxes": [
    "https://gbngug.lem.rocks/inbox",
    "https://f3heh9.lem.rocks/inbox"
  ],
  "data": {
    "actor": "https://i6q7wn.lem.rocks/u/admin",
    "to": [
      "https://f3heh9.lem.rocks/c/0194"
    ],
    "object": "https://gbngug.lem.rocks/post/5",
    "summary": "test report all 0.19.4-beta.6",
    "content": null,
    "type": "Flag",
    "id": "https://i6q7wn.lem.rocks/activities/flag/57dc5b63-9a94-4fe9-98af-4f1f7d3dbd67",
    "audience": "https://f3heh9.lem.rocks/c/0194"
  }
}

A 0.19.3 comment reported from 0.19.4-beta.6:

{
  "send_inboxes": [
    "https://f3heh9.lem.rocks/inbox"
  ],
  "data": {
    "actor": "https://i6q7wn.lem.rocks/u/admin",
    "to": [
      "https://f3heh9.lem.rocks/c/0194"
    ],
    "object": "https://7c4tx1.lem.rocks/comment/18",
    "summary": "test from 0.19.4-beta.6, this should go to the 0.19.3 home instance",
    "content": null,
    "type": "Flag",
    "id": "https://i6q7wn.lem.rocks/activities/flag/a40477d3-18ef-463e-bbd6-281f29e24972",
    "audience": "https://f3heh9.lem.rocks/c/0194"
  }
}

Unless the remote software is taken into account when deciding whether to send a report to the home instance, it shouldn't matter that the instance is 0.19.3?

Somehow my 0.19.3 instance is missing in the site table on all of the 0.19.4 instances:

lemmy=# select s.id, i.id, s.name, i.domain, i.version from instance i left join site s on i.id = s.instance_id;
 id | id |       name       |      domain      |    version
----+----+------------------+------------------+---------------
  1 |  1 | i6q7wn.lem.rocks | i6q7wn.lem.rocks | 0.19.4-beta.6
    |  3 |                  | 7c4tx1.lem.rocks | 0.19.3
    |  5 |                  | fake.lem.rocks   |
  3 |  2 | f3heh9.lem.rocks | f3heh9.lem.rocks | 0.19.4-beta.6
  2 |  4 | gbngug.lem.rocks | gbngug.lem.rocks | 0.19.4-beta.6
(5 rows)

Right thats the reason then, got it fixed.