From 17c376348dc9c29b2c75d5913ed5225100a5d408 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 26 May 2026 15:17:36 -0500 Subject: [PATCH] Better `msc4311_stripped_state` description --- rust/src/room_versions.rs | 20 +++++++++----------- synapse/synapse_rust/room_versions.pyi | 20 +++++++++----------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/rust/src/room_versions.rs b/rust/src/room_versions.rs index 2a0e898f9c..94252ecca9 100644 --- a/rust/src/room_versions.rs +++ b/rust/src/room_versions.rs @@ -161,24 +161,22 @@ pub struct RoomVersion { /// This is similar to how doubly-linked lists can potentially not refer to previous items correctly /// without verifying the list's integrity, but doing it on every insert is too expensive. pub msc4242_state_dags: bool, - /// Whether the `m.room.create` event is required in - /// `invite_room_state`/`knock_room_state` when receiving invites/knocks over the - /// federation API's. - /// - /// Also determines whether we expect full PDU's in the - /// `invite_room_state`/`knock_room_state` in the federation API. The client API - /// still uses stripped state. + /// Determines whether a room version *SHOULD* rather than *MAY* reject invites/knocks + /// with invalid stripped state events. /// /// According to MSC4311: - /// > If any of the events are not a PDU, not for the room ID specified, or fail + /// > If any of the [stripped state] events are not a PDU, not for the room ID specified, or fail /// > signature checks, or the `m.room.create` event is missing, the receiving /// > server MAY respond to invites with a `400 M_MISSING_PARAM` standard Matrix /// > error (new to the endpoint). For invites to room version 12+ rooms, servers /// > SHOULD rather than MAY respond to such requests with `400 M_MISSING_PARAM`. /// - /// This does *not* determine whether we should include the `m.room.create` event in - /// stripped state or use full PDU's in stripped state over federation. We should - /// always do this. + /// Regardless of room version (we should always do these things): + /// 1. The `m.room.create` event *MUST* be included in + /// `invite_room_state`/`knock_room_state` when sending invites/knocks over the + /// federation API's. + /// 2. Use full PDU's in the `invite_room_state`/`knock_room_state` in the federation + /// API. The client API still uses stripped state. msc4311_stripped_state: bool, } diff --git a/synapse/synapse_rust/room_versions.pyi b/synapse/synapse_rust/room_versions.pyi index 0bd56ebda9..c69fd77a22 100644 --- a/synapse/synapse_rust/room_versions.pyi +++ b/synapse/synapse_rust/room_versions.pyi @@ -125,24 +125,22 @@ class RoomVersion: without verifying the list's integrity, but doing it on every insert is too expensive.""" msc4311_stripped_state: bool """ - Whether the `m.room.create` event is required in - `invite_room_state`/`knock_room_state` when receiving invites/knocks over the - federation API's. - - Also determines whether we expect full PDU's in the - `invite_room_state`/`knock_room_state` in the federation API. The client API - still uses stripped state. + Determines whether a room version *SHOULD* rather than *MAY* reject invites/knocks + with invalid stripped state events. According to MSC4311: - > If any of the events are not a PDU, not for the room ID specified, or fail + > If any of the [stripped state] events are not a PDU, not for the room ID specified, or fail > signature checks, or the `m.room.create` event is missing, the receiving > server MAY respond to invites with a `400 M_MISSING_PARAM` standard Matrix > error (new to the endpoint). For invites to room version 12+ rooms, servers > SHOULD rather than MAY respond to such requests with `400 M_MISSING_PARAM`. - This does *not* determine whether we should include the `m.room.create` event in - stripped state or use full PDU's in stripped state over federation. We should - always do this. + Regardless of room version (we should always do these things): + 1. The `m.room.create` event *MUST* be included in + `invite_room_state`/`knock_room_state` when sending invites/knocks over the + federation API's. + 2. Use full PDU's in the `invite_room_state`/`knock_room_state` in the federation + API. The client API still uses stripped state. """ class RoomVersions: