Skip to content

Return allowed_room_ids in the client /hierarchy response - #20154

Open
barodeur wants to merge 6 commits into
element-hq:developfrom
barodeur:room-hierachy-new-fields
Open

Return allowed_room_ids in the client /hierarchy response#20154
barodeur wants to merge 6 commits into
element-hq:developfrom
barodeur:room-hierachy-new-fields

Conversation

@barodeur

Copy link
Copy Markdown
Collaborator

Part of #18731 (Support Matrix 1.15).

Since Matrix 1.15, the spec defines allowed_room_ids on the room summaries returned by GET /_matrix/client/v1/rooms/{roomId}/hierarchy, so that clients can tell whether a restricted room can be joined or only knocked at:

allowed_room_ids[Room ID] — If the room is a restricted room, these are the room IDs which are specified by the join rules. Empty or omitted otherwise. Added in v1.15

Matrix Spec

Synapse currently strips the field from the client /hierarchy response before returning it — a guard added in matrix-org/synapse#12175 (2022), correct at the time, when the spec defined the field for federation only and it was leaking into client responses. The other two surfaces that define the field (/room_summary and the federation /hierarchy) already return it.

This PR removes the strip in _RoomEntry.as_json (and the now-unused for_client parameter), so client hierarchy entries include allowed_room_ids for restricted rooms, both local and received over federation. The first commit adds the failing test coverage, the second removes the strip.


Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

Matrix 1.15 (MSC3266) added allowed_room_ids, room_version and encryption
to the room summaries returned by the client hierarchy API. These tests
assert the field is returned for local restricted rooms and passed through
for remote rooms; they fail until the stripping is removed.
The field was deliberately removed from client responses in 2022
(matrix-org/synapse#12175) when the spec defined it for federation only.
MSC3266, merged into the client-server spec in Matrix 1.15, made it a
required property of client room summaries, so return it as-is.
MSC3266 has been merged into the spec since Matrix 1.15, so the spec text
is the normative reference.
@barodeur barodeur changed the title Room hierachy new fields Return allowed_room_ids in the client /hierarchy response Aug 27, 2026
@barodeur
barodeur marked this pull request as ready for review August 27, 2026 15:35
@barodeur
barodeur requested a review from a team as a code owner August 27, 2026 15:35
@barodeur
barodeur requested review from anoadragon453 and removed request for a team August 27, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant