synapse icon indicating copy to clipboard operation
synapse copied to clipboard

Track local users from deleted rooms and send synthentic leaves after room purge

Open Half-Shot opened this issue 6 months ago • 3 comments

Fixes #18599

This adds a new table to track local users who were part of a locally deleted room, to preserve the information needed to send a leave down sync so that the client can remove the room locally.

  • [x] Database design
  • [x] Storage of members
  • [x] Handle down legacy sync
  • [x] Handle down sliding sync
  • [x] Handle down appservices
  • [ ] Tests

Notes on appservices

Everything is harder with appservices. Appservices (like sync v3) will handle leaves from rooms just fine if they are fast enough, since the event will still exist. Since AS transactions are stored as event_ids, we simply skip unknown events after the room is deleted and the AS will never know it has been removed so we have to be a little smarter. I'm thinking this is handled in two ways.

We need to just filter out any leave events from deleted rooms being pushed to ASes entirely, since they're unreliable. Instead, we should simply check the list of deleted rooms and users since the last time the AS checked (new column alert!), and push those over.

Half-Shot avatar Jun 27 '25 16:06 Half-Shot

This PR is useful, pls review this for merging.

duucck avatar Oct 30 '25 01:10 duucck

@duucck this PR is currently in the author, @Half-Shot's, court to update.

anoadragon453 avatar Oct 30 '25 10:10 anoadragon453

Hey hey. Sorry this has taken so long. I had to park this due to other priorities coming up, so it's up for grabs. It's so far along now that I think it really just needs picking up to solve the last few outstanding bugs. However, at the moment this cannot be me.

Can the maintainers find someone who might be able to finish the last mile?

Half-Shot avatar Oct 30 '25 11:10 Half-Shot