Skip to content
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

Support MSC4140: Delayed events (Futures) #17326

Merged
merged 86 commits into from
Sep 23, 2024

Conversation

AndrewFerr
Copy link
Member

@AndrewFerr AndrewFerr commented Jun 18, 2024

See: MSC4140

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct
    (run the linters)

@github-actions github-actions bot deployed to PR Documentation Preview June 18, 2024 21:21 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 18, 2024 21:23 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 20, 2024 11:30 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 27, 2024 11:56 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 27, 2024 17:06 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 28, 2024 12:50 Active
@AndrewFerr AndrewFerr force-pushed the af/msc4140 branch 3 times, most recently from 6b06bf0 to 6466bd1 Compare August 1, 2024 03:14
@AndrewFerr AndrewFerr marked this pull request as ready for review August 1, 2024 03:21
@AndrewFerr AndrewFerr requested a review from a team as a code owner August 1, 2024 03:21
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndrewFerr would it be possible to break this PR up into a few more logical commits? Currently it's roughly 1 commit with >1000 lines changed, which appears daunting to review 🙂

@AndrewFerr
Copy link
Member Author

Ironically, the reason I had squashed the commits was to try make it easier to review 🙃

I've now split them up to isolate what should be the most relevant components of the PR.

@github-actions github-actions bot deployed to PR Documentation Preview September 13, 2024 14:34 Active
When a delayed event is sent on-demand, let its timestamp be set to
whatever time the event is sent at, like non-delayed events.

Only timed-out delayed events should have their timestamps set to their
timeout time, as that is the time they are meant to be sent.
as it converts fields (namely RoomIDs) to dicts too
Require non-empty delay ID in path
Add missing WHERE clause in branched case
@github-actions github-actions bot deployed to PR Documentation Preview September 16, 2024 05:05 Active
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the time you've spent (and patiently waited) on this. This now looks good to me, and the added tests help.

I see you have a matching Complement branch here: matrix-org/complement#734. I assume you would like to hold off on merging this PR until those tests pass?

Finally, once this is merged and done, if you have some time to document how the whole mechanism works (however detailed or briefly) in https://element-hq.github.io/synapse/latest/development/internal_documentation/index.html, that would help future development efforts.

@AndrewFerr
Copy link
Member Author

I see you have a matching Complement branch here: matrix-org/complement#734. I assume you would like to hold off on merging this PR until those tests pass?

Yes, as long as it's permissible to merge Complement tests before any implementations are merged.

Finally, once this is merged and done, if you have some time to document how the whole mechanism works (however detailed or briefly) in https://element-hq.github.io/synapse/latest/development/internal_documentation/index.html, that would help future development efforts.

Noted!

@github-actions github-actions bot deployed to PR Documentation Preview September 16, 2024 20:30 Active
@anoadragon453
Copy link
Member

Typically we'll merge them at the same time. However, yes, technically the Complement tests can be merged beforehand, as they won't be enabled on develop until this PR is merged.

@anoadragon453
Copy link
Member

(Complement CI is expected to fail until matrix-org/complement#734 is merged.)

@anoadragon453
Copy link
Member

@anoadragon453 anoadragon453 enabled auto-merge (squash) September 18, 2024 15:07
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, assuming the Complement tests are happy.

@AndrewFerr
Copy link
Member Author

assuming the Complement tests are happy

They aren't 🙃 Looking into it now. The failures reproduce locally, so I should have a fix ready very soon.

@anoadragon453
Copy link
Member

anoadragon453 commented Sep 18, 2024

@AndrewFerr looks like there's complement failures on the delayed event tests: https://github.com/element-hq/synapse/actions/runs/10891540744/job/30325234632?pr=17326

Edit: GitHub failed to show your last comment 🤦

@AndrewFerr
Copy link
Member Author

Looks like the Complement failures are false-positives when running in Postgres. I'm updating the Complement tests to account for that.

@AndrewFerr
Copy link
Member Author

The Postgres tests should be fixed by matrix-org/complement#737. They pass when I run them locally, in either monolith or worker mode.

auto-merge was automatically disabled September 18, 2024 19:07

Head branch was pushed to by a user without write access

@github-actions github-actions bot deployed to PR Documentation Preview September 18, 2024 19:08 Active
@AndrewFerr
Copy link
Member Author

Alright, I added an extra commit to satisfy what the Complement test was failing on, and now we don't have to worry about merging matrix-org/complement#737 first.

The test expects GET /delayed_events to return events in the order they'll be sent, but no such order was guaranteed when using Postgres. dfde3c2 applies the ordering the test expects.

Strictly speaking, the test doesn't have to cover ordering on GET /delayed_events because the MSC doesn't (yet) define an ordering, so I wrote matrix-org/complement@279d1b3 to remove that part of the test.

The other test failure was simply due to leftover data after the first test failed, so I wrote matrix-org/complement@6f86880 to make tests do some teardown to prevent unrelated failures later on.

Note that all tests will continue to pass with matrix-org/complement#737, so it can still be merged safely, but now it is optional to do so 🙂

@anoadragon453 anoadragon453 merged commit 5173741 into element-hq:develop Sep 23, 2024
41 checks passed
@AndrewFerr AndrewFerr mentioned this pull request Oct 7, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants