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

Clarify that .m.rule.master has a higher priority than any push rule #1320

Merged
merged 2 commits into from Nov 8, 2022

Conversation

zecakeh
Copy link
Contributor

@zecakeh zecakeh commented Nov 3, 2022

This is a bit controversial because this is only enforced by Synapse. Dendrite and Conduit treat it like other server-default push rules, as the spec says. However Synapse's implementation was probably the source of the spec's definition in the first place, and clients like Element Web rely on this behavior to disable notifications.

Related to #668.

Signed-off-by: Kévin Commaille zecakeh@tedomum.fr

Related PR in Ruma that would allow to fix Conduit's implementation: ruma/ruma#1364

Preview: https://pr1320--matrix-spec-previews.netlify.app

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
@zecakeh zecakeh requested a review from a team as a code owner November 3, 2022 09:42
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

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

I'm not really sure it was ever intended to work this way, except that the master rule should always be first & therefore naturally highest precedence. It feels like a weird exception. Do you have a link to where Synapse implements this behaviour?

@zecakeh
Copy link
Contributor Author

zecakeh commented Nov 8, 2022

Sure, currently it's visible in Rust that the rules are assembled like that: https://github.com/matrix-org/synapse/blob/develop/rust/src/push/mod.rs#L384-L400

Where m.rule.master is part of the BASE_PREPEND_OVERRIDE_RULES.

It was already introduced as the only preprended rule in this commit: matrix-org/synapse@04f8478

@dbkr
Copy link
Member

dbkr commented Nov 8, 2022

Right - this is what I was trying to say: the master rule isn't explicitly first, it's just implicitly first because it's the first prepend override rule.

@zecakeh
Copy link
Contributor Author

zecakeh commented Nov 8, 2022

Does that mean we should define prepend override rules in the spec instead, with this rule inside?

@dbkr
Copy link
Member

dbkr commented Nov 8, 2022

Oh, I think I see what you're saying now: the spec says default rules have lower precedence than user defined rules but synapse prepends some override rules to the start (of which the only one is the master rule) giving them higher precedence. In which case, apologies, I think you were correct in the first place. There's a bit of a question over whether a user could, if they really wanted, manually define rules that the master rule doesn't affect, but agreed it's probably best to fix the spec to match reality since clients expect the rule to work to turn off push altogether.

Will re-request review in case someone disagrees with any of the above.

@dbkr dbkr requested a review from a team November 8, 2022 21:09
@richvdh
Copy link
Member

richvdh commented Nov 8, 2022

There's a bit of a question over whether a user could, if they really wanted, manually define rules that the master rule doesn't affect

Currently they can't do this with Synapse.

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

lgtm

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.

None yet

3 participants