Stabilise serving partial join responses (#14839)

Serving partial join responses is no longer experimental. They will only be served under the stable identifier if the the undocumented config flag experimental.msc3706_enabled is set to true.

Synapse continues to request a partial join only if the undocumented config flag experimental.faster_joins is set to true; this setting remains present and unaffected.
This commit is contained in:
David Robertson 2023-01-17 12:44:15 +00:00 committed by GitHub
parent 316590d1ea
commit 5b3af1c7d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 16 deletions

View File

@ -0,0 +1 @@
Faster joins: always serve a partial join response to servers that request it with the stable query param.

View File

@ -94,8 +94,6 @@ allow_device_name_lookup_over_federation: true
experimental_features: experimental_features:
# Enable history backfilling support # Enable history backfilling support
msc2716_enabled: true msc2716_enabled: true
# server-side support for partial state in /send_join responses
msc3706_enabled: true
{% if not workers_in_use %} {% if not workers_in_use %}
# client-side support for partial state in /send_join responses # client-side support for partial state in /send_join responses
faster_joins: true faster_joins: true

View File

@ -75,11 +75,15 @@ class ExperimentalConfig(Config):
) )
# MSC3706 (server-side support for partial state in /send_join responses) # MSC3706 (server-side support for partial state in /send_join responses)
# Synapse will always serve partial state responses to requests using the stable
# query parameter `omit_members`. If this flag is set, Synapse will also serve
# partial state responses to requests using the unstable query parameter
# `org.matrix.msc3706.partial_state`.
self.msc3706_enabled: bool = experimental.get("msc3706_enabled", False) self.msc3706_enabled: bool = experimental.get("msc3706_enabled", False)
# experimental support for faster joins over federation # experimental support for faster joins over federation
# (MSC2775, MSC3706, MSC3895) # (MSC2775, MSC3706, MSC3895)
# requires a target server with msc3706_enabled enabled. # requires a target server that can provide a partial join response (MSC3706)
self.faster_joins_enabled: bool = experimental.get("faster_joins", False) self.faster_joins_enabled: bool = experimental.get("faster_joins", False)
# MSC3720 (Account status endpoint) # MSC3720 (Account status endpoint)

View File

@ -422,7 +422,7 @@ class FederationV2SendJoinServlet(BaseFederationServerServlet):
server_name: str, server_name: str,
): ):
super().__init__(hs, authenticator, ratelimiter, server_name) super().__init__(hs, authenticator, ratelimiter, server_name)
self._msc3706_enabled = hs.config.experimental.msc3706_enabled self._read_msc3706_query_param = hs.config.experimental.msc3706_enabled
async def on_PUT( async def on_PUT(
self, self,
@ -436,16 +436,15 @@ class FederationV2SendJoinServlet(BaseFederationServerServlet):
# match those given in content # match those given in content
partial_state = False partial_state = False
if self._msc3706_enabled: # The stable query parameter wins, if it disagrees with the unstable
# The stable query parameter wins, if it disagrees with the unstable # parameter for some reason.
# parameter for some reason. stable_param = parse_boolean_from_args(query, "omit_members", default=None)
stable_param = parse_boolean_from_args(query, "omit_members", default=None) if stable_param is not None:
if stable_param is not None: partial_state = stable_param
partial_state = stable_param elif self._read_msc3706_query_param:
else: partial_state = parse_boolean_from_args(
partial_state = parse_boolean_from_args( query, "org.matrix.msc3706.partial_state", default=False
query, "org.matrix.msc3706.partial_state", default=False )
)
result = await self.handler.on_send_join_request( result = await self.handler.on_send_join_request(
origin, content, room_id, caller_supports_partial_state=partial_state origin, content, room_id, caller_supports_partial_state=partial_state

View File

@ -211,9 +211,8 @@ class SendJoinFederationTests(unittest.FederatingHomeserverTestCase):
) )
self.assertEqual(r[("m.room.member", joining_user)].membership, "join") self.assertEqual(r[("m.room.member", joining_user)].membership, "join")
@override_config({"experimental_features": {"msc3706_enabled": True}})
def test_send_join_partial_state(self) -> None: def test_send_join_partial_state(self) -> None:
"""When MSC3706 support is enabled, /send_join should return partial state""" """/send_join should return partial state, if requested"""
joining_user = "@misspiggy:" + self.OTHER_SERVER_NAME joining_user = "@misspiggy:" + self.OTHER_SERVER_NAME
join_result = self._make_join(joining_user) join_result = self._make_join(joining_user)