Commit Graph
26060 Commits
Author SHA1 Message Date
Jason Robinson 9deebfb5b3 Remove writing to the profile updates stream in delete_profile_upon_deactivation
We'll anyway have "left room" actions generated for the user for everyone who is interested, as the user parter pushes them out of the room. Thus we would be doing unnecessary extra work here.
2026-07-17 16:41:31 +03:00
Jason Robinson 8b0be80303 Add a failing test for covering members of a room joined
The MSC indicates we should send down profiles for room members when someone joins a room, but it's a bit of a question right now on how to do this.
2026-07-17 16:40:15 +03:00
Jason Robinson 5e7475d837 Add a test covering invite/knock 2026-07-17 15:51:39 +03:00
Jason Robinson 489539fa4b Fix up profile updates for memberhip changes
* Should also notify on KNOCK and INVITE (though calling them a join is a bit poor)
* Remove unnecessary fetch of user rooms as we only need to notify the members of the current room in question
2026-07-17 15:32:10 +03:00
Jason Robinson 0e840eb6a3 Merge remote-tracking branch 'origin/develop' into anoa/msc4429 2026-07-17 00:32:21 +03:00
Jason Robinson 5cb6d2caf3 Cleanup and docstring updates 2026-07-17 00:31:01 +03:00
Jason Robinson a01fc2ef0a Revert Event.internal_metadata changes from https://github.com/element-hq/synapse/pull/19556/changes/9b6ff35e9a53f1a6fa50c046132ba8115294c480 2026-07-17 00:12:00 +03:00
Jason Robinson 865273c524 Run linter on all files 2026-07-16 23:45:55 +03:00
Jason Robinson cb9e1e55b9 Fix test_sync_response_always_includes_the_user_themselves 2026-07-16 23:42:22 +03:00
夜坂雅 5ed830b3b4 Change default room version to 11 (MSC4239) (#18680)
Fix #18530

Complement test changes: https://github.com/matrix-org/complement/pull/858

SyTest changes: https://github.com/matrix-org/sytest/pull/1422
2026-07-16 12:33:13 -05:00
Jason Robinson 7afa1956c3 Merge remote-tracking branch 'origin/anoa/msc4429' into anoa/msc4429 2026-07-16 16:10:01 +03:00
Jason Robinson 4bd5573d9b Refactor persisting profile updates when persisting events
Instead of passing in a previous membership or a list of target users down in the event internal metadata, use the state delta (or rather, previously calculated sliding sync table changes based on state delta) to figure out if a membership really changed. Then add the member lookups to get the right users to update for.

Somewhat WIP, a few tests still fail and this commit misses a bunch of docstrings and/or cleanups of old functionality.
2026-07-16 16:09:43 +03:00
Jason RobinsonandOlivier 'reivilibre' f31d9fb983 Apply suggestions from code review
Co-authored-by: Olivier 'reivilibre' <olivier@librepush.net>
2026-07-15 23:13:01 +03:00
Eric Eastwood 837d687977 Merge branch 'release-v1.157' into develop
Conflicts:
	scripts-dev/release.py
2026-07-15 12:02:47 -05:00
Eric Eastwood d930ac615b Update release script JSON schema find/replace to be compatible with macOS (#19962)
BSD vs GNU `sed` problems:
```shell
$ sed -i '0,/^\$id: .*/s||$id: https://element-hq.github.io/synapse/schema/synapse/v1.157/synapse-config.schema.json|' schema/synapse-config.schema.yaml
sed: 1: "schema/synapse-config.s ...": bad flag in substitute command: 'h'
```
2026-07-15 12:01:09 -05:00
Eric Eastwood 4679ed4b06 Silencing alerts is no longer necessary during a deploy (release script instructions) (#19968)
As discussed in
[`#element-backend-internal:matrix.org`](https://matrix.to/#/!SGNQGPGUwtcPBUotTL:matrix.org/$29ZzRe7gg62UZmT0bgeseMs320Kb-Ub6DyaQE20-3ng?via=jki.re&via=element.io&via=matrix.org)

Our assumptions on why this was done previously: in the olden days you'd
get paged doing the redeploy even if everything was actually fine
(probably before we started doing rolling restarts?)
2026-07-15 11:45:52 -05:00
catfromplan9 30088f38c0 Implement support for generating animated thumbnails in the media thumbnailer (#18831)
Signed-off-by: cat <cat@plan9.rocks>
2026-07-15 15:37:09 +00:00
Eric Eastwood e1420becdd Linkify 'Redact events of a user' docs v1.157.0rc1 2026-07-15 09:56:19 -05:00
dependabot[bot] 0512511f87 Bump anyhow from 1.0.102 to 1.0.103 in the patches group (#19952)
Signed-off-by: dependabot[bot] <support@github.com>
2026-07-15 11:25:46 +00:00
dependabot[bot] ff4e9ec7a7 Bump the minor-and-patches group with 2 updates (#19953)
Signed-off-by: dependabot[bot] <support@github.com>
2026-07-15 11:24:15 +00:00
jakobrss 243983e193 Clarified documentation for "List accounts" guests parameter (#19963) 2026-07-15 11:18:55 +00:00
Jason RobinsonandAndrew Morgan edc8624a64 Update synapse/config/workers.py
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2026-07-15 13:25:43 +03:00
Jason Robinson cbe7c81727 Remove unnecessary select from _record_profile_updates_for_user_left_room_txn 2026-07-15 11:47:52 +03:00
Jason Robinson 34ce70f6af Lint 2026-07-15 11:43:54 +03:00
Jason RobinsonandCopilot Autofix powered by AI 3824af8778 Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-15 11:42:50 +03:00
Eric Eastwood 11b48cdbad Fix title case 2026-07-14 16:37:50 -05:00
Eric Eastwood f8c913c1c0 Call out upgrade notes 2026-07-14 16:32:17 -05:00
Eric Eastwood 72be9b5e17 1.157.0rc1 2026-07-14 16:20:56 -05:00
Eric Eastwood 651b44e0fc Update release script to be compatible with macOS
BSD vs GNU `sed` problems:
```
sed -i '0,/^\$id: .*/s||$id: https://element-hq.github.io/synapse/schema/synapse/v1.157/synapse-config.schema.json|' schema/synapse-config.schema.yaml
sed: 1: "schema/synapse-config.s ...": bad flag in substitute command: 'h'
```
2026-07-14 16:14:35 -05:00
Jason Robinson 57675ee36d Merge remote-tracking branch 'origin/develop' into anoa/msc4429
# Conflicts:
#	rust/src/config/mod.rs
2026-07-14 22:48:23 +03:00
Jason Robinson 9b6ff35e9a Move persisting profile update actions for membership events into the same transaction as events
Before persisting the membership event to the database, collect some information for the store so that it can insert the right profile update stream rows regarding membership join and leave events.

This increases transaction safety as we write the profile update rows and the events themselves in the same transaction.
2026-07-14 22:44:06 +03:00
dependabot[bot] 1979fcca52 Bump actions/checkout from 6.0.3 to 7.0.0 (#19921)
Signed-off-by: dependabot[bot] <support@github.com>
2026-07-14 11:19:15 +00:00
Andrew Morgan 6bfec47c47 Revert "Fix flaky 3PID inhibit error unit tests" (#19916) 2026-07-14 09:46:28 +00:00
dependabot[bot] ff7c3b9418 Bump actions/cache from 5.0.5 to 6.1.0 (#19920)
Signed-off-by: dependabot[bot] <support@github.com>
2026-07-14 09:25:28 +00:00
dependabot[bot] 60aa4466c8 Bump the minor-and-patches group with 2 updates (#19919)
Signed-off-by: dependabot[bot] <support@github.com>
2026-07-14 09:25:07 +00:00
dependabot[bot] 10f6370daf Bump bytes from 1.11.1 to 1.12.0 (#19918)
Signed-off-by: dependabot[bot] <support@github.com>
2026-07-14 09:24:39 +00:00
dependabot[bot] 1b181ee813 Bump log from 0.4.32 to 0.4.33 in the patches group (#19917)
Signed-off-by: dependabot[bot] <support@github.com>
2026-07-14 09:24:11 +00:00
dependabot[bot] aafb1fabcf Bump golang.org/x/crypto from 0.51.0 to 0.52.0 in /complement (#19925)
Signed-off-by: dependabot[bot] <support@github.com>
2026-07-14 09:04:15 +00:00
SpiritCrocandAndrew Morgan bf0f4f6a9d Support MSC4446: allow moving fully read markers backwards (#19663)
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2026-07-13 16:12:26 +00:00
Wessel c93d5230c0 Honor de.sorunome.msc2409.push_ephemeral flag in appservice handler (#19928) 2026-07-13 16:06:17 +00:00
Olivier 'reivilibre 292bbb8f30 Fix a bug causing device list pruning to skip some rows when the transaction gets retried. (#19947)
Introduced in: #19473

Noticed in:
https://github.com/element-hq/synapse/pull/19556#discussion_r3505783541

I have not experienced the bug in the real world, it's just something I
noticed by reading.

--

Fix bug in `_prune_device_lists_changes_in_room` when transaction is
retried
The `nonlocal` variable is a footgun as it increments the counter even
though the transaction did not commit yet and may still be retried.

---------

Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
2026-07-13 13:32:09 +01:00
Jason Robinson 0570774f75 Remove profile_updates dedicates stream writer worker
Instead, all profile updates stream writes should go via the event persisters, via replication if not directly coming out of events.
2026-07-13 15:31:25 +03:00
Sandro 733620acd7 Fix SYNAPSE_ASYNC_IO_REACTOR=1 on Python 3.14 (#19949) 2026-07-13 09:39:56 +00:00
Erik Johnston be511b22a2 Send offline presence for stale states when presence is disabled (#19948)
If presence is disabled after having been enabled, the presence states
in the database (and hence on clients) are frozen at whatever they were
when presence was last enabled: nothing writes to the presence stream
any more and /sync omits the presence section entirely, so clients show
the old presence states forever.

Fix this in two parts:

1. At startup, if presence is disabled but the database still contains
non-offline presence states, the presence writer sends out one final
round of updates marking those users as offline.

2. /sync no longer unconditionally omits presence when presence is
disabled: incremental syncs whose since token is behind the presence
stream still get the straggling updates. As the stream doesn't advance
while presence is disabled, clients catch up once and the check then
short-circuits to a token comparison.

Remote servers already handle this themselves by timing out our users
([`FEDERATION_TIMEOUT`](https://github.com/element-hq/synapse/blob/4d8905a15a417ed0054ec2533d243932d890bbbd/synapse/handlers/presence.py#L194-L198)),
so no federation changes are needed.

Note that this only fixes the issue if presence is fully disabled. If
set to `untracked` we still have the same issue, however since modules
would still write to presence we can't just clobber everything like we
do in this patch.
2026-07-13 10:08:57 +01:00
Erik JohnstonandClaude Fable 5 0bd28389b1 Improve caching for presence (#19939)
This does two things, first it adds a config flag to ignore rooms for
the purposes of presence routing.

Secondly, it changes the caching behaviour to try and improve the cache
hit ratio. Previously, the size of the `do_users_share_a_room` cache
(which stores pairs of users) needs to `O(n²)` for the number of online
users, which is infeasible for large servers.

Instead, we call `get_users_in_room` for both the syncing and updated
users. This sounds more expensive, but a) we will already have cached
the syncing user's rooms, and b) we will only calculate the updated
user's rooms once (rather than once per syncing user).

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 09:34:07 +01:00
Andrew FerrazzuttiandEric Eastwood c0c2b37d5e MSC4140: update error responses (#19539)
- Impose limit of scheduled delayed events
- Update error codes to match latest draft of MSC4140 

---------

Co-authored-by: Eric Eastwood <madlittlemods@gmail.com>
2026-07-11 01:23:33 +00:00
4d8905a15a Throttle sync-driven presence updates relayed to the presence writer (#19941)
Sync workers proxied a full `ReplicationPresenceSetState` call to the
presence writer on every sync request with `affect_presence=True` (via
`user_syncing`), and a `ReplicationBumpPresenceActiveTime` call on every
user action, even though the writer's presence timers only need feeding
every `SYNC_ONLINE_TIMEOUT` / `LAST_ACTIVE_GRANULARITY`. On busy clients
this amounts to tens of no-op replication calls per user per minute, and
the resulting per-update work is the dominant CPU cost on saturated
presence writers.

Track the last relayed `(state, timestamp)` per `(user, device)` on the
worker and suppress unchanged sync-driven repeats within a 25s relay
interval - deliberately below `SYNC_ONLINE_TIMEOUT` (30s) so the
writer's device `last_sync_ts`/`last_active_ts` timers stay fed and
users neither flap offline nor bounce `currently_active`. Genuine state
changes are relayed immediately, explicit (non-sync) set_state calls
always go through and reset the throttle, bumps that might un-idle a
device bypass it, and entries are evicted when a `USER_SYNC` stop is
sent so reconnecting devices are relayed afresh.

This gives the writer-CPU benefit that deployments currently obtain by
tightening `rc_presence` to ~1/29s, without dropping real presence
transitions.

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Quentin Gliech <quenting@element.io>
2026-07-10 14:05:10 +01:00
Jason Robinson f73ce43e3d Ensure we write to the profile update stream for a membership JOIN also in the event of the previous membership event being something other than LEAVE 2026-07-10 15:27:34 +03:00
Jason Robinson 0498688faa Fix oops with SQL statements with \ 2026-07-10 15:21:23 +03:00
Jason Robinson 48b45263fa Merge remote-tracking branch 'origin/develop' into anoa/msc4429 2026-07-10 15:15:48 +03:00