Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
5 tasks done
Nothing4You opened this issue May 4, 2024 · 8 comments
Closed
5 tasks done
Labels
area: federation support federation via activitypub area: moderation bug Something isn't working
Milestone

Comments

@Nothing4You
Copy link
Contributor

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

@Nothing4You Nothing4You added the bug Something isn't working label May 4, 2024
@dullbananas dullbananas added area: federation support federation via activitypub area: moderation labels May 5, 2024
@dessalines dessalines added this to the 0.19.4 milestone May 7, 2024
@dessalines
Copy link
Member

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.

@Nothing4You
Copy link
Contributor Author

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

@dessalines
Copy link
Member

I'm mostly sure that test case is handled here

@Nothing4You
Copy link
Contributor Author

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

@Nutomic
Copy link
Member

Nutomic commented May 8, 2024

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

@Nothing4You
Copy link
Contributor Author

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?

@Nothing4You
Copy link
Contributor Author

Nothing4You commented May 8, 2024

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)

@Nutomic
Copy link
Member

Nutomic commented May 8, 2024

Right thats the reason then, got it fixed.

dessalines pushed a commit that referenced this issue May 15, 2024
… (#4711)

* Add test to ensure reports are sent to user's home instance (ref #4701)

* enable all tests

* set package-manager-strict=false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: federation support federation via activitypub area: moderation bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants