Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 8f10c8b

Browse files
Move MSC3030 /timestamp_to_event endpoint to stable v1 location (#14471)
Fix #14390 - Client API: `/_matrix/client/unstable/org.matrix.msc3030/rooms/<roomID>/timestamp_to_event?ts=<timestamp>&dir=<direction>` -> `/_matrix/client/v1/rooms/<roomID>/timestamp_to_event?ts=<timestamp>&dir=<direction>` - Federation API: `/_matrix/federation/unstable/org.matrix.msc3030/timestamp_to_event/<roomID>?ts=<timestamp>&dir=<direction>` -> `/_matrix/federation/v1/timestamp_to_event/<roomID>?ts=<timestamp>&dir=<direction>` Complement test changes: matrix-org/complement#559
1 parent 1183c37 commit 8f10c8b

File tree

13 files changed

+26
-37
lines changed

13 files changed

+26
-37
lines changed

changelog.d/14471.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Move MSC3030 `/timestamp_to_event` endpoints to stable `v1` location (`/_matrix/client/v1/rooms/<roomID>/timestamp_to_event?ts=<timestamp>&dir=<direction>`, `/_matrix/federation/v1/timestamp_to_event/<roomID>?ts=<timestamp>&dir=<direction>`).

docker/complement/conf/workers-shared-extra.yaml.j2

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ experimental_features:
100100
# client-side support for partial state in /send_join responses
101101
faster_joins: true
102102
{% endif %}
103-
# Enable jump to date endpoint
104-
msc3030_enabled: true
105103
# Filtering /messages by relation type.
106104
msc3874_enabled: true
107105

docker/configure_workers_and_start.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
"^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event",
141141
"^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms",
142142
"^/_matrix/client/(api/v1|r0|v3|unstable/.*)/rooms/.*/aliases",
143+
"^/_matrix/client/v1/rooms/.*/timestamp_to_event$",
143144
"^/_matrix/client/(api/v1|r0|v3|unstable)/search",
144145
],
145146
"shared_extra_conf": {},
@@ -163,6 +164,7 @@
163164
"^/_matrix/federation/(v1|v2)/invite/",
164165
"^/_matrix/federation/(v1|v2)/query_auth/",
165166
"^/_matrix/federation/(v1|v2)/event_auth/",
167+
"^/_matrix/federation/v1/timestamp_to_event/",
166168
"^/_matrix/federation/(v1|v2)/exchange_third_party_invite/",
167169
"^/_matrix/federation/(v1|v2)/user/devices/",
168170
"^/_matrix/federation/(v1|v2)/get_groups_publicised$",

docs/workers.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ information.
191191
^/_matrix/federation/(v1|v2)/send_leave/
192192
^/_matrix/federation/(v1|v2)/invite/
193193
^/_matrix/federation/v1/event_auth/
194+
^/_matrix/federation/v1/timestamp_to_event/
194195
^/_matrix/federation/v1/exchange_third_party_invite/
195196
^/_matrix/federation/v1/user/devices/
196197
^/_matrix/key/v2/query
@@ -218,6 +219,7 @@ information.
218219
^/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer$
219220
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event/
220221
^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms$
222+
^/_matrix/client/v1/rooms/.*/timestamp_to_event$
221223
^/_matrix/client/(api/v1|r0|v3|unstable)/search$
222224

223225
# Encryption requests

scripts-dev/complement.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ else
162162
# We only test faster room joins on monoliths, because they are purposefully
163163
# being developed without worker support to start with.
164164
#
165-
# The tests for importing historical messages (MSC2716) and jump to date (MSC3030)
166-
# also only pass with monoliths, currently.
167-
test_tags="$test_tags,faster_joins,msc2716,msc3030"
165+
# The tests for importing historical messages (MSC2716) also only pass with monoliths,
166+
# currently.
167+
test_tags="$test_tags,faster_joins,msc2716"
168168
fi
169169

170170

synapse/config/experimental.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
5353
# MSC3266 (room summary api)
5454
self.msc3266_enabled: bool = experimental.get("msc3266_enabled", False)
5555

56-
# MSC3030 (Jump to date API endpoint)
57-
self.msc3030_enabled: bool = experimental.get("msc3030_enabled", False)
58-
5956
# MSC2409 (this setting only relates to optionally sending to-device messages).
6057
# Presence, typing and read receipt EDUs are already sent to application services that
6158
# have opted in to receive them. If enabled, this adds to-device messages to that list.

synapse/federation/federation_client.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1691,9 +1691,19 @@ async def _timestamp_to_event_from_destination(
16911691
# to return events on *both* sides of the timestamp to
16921692
# help reconcile the gap faster.
16931693
_timestamp_to_event_from_destination,
1694+
# Since this endpoint is new, we should try other servers before giving up.
1695+
# We can safely remove this in a year (remove after 2023-11-16).
1696+
failover_on_unknown_endpoint=True,
16941697
)
16951698
return timestamp_to_event_response
1696-
except SynapseError:
1699+
except SynapseError as e:
1700+
logger.warn(
1701+
"timestamp_to_event(room_id=%s, timestamp=%s, direction=%s): encountered error when trying to fetch from destinations: %s",
1702+
room_id,
1703+
timestamp,
1704+
direction,
1705+
e,
1706+
)
16971707
return None
16981708

16991709
async def _timestamp_to_event_from_destination(

synapse/federation/transport/client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,8 @@ async def timestamp_to_event(
185185
Raises:
186186
Various exceptions when the request fails
187187
"""
188-
path = _create_path(
189-
FEDERATION_UNSTABLE_PREFIX,
190-
"/org.matrix.msc3030/timestamp_to_event/%s",
188+
path = _create_v1_path(
189+
"/timestamp_to_event/%s",
191190
room_id,
192191
)
193192

synapse/federation/transport/server/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from synapse.federation.transport.server.federation import (
2626
FEDERATION_SERVLET_CLASSES,
2727
FederationAccountStatusServlet,
28-
FederationTimestampLookupServlet,
2928
)
3029
from synapse.http.server import HttpServer, JsonResource
3130
from synapse.http.servlet import (
@@ -291,13 +290,6 @@ def register_servlets(
291290
)
292291

293292
for servletclass in SERVLET_GROUPS[servlet_group]:
294-
# Only allow the `/timestamp_to_event` servlet if msc3030 is enabled
295-
if (
296-
servletclass == FederationTimestampLookupServlet
297-
and not hs.config.experimental.msc3030_enabled
298-
):
299-
continue
300-
301293
# Only allow the `/account_status` servlet if msc3720 is enabled
302294
if (
303295
servletclass == FederationAccountStatusServlet

synapse/federation/transport/server/federation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,13 @@ class FederationTimestampLookupServlet(BaseFederationServerServlet):
218218
`dir` can be `f` or `b` to indicate forwards and backwards in time from the
219219
given timestamp.
220220
221-
GET /_matrix/federation/unstable/org.matrix.msc3030/timestamp_to_event/<roomID>?ts=<timestamp>&dir=<direction>
221+
GET /_matrix/federation/v1/timestamp_to_event/<roomID>?ts=<timestamp>&dir=<direction>
222222
{
223223
"event_id": ...
224224
}
225225
"""
226226

227227
PATH = "/timestamp_to_event/(?P<room_id>[^/]*)/?"
228-
PREFIX = FEDERATION_UNSTABLE_PREFIX + "/org.matrix.msc3030"
229228

230229
async def on_GET(
231230
self,

0 commit comments

Comments
 (0)