-
Notifications
You must be signed in to change notification settings - Fork 418
MSC2716: Incrementally importing history into existing rooms #2716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ara4n
wants to merge
69
commits into
old_master
Choose a base branch
from
matthew/msc2716
base: old_master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+767
−0
Open
Changes from 8 commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
8c8d5e3
MSC2716: Incrementally importing history into existing rooms
ara4n 3a03172
note that we don't solve lazyloading history from ASes
ara4n 5e6b7b9
add another alternative
ara4n 9451439
s/parent/prev_event/ for consistency with SS API
ara4n 8668e3a
Add initial draft of alternative batch sending historical messages
MadLittleMods d40f3b9
Update with chunk events
MadLittleMods 5854ca2
Add note about adding m.historical
MadLittleMods b766be5
Only connect the base insertion event to the specified prev_event
MadLittleMods b448452
Start of consolidation and adding more clear information
MadLittleMods 8a4d136
Wrap lines
MadLittleMods 92f87ed
Add remaining alternatives
MadLittleMods bb44a63
Correct stable endpoint location
MadLittleMods 3367f56
Reading pass
MadLittleMods a4c474e
Fix casing typo
MadLittleMods 9df8b6e
Split out meta MSC2716 events into their own fields
MadLittleMods b3b7903
Remove outdated comment on current iteration of spec
MadLittleMods 38bebb1
Use more obvious query param name
MadLittleMods 7df80fe
Rename from chunks to batches
MadLittleMods 3f28588
Add graph to show how historical state plays into the DAG
MadLittleMods 80e68bc
Add server detection support
MadLittleMods 1678282
Prefer empty prev_events=[] over fake prev_events
MadLittleMods c6a60b1
GitHub now supports mermaid natively
MadLittleMods 65e5f7b
Incorporate in feedback
MadLittleMods d7cf789
Fix little mistakes
MadLittleMods d016b7d
Emphasize has *all* history as it's the key differentiator for that s…
MadLittleMods 2544a3f
Address markers being lost in timeline gaps (marker events as state)
MadLittleMods 7258f64
Formatting
MadLittleMods a828de3
Small typos and other fixes
anoadragon453 b2b5b54
Use json5
MadLittleMods a7920fb
Remove base graph
MadLittleMods 73f4143
?ts is now specced
MadLittleMods 92a7658
Say explicit for current room version
MadLittleMods 1cf7395
Say which query parameters are optional vs required
MadLittleMods 2433dfa
"Live timeline" so it's obvious
MadLittleMods efbee43
Fix stable versions
MadLittleMods b4ba8c4
Feature needs to be true
MadLittleMods 7cde5cd
More clear phrasing
MadLittleMods 8a50cbf
Add annotation that older events are at the top of the graphs
MadLittleMods 8286ca4
A --> B is just where you want to import between
MadLittleMods 850e2f1
More than one reason for new room version
MadLittleMods 3332ca8
unioned with the state at the prev_event_id
MadLittleMods 3668193
State events are allowed
MadLittleMods c936c7b
Merge branch 'matthew/msc2716' of github.com:matrix-org/matrix-doc in…
MadLittleMods 1d3f562
Unsaved merge conflict
MadLittleMods e593c20
More clear image
MadLittleMods 2c46547
Just use event types when referring to them
MadLittleMods f60c233
Self-referential batches descoped to another MSC
MadLittleMods b081ec7
Re-arrange to explain events and fields in table
MadLittleMods d20455f
Fix some table formatting and better full examples
MadLittleMods a8313bd
Link to depth discussion
MadLittleMods 9d96c5c
Wrapping
MadLittleMods 991bd84
Fix direction
MadLittleMods 55551fc
Remove namespace beacuse the event type is already the namespace
MadLittleMods 1ee23d4
Fix heading structure and more words to describe the historical property
MadLittleMods e7e435d
Explain when the messages in the example were sent
MadLittleMods 775d3d3
Clarify that you provide it next time
MadLittleMods 6ccecd7
Clarify how it connects
MadLittleMods af24a5f
Fix endpoint path (no unstable)
MadLittleMods 10599cb
Add heading for new event types
MadLittleMods a6b5d8f
Use m.room.insertion type name in mermaid graphs
MadLittleMods 0642d88
Remove backticks from mermaid graphs
MadLittleMods b18c214
Add more initial explanation
MadLittleMods 02b5f4b
Better DAG to match expectation image
MadLittleMods 69bd287
Add example why you would use the historical content property
MadLittleMods 5412e80
Remove "full"
MadLittleMods 16a6a40
Fix historical typo
MadLittleMods 4a8f834
Explain that /batch_send does the insertion/batch dance for you
MadLittleMods e4193ff
Make it more clear what the drawbacks are
MadLittleMods 1fc8b6b
with should be without
MadLittleMods File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,263 @@ | ||
| # MSC2716: Batch send historical messages | ||
|
|
||
| For the full problem statement, considerations, see the other `proposals/2716-importing-history-into-existing-rooms.md` document. Happy to merge the two, once we get more feedback on it. | ||
|
|
||
| ## Alternative batch send proposal | ||
|
|
||
|
|
||
| ### Expectation | ||
|
|
||
| Historical messages that we insert should appear in the timeline just like they would if they were sent back at that time. | ||
|
|
||
| Here is what scrollback is expected to look like in Element: | ||
|
|
||
|  | ||
MadLittleMods marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
|
|
||
| ### New batch send approach | ||
|
|
||
| Add a new endpoint, `POST /_matrix/client/unstable/org.matrix.msc2716/rooms/<roomID>/batch_send?prev_event=<eventID>&chunk_id=<chunkID>`, which can insert a chunk of events historically back in time next to the given `prev_event`. This endpoint can only be used by application services. `chunk_id` comes from `next_chunk_id` in the response of the batch send endpoint and is derived from the "insertion" events added to each chunk. It's not required for the first batch send. | ||
| ``` | ||
| # Body | ||
| { | ||
MadLittleMods marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "events": [ ... ], | ||
| "state_events_at_start": [ ... ] | ||
| } | ||
|
|
||
| # Response | ||
| { | ||
| "state_events": [...list of state event ID's we inserted], | ||
| "events": [...list of historical event ID's we inserted], | ||
| "next_chunk_id": "random-unique-string", | ||
MadLittleMods marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| ``` | ||
|
|
||
| `state_events_at_start` is used to define the historical state events needed to auth the `events` like join events. These events can float outside of the normal DAG. In Synapse, these are called floating `outlier`'s and won't be visible in the chat history which also allows us to insert multiple chunks without having a bunch of `@mxid joined the room` noise between each chunk. The state will not be resolved into the current state of the room. | ||
|
|
||
| `events` is chronological chunk/list of events you want to insert. For Synapse, there is a reverse-chronological constraint on chunks so once you insert one chunk of messages, you can only insert older an older chunk after that. tldr; Insert from your most recent chunk of history -> oldest history. | ||
|
|
||
| The `state_events`/`events` payload is in **chronological** order (`[0, 1, 2]`) and is processed it in that order so the `prev_events` point to it's older-in-time previous message which is more sane in the DAG. **Depth discussion:** For Synapse, when persisting, we **reverse the list (to make it reverse-chronological)** so we can still get the correct `(topological_ordering, stream_ordering)` so it sorts between A and B as we expect. Why? `depth` is not re-calculated when historical messages are inserted into the DAG. This means we have to take care to insert in the right order. Events are sorted by `(topological_ordering, stream_ordering)` where `topological_ordering` is just `depth`. Normally, `stream_ordering` is an auto incrementing integer but for `backfilled=true` events, it decrements. Historical messages are inserted all at the same `depth`, and marked as backfilled so the `stream_ordering` decrements and each event is sorted behind the next. (from https://github.com/matrix-org/synapse/pull/9247#discussion_r588479201) | ||
|
|
||
| All of the events in the chunk get a content field, `"m.historical": true`, to indicate that they are historical at the point of being added to a room. | ||
|
|
||
| With the new process, the DAG will look like: | ||
|
|
||
|  | ||
|
|
||
|
|
||
| [Mermaid live editor playground link](https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxvd2NoYXJ0IEJUXG4gICAgc3ViZ3JhcGggbGl2ZVxuICAgICAgICBCIC0tLS0tLS0tLS0tLS0-IEFcbiAgICBlbmRcbiAgICBcbiAgICBzdWJncmFwaCBjaHVuazBcbiAgICAgICAgY2h1bmswLTIoKFwiMlwiKSkgLS0-IGNodW5rMC0xKCgxKSkgLS0-IGNodW5rMC0wKCgwKSlcbiAgICBlbmRcblxuICAgIHN1YmdyYXBoIGNodW5rMVxuICAgICAgICBjaHVuazEtMigoXCIyXCIpKSAtLT4gY2h1bmsxLTEoKDEpKSAtLT4gY2h1bmsxLTAoKDApKVxuICAgIGVuZFxuICAgIFxuICAgIHN1YmdyYXBoIGNodW5rMlxuICAgICAgICBjaHVuazItMigoXCIyXCIpKSAtLT4gY2h1bmsyLTEoKDEpKSAtLT4gY2h1bmsyLTAoKDApKVxuICAgIGVuZFxuXG4gICAgXG4gICAgY2h1bmswLTAgLS0tLS0tLT4gQVxuICAgIGNodW5rMS0wIC0tPiBBXG4gICAgY2h1bmsyLTAgLS0-IEFcbiAgICBcbiAgICAlJSBhbGlnbm1lbnQgbGlua3MgXG4gICAgY2h1bmswLTAgLS0tIGNodW5rMS0yXG4gICAgY2h1bmsxLTAgLS0tIGNodW5rMi0yXG4gICAgJSUgbWFrZSB0aGUgbGlua3MgaW52aXNpYmxlIFxuICAgIGxpbmtTdHlsZSAxMCBzdHJva2Utd2lkdGg6MnB4LGZpbGw6bm9uZSxzdHJva2U6bm9uZTtcbiAgICBsaW5rU3R5bGUgMTEgc3Ryb2tlLXdpZHRoOjJweCxmaWxsOm5vbmUsc3Ryb2tlOm5vbmU7IiwibWVybWFpZCI6Int9IiwidXBkYXRlRWRpdG9yIjpmYWxzZSwiYXV0b1N5bmMiOnRydWUsInVwZGF0ZURpYWdyYW0iOmZhbHNlfQ) | ||
|
|
||
|
|
||
| <details> | ||
| <summary>mermaid graph syntax</summary> | ||
|
|
||
| ```mermaid | ||
| flowchart BT | ||
| subgraph live | ||
MadLittleMods marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| B -------------> A | ||
| end | ||
|
|
||
| subgraph chunk0 | ||
| chunk0-2(("2")) --> chunk0-1((1)) --> chunk0-0((0)) | ||
| end | ||
|
|
||
| subgraph chunk1 | ||
| chunk1-2(("2")) --> chunk1-1((1)) --> chunk1-0((0)) | ||
| end | ||
|
|
||
| subgraph chunk2 | ||
| chunk2-2(("2")) --> chunk2-1((1)) --> chunk2-0((0)) | ||
| end | ||
|
|
||
|
|
||
| chunk0-0 -------> A | ||
| chunk1-0 --> A | ||
| chunk2-0 --> A | ||
|
|
||
| %% alignment links | ||
| chunk0-0 --- chunk1-2 | ||
| chunk1-0 --- chunk2-2 | ||
| %% make the links invisible | ||
| linkStyle 10 stroke-width:2px,fill:none,stroke:none; | ||
| linkStyle 11 stroke-width:2px,fill:none,stroke:none; | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
|
|
||
|
|
||
| ### New approach with "insertion" events | ||
|
|
||
| Next we add "insertion" and "chunk" events so it's more presriptive on how each historical chunk should connect to each other and how the homeserver can navigate the DAG. | ||
|
|
||
| - With "insertion" events, we just add them to the start of each chronological chunk (where the oldest message in the chunk is). The next older-in-time chunk can connect to that "insertion" point from the previous chunk. | ||
| - The initial "insertion" event could be from the main DAG or we can create it ad-hoc in the first chunk so the homeserver can start traversing up the chunk from there after a "marker" event points to it. | ||
| - We use "chunk" events to point to the "insertion" event by referencing the "next_chunk_id" from the "insertion" event. | ||
| - Consideration: the "insertion"/"chunk" events add a new way for an application service to tie the chunk reconciliation in knots(similar to the DAG knots that can happen). | ||
|
|
||
|
|
||
|  | ||
|
|
||
| [Mermaid live editor playground link](https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxvd2NoYXJ0IEJUXG4gICAgc3ViZ3JhcGggbGl2ZVxuICAgICAgICBCIC0tLS0tLS0tLS0tLS0tLS0tPiBBXG4gICAgZW5kXG4gICAgXG4gICAgc3ViZ3JhcGggY2h1bmswXG4gICAgICAgIGNodW5rMC1jaHVua1tbXCJjaHVua1wiXV0gLS0-IGNodW5rMC0yKChcIjJcIikpIC0tPiBjaHVuazAtMSgoMSkpIC0tPiBjaHVuazAtMCgoMCkpIC0tPiBjaHVuazAtaW5zZXJ0aW9uWy9pbnNlcnRpb25cXF1cbiAgICBlbmRcblxuICAgIHN1YmdyYXBoIGNodW5rMVxuICAgICAgICBjaHVuazEtY2h1bmtbW1wiY2h1bmtcIl1dIC0tPiBjaHVuazEtMigoXCIyXCIpKSAtLT4gY2h1bmsxLTEoKDEpKSAtLT4gY2h1bmsxLTAoKDApKSAtLT4gY2h1bmsxLWluc2VydGlvblsvaW5zZXJ0aW9uXFxdXG4gICAgZW5kXG4gICAgXG4gICAgc3ViZ3JhcGggY2h1bmsyXG4gICAgICAgIGNodW5rMi1jaHVua1tbXCJjaHVua1wiXV0gLS0-IGNodW5rMi0yKChcIjJcIikpIC0tPiBjaHVuazItMSgoMSkpIC0tPiBjaHVuazItMCgoMCkpIC0tPiBjaHVuazItaW5zZXJ0aW9uWy9pbnNlcnRpb25cXF1cbiAgICBlbmRcblxuICAgIFxuICAgIGNodW5rMC1pbnNlcnRpb25CYXNlWy9pbnNlcnRpb25cXF0gLS0tLS0tLS0tLS0tLT4gQVxuICAgIGNodW5rMC1jaHVuayAtLi0-IGNodW5rMC1pbnNlcnRpb25CYXNlWy9pbnNlcnRpb25cXF1cbiAgICBjaHVuazEtY2h1bmsgLS4tPiBjaHVuazAtaW5zZXJ0aW9uXG4gICAgY2h1bmsyLWNodW5rIC0uLT4gY2h1bmsxLWluc2VydGlvblxuIiwibWVybWFpZCI6Int9IiwidXBkYXRlRWRpdG9yIjpmYWxzZSwiYXV0b1N5bmMiOnRydWUsInVwZGF0ZURpYWdyYW0iOmZhbHNlfQ) | ||
|
|
||
| <details> | ||
| <summary>mermaid graph syntax</summary> | ||
|
|
||
| ```mermaid | ||
| flowchart BT | ||
MadLittleMods marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| subgraph live | ||
| B -----------------> A | ||
| end | ||
|
|
||
| subgraph chunk0 | ||
| chunk0-chunk[["chunk"]] --> chunk0-2(("2")) --> chunk0-1((1)) --> chunk0-0((0)) --> chunk0-insertion[/insertion\] | ||
| end | ||
|
|
||
| subgraph chunk1 | ||
| chunk1-chunk[["chunk"]] --> chunk1-2(("2")) --> chunk1-1((1)) --> chunk1-0((0)) --> chunk1-insertion[/insertion\] | ||
| end | ||
|
|
||
| subgraph chunk2 | ||
| chunk2-chunk[["chunk"]] --> chunk2-2(("2")) --> chunk2-1((1)) --> chunk2-0((0)) --> chunk2-insertion[/insertion\] | ||
| end | ||
|
|
||
|
|
||
| chunk0-insertionBase[/insertion\] -------------> A | ||
| chunk0-chunk -.-> chunk0-insertionBase[/insertion\] | ||
| chunk1-chunk -.-> chunk0-insertion | ||
| chunk2-chunk -.-> chunk1-insertion | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| The structure of the insertion event would look like: | ||
| ```js | ||
| { | ||
| "type": "m.room.insertion", | ||
| "sender": "@appservice:example.org", | ||
| "content": { | ||
| "m.next_chunk_id": next_chunk_id, | ||
| "m.historical": true | ||
| }, | ||
| "room_id": "!jEsUZKDJdhlrceRyVU:example.org", | ||
| // Doesn't affect much but good to use the same time as the closest event | ||
| "origin_server_ts": 1626914158639 | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
| The structure of the chunk event would look like: | ||
| ```js | ||
| { | ||
| "type": "m.room.chunk", | ||
| "sender": "@appservice:example.org", | ||
| "content": { | ||
| "m.chunk_id": chunk_id, | ||
| "m.historical": true | ||
| }, | ||
| "room_id": "!jEsUZKDJdhlrceRyVU:example.org", | ||
| // Doesn't affect much but good to use the same time as the closest event | ||
| "origin_server_ts": 1626914158639 | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
|
|
||
| ### "Marker" events | ||
|
|
||
| Finally, we add "marker" events into the mix so that federated remote servers can also navigate and to know where/how to fetch historical messages correctly. | ||
|
|
||
| To lay out the different types of servers consuming these historical messages (more context on why we need "marker" events): | ||
|
|
||
| 1. Local server | ||
| - This can pretty much work out of the box. Just add the events to the database and they're available. The new endpoint is just a mechanism to insert the events. | ||
| 1. Federated remote server that already has all scrollback history and then new history is inserted | ||
| - The big problem is how does a HS know it needs to go fetch more history if they already fetched all of the history in the room? We're solving this with "marker" events which are sent on the "live" timeline and point back to the "insertion" event where we inserted history next to. The HS can then go and backfill the "insertion" event and continue navigating the chunks from there. | ||
| 1. Federated remote server that joins a new room with historical messages | ||
| - We need to update the `/backfill` response to include historical messages from the chunks | ||
| 1. Federated remote server already in the room when history is inserted | ||
| - Depends on whether the HS has the scrollback history. If the HS already has all history, see scenario 2, if doesn't, see scenario 3. | ||
| 1. For federated servers already in the room that haven't implemented MSC2716 | ||
| - Those homeservers won't have historical messages available because they're unable to navigate the "marker"/"insertion" events. But the historical messages would be available once the HS implements MSC2716 and processes the "marker" events that point to the history. | ||
|
|
||
|
|
||
| --- | ||
|
|
||
| - A "marker" event simply points back to an "insertion" event. | ||
| - The "marker" event solves the problem of, how does a federated homeserver know about the historical events which won't come down incremental sync? And the scenario where the federated HS already has all the history in the room, so it won't do a full sync of the room again. | ||
| - Unlike the historical events, the "marker" event is sent as a normal event on the "live" timeline so that comes down incremental sync and is available to all homeservers regardless of how much scrollback history they already have. | ||
| - Note: If a server joins after a "marker" event is sent, it could be lost in the middle of the timeline and they could jump back in time past the "marker" and never pick it up. But `backfill/` response should have historical messages included. It gets a bit hairy if the server has the room backfilled, the user leaves, a "marker" event is sent, more messages put it back in the timeline, the user joins back, jumps back in the timeline and misses the "marker" and expects to see the historical messages. They will be missing the historical messages until they can backfill the gap where they left. | ||
| - A "marker" event is not needed for every chunk/batch of historical messages. Multiple chunks can be inserted then once we're done importing everything, we can add one "marker" event pointing at the root "insertion" event | ||
| - If more history is decided to be added later, another "marker" can be sent to let the homeservers know again. | ||
| - When a remote federated homeserver, receives a "marker" event, it can mark the "insertion" prev events as needing to backfill from that point again and can fetch the historical messages when the user scrolls back to that area in the future. | ||
| - We could remove the need for "marker" events if we decided to only allow sending "insertion" events on the "live" timeline at any point where you would later want to add history. But this isn't compatible with our dynamic insertion use cases like Gitter where the rooms already exist with no "insertion" events at the start of the room, and the examples from this MSC like NNTP (newsgroup) and email which can potentially want to branch off of everything. | ||
|
|
||
| The structure of the "marker" event would look like: | ||
| ```js | ||
| { | ||
| "type": "m.room.marker", | ||
MadLittleMods marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "sender": "@appservice:example.org", | ||
| "content": { | ||
| "m.insertion_id": insertion_event.event_id, | ||
| "m.historical": true | ||
MadLittleMods marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| "room_id": "!jEsUZKDJdhlrceRyVU:example.org", | ||
| "origin_server_ts": 1626914158639, | ||
| } | ||
| ``` | ||
|
|
||
|  | ||
|
|
||
| [Mermaid live editor playground link](https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxvd2NoYXJ0IEJUXG4gICAgc3ViZ3JhcGggbGl2ZVxuICAgICAgICBtYXJrZXIxPlwibWFya2VyXCJdIC0tLS0-IEIgLS0tLS0tLS0tLS0tLS0tLS0-IEFcbiAgICBlbmRcbiAgICBcbiAgICBzdWJncmFwaCBjaHVuazBcbiAgICAgICAgY2h1bmswLWNodW5rW1tcImNodW5rXCJdXSAtLT4gY2h1bmswLTIoKFwiMlwiKSkgLS0-IGNodW5rMC0xKCgxKSkgLS0-IGNodW5rMC0wKCgwKSkgLS0-IGNodW5rMC1pbnNlcnRpb25bL2luc2VydGlvblxcXVxuICAgIGVuZFxuXG4gICAgc3ViZ3JhcGggY2h1bmsxXG4gICAgICAgIGNodW5rMS1jaHVua1tbXCJjaHVua1wiXV0gLS0-IGNodW5rMS0yKChcIjJcIikpIC0tPiBjaHVuazEtMSgoMSkpIC0tPiBjaHVuazEtMCgoMCkpIC0tPiBjaHVuazEtaW5zZXJ0aW9uWy9pbnNlcnRpb25cXF1cbiAgICBlbmRcbiAgICBcbiAgICBzdWJncmFwaCBjaHVuazJcbiAgICAgICAgY2h1bmsyLWNodW5rW1tcImNodW5rXCJdXSAtLT4gY2h1bmsyLTIoKFwiMlwiKSkgLS0-IGNodW5rMi0xKCgxKSkgLS0-IGNodW5rMi0wKCgwKSkgLS0-IGNodW5rMi1pbnNlcnRpb25bL2luc2VydGlvblxcXVxuICAgIGVuZFxuXG4gICAgXG4gICAgbWFya2VyMSAtLi0-IGNodW5rMC1pbnNlcnRpb25CYXNlXG4gICAgY2h1bmswLWluc2VydGlvbkJhc2VbL2luc2VydGlvblxcXSAtLS0tLS0tLS0tLS0tPiBBXG4gICAgY2h1bmswLWNodW5rIC0uLT4gY2h1bmswLWluc2VydGlvbkJhc2VbL2luc2VydGlvblxcXVxuICAgIGNodW5rMS1jaHVuayAtLi0-IGNodW5rMC1pbnNlcnRpb25cbiAgICBjaHVuazItY2h1bmsgLS4tPiBjaHVuazEtaW5zZXJ0aW9uXG4iLCJtZXJtYWlkIjoie30iLCJ1cGRhdGVFZGl0b3IiOmZhbHNlLCJhdXRvU3luYyI6dHJ1ZSwidXBkYXRlRGlhZ3JhbSI6ZmFsc2V9) | ||
|
|
||
| <details> | ||
| <summary>mermaid graph syntax</summary> | ||
|
|
||
| ```mermaid | ||
| flowchart BT | ||
| subgraph live | ||
| marker1>"marker"] ----> B -----------------> A | ||
| end | ||
|
|
||
| subgraph chunk0 | ||
| chunk0-chunk[["chunk"]] --> chunk0-2(("2")) --> chunk0-1((1)) --> chunk0-0((0)) --> chunk0-insertion[/insertion\] | ||
| end | ||
|
|
||
| subgraph chunk1 | ||
| chunk1-chunk[["chunk"]] --> chunk1-2(("2")) --> chunk1-1((1)) --> chunk1-0((0)) --> chunk1-insertion[/insertion\] | ||
| end | ||
|
|
||
| subgraph chunk2 | ||
| chunk2-chunk[["chunk"]] --> chunk2-2(("2")) --> chunk2-1((1)) --> chunk2-0((0)) --> chunk2-insertion[/insertion\] | ||
| end | ||
|
|
||
|
|
||
| marker1 -.-> chunk0-insertionBase | ||
| chunk0-insertionBase[/insertion\] -------------> A | ||
| chunk0-chunk -.-> chunk0-insertionBase[/insertion\] | ||
| chunk1-chunk -.-> chunk0-insertion | ||
| chunk2-chunk -.-> chunk1-insertion | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| ### Limit who can send historical messages | ||
|
|
||
| Since events being silently sent in the past is hard to moderate, it will probably be good to limit who can add historical messages to the timeline. The batch send endpoint is already limited to application services but we also need to limit who can send "insertion", "chunk", and "marker" events since someone can attempt to send them via the normal `/send` API (we don't want any nasty weird knots to reconcile either) | ||
|
|
||
| We can limit and protect from this by introducing a new `historical` power level which controls who can send "insertion", "chunk", and "marker" events. Since we're changing the power levels and `event_auth.py` stuff in Synapse, this probably requires a new room version. For experimenting, we can use an experimental room version, `org.matrix.msc2716`. | ||
MadLittleMods marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Alternatively, we can use the existing `events` power level. For the default and existing rooms, if the "insertion", "chunk", and "marker" event PL levels are unset, we can completely disallow sending of those events in the room. This lets people opt-in and set a power level when they want an application service to start inserting history. | ||
|
|
||
|
|
||
|
|
||
|
|
||
MadLittleMods marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.