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

Commit 0f02f0b

Browse files
Remove experimental MSC2716 implementation to incrementally import history into existing rooms (#15748)
Context for why we're removing the implementation: - matrix-org/matrix-spec-proposals#2716 (comment) - matrix-org/matrix-spec-proposals#2716 (comment) Anyone wanting to continue MSC2716, should also address these leftover tasks: #10737 Closes #10737 in the fact that it is not longer necessary to track those things.
1 parent 2ac6c3b commit 0f02f0b

28 files changed

+36
-2103
lines changed

changelog.d/15748.removal

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove experimental [MSC2716](https://github.com/matrix-org/matrix-spec-proposals/pull/2716) implementation to incrementally import history into existing rooms.

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

-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ allow_device_name_lookup_over_federation: true
9292
## Experimental Features ##
9393

9494
experimental_features:
95-
# Enable history backfilling support
96-
msc2716_enabled: true
9795
# client-side support for partial state in /send_join responses
9896
faster_joins: true
9997
# Enable support for polls

docker/configure_workers_and_start.py

-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@
244244
"^/_matrix/client/(api/v1|r0|v3|unstable)/join/",
245245
"^/_matrix/client/(api/v1|r0|v3|unstable)/knock/",
246246
"^/_matrix/client/(api/v1|r0|v3|unstable)/profile/",
247-
"^/_matrix/client/(v1|unstable/org.matrix.msc2716)/rooms/.*/batch_send",
248247
],
249248
"shared_extra_conf": {},
250249
"worker_extra_conf": "",

docs/workers.md

-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ information.
232232
^/_matrix/client/v1/rooms/.*/hierarchy$
233233
^/_matrix/client/(v1|unstable)/rooms/.*/relations/
234234
^/_matrix/client/v1/rooms/.*/threads$
235-
^/_matrix/client/unstable/org.matrix.msc2716/rooms/.*/batch_send$
236235
^/_matrix/client/unstable/im.nheko.summary/rooms/.*/summary$
237236
^/_matrix/client/(r0|v3|unstable)/account/3pid$
238237
^/_matrix/client/(r0|v3|unstable)/account/whoami$

scripts-dev/complement.sh

-4
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,6 @@ else
246246
else
247247
export PASS_SYNAPSE_COMPLEMENT_DATABASE=sqlite
248248
fi
249-
250-
# The tests for importing historical messages (MSC2716)
251-
# only pass with monoliths, currently.
252-
test_tags="$test_tags,msc2716"
253249
fi
254250

255251
if [[ -n "$ASYNCIO_REACTOR" ]]; then

synapse/api/constants.py

-14
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,6 @@ class EventTypes:
123123
SpaceChild: Final = "m.space.child"
124124
SpaceParent: Final = "m.space.parent"
125125

126-
MSC2716_INSERTION: Final = "org.matrix.msc2716.insertion"
127-
MSC2716_BATCH: Final = "org.matrix.msc2716.batch"
128-
MSC2716_MARKER: Final = "org.matrix.msc2716.marker"
129-
130126
Reaction: Final = "m.reaction"
131127

132128

@@ -222,16 +218,6 @@ class EventContentFields:
222218
# Used in m.room.guest_access events.
223219
GUEST_ACCESS: Final = "guest_access"
224220

225-
# Used on normal messages to indicate they were historically imported after the fact
226-
MSC2716_HISTORICAL: Final = "org.matrix.msc2716.historical"
227-
# For "insertion" events to indicate what the next batch ID should be in
228-
# order to connect to it
229-
MSC2716_NEXT_BATCH_ID: Final = "next_batch_id"
230-
# Used on "batch" events to indicate which insertion event it connects to
231-
MSC2716_BATCH_ID: Final = "batch_id"
232-
# For "marker" events
233-
MSC2716_INSERTION_EVENT_REFERENCE: Final = "insertion_event_reference"
234-
235221
# The authorising user for joining a restricted room.
236222
AUTHORISING_USER: Final = "join_authorised_via_users_server"
237223

synapse/api/room_versions.py

-61
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ class RoomVersion:
9191
# MSC2403: Allows join_rules to be set to 'knock', changes auth rules to allow sending
9292
# m.room.membership event with membership 'knock'.
9393
msc2403_knocking: bool
94-
# MSC2716: Adds m.room.power_levels -> content.historical field to control
95-
# whether "insertion", "chunk", "marker" events can be sent
96-
msc2716_historical: bool
97-
# MSC2716: Adds support for redacting "insertion", "chunk", and "marker" events
98-
msc2716_redactions: bool
9994
# MSC3389: Protect relation information from redaction.
10095
msc3389_relation_redactions: bool
10196
# MSC3787: Adds support for a `knock_restricted` join rule, mixing concepts of
@@ -130,8 +125,6 @@ class RoomVersions:
130125
msc3083_join_rules=False,
131126
msc3375_redaction_rules=False,
132127
msc2403_knocking=False,
133-
msc2716_historical=False,
134-
msc2716_redactions=False,
135128
msc3389_relation_redactions=False,
136129
msc3787_knock_restricted_join_rule=False,
137130
msc3667_int_only_power_levels=False,
@@ -153,8 +146,6 @@ class RoomVersions:
153146
msc3083_join_rules=False,
154147
msc3375_redaction_rules=False,
155148
msc2403_knocking=False,
156-
msc2716_historical=False,
157-
msc2716_redactions=False,
158149
msc3389_relation_redactions=False,
159150
msc3787_knock_restricted_join_rule=False,
160151
msc3667_int_only_power_levels=False,
@@ -176,8 +167,6 @@ class RoomVersions:
176167
msc3083_join_rules=False,
177168
msc3375_redaction_rules=False,
178169
msc2403_knocking=False,
179-
msc2716_historical=False,
180-
msc2716_redactions=False,
181170
msc3389_relation_redactions=False,
182171
msc3787_knock_restricted_join_rule=False,
183172
msc3667_int_only_power_levels=False,
@@ -199,8 +188,6 @@ class RoomVersions:
199188
msc3083_join_rules=False,
200189
msc3375_redaction_rules=False,
201190
msc2403_knocking=False,
202-
msc2716_historical=False,
203-
msc2716_redactions=False,
204191
msc3389_relation_redactions=False,
205192
msc3787_knock_restricted_join_rule=False,
206193
msc3667_int_only_power_levels=False,
@@ -222,8 +209,6 @@ class RoomVersions:
222209
msc3083_join_rules=False,
223210
msc3375_redaction_rules=False,
224211
msc2403_knocking=False,
225-
msc2716_historical=False,
226-
msc2716_redactions=False,
227212
msc3389_relation_redactions=False,
228213
msc3787_knock_restricted_join_rule=False,
229214
msc3667_int_only_power_levels=False,
@@ -245,8 +230,6 @@ class RoomVersions:
245230
msc3083_join_rules=False,
246231
msc3375_redaction_rules=False,
247232
msc2403_knocking=False,
248-
msc2716_historical=False,
249-
msc2716_redactions=False,
250233
msc3389_relation_redactions=False,
251234
msc3787_knock_restricted_join_rule=False,
252235
msc3667_int_only_power_levels=False,
@@ -268,8 +251,6 @@ class RoomVersions:
268251
msc3083_join_rules=False,
269252
msc3375_redaction_rules=False,
270253
msc2403_knocking=False,
271-
msc2716_historical=False,
272-
msc2716_redactions=False,
273254
msc3389_relation_redactions=False,
274255
msc3787_knock_restricted_join_rule=False,
275256
msc3667_int_only_power_levels=False,
@@ -291,8 +272,6 @@ class RoomVersions:
291272
msc3083_join_rules=False,
292273
msc3375_redaction_rules=False,
293274
msc2403_knocking=True,
294-
msc2716_historical=False,
295-
msc2716_redactions=False,
296275
msc3389_relation_redactions=False,
297276
msc3787_knock_restricted_join_rule=False,
298277
msc3667_int_only_power_levels=False,
@@ -314,8 +293,6 @@ class RoomVersions:
314293
msc3083_join_rules=True,
315294
msc3375_redaction_rules=False,
316295
msc2403_knocking=True,
317-
msc2716_historical=False,
318-
msc2716_redactions=False,
319296
msc3389_relation_redactions=False,
320297
msc3787_knock_restricted_join_rule=False,
321298
msc3667_int_only_power_levels=False,
@@ -337,8 +314,6 @@ class RoomVersions:
337314
msc3083_join_rules=True,
338315
msc3375_redaction_rules=True,
339316
msc2403_knocking=True,
340-
msc2716_historical=False,
341-
msc2716_redactions=False,
342317
msc3389_relation_redactions=False,
343318
msc3787_knock_restricted_join_rule=False,
344319
msc3667_int_only_power_levels=False,
@@ -360,8 +335,6 @@ class RoomVersions:
360335
msc3083_join_rules=True,
361336
msc3375_redaction_rules=True,
362337
msc2403_knocking=True,
363-
msc2716_historical=False,
364-
msc2716_redactions=False,
365338
msc3389_relation_redactions=False,
366339
msc3787_knock_restricted_join_rule=True,
367340
msc3667_int_only_power_levels=False,
@@ -383,8 +356,6 @@ class RoomVersions:
383356
msc3083_join_rules=True,
384357
msc3375_redaction_rules=True,
385358
msc2403_knocking=True,
386-
msc2716_historical=False,
387-
msc2716_redactions=False,
388359
msc3389_relation_redactions=False,
389360
msc3787_knock_restricted_join_rule=False,
390361
msc3667_int_only_power_levels=False,
@@ -406,38 +377,13 @@ class RoomVersions:
406377
msc3083_join_rules=True,
407378
msc3375_redaction_rules=True,
408379
msc2403_knocking=True,
409-
msc2716_historical=False,
410-
msc2716_redactions=False,
411380
msc3389_relation_redactions=False,
412381
msc3787_knock_restricted_join_rule=True,
413382
msc3667_int_only_power_levels=True,
414383
msc3821_redaction_rules=False,
415384
msc3931_push_features=(),
416385
msc3989_redaction_rules=False,
417386
)
418-
MSC2716v4 = RoomVersion(
419-
"org.matrix.msc2716v4",
420-
RoomDisposition.UNSTABLE,
421-
EventFormatVersions.ROOM_V4_PLUS,
422-
StateResolutionVersions.V2,
423-
enforce_key_validity=True,
424-
special_case_aliases_auth=False,
425-
strict_canonicaljson=True,
426-
limit_notifications_power_levels=True,
427-
msc2175_implicit_room_creator=False,
428-
msc2176_redaction_rules=False,
429-
msc3083_join_rules=False,
430-
msc3375_redaction_rules=False,
431-
msc2403_knocking=True,
432-
msc2716_historical=True,
433-
msc2716_redactions=True,
434-
msc3389_relation_redactions=False,
435-
msc3787_knock_restricted_join_rule=False,
436-
msc3667_int_only_power_levels=False,
437-
msc3821_redaction_rules=False,
438-
msc3931_push_features=(),
439-
msc3989_redaction_rules=False,
440-
)
441387
MSC1767v10 = RoomVersion(
442388
# MSC1767 (Extensible Events) based on room version "10"
443389
"org.matrix.msc1767.10",
@@ -453,8 +399,6 @@ class RoomVersions:
453399
msc3083_join_rules=True,
454400
msc3375_redaction_rules=True,
455401
msc2403_knocking=True,
456-
msc2716_historical=False,
457-
msc2716_redactions=False,
458402
msc3389_relation_redactions=False,
459403
msc3787_knock_restricted_join_rule=True,
460404
msc3667_int_only_power_levels=True,
@@ -476,8 +420,6 @@ class RoomVersions:
476420
msc3083_join_rules=True,
477421
msc3375_redaction_rules=True,
478422
msc2403_knocking=True,
479-
msc2716_historical=False,
480-
msc2716_redactions=False,
481423
msc3389_relation_redactions=False,
482424
msc3787_knock_restricted_join_rule=True,
483425
msc3667_int_only_power_levels=True,
@@ -500,8 +442,6 @@ class RoomVersions:
500442
msc3083_join_rules=True,
501443
msc3375_redaction_rules=True,
502444
msc2403_knocking=True,
503-
msc2716_historical=False,
504-
msc2716_redactions=False,
505445
msc3389_relation_redactions=False,
506446
msc3787_knock_restricted_join_rule=True,
507447
msc3667_int_only_power_levels=True,
@@ -526,7 +466,6 @@ class RoomVersions:
526466
RoomVersions.V9,
527467
RoomVersions.MSC3787,
528468
RoomVersions.V10,
529-
RoomVersions.MSC2716v4,
530469
RoomVersions.MSC3989,
531470
RoomVersions.MSC3820opt2,
532471
)

synapse/app/generic_worker.py

-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
from synapse.storage.databases.main.registration import RegistrationWorkerStore
8484
from synapse.storage.databases.main.relations import RelationsWorkerStore
8585
from synapse.storage.databases.main.room import RoomWorkerStore
86-
from synapse.storage.databases.main.room_batch import RoomBatchStore
8786
from synapse.storage.databases.main.roommember import RoomMemberWorkerStore
8887
from synapse.storage.databases.main.search import SearchStore
8988
from synapse.storage.databases.main.session import SessionStore
@@ -120,7 +119,6 @@ class GenericWorkerStore(
120119
# the races it creates aren't too bad.
121120
KeyStore,
122121
RoomWorkerStore,
123-
RoomBatchStore,
124122
DirectoryWorkerStore,
125123
PushRulesWorkerStore,
126124
ApplicationServiceTransactionWorkerStore,

synapse/config/experimental.py

-3
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,6 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
247247
# MSC3026 (busy presence state)
248248
self.msc3026_enabled: bool = experimental.get("msc3026_enabled", False)
249249

250-
# MSC2716 (importing historical messages)
251-
self.msc2716_enabled: bool = experimental.get("msc2716_enabled", False)
252-
253250
# MSC3244 (room version capabilities)
254251
self.msc3244_enabled: bool = experimental.get("msc3244_enabled", True)
255252

synapse/event_auth.py

-40
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,6 @@ def check_state_dependent_auth_rules(
339339
if event.type == EventTypes.Redaction:
340340
check_redaction(event.room_version, event, auth_dict)
341341

342-
if (
343-
event.type == EventTypes.MSC2716_INSERTION
344-
or event.type == EventTypes.MSC2716_BATCH
345-
or event.type == EventTypes.MSC2716_MARKER
346-
):
347-
check_historical(event.room_version, event, auth_dict)
348-
349342
logger.debug("Allowing! %s", event)
350343

351344

@@ -365,7 +358,6 @@ def check_state_dependent_auth_rules(
365358
RoomVersions.V9,
366359
RoomVersions.MSC3787,
367360
RoomVersions.V10,
368-
RoomVersions.MSC2716v4,
369361
RoomVersions.MSC1767v10,
370362
}
371363

@@ -823,38 +815,6 @@ def check_redaction(
823815
raise AuthError(403, "You don't have permission to redact events")
824816

825817

826-
def check_historical(
827-
room_version_obj: RoomVersion,
828-
event: "EventBase",
829-
auth_events: StateMap["EventBase"],
830-
) -> None:
831-
"""Check whether the event sender is allowed to send historical related
832-
events like "insertion", "batch", and "marker".
833-
834-
Returns:
835-
None
836-
837-
Raises:
838-
AuthError if the event sender is not allowed to send historical related events
839-
("insertion", "batch", and "marker").
840-
"""
841-
# Ignore the auth checks in room versions that do not support historical
842-
# events
843-
if not room_version_obj.msc2716_historical:
844-
return
845-
846-
user_level = get_user_power_level(event.user_id, auth_events)
847-
848-
historical_level = get_named_level(auth_events, "historical", 100)
849-
850-
if user_level < historical_level:
851-
raise UnstableSpecAuthError(
852-
403,
853-
'You don\'t have permission to send send historical related events ("insertion", "batch", and "marker")',
854-
errcode=Codes.INSUFFICIENT_POWER,
855-
)
856-
857-
858818
def _check_power_levels(
859819
room_version_obj: RoomVersion,
860820
event: "EventBase",

synapse/events/__init__.py

-9
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ def __init__(self, internal_metadata_dict: JsonDict):
198198
soft_failed: DictProperty[bool] = DictProperty("soft_failed")
199199
proactively_send: DictProperty[bool] = DictProperty("proactively_send")
200200
redacted: DictProperty[bool] = DictProperty("redacted")
201-
historical: DictProperty[bool] = DictProperty("historical")
202201

203202
txn_id: DictProperty[str] = DictProperty("txn_id")
204203
"""The transaction ID, if it was set when the event was created."""
@@ -288,14 +287,6 @@ def is_redacted(self) -> bool:
288287
"""
289288
return self._dict.get("redacted", False)
290289

291-
def is_historical(self) -> bool:
292-
"""Whether this is a historical message.
293-
This is used by the batchsend historical message endpoint and
294-
is needed to and mark the event as backfilled and skip some checks
295-
like push notifications.
296-
"""
297-
return self._dict.get("historical", False)
298-
299290
def is_notifiable(self) -> bool:
300291
"""Whether this event can trigger a push notification"""
301292
return not self.is_outlier() or self.is_out_of_band_membership()

synapse/events/utils.py

-9
Original file line numberDiff line numberDiff line change
@@ -164,21 +164,12 @@ def add_fields(*fields: str) -> None:
164164
if room_version.msc2176_redaction_rules:
165165
add_fields("invite")
166166

167-
if room_version.msc2716_historical:
168-
add_fields("historical")
169-
170167
elif event_type == EventTypes.Aliases and room_version.special_case_aliases_auth:
171168
add_fields("aliases")
172169
elif event_type == EventTypes.RoomHistoryVisibility:
173170
add_fields("history_visibility")
174171
elif event_type == EventTypes.Redaction and room_version.msc2176_redaction_rules:
175172
add_fields("redacts")
176-
elif room_version.msc2716_redactions and event_type == EventTypes.MSC2716_INSERTION:
177-
add_fields(EventContentFields.MSC2716_NEXT_BATCH_ID)
178-
elif room_version.msc2716_redactions and event_type == EventTypes.MSC2716_BATCH:
179-
add_fields(EventContentFields.MSC2716_BATCH_ID)
180-
elif room_version.msc2716_redactions and event_type == EventTypes.MSC2716_MARKER:
181-
add_fields(EventContentFields.MSC2716_INSERTION_EVENT_REFERENCE)
182173

183174
# Protect the rel_type and event_id fields under the m.relates_to field.
184175
if room_version.msc3389_relation_redactions:

0 commit comments

Comments
 (0)