m.room.create has a null room_id when calling /state on a room #1094

Open
opened 2025-09-30 22:06:54 +00:00 by nex · 2 comments
Owner

Calling GET /_matrix/client/v3/rooms/:room_id/state returns the state as expected, however the m.room.create event lacks the room_id, which is illegal for client-formatted events.

example:

{
  "content": {
    "additional_creators": [
      "@nex:nexy7574.co.uk",
      "@nex:timedout.uk",
      "@nex:synapse.nexy7574.co.uk",
      "@moderator:timedout.uk",
      "@nex:continuwuity.rocks",
      "@nex:transgender.ing",
      "@nex:maunapse.nexy7574.co.uk",
      "@star:nexy7574.co.uk",
      "@star:synapse.nexy7574.co.uk",
      "@alex:nexy7574.co.uk",
      "@alex:timedout.uk",
      "@kit:timedout.uk",
      "@charlie:timedout.uk"
    ],
    "predecessor": {
      "room_id": "!offtopic-11.1.3:timedout.uk"
    },
    "room_version": "12"
  },
  "event_id": "$BXKRDWCNsl8uPfBHCKftiEpbUdP5uURMCwXxRvhG-vY",
  "origin_server_ts": 1758757280771,
  "room_id": null,
  "sender": "@star:starstruck.systems",
  "state_key": "",
  "type": "m.room.create",
  "unsigned": {
    "age_ts": 1758757280771
  }
}

This mainly has an impact on clients that keep track of rooms by ensuring a foreign key relation between events and room IDs, which will obviously fail when the room ID is null. Notable examples are Gomuks web.

Calling `GET /_matrix/client/v3/rooms/:room_id/state` returns the state as expected, however the `m.room.create` event lacks the `room_id`, which is illegal for client-formatted events. example: ```json { "content": { "additional_creators": [ "@nex:nexy7574.co.uk", "@nex:timedout.uk", "@nex:synapse.nexy7574.co.uk", "@moderator:timedout.uk", "@nex:continuwuity.rocks", "@nex:transgender.ing", "@nex:maunapse.nexy7574.co.uk", "@star:nexy7574.co.uk", "@star:synapse.nexy7574.co.uk", "@alex:nexy7574.co.uk", "@alex:timedout.uk", "@kit:timedout.uk", "@charlie:timedout.uk" ], "predecessor": { "room_id": "!offtopic-11.1.3:timedout.uk" }, "room_version": "12" }, "event_id": "$BXKRDWCNsl8uPfBHCKftiEpbUdP5uURMCwXxRvhG-vY", "origin_server_ts": 1758757280771, "room_id": null, "sender": "@star:starstruck.systems", "state_key": "", "type": "m.room.create", "unsigned": { "age_ts": 1758757280771 } } ``` This mainly has an impact on clients that keep track of rooms by ensuring a foreign key relation between events and room IDs, which will obviously fail when the room ID is null. Notable examples are Gomuks web.
nex added this to the 0.5.0 milestone 2025-09-30 22:06:54 +00:00
nex self-assigned this 2025-09-30 22:06:54 +00:00
Author
Owner

This is proving to be a very annoying issue.

#[serde(skip_serializing_if = "Option::is_none")]
pub room_id: Option<OwnedRoomId>,

This somehow needs to be populated by room_id_or_hash(), but not only that, only if we're converting to a client event AND it is not already populated.

This is proving to be a very annoying issue. https://forgejo.ellis.link/continuwuation/continuwuity/src/commit/cc4c2fed25b2ccaab253e1697b483ca111c9beba/src/core/matrix/pdu.rs#L34-L35 This somehow needs to be populated by `room_id_or_hash()`, but not only that, *only if we're converting to a client event* AND *it is not already populated*.
Owner

There isn't really a centeral place to set this - #847 is similar, I traced where all the points that clients recieve events are to do the transforms. The only actual problems with that were code style/not parelising the additional database lookups iirc

There isn't really a centeral place to set this - https://forgejo.ellis.link/continuwuation/continuwuity/pulls/847 is similar, I traced where all the points that clients recieve events are to do the transforms. The only actual problems with that were code style/not parelising the additional database lookups iirc
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
continuwuation/continuwuity#1094
No description provided.