normalize predefined push rule actions to match spec defaults#6296
normalize predefined push rule actions to match spec defaults#6296Reaster0 wants to merge 1 commit intomatrix-org:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6296 +/- ##
==========================================
+ Coverage 89.87% 89.89% +0.01%
==========================================
Files 374 374
Lines 102275 102347 +72
Branches 102275 102347 +72
==========================================
+ Hits 91923 92003 +80
+ Misses 6787 6781 -6
+ Partials 3565 3563 -2 ☔ View full report in Codecov by Sentry. |
af47813 to
3ad582c
Compare
|
well yeah that would be good, that would be a good idea, but defaulting to silent by default in certains case is not really easy for non power users no? is not really straight forward for non power user no? the opposite would be more user friendly i think (having to fidget the settings in case you want to "mute" some kind of notif) at least that's how it is on most chat apps, would you think it's better to default to noisy only when the settings panel exist? |
That is a good point @Reaster0 , the noisy/silent setting is a complex setting (power user). Meanwhile let's wait for kovapatrik conclusions here as he is saying he will dive deeper. |
|
@Reaster0 I created an issue here for both EXI and EXA to get product feedack and track comments |

Fix silent push notifications when homeserver provides non-spec default push rules
Problem
Some homeservers (notably Continuwuity) provide predefined push rules with actions that differ from the Matrix spec defaults. For example, the spec defines that .m.rule.room_one_to_one
should include a {"set_tweak": "sound", "value": "default"} action, but these servers omit it.
This causes the SDK's NotificationItem::is_noisy to always evaluate to false, which downstream clients (Element X iOS, Element X Android) rely on to decide whether to play a notification
sound. The result is that all notifications are completely silent — no sound, no vibration — for users on affected homeservers.
Other clients like FluffyChat and Element Web are unaffected because they either handle sound independently of push rule evaluation or run in-process where the distinction doesn't matter.
Context
Solution
Introduce normalize_predefined_push_rule_actions(), which replaces the actions of predefined push rules (those with default: true) with the spec-defined actions from
Ruleset::server_default(), while preserving the enabled state from the server. This is applied at both push rule loading points:
Rules that are not server defaults (default: false), such as user-created custom rules, are left completely untouched.
Trade-offs
This approach enforces the spec-defined actions for predefined rules, which means if a user explicitly modified the actions of a predefined rule (e.g., removed the sound tweak from
.m.rule.room_one_to_one via the push rules API), that customization would be overridden. However:
The enabled/disabled state is always preserved — disabling a rule still works
User-created custom rules are never touched
Modifying predefined rule actions is uncommon; disabling rules is the standard UX
The alternative (permanent silent notifications for all users on non-compliant servers) is a significantly worse outcome
The spec defines what these actions should be — clients enforcing them is defensible
Testing
3 new unit tests covering:
All 20 existing notification client tests continue to pass