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

MSC4074: Server side annotation aggregation #4074

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

dihydrogenmonoxide16
Copy link

@dihydrogenmonoxide16 dihydrogenmonoxide16 commented Nov 7, 2023

Proposal describes the way how clients and servers could interact in a more efficient and scalable way working with annotation (reaction) - heavy rooms.

rendered

Signed-off-by: Vladimir Aseev [email protected]

@turt2live turt2live changed the title Server side annotation aggregation MSC4074: Server side annotation aggregation Nov 7, 2023
@turt2live
Copy link
Member

@dihydrogenmonoxide16 when you get a chance, please sign off on the changes for this MSC to be eligible for FCP acceptance. Also, lines should be limited to approximately 120 characters.

@turt2live turt2live added proposal A matrix spec change proposal client-server Client-Server API kind:maintenance MSC which clarifies/updates existing spec needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels Nov 7, 2023
@dihydrogenmonoxide16
Copy link
Author

@dihydrogenmonoxide16 when you get a chance, please sign off on the changes for this MSC to be eligible for FCP acceptance. Also, lines should be limited to approximately 120 characters.

addressed

@turt2live turt2live requested a review from a team November 10, 2023 19:39
@dihydrogenmonoxide16
Copy link
Author

@turt2live , I added changes to make the behavior backwards-compatible with older clients as we discussed before

@turt2live turt2live self-requested a review November 19, 2023 04:32
@richvdh richvdh removed the request for review from a team March 26, 2024 18:53
Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall this seems like a great concept. I'm not sure on the client synchronization stuff myself, but others should be. A listed client implementation would help quite a bit in this understanding, I suspect.

Servers tried to provide clients with server side generated
annotation aggregates before, but these attempts were not successful
mainly because both sides (server and client) tried to
aggregate and the same time. That used to lead to the situation when
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and what at the same time?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected

Comment on lines 47 to 48
aggregated by the server. The only exception to this rule is E2E
encrypted events, which should be solely aggregated by the client.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the encryption condition only apply once reactions are encrypted?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rephrased to make it clearer

Comment on lines 64 to 65
For server-server API, homeserver should provide aggregates,
including only local events (events created and signed by self).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not following this bit. Servers distribute the events as-is without consideration for the underlying feature, meaning each server should be able to determine how many of each event there is. Reactions can also be used as a form of "DAG healing" when rooms get complex. This is because they are normally higher traffic than regular messages, giving more opportunity for the DAG to heal extremities. The delay associated with needing to process these complicated event trees is also (typically) less critical than message traffic.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extended the comment to clarify the idea: severs do not filter aggregated relations (no issue with the problem you described), but attach aggregates with counters to parent events they deliver (e.g servers A and B federate room R. server A users liked event E 100 times. server B users liked event E 20 times. when server A delivers E event PDU, it comes with counter 100, server B knows that there are additional 20 'local' likes and can deduct/merge 100+20 = 120.);

If this point seems arguable, we can exclude the paragraph completely

Comment on lines 67 to 77
Servers are allowed to limit maximum number of different "m.annotation"
keys they aggregate to a single event by a reasonable value (that
corresponds to a limited number of different reaction kinds, e.g. "👍",
"👎"). This is needed to avoid the situation when malicious users may
attack server creating jumbo-events (events with arbitrary high count of
different reaction kinds). Servers may configure this threshold on their
discretion, but this number should not be lower than 16. When annotation
key limit is reached, no new keys should be added to the aggregate, but
older keys would continue to be aggregated (change their count).
Annotations beyond that threshold should still be available via
[`relations`](https://spec.matrix.org/v1.8/client-server-api/#relationships-api) endpoints.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would a server communicate that it hit the limit?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely removed this clause. Potentially this problem already exists now, but only on the client side. I think it would better get addressed separately in order not to overcomplicate this change proposal (already big enough and technically complex)

Comment on lines +264 to +266
No new identifiers are proposed; it is proposed that servers implementing
this
proposal simply do so on the existing endpoints.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filter_server_aggregated_relation_types and the m.reaction EDU appear new, as do a few other identifiers. They will need to be namespaced.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefixed with msc4074., also renamed filter_server_aggregated_relation_types to msc4072.not_aggregated_relations to better match other filter params naming

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation requirements:

  • Server supporting filter opt-in behaviour
  • Client using the filter behaviour

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the expectation here?

  • to add this comment to the MXC inself
  • some pseudocode
  • working client/server implementation somewhere
  • arch doc
    ?

Or is it just a ref comment for other contributors?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The third option, a working client/server implementation somewhere. MSCs must be proven with implementations before they can be accepted: https://spec.matrix.org/proposals/#implementing-a-proposal

It generally doesn't matter who implements it or where, so implementation requirements are commented as a reference for everyone

@dihydrogenmonoxide16
Copy link
Author

overall this seems like a great concept. I'm not sure on the client synchronization stuff myself, but others should be. A listed client implementation would help quite a bit in this understanding, I suspect.

@turt2live , I'm doing a follow-up work to answer your comments and extend/adjust the proposal. Will post updates in ~1 week due to high work load.

@turt2live
Copy link
Member

No worries! Take the time you need :)

…ot to complicate client gap resolution logic
@dihydrogenmonoxide16
Copy link
Author

dihydrogenmonoxide16 commented Jun 27, 2024

No worries! Take the time you need :)

@turt2live, thank you for your feedback and collaboration! I answered your comments and addressed the points you mentioned. Added few improvements that turned out to be necessary for a few corner cases (gap resolution, older event updates). Asked few questions there also.

@turt2live turt2live self-requested a review June 27, 2024 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-server Client-Server API kind:maintenance MSC which clarifies/updates existing spec needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal
Projects
Status: Scheduled - v1.10
Development

Successfully merging this pull request may close these issues.

3 participants