element-hq / element-hq/synapse

pushrules not properly applied

Open
#19,497 0 comments 0 reactions 0 assignees View on GitHub
A-Push
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

### Description

When not enabling notifications on all `m.room.message`s, per room notifications are not sent.

I have pushrules from my account with all rules that do not apply trimmed out:

Pushrules with default `m.room.message`

```json
{
"global": {
"underride": [
{
"conditions": [
{
"kind": "event_match",
"key": "type",
"pattern": "m.room.message"
}
],
"actions": [
"notify",
{
"set_tweak": "sound",
"value": "default"
}
],
"rule_id": ".m.rule.message",
"default": true,
"enabled": true
}
],
"sender": [],
"room": [
{
"actions": [
"notify",
{
"set_tweak": "sound",
"value": "default"
}
],
"rule_id": "!WPzbNhFBezJfyuPcrs:hackint.org",
"default": false,
"enabled": true
}
],
"override": []
}
}
```

Pushrules with empty default `m.room.message`

```json
{
"global": {
"underride": [
{
"conditions": [
{
"kind": "event_match",
"key": "type",
"pattern": "m.room.message"
}
],
"actions": [],
"rule_id": ".m.rule.message",
"default": true,
"enabled": true
}
],
"sender": [],
"room": [
{
"actions": [
"notify",
{
"set_tweak": "sound",
"value": "default"
}
],
"rule_id": "!WPzbNhFBezJfyuPcrs:hackint.org",
"default": false,
"enabled": true
}
],
"postcontent": [],
"content": [],
"override": []
}
}
```

### Steps to reproduce

1. set default notifications not to include all messages
2. set a room overwrite to include all messages
3. send a message from a third account to a room with more than two members (as far as I can tell there are extra rules for rooms with exactly two members to cover DMs)
4. check `/_matrix/client/v3/notifications`

### Homeserver

ccc.ac

### Synapse Version

1.142.0

### Installation Method

Docker (matrixdotorg/synapse)

### Database

PostgresSQL

### Workers

Single process

### Platform

Synapse, Postgres, (and MAS) are running in docker-compose on Debian.

PostgresSQL is still at version 13 until we have time to upgrade it, that's also why Synapse is still at 1.142.0. The database has not been ported as far as I am aware but previously been restored from a backup during a server migration.

### Configuration

- no experimental features
- presence is enabled
- redaction retention is reduced to one day, the rest is on default settings
- no modules are enabled

### Relevant log output

```shell
.
```

### Anything else that would be useful to know?

It is virtually impossible to find any really relevant logs with this homeserver participating in the federation with more than 50 users. The most interesting thing there seems to be the curl calls to the the different APIs.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue using the listed push rules and the `/_matrix/client/v3/notifications` endpoint. Trace how Synapse evaluates the empty default `m.room.message` rule alongside the per-room rule. Done means a room override sends notifications even when the default message rule has no actions.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.