From cc41cfee10c20f56f3bad5f1fa1dd3f7af960a99 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Fri, 2 Dec 2022 13:55:34 +0000 Subject: [PATCH 1/4] Draft --- ...CD-heroes-in-partial-send-join-response.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 proposals/ABCD-heroes-in-partial-send-join-response.md diff --git a/proposals/ABCD-heroes-in-partial-send-join-response.md b/proposals/ABCD-heroes-in-partial-send-join-response.md new file mode 100644 index 00000000000..f5a3eaf4778 --- /dev/null +++ b/proposals/ABCD-heroes-in-partial-send-join-response.md @@ -0,0 +1,70 @@ +# MSCABCD: Partial joins to nameless rooms should include heroes' memberships. + +This is an addendum to [MSC3706](https://github.com/matrix-org/matrix-spec-proposals/pull/3706) which ensures that partial-joining a nameless room has a reasonable client UX. + +## Background + +[MSC3706](https://github.com/matrix-org/matrix-spec-proposals/pull/3706) extends the federation `/send_join` endpoint to optionally return a "partial state" response. In this mode of operation, the joining server is given only a _subset_ of the current state[^1] of the room to be joined; the full state is lazily loaded by the joining server. + +[^1]: More precisely: the current state of the room to be joined _from the perspective of the resident server_. + +MSC3706 specifies this subset + +> `state`: if partial state is being returned, then state events with event +> type `m.room.member` are omitted from the response. All other room state is +> returned as normal. + +because + +> Currently, `m.room.member` events are by far the biggest problem. + +but also notes that + +> In future, the list of event types to omit could be expanded. (Some rooms + may have large numbers of other state events). + +## Problem + +_Originally noted in [synapse#12995](https://github.com/matrix-org/synapse/issues/12995)._ + +Clients need to present a display name for the room, using `m.room.name` or `m.room.canonical_alias` state events[^2] as described [in the spec](https://spec.matrix.org/v1.5/client-server-api/#calculating-the-display-name-for-a-room). If neither event exists, then the client falls back to a name calculated based on the membership events for the "heroes" of the room. + +[^2]: More precisely: using state events with (type, state\_key) pair equal to `('m.room.name', '')` or `('m.room.canonical_alias', '')`. + +The problem is that the partial-joining server does not have the heroes' membership events until it fetches the full state of the room; in this situation, the room has no defined display name. This results in a poor end-user experience. + +## Proposal + +When serving a partial join, if the room to be joined has no `m.room.name` or `m.room.canonical_alias` events in its current state, the resident server SHOULD + +- determine the heroes for the room (as specced today), +- include the heroes' current membership events in the response `state` field, and +- include the heroes' current membership events' auth chains in the response `auth_chain` field. + +## Potential issues + +This enlarges the `state` and the `auth\_chain` returned in a partial state response. The effect on `state` is limited as there are at most 5 heroes in any given room. The `auth\_chain` for the heroes' membership events may be arbitrarily long. + +## Alternatives + +- Have the resident server compute a dummy room name and express this as a new field in the `/send\_join` response. This is hard to internationalise and complicates the data model for minimal gain.a +- Require clients to use the room ID or alias which initiated the join as a room displayname. + - What if the join was actioned by a different client device, or by the server directly? +- Change the spec's display name rules to fallback to the room ID if there are no membership events available. + - Poor end-user experience: room IDs are opaque. + - This would also gives rooms that contain only an `m.room.create` event a defined display name. But that's not especially useful. + +## Security considerations + +None at present. Or better put: this doesn't introduce any new concerns. + +- The joining server is already privvy to these additional membership events. It will receive them when it receives the full state from the resident server. +- The joining server already trusts that the resident server is sending an accurate partial and full state. + +## Unstable prefix + +Not required. + +## Dependencies + +[MSC3706](https://github.com/matrix-org/matrix-spec-proposals/pull/3706). From b86e3bb8670db5ea4d68a90eac170a6987b9ed9a Mon Sep 17 00:00:00 2001 From: David Robertson Date: Fri, 2 Dec 2022 14:03:29 +0000 Subject: [PATCH 2/4] Assign MSC number --- ...response.md => 3943-heroes-in-partial-send-join-response.md} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename proposals/{ABCD-heroes-in-partial-send-join-response.md => 3943-heroes-in-partial-send-join-response.md} (98%) diff --git a/proposals/ABCD-heroes-in-partial-send-join-response.md b/proposals/3943-heroes-in-partial-send-join-response.md similarity index 98% rename from proposals/ABCD-heroes-in-partial-send-join-response.md rename to proposals/3943-heroes-in-partial-send-join-response.md index f5a3eaf4778..d6f9eadd5b9 100644 --- a/proposals/ABCD-heroes-in-partial-send-join-response.md +++ b/proposals/3943-heroes-in-partial-send-join-response.md @@ -1,4 +1,4 @@ -# MSCABCD: Partial joins to nameless rooms should include heroes' memberships. +# MSC3943: Partial joins to nameless rooms should include heroes' memberships. This is an addendum to [MSC3706](https://github.com/matrix-org/matrix-spec-proposals/pull/3706) which ensures that partial-joining a nameless room has a reasonable client UX. From 8e2604b635209877640fdf49aff4fb82262c07a2 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Fri, 2 Dec 2022 14:05:08 +0000 Subject: [PATCH 3/4] Fix underscores inside backticks --- proposals/3943-heroes-in-partial-send-join-response.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/3943-heroes-in-partial-send-join-response.md b/proposals/3943-heroes-in-partial-send-join-response.md index d6f9eadd5b9..f8010551d65 100644 --- a/proposals/3943-heroes-in-partial-send-join-response.md +++ b/proposals/3943-heroes-in-partial-send-join-response.md @@ -43,7 +43,7 @@ When serving a partial join, if the room to be joined has no `m.room.name` or `m ## Potential issues -This enlarges the `state` and the `auth\_chain` returned in a partial state response. The effect on `state` is limited as there are at most 5 heroes in any given room. The `auth\_chain` for the heroes' membership events may be arbitrarily long. +This enlarges the `state` and the `auth_chain` returned in a partial state response. The effect on `state` is limited as there are at most 5 heroes in any given room. The `auth_chain` for the heroes' membership events may be arbitrarily long. ## Alternatives From e22d250add04f519b62cd70ed4470da765b77c80 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Fri, 13 Jan 2023 12:10:38 +0000 Subject: [PATCH 4/4] typo fix Co-authored-by: Erik Johnston --- proposals/3943-heroes-in-partial-send-join-response.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/3943-heroes-in-partial-send-join-response.md b/proposals/3943-heroes-in-partial-send-join-response.md index f8010551d65..e8decc5fc36 100644 --- a/proposals/3943-heroes-in-partial-send-join-response.md +++ b/proposals/3943-heroes-in-partial-send-join-response.md @@ -47,7 +47,7 @@ This enlarges the `state` and the `auth_chain` returned in a partial state respo ## Alternatives -- Have the resident server compute a dummy room name and express this as a new field in the `/send\_join` response. This is hard to internationalise and complicates the data model for minimal gain.a +- Have the resident server compute a dummy room name and express this as a new field in the `/send\_join` response. This is hard to internationalise and complicates the data model for minimal gain. - Require clients to use the room ID or alias which initiated the join as a room displayname. - What if the join was actioned by a different client device, or by the server directly? - Change the spec's display name rules to fallback to the room ID if there are no membership events available.