Commit Graph
25956 Commits
Author SHA1 Message Date
Jason Robinson f431951fdb Add a test to ensure display name changes don't generate extra room_joined profile updates rows, due to membership event changes 2026-07-06 15:23:11 +03:00
Jason Robinson b571fcef4e Clear all old ProfileUpdate rows from profile_updates_per_user on a leave
Regardless of action. This is cleaner and also ensures a join/leave/join/leave case might not get confused.
2026-07-06 15:08:10 +03:00
Jason Robinson 425aa00a9b Add a join → leave → re-join → leave to try and rule out bugs in that aspect 2026-07-06 14:50:04 +03:00
Jason Robinson 1955fbee22 Ensure falsey values survive the set_field / sync profile updates -cycle 2026-07-03 18:28:49 +03:00
Jason Robinson d3dd12f027 Rewrite lazy_loaded_profile_fields_cache 2026-07-03 15:42:57 +03:00
Jason Robinson 6f6e633b5c Ensure we don't respond with profile fields the client didn't ask for 2026-07-03 14:58:33 +03:00
Jason Robinson 2c7b418105 Ensure we filter out federated users in lazy loading sync when collecting profile updates from timeline events 2026-07-02 23:13:05 +03:00
Jason Robinson 182e4c2d10 Clarify variable names and add comments to ReplicationDataHandler 2026-07-02 22:40:41 +03:00
Jason Robinson 56b7de210e Correctly type ProfileUpdatesStreamRow.field_name 2026-07-02 22:27:18 +03:00
Jason Robinson 868513720f Correctly type ProfileUpdatesStreamRow.action 2026-07-02 22:25:43 +03:00
Jason Robinson e68560a8a2 Don't dump to json string in tests 2026-07-02 22:21:00 +03:00
Jason Robinson c7f3b79e75 Use deleted_stream_id instead of indexing on row 2026-07-01 19:05:39 +03:00
Jason Robinson 4934fca946 Clean up some SQL for easier reading 2026-07-01 19:03:29 +03:00
Jason Robinson 4271ffa937 Add primary key to profile_updates_per_user 2026-07-01 18:40:11 +03:00
Jason Robinson e74046a583 Remove confusing wording 2026-07-01 18:28:40 +03:00
Jason Robinson 180c6a2746 tuples in _track_profile_updates_per_user_txn 2026-07-01 18:24:41 +03:00
Jason Robinson f6c1db70dd Fix StreamKeyType.__str__ 2026-07-01 18:22:25 +03:00
Jason Robinson 28563f0921 Make ProfileUpdateAction docstrings more descriptive on what the different enum values mean. 2026-07-01 18:17:09 +03:00
Jason Robinson 6730ad0610 Add str to ProfileUpdateAction types 2026-07-01 17:35:08 +03:00
Jason Robinson 45e9a018af Don't unpact ProfileUpdateAction unnecessarily early 2026-07-01 17:32:08 +03:00
6a5adb9c04 Remove extra ids definition
Co-authored-by: Olivier 'reivilibre' <oliverw@element.io>
2026-07-01 17:23:22 +03:00
ecd890a7af Fix MSC4429 referring comment
Co-authored-by: Olivier 'reivilibre' <oliverw@element.io>
2026-07-01 16:01:40 +03:00
Jason Robinson e6aec556ab Merge remote-tracking branch 'origin/develop' into anoa/msc4429 2026-07-01 11:55:57 +03:00
Jason Robinson eb5aa2129a Ensure both initial and incremental syncs include our own profile and updates
Otherwise if the user has multiple clients doing incremental sync, they wont get their own profile updates to their other clients. For initial because it should probably match the incremental behaviour + it avoids clients needing to look up the profile separately potentially.
2026-07-01 11:22:57 +03:00
aa97687305 Change MSC3814 dehydrated device /events endpoint from POST to GET (#19896)
Change `/org.matrix.msc3814.v1/dehydrated_device/[device_id]/events` to
accept GET requests instead of POST.

The original version of
[MSC3814](https://github.com/matrix-org/matrix-spec-proposals/pull/3814)
said we should delete keys after returning them from this endpoint, but
it is being updated to say we should not delete them, and therefore the
appropriate verb is GET.

Synapse already doesn't delete anything, so we just need to change to a
GET with a `next_batch` query param. (Currently it is a POST with
`next_batch` in the JSON content.)

This code was initially written by @ara4n and Claude, but both he and I
have read it and think it makes sense. I am far from a Synapse expert,
so feel free to tell me it's all wrong and point me in the right
direction.

I don't know what system tests will be affected by this, but I guess we
will see when the CI runs (right?).

This is a change to an unstable endpoint so no need for notifications
about breaking changes or similar.

Part of https://github.com/element-hq/element-meta/issues/2704

### Pull Request Checklist

* [x] Pull request is based on the develop branch
* [x] Pull request includes a [changelog
file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog).
The entry should:
* [x] [Code
style](https://element-hq.github.io/synapse/latest/code_style.html) is
correct (run the
[linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))

---------

Co-authored-by: Matthew Hodgson <matthew@matrix.org>
2026-06-30 21:20:26 +00:00
Olivier 'reivilibre fd8f0e53a3 Tweak changelog v1.156.0rc1 2026-06-30 16:42:21 +01:00
Olivier 'reivilibre a247001400 1.156.0rc1 2026-06-30 14:41:26 +01:00
aa6e616470 Don't delete the dehydrated device when MAS syncs the device list (#19892)
`_synapse/mas/sync_devices` checks the device list against the set of
devices MAS knows about, but the dehydrated device (MSC3814) is
invisible to MAS, so it gets automatically deleted on each sync, which
prevents dehydrated devices from working.

This change excludes the dehydrated device from the check.

There is similar special case code in the admin devices API (which gives
it a special flag) and MAS's own legacy sync path (which filters it
out).

This code was initially written by @ara4n and Claude, but both he and I
have read it and think it makes sense. I am far from a Synapse expert,
so feel free to tell me it's all wrong and point me in the right
direction.

A system-level test for this bug is being written here:
https://github.com/element-hq/element-web/issues/34034 but if you think
we should have one somewhere else, please let me know.

Closes https://github.com/element-hq/synapse/issues/19889

### Pull Request Checklist

* [x] Pull request is based on the develop branch
* [x] Pull request includes a [changelog
file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog).
The entry should:
* [x] [Code
style](https://element-hq.github.io/synapse/latest/code_style.html) is
correct (run the
[linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))

Co-authored-by: Matthew <matthew@element.io>
2026-06-30 15:24:42 +02:00
Andrew MorganandGitHub 1639c30281 Fix the cargo-test and cargo-bench CI jobs not running (#19883) 2026-06-30 11:46:47 +00:00
Jason Robinson a460c285a7 Merge remote-tracking branch 'origin/develop' into anoa/msc4429 2026-06-29 21:58:15 +03:00
Jason Robinson 5064349eec Don't delete custom profile field when setting an empty string 2026-06-29 21:56:58 +03:00
Jason Robinson 496728df15 Add docstrings to tests
Plus make a few tests actually do something sane..
2026-06-29 21:48:11 +03:00
Jason Robinson 2377165ebd Add test to prove initial sync doesn't include users updates who don't share a room 2026-06-29 16:33:36 +03:00
5edcb0f542 MSC4143: Advertise org.matrix.msc4143 in /versions unstable_features (#19646)
Closes #19580

---------

Co-authored-by: toonbr1me <toonbr1me@users.noreply.github.com>
2026-06-29 14:07:43 +01:00
Jason Robinson 60ed1758dc When user has left all rooms shared with a user, clear any previous profile updates
This ensures we don't accidentally leak any profile updates to users no longer sharing rooms.
2026-06-29 16:00:00 +03:00
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