Files
synapse/tests
11cdd6eaa1 Skip on_new_event module callbacks for rejected events
`ThirdPartyEventRulesModuleApiCallbacks.on_new_event` looked the event up with
`store.get_event(event_id)`, which raises `NotFoundError` for a rejected event.
The notifier calls it for every new event, so on any deployment with a module
registering an `on_new_event` callback, a rejected event received over
federation failed the persist that triggered it.

The lookup now passes `allow_rejected=True` and returns early on a rejected
event. `docs/modules/third_party_rules_callbacks.md` has promised this since
2023: "This callback will not be called for events that are marked as
rejected."

Only the instance that persisted the event could hit this: `ReplicationDataHandler`
already skips rejected rows before notifying, so a worker reading the events
stream never got there.

The test registers a callback, sends an event that will be rejected, and checks
that the persist succeeds and that the callback is not told about the event. It
fails with `NotFoundError` without the fix.

Split out of #19958.

Co-authored-by: Quentin Gliech <quenting@element.io>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-30 10:15:48 +01:00
..
2026-09-18 12:00:45 +01:00