mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-11 12:17:54 +00:00
`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>