This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
MSC2716 leftover todo tasks #10737
Copy link
Copy link
Closed
Labels
T-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Description
Just trying to keep track of the last remaining little tasks to get MSC2716 good to go.
Todo
- Verify
chunk_id_from_querycorresponds to an actual insertion event,synapse/rest/client/room_batch.py#L302) - Ensure insertion events have unique
next_chunk_idbefore persisting. Ensure(room_id, next_chunk_id)is unique. Avoid cross-talk/conflicts between chunks- -> Ensure
(room_id, next_batch_id)is unique to avoid cross-talk/conflicts between batches (MSC2716) #10877 - Reject/soft-fail event over federation
- Disallow persisting on local server
- Discussed at Make historical events discoverable from backfill for servers without any scrollback history (MSC2716) (federation) #10245 (comment)
- -> Ensure
- Split meta events in
/batch_sendresponse into their own fields, MSC2716: Incrementally importing history into existing rooms matrix-spec-proposals#2716 (comment) - Rename
chunktobatchto match/batch_sendendpoint, MSC2716: Incrementally importing history into existing rooms matrix-spec-proposals#2716 (comment) - Rename
?prev_eventto?prev_event_id, MSC2716: Incrementally importing history into existing rooms matrix-spec-proposals#2716 (comment) -
Backfill should gracefully handle the case where no one has the complete state for a given event #10764- No longer needed because we now use an empty set of
prev_eventsinstead of fakeprev_events
- No longer needed because we now use an empty set of
- Backfill gets clogged up with fake prev_events when using the MSC2716 /batch_send endpoint #11091
- Historical state events from
state_events_at_startin the MSC2716/batch_sendendpoint get pushed to an application service/transactions#11241 - Make "marker" events state events, MSC2716: Incrementally importing history into existing rooms matrix-spec-proposals#2716 (comment). When the homeserver sees the marker state change or joins the room again, it can go up the marker event
unsigned.replaces_statechain of the to collect all of them.room.markerevents along the way and set as backward extremities on the homeserver. - Make Element throw away the timeline and re-fetch when it sees the "marker" state change
- Make Synapse process batches faster
- Disallow
/batch_sendusage in a room where the room version doesn't support it or is not the room creator- Currently, we just don't persist the insertion, batch, and marker events but we shouldn't allow the
/batch_sendusage in the first place to make it more obvious - -> Disallow
/batch_sendusage in a room where the room version doesn't support it or is not the room creator #13216
- Currently, we just don't persist the insertion, batch, and marker events but we shouldn't allow the
- Add some new background updates to fill in the
insertion_events,insertion_event_edges,batch_events, andinsertion_event_extremitiestables whenhs.config.experimental.msc2716_enabledis enabled so homeservers which go from having the config disabled to enabled(or unsupported to supported) can fill in the necessary info to have historical events appear.- As discussed at Allow room creator to send MSC2716 related events in existing room versions #10566 (comment)
- Other PR where I added a background update, Populate
rooms.creatorfield for easy lookup #10697
- Optimize
synapse/handlers/federation_event.py#L545(backfill receiving) to be more efficient. Calculate thestream_orderingfrom newest -> oldest (in the correct order) and persist in the oldest -> newest to get the least missingprev_eventfetch thrashing- Spawned from Fix historical messages backfilling in random order on remote homeservers (MSC2716) #11114 (comment)
- Why aren't we sorting topologically when receiving backfill events? See Fix historical messages backfilling in random order on remote homeservers (MSC2716) #11114 (comment)
- Blocked on a race condition not being able to run the Complement test for this, Resync state after partial-state join #12394 (comment)
- -> Optimize backfill receiving to have less missing
prev_eventthrashing (scratch) #13864 and Optimize backfill receiving to have less missingprev_eventthrashing (v2) #13970 and No more floating MSC2716 historical batches #13971
- Figure out how we want to elegantly support relations in the MSC2716 API's. How do I reference a message in the same batch which hasn't been persisted yet.
- (Element problem) When visiting a link to a specific message (permalink), fix messages not loading before it in the scrollback
- Write MSC2716 test to see if the bridge can join the room later, then import messages before the room was created
- Enable MSC2716 Complement tests for workers
Outstanding PRs that would still be good to merge (even the closed ones):
- Draft: Test that
/messagesworks on remote homeserver and can be backfilled properly after many batches (MSC2716) complement#214 - Properly verify and error on power-level mismatch in
/batch_sendendpoint #13229 - Draft: Make sure historical state events don't come down
/transactionsfor application services (MSC2716) complement#221
Maybe:
- Add
(room_id, next_batch_id)unique constraint to DB, Ensure(room_id, next_batch_id)is unique to avoid cross-talk/conflicts between batches (MSC2716) #10877 (comment) - Make
/messagesand/contextinclude the state from any historical messages returned. Currently, if the historical message isn't the first or last (depending on which endpoint), the historical state won't be available for the historical messages in the timeline and the avatar/displayname won't show for them.- This is a problem for people who individually import historical messages.
- And is also a problem for when you import a bunch of history to an existing room at the start. The transition between real messages and historical won't have avatar/displaynames shown. Once you reach the next
/messagesback, they will show. - (also discussed in the #10975 PR description)
- According to the spec,
/messagesreturns "A list of state events relevant to showing the chunk." so we should be able to make this work and also include any historical state associated with some historical messages in the chunk. - According to the spec,
/contextonly returns "The state of the room at the last event returned." which doesn't precisely allow wiggle room for adding some random historical state. But we technically could since it's just a list of state events returned. - I don't think we have to worry about
/syncsince historical messages will supposedly be way off in the distance and really only fetched by paginating/messages. Just to note that/syncreturns messages for the first message in the chunk, https://github.com/matrix-org/matrix-doc/issues/687
- Fix error when using
invite_room_stateon the/batch_sendstate events, as encountered Fix using MSC2716 batch sending with event persistence workers #11220. This isn't any useful functionality gained but would be nice not to throw a 500 here. - Allow state events to be sent in the
eventslist- The current problem is that the events are persisted in reverse-chronological order so they have the correct stream_ordering while being backfilled which decrements.
- As an example of why this fails, if we
/batch_send->events: [messageFromA, memberEventB, messageFromB], it will first try to persistmessageFromBwhich will fail becausememberEventBhasn't been processed yet. - "My hunch is that we want to try and persist the entire batch of events all in one go, rather than doing them one-by-one in reverse order."
- See Refactor
create_new_client_eventto use a new parameter,state_event_ids, which accurately describes the usage with MSC2716 instead of abusingauth_event_ids#12083 (comment) - Related Idea: Sending multiple events to a single room in a linked batch #12010
Metadata
Metadata
Assignees
Labels
T-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.