Commit Graph
25921 Commits
Author SHA1 Message Date
Jason Robinson bf3e1339ff Fix SCHEMA_VERSION in __init__.py 2026-06-29 13:01:03 +03:00
Jason Robinson b0950f98df Merge remote-tracking branch 'origin/develop' into anoa/msc4429 2026-06-29 12:57:21 +03:00
Jason Robinson 1fc8d4c6cd Move profile updates SQL to latest delta
We shouldn't need a delta bump for this feature as far as I can tell.
2026-06-29 12:39:46 +03:00
Jason Robinson c12623e769 Lint server config 2026-06-26 18:15:30 +03:00
Jason Robinson 088f23065a Gate more things behind msc4429 being enabled 2026-06-26 18:10:25 +03:00
Jason Robinson 4a874c4687 Remove invalid docs on profile_updates stream
`PUT` and `DELETE` can go to any supported worker, replication will handle the stream updates to the right worker.
2026-06-26 18:09:02 +03:00
Jason Robinson b459512725 Use include_profile_updates_in_sync config item instead of an experimental flag + alias.
The requirement for this comes from a customer commitment.
2026-06-26 18:08:12 +03:00
Jason Robinson b2246de4e3 Ensure we don't call _dispatch_record_profile_updates with an empty list of fields 2026-06-26 16:57:33 +03:00
Jason Robinson f453e03c8c Remove more useless casts 2026-06-26 13:29:48 +03:00
Jason Robinson 7a60657dd1 Clean up recording profile updates on changes
Instead of using replication when setting field values, remove that replication, keep writing the field via the profile handler in the current instance, and then dispatch recording the profile update over replication, if needed.

This is cleaner as it ensures we don't need to wrap various places outside the profile handler that set things like the displayname in the "if profile worker else replication" logic.
2026-06-26 13:25:53 +03:00
timedoutandGitHub 7bc2b93e4c Implement unstable support for MSC4491 (#19874)
Signed-off-by: timedout <git@nexy7574.co.uk>
2026-06-26 08:35:26 +00:00
Jason Robinson 8bace9f97b Fix some types in various places regarding profile field values
I believe the correct type is `JsonValue | dict[str, JsonValue]`, except deep down in the displayname/avatar_url store methods.

Removes a dubious cast by correctly casting in `get_profile_data_for_users`
2026-06-25 22:40:00 +03:00
Jason Robinson e278dfdb03 Restore initial sync behaviour to return full profiles of users currently sharing rooms 2026-06-25 21:43:49 +03:00
Jason Robinson 585590bbd9 Protect against stream being rewound 2026-06-25 21:31:07 +03:00
Will HuntandGitHub 2bb3aac839 Add metric to count number of non-deactivated users. (#19848)
This reports the total count of users (split by appservice) which is
meant to be the monthless counterpart to the MAU metric.

Context:

> So this is largely for billing purposes and wanting to know the change
in the number of users. If a user is deactivated then we no longer want
to count them. Consumers *might* want to count appservice users, and
maybe count them based on the service (perhaps you change more for users
under bridge X or bridge Y).
>
> *-- https://github.com/element-hq/synapse/pull/19848#discussion_r3402216234*
2026-06-25 11:57:36 -05:00
Jason Robinson bf10187a1d Docstring for ProfileUpdateAction 2026-06-25 18:35:40 +03:00
Jason Robinson 5f761ab5b4 Use set for uniqueness 2026-06-25 17:39:42 +03:00
Jason Robinson 3e4301ad01 Remove unnecessary if 2026-06-25 15:26:43 +03:00
dependabot[bot]andGitHub 4e9f7757f1 Bump msgpack from 1.1.2 to 1.2.1 (#19873)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-24 21:16:03 +00:00
dependabot[bot]andGitHub c386ab8f85 Bump bleach from 6.3.0 to 6.4.0 (#19864)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-24 20:14:47 +00:00
dependabot[bot]andGitHub d304743057 Bump pyjwt from 2.12.0 to 2.13.0 (#19861)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-24 20:12:15 +00:00
dependabot[bot]andGitHub 732de34bc4 Bump tornado from 6.5.5 to 6.5.7 (#19860)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-24 20:11:42 +00:00
dependabot[bot]andGitHub 98d28b8ac7 Bump python-multipart from 0.0.27 to 0.0.31 (#19859)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-24 19:00:24 +00:00
Jason Robinson ea12b22164 Merge remote-tracking branch 'origin/develop' into anoa/msc4429 2026-06-24 19:23:12 +03:00
Jason Robinson b657d2f8db Add a prune job for the profile updates stream tables
Taken and adapted from https://github.com/element-hq/synapse/pull/19473

Didn't add the "safety" table due to afaik that has more relevance with the device updates, and not so much here for the profile updates.
2026-06-24 19:11:41 +03:00
Jason Robinson 05634f90b4 Ensure room_member handler writes profile updates to the right profile update stream writer 2026-06-24 16:29:32 +03:00
Andrew MorganandGitHub 287195db06 Bump poetry in the Dockerfile and when building the debian venv (#19877) 2026-06-24 12:46:44 +00:00
dependabot[bot]andGitHub 5248ea0bc2 Bump the minor-and-patches group across 1 directory with 6 updates (#19863)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-24 11:38:22 +00:00
Jason Robinson 7c728ec61c Optimize profile handler user_joined_room and user_left_room
Save a db query if there are no users to add profile updates for.
2026-06-24 13:45:13 +03:00
Jason Robinson d3aacee235 Fix test_update_profile_set_field_writes_to_per_user_profile_tracking_table test
And remove unused `get_profile_updates_per_user_for_user` function
2026-06-24 13:32:19 +03:00
Jason Robinson 9d58d19934 Merge remote-tracking branch 'origin/develop' into anoa/msc4429 2026-06-24 11:52:58 +03:00
Olivier 'reivilibreandGitHub 1c79397d7f Tweak wording of Rust crate dependency update policy. (#19829)
After looking into it, just a couple of things to pick a bone at in the
old wording,
which I thought could be clarified for when I next come to look at this
again.


- the claim that there's a fundamental difference; I'd argue there isn't
really, it's just by convention
  on some mainstream distros. So I have changed this to 'typically'
- statements that some distros fetch dependencies at build time
(probably does happen, but
traditional distros make a point of not doing this for the reasons you'd
expect).
- This was probably meant to be talking about Debian, but my observation
based on sample size of 3 is that some crates are packaged natively,
others are vendored in the respective application's source package (like
they do for us) and sometime they patch the bounds a bit

There could probably be room to talk about how distros vendoring
packages is a maintenance burden on them,
but I guess it's a bit moot as we would struggle to conform to wide
enough bounds to make everyone
happy (and anyway; I expect the distros that vendor packages have the
tooling to make this easy to
update and we do keep on top of security updates and release
frequently...)

---

Spawning from discussion in
[`#element-backend-internal:matrix.org`](https://matrix.to/#/!SGNQGPGUwtcPBUotTL:matrix.org/$VttYPPUevn2S_W_rrzg2ZOXWI6aKebk2ganTgrLEWUc?via=jki.re&via=element.io&via=matrix.org)

---------

Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
2026-06-23 18:40:38 +01:00
Andrew Morgan ddb0c52fde Actually run MSC4429 complement tests in CI
I only just noticed that the Complement tests weren't actually running in CI...
2026-06-23 15:24:52 +01:00
Jason Robinson 50e788b9d6 Add foreign key to profile_updates_per_user.stream_id 2026-06-23 16:49:08 +03:00
Jason Robinson 8504386b1f Send down full profile of user if user has joined during incremental sync
Also refactor the "user left" to not listen to the "user_left_room" dispatch hook since we only want to do this once, thus call the profile handler immediately in the instance responsible for receiving the event.
2026-06-23 16:44:39 +03:00
16fe5fb462 Expose MSC4354 Sticky Events over MSC4186 (Simplified) Sliding Sync. (#19591)
Follows: #19487
Part of: MSC4354 whose experimental feature tracking issue is #19409

This PR implements the Sliding Sync (MSC4186) extension described in
MSC4354, allowing sliding sync clients
to receive sticky events in a reliable way.

The logic is much the same as for oldschool sync (implementation in
#19487),
although in the sliding sync extension, the client can choose their own
limit
and must control their own pagination through an extra token in the
extension request/response bodies.

Note this does not yet send down existing sticky events in the
room when the room has been newly-joined.
This newly-discovered gap is tracked at #19662 and will be addressed for
both current sync and MSC4186 SSS soon.

---------

Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
Co-authored-by: Eric Eastwood <erice@element.io>
2026-06-23 13:04:36 +00:00
dependabot[bot]andGitHub 047d9c4231 Bump the patches group across 1 directory with 3 updates (#19835)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-23 12:45:52 +00:00
Jason Robinson 2dbaec329b Send down a null when user has left all shared rooms
Restore test and switch from {} to null.
2026-06-23 15:37:35 +03:00
Andrew MorganandJason Robinson 339eee55cd WIP track when a user leaves a room in profile_updates_per_user 2026-06-23 15:14:30 +03:00
Jason Robinson 09e212537e Fix incremental lazy sync to send down profiles for users without profile updates
Remove the checking of any stream token changes and ensure we always collect profiles for users even if they have not done profile updates, if they have events in the timeline. Also fix the cache.
2026-06-23 14:53:33 +03:00
Stefan CeriuandGitHub 6d289f7ce0 Fix permanent badge inflation from read receipts before first rotation (#19785) 2026-06-23 11:31:32 +00:00
Jason Robinson 5819dccd91 Use a cache to ensure we don't re-send the full profile fields of users in every incremental sync all the time when lazy loading 2026-06-23 13:10:21 +03:00
Jason Robinson daa8d7a28d Ensure lazy loaded profile updates in sync contain full profiles for users in timeline 2026-06-23 12:39:07 +03:00
Jason Robinson 27417cf0a8 Remove mypy ignore 2026-06-22 23:10:20 +03:00
Jason Robinson 874dc359ac Merge remote-tracking branch 'origin/develop' into anoa/msc4429 2026-06-22 22:54:16 +03:00
Maximilian BoschandGitHub 1f0c2bc3e4 docs/config: make it explicit that auto_join_rooms can be used for invite-only rooms (#19660) 2026-06-22 08:57:10 +00:00
Andrew Morgan ab9c917ca2 Remove test_incremental_sync_sends_down_null_profile_if_user_no_longer_sharing_rooms
We might just have clients do this instead (based on leave membership events).
2026-06-21 23:02:04 +01:00
Andrew Morgan 4a3fc09856 fix the tests 2026-06-21 22:53:29 +01:00
Andrew Morgan 676ef4f819 Read from profile_updates_per_user when syncing
No longer do we do the expensive lookup for which users share a room during /sync.
2026-06-21 22:40:52 +01:00
Andrew Morgan 029c4d81e4 Create profile_updates_per_user
This table tracks which users should receive profile updates. It is intended as a write-heavy, cheap-read mechanism.

At profile update time, the homeserver determines all the users that should receive the update. At the point of /sync, we then quickly read this table and check for any relevant updates for the syncing user.

The timestamp field will be used to cull the table over time (so it doesn't grow indefinitely).
2026-06-21 22:39:27 +01:00