element-hq / element-hq/synapse

Incorrect `unread_notifications` with some push rules

Open
#18,111 2 comments 0 reactions 0 assignees View on GitHub
A-Push A-Sync O-Occasional S-Tolerable T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

### Description

With certain push rules set up, synapse does not increment the `unread_notifications` in the same `/sync` that receives the event triggering the push rule, violating the spec requirement
> [The updated notification count from a new event MUST appear in the same /sync response as the event itself.](https://spec.matrix.org/v1.13/client-server-api/#server-behaviour-8)

### Steps to reproduce

- create 3 accounts in an element web + synapse + mas setup
- log into all 3
- enable bob's desktop notifications
- create a room between `kim` and `bob`
- note `bob`'s access token
- use playground.matrix.org to add a `notify` action to `bob`'s `.m.rule.member_event`, confirm via playground and element devtools. see attachment.
- watch `bob`'s element's \`/sync' via browser devtools
- `kim` invites `charlie`
- check the `/sync` response, see attachment.
- (check the notification logging)

[push_rules.json](https://github.com/user-attachments/files/18560739/push_rules.json)
[sync.json](https://github.com/user-attachments/files/18560738/sync.json)

### Homeserver

localhost

### Synapse Version

synapse 1.122

### Installation Method

Docker (matrixdotorg/synapse)

### Database

fresh postgres 16 container

### Workers

Single process

### Platform

docker

### Configuration

default

### Relevant log output

```shell
🤷
```

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

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.