Files
synapse/rust
43bdb619b7 Add the default .m.rule.knock push rule (MSC4506)
`.m.rule.member_event` suppresses every `m.room.member` event, so a knock
(MSC2403) pushes nobody today. The new override rule
`.org.matrix.msc4506.rule.knock` matches a knock membership event and the
`recipient_permission` condition on `invite`, and notifies with a sound.
It sits after `.m.rule.invite_for_me` and before `.m.rule.member_event`.

A knock has sender == state_key, so the bulk evaluator's member-event fast
path finds nobody to evaluate rules for. With the flag on, a knock now evaluates
rules for every local member, at the cost of a message in the same room.

Blast radius: the rule pushes every member at or above the room's `invite`
level. Synapse creates rooms with `invite: 50`, but a room that omits the
key defaults to 0, as do the `private_chat` and `trusted_private_chat`
presets, and there every member gets pushed for every knock.

`filter_push_rules` drops the rule while `msc4506_enabled` is off, so
`/pushrules` serves it only with the flag on.

The code departs from the MSC text in three places, to raise as MSC
follow-ups. It uses `event_match` where the MSC uses
`event_property_is`, matching `.m.rule.invite_for_me`. The MSC escapes
the value as `m\.room\.member`, which `event_property_is` compares
literally, so that condition never fires. The actions add
`highlight: false`, as every other default notify rule does.

Co-authored-by: Quentin Gliech <quenting@element.io>

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-30 10:20:35 +01:00
..