Put MSC2666 endpoint behind an experimental flag (#19219)

This commit is contained in:
Andrew Morgan 2025-11-25 18:03:33 +00:00 committed by GitHub
parent ae98771fea
commit ba65d8c351
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 39 additions and 2 deletions

1
changelog.d/19219.misc Normal file
View File

@ -0,0 +1 @@
Require an experimental feature flag to be enabled in order for the unstable [MSC2666](https://github.com/matrix-org/matrix-spec-proposals/pull/2666) endpoint (`/_matrix/client/unstable/uk.half-shot.msc2666/user/mutual_rooms`) to be available.

View File

@ -117,6 +117,17 @@ each upgrade are complete before moving on to the next upgrade, to avoid
stacking them up. You can monitor the currently running background updates with stacking them up. You can monitor the currently running background updates with
[the Admin API](usage/administration/admin_api/background_updates.html#status). [the Admin API](usage/administration/admin_api/background_updates.html#status).
# Upgrading to v1.144.0
## Unstable mutual rooms endpoint is now behind an experimental feature flag
The unstable mutual rooms endpoint from
[MSC2666](https://github.com/matrix-org/matrix-spec-proposals/pull/2666)
(`/_matrix/client/unstable/uk.half-shot.msc2666/user/mutual_rooms`) is now
disabled by default. If you rely on this unstable endpoint, you must now set
`experimental_features.msc2666_enabled: true` in your configuration to keep
using it.
# Upgrading to v1.143.0 # Upgrading to v1.143.0
## Dropping support for PostgreSQL 13 ## Dropping support for PostgreSQL 13

View File

@ -438,6 +438,9 @@ class ExperimentalConfig(Config):
# previously calculated push actions. # previously calculated push actions.
self.msc2654_enabled: bool = experimental.get("msc2654_enabled", False) self.msc2654_enabled: bool = experimental.get("msc2654_enabled", False)
# MSC2666: Query mutual rooms between two users.
self.msc2666_enabled: bool = experimental.get("msc2666_enabled", False)
# MSC2815 (allow room moderators to view redacted event content) # MSC2815 (allow room moderators to view redacted event content)
self.msc2815_enabled: bool = experimental.get("msc2815_enabled", False) self.msc2815_enabled: bool = experimental.get("msc2815_enabled", False)

View File

@ -90,4 +90,5 @@ class UserMutualRoomsServlet(RestServlet):
def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None: def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None:
UserMutualRoomsServlet(hs).register(http_server) if hs.config.experimental.msc2666_enabled:
UserMutualRoomsServlet(hs).register(http_server)

View File

@ -124,7 +124,7 @@ class VersionsRestServlet(RestServlet):
# Implements additional endpoints as described in MSC2432 # Implements additional endpoints as described in MSC2432
"org.matrix.msc2432": True, "org.matrix.msc2432": True,
# Implements additional endpoints as described in MSC2666 # Implements additional endpoints as described in MSC2666
"uk.half-shot.msc2666.query_mutual_rooms": True, "uk.half-shot.msc2666.query_mutual_rooms": self.config.experimental.msc2666_enabled,
# Whether new rooms will be set to encrypted or not (based on presets). # Whether new rooms will be set to encrypted or not (based on presets).
"io.element.e2ee_forced.public": self.e2ee_forced_public, "io.element.e2ee_forced.public": self.e2ee_forced_public,
"io.element.e2ee_forced.private": self.e2ee_forced_private, "io.element.e2ee_forced.private": self.e2ee_forced_private,

View File

@ -43,6 +43,12 @@ class UserMutualRoomsTest(unittest.HomeserverTestCase):
mutual_rooms.register_servlets, mutual_rooms.register_servlets,
] ]
def default_config(self) -> dict:
config = super().default_config()
experimental = config.setdefault("experimental_features", {})
experimental.setdefault("msc2666_enabled", True)
return config
def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer: def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
config = self.default_config() config = self.default_config()
return self.setup_test_homeserver(config=config) return self.setup_test_homeserver(config=config)
@ -58,6 +64,21 @@ class UserMutualRoomsTest(unittest.HomeserverTestCase):
access_token=token, access_token=token,
) )
@unittest.override_config({"experimental_features": {"msc2666_enabled": False}})
def test_mutual_rooms_no_experimental_flag(self) -> None:
"""
The endpoint should 404 if the experimental flag is not enabled.
"""
# Register a user.
u1 = self.register_user("user1", "pass")
u1_token = self.login(u1, "pass")
# Check that we're unable to query the endpoint due to the endpoint
# being unrecognised.
channel = self._get_mutual_rooms(u1_token, "@not-used:test")
self.assertEqual(404, channel.code, channel.result)
self.assertEqual("M_UNRECOGNIZED", channel.json_body["errcode"], channel.result)
def test_shared_room_list_public(self) -> None: def test_shared_room_list_public(self) -> None:
""" """
A room should show up in the shared list of rooms between two users A room should show up in the shared list of rooms between two users