summary refs log tree commit diff
path: root/synapse (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Prefer `make_awaitable` over `defer.succeed` in tests (#12505)Sean Quah2022-04-271-9/+17
| | | | | | | | | | | When configuring the return values of mocks, prefer awaitables from `make_awaitable` over `defer.succeed`. `Deferred`s are only awaitable once, so it is inappropriate for a mock to return the same `Deferred` multiple times. Also update `run_in_background` to support functions that return arbitrary awaitables. Signed-off-by: Sean Quah <seanq@element.io>
* Add a module API to allow modules to edit push rule actions (#12406)Brendan Abolivier2022-04-276-103/+235
| | | Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Remove unused `# type: ignore`s (#12531)David Robertson2022-04-2712-27/+27
| | | | | | | | | | | | | | | | | | | | | | Over time we've begun to use newer versions of mypy, typeshed, stub packages---and of course we've improved our own annotations. This makes some type ignore comments no longer necessary. I have removed them. There was one exception: a module that imports `select.epoll`. The ignore is redundant on Linux, but I've kept it ignored for those of us who work on the source tree using not-Linux. (#11771) I'm more interested in the config line which enforces this. I want unused ignores to be reported, because I think it's useful feedback when annotating to know when you've fixed a problem you had to previously ignore. * Installing extras before typechecking Lacking an easy way to install all extras generically, let's bite the bullet and make install the hand-maintained `all` extra before typechecking. Now that https://github.com/matrix-org/backend-meta/pull/6 is merged to the release/v1 branch.
* Consistently use collections.abc.Mapping to check frozendict. (#12564)Patrick Cloke2022-04-274-9/+10
|
* Add option to enable token registration without requiring 3pids (#12526)Will Hunt2022-04-273-2/+18
|
* Add some type hints to datastore (#12485)Dirk Klimpel2022-04-2711-84/+187
|
* Bound ephemeral events by key (#12544)Nick Mills-Barrett2022-04-262-4/+4
| | | | Co-authored-by: Brad Murray <bradtgmurray@gmail.com> Co-authored-by: Andrew Morgan <andrewm@element.io>
* Mark remote device list updates as already handled (#12557)Erik Johnston2022-04-262-3/+5
|
* Comment out dodgy log-kv (#12554)David Robertson2022-04-261-3/+6
|
* Fix sending opentracing contexts to remote servers (#12555)Erik Johnston2022-04-261-1/+11
|
* Optimise backfill calculation (#12522)Richard van der Hoff2022-04-264-106/+167
| | | | | | Try to avoid an OOM by checking fewer extremities. Generally this is a big rewrite of _maybe_backfill, to try and fix some of the TODOs and other problems in it. It's best reviewed commit-by-commit.
* Handle cancellation in `EventsWorkerStore._get_events_from_cache_or_db` (#12529)Sean Quah2022-04-251-34/+49
| | | | | | | | Multiple calls to `EventsWorkerStore._get_events_from_cache_or_db` can reuse the same database fetch, which is initiated by the first call. Ensure that cancelling the first call doesn't cancel the other calls sharing the same database fetch. Signed-off-by: Sean Quah <seanq@element.io>
* Misc. clean-ups to the relations code (#12519)Patrick Cloke2022-04-252-63/+33
| | | | | * Corrects some typos / copy & paste errors in tests. * Clarifies docstrings. * Removes an unnecessary method.
* Update `delay_cancellation` to accept any awaitable (#12468)Sean Quah2022-04-222-12/+43
| | | | | | | | This will mainly be useful when dealing with module callbacks, which are all typed as returning `Awaitable`s instead of coroutines or `Deferred`s. Signed-off-by: Sean Quah <seanq@element.io>
* MSC3202: Fix device_unused_fallback_keys -> device_unused_fallback_key_types ↵Will Hunt2022-04-222-2/+2
| | | | | | | (#12520) * Fix device_unused_fallback_keys -> device_unused_fallback_key_types * changelog
* Await un-partial-stating after a partial-state join (#12399)Richard van der Hoff2022-04-215-4/+156
| | | | | | When we join a room via the faster-joins mechanism, we end up with "partial state" at some points on the event DAG. Many parts of the codebase need to wait for the full state to load. So, we implement a mechanism to keep track of which events have partial state, and wait for them to be fully-populated.
* Dump setuptools; correct pyproject version number (#12478)David Robertson2022-04-202-152/+3
|
* Fix Jinja templating error when generating thumbnail URLs. (#12510)Patrick Cloke2022-04-201-1/+1
| | | scale is meant to be a constant string, not refer to a variable.
* Implement MSC2815: allow room moderators to view redacted event content (#12427)Tulir Asokan2022-04-206-3/+99
| | | | | | Implements matrix-org/matrix-spec-proposals#2815 Signed-off-by: Tulir Asokan <tulir@maunium.net>
* Fix returned count of delete extremities admin API (#12496)Erik Johnston2022-04-191-3/+5
|
* Fix `/room/.../event/...` to return the *original* event after any edits ↵Richard van der Hoff2022-04-192-9/+16
| | | | | | (#12476) This is what the MSC (now) requires. Fixes https://github.com/matrix-org/synapse/issues/10310.
* Implement MSC3383: include destination in X-Matrix auth header (#11398)Jan Christian Grünhage2022-04-192-10/+41
| | | | Co-authored-by: Jan Christian Grünhage <jan.christian@gruenhage.xyz> Co-authored-by: Marcus Hoffmann <bubu@bubu1.eu>
* Merge branch 'master' into developOlivier Wilkinson (reivilibre)2022-04-191-1/+1
|\
| * 1.57.0Olivier Wilkinson (reivilibre)2022-04-191-1/+1
| |
* | Back out implementation of MSC2314 (#12474)Richard van der Hoff2022-04-192-18/+10
| | | | | | | | | | | | | | | | MSC2314 has now been closed, so we're backing out its implementation, which originally happened in #6176. Unfortunately it's not a direct revert, as that PR mixed in a bunch of unrelated changes to tests etc.
* | Fix grammatical error in error message (#12483)Travis Ralston2022-04-181-1/+1
| | | | | | | | | | * Fix grammatical error in error message * changelog
* | Only send out device list updates for our own users (#12465)Erik Johnston2022-04-142-4/+10
| | | | | | Broke in #12365
* | Limit `device_id` size to 512B (#12454)Shay2022-04-131-0/+9
| | | | | | *
* | Prevent a sync request from removing a user's busy presence status (#12213)David Baker2022-04-133-18/+53
| | | | | | | | | | | | | | | | | | | | In trying to use the MSC3026 busy presence status, the user's status would be set back to 'online' next time they synced. This change makes it so that syncing does not affect a user's presence status if it is currently set to 'busy': it must be removed through the presence API. The MSC defers to implementations on the behaviour of busy presence, so this ought to remain compatible with the MSC.
* | Fix missing sync events during historical batch imports (#12319)Nick Mills-Barrett2022-04-133-17/+38
| | | | | | | | | | | | | | | | Discovered after much in-depth investigation in #12281. Closes: #12281 Closes: #3305 Signed off by: Nick Mills-Barrett nick@beeper.com
* | Rename Mutual Rooms `unstable_features` flag to match MSC (#12445)Jonathan de Jong2022-04-131-1/+1
| | | | | | Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>
* | Process device list updates asynchronously (#12365)Erik Johnston2022-04-124-91/+12
| |
* | Remove the unstable event field for `/send_join` per MSC3083. (#12395)Patrick Cloke2022-04-122-12/+0
| | | | | | | | | | | | | | This was missed when initially stabilising room version 8 and was left in as a compatibility shim. Most homeservers have upgraded to a version which expects the proper field name, and the failure mode is reasonable (a user on an older server may have to attempt joining the room twice with an obscure error message the first time).
* | Merge branch 'release-v1.57' into developErik Johnston2022-04-121-1/+1
|\|
| * 1.57.0rc1Erik Johnston2022-04-121-1/+1
| |
* | Disable groups/communities by default. (#12344)Patrick Cloke2022-04-121-1/+1
| | | | | | | | This disables the endpoints (and sync response fields) for groups/communities by default.
* | Resync state after partial-state join (#12394)Richard van der Hoff2022-04-127-0/+288
| | | | | | | | | | We work through all the events with partial state, updating the state at each of them. Once it's done, we recalculate the state for the whole room, and then mark the room as having complete state.
* | Remove references to unstable identifiers from MSC3440. (#12382)Patrick Cloke2022-04-129-95/+19
|/ | | | | Removes references to unstable thread relation, unstable identifiers for filtering parameters, and the experimental config flag.
* Add some type hints to datastore (#12423)Dirk Klimpel2022-04-128-77/+122
| | | | | | | | | | | | | | | | | | | * Add some type hints to datastore * newsfile * change `Collection` to `List` * refactor return type of `select_users_txn` * correct type hint in `stream.py` * Remove `Optional` in `select_users_txn` * remove not needed return type in `__init__` * Revert change in `get_stream_id_for_event_txn` * Remove import from `Literal`
* Specify tls extra for Twisted dependency. (#12444)Erik Johnston2022-04-121-2/+1
| | | | | | | | | | | * Specify `tls` extra for Twisted dependency. It was already pulled in for us by `treq`, but we should be explicit that we do use the `tls` functionality of Twisted directly. * Mark `idna` as dev-dependency This doesn't actually change anything, as `Twisted[tls]` will put it in as a main dependency anyway.
* Remove experimental configuration flag for MSC3666. (#12436)Patrick Cloke2022-04-112-19/+13
|
* Add missing type hints to config classes. (#12402)Patrick Cloke2022-04-1147-140/+239
|
* Do not consider events by ignored users for bundled aggregations (#12235)Patrick Cloke2022-04-112-39/+357
| | | | | | | Consider the requester's ignored users when calculating the bundled aggregations. See #12285 / 4df10d32148ae29f792afc68ff774bcbd1915cea for corresponding changes for the `/relations` endpoint.
* Disallow untyped defs in synapse._scripts (#12422)David Robertson2022-04-1111-109/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Of note: * No untyped defs in `register_new_matrix_user` This one might be contraversial. `request_registration` has three dependency-injection arguments used for testing. I'm removing the injection of the `requests` module and using `unitest.mock.patch` in the test cases instead. Doing `reveal_type(requests)` and `reveal_type(requests.get)` before the change: ``` synapse/_scripts/register_new_matrix_user.py:45: note: Revealed type is "Any" synapse/_scripts/register_new_matrix_user.py:46: note: Revealed type is "Any" ``` And after: ``` synapse/_scripts/register_new_matrix_user.py:44: note: Revealed type is "types.ModuleType" synapse/_scripts/register_new_matrix_user.py:45: note: Revealed type is "def (url: Union[builtins.str, builtins.bytes], params: Union[Union[_typeshed.SupportsItems[Union[builtins.str, builtins.bytes, builtins.int, builtins.float], Union[builtins.str, builtins.bytes, builtins.int, builtins.float, typing.Iterable[Union[builtins.str, builtins.bytes, builtins.int, builtins.float]], None]], Tuple[Union[builtins.str, builtins.bytes, builtins.int, builtins.float], Union[builtins.str, builtins.bytes, builtins.int, builtins.float, typing.Iterable[Union[builtins.str, builtins.bytes, builtins.int, builtins.float]], None]], typing.Iterable[Tuple[Union[builtins.str, builtins.bytes, builtins.int, builtins.float], Union[builtins.str, builtins.bytes, builtins.int, builtins.float, typing.Iterable[Union[builtins.str, builtins.bytes, builtins.int, builtins.float]], None]]], builtins.str, builtins.bytes], None] =, data: Union[Any, None] =, headers: Union[Any, None] =, cookies: Union[Any, None] =, files: Union[Any, None] =, auth: Union[Any, None] =, timeout: Union[Any, None] =, allow_redirects: builtins.bool =, proxies: Union[Any, None] =, hooks: Union[Any, None] =, stream: Union[Any, None] =, verify: Union[Any, None] =, cert: Union[Any, None] =, json: Union[Any, None] =) -> requests.models.Response" ``` * Drive-by comment in `synapse.storage.types` * No untyped defs in `synapse_port_db` This was by far the most painful. I'm happy to break this up into smaller pieces for review if it's not managable as-is.
* Add Module API for reading and writing global account data. (#12391)reivilibre2022-04-111-0/+76
|
* Optimise `_update_client_ips_batch_txn` to batch together database ↵reivilibre2022-04-082-35/+132
| | | | | operations. (#12252) Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Make `synapse._scripts` pass typechecks (#12421)David Robertson2022-04-084-38/+49
|
* Unify HTTP query parameter type hints (#12415)David Robertson2022-04-085-38/+42
| | | | | | * Pull out query param types to `synapse.http.types` * Use QueryParams everywhere * Simplify `encode_query_args` * Add annotation which would have caught #12410
* Update the server notices user profile in room if changed. (#12115)Jorge Florian2022-04-081-4/+55
|
* Fix rejecting invites over federation (#12409)Erik Johnston2022-04-071-20/+33
| | | | | Currently causes future incremental syncs to fail. Broke by #12191
* Fix fetching public rooms over federation (#12410)Erik Johnston2022-04-071-1/+1
| | | Broke by #12364
* Do not add groups to sync results if disabled. (#12408)Patrick Cloke2022-04-072-10/+10
|
* Add opentracing spans to calls to external cache (#12380)Erik Johnston2022-04-072-11/+23
|
* Support the v1 endpoint for `/relations`. (#12403)Patrick Cloke2022-04-071-1/+1
| | | | Now that MSC2675 has passed FCP and the implementation is compliant with the final version.
* Remove support for the unstable identifier from MSC3288. (#12398)Patrick Cloke2022-04-061-2/+0
|
* Narrow the `importlib_metadata` dependency (#12400)David Robertson2022-04-061-1/+1
|
* Fix `synapse_event_persisted_position` metric (#12390)Richard van der Hoff2022-04-061-3/+3
| | | | Fixes a bug introduced in #11417 where we would only included backfilled events in `synapse_event_persisted_position`
* Update type annotations for compatiblity with prometheus_client 0.14 (#12389)Richard van der Hoff2022-04-067-18/+66
| | | | | | | Principally, `prometheus_client.REGISTRY.register` now requires its argument to extend `prometheus_client.Collector`. Additionally, `Gauge.set` is now annotated so that passing `Optional[int]` causes an error.
* Generate historic pagination token for `/messages` when no `?from` token ↵Eric Eastwood2022-04-064-14/+23
| | | | provided (#12370)
* Add missing dependency on importlib_metadata (#12384)David Robertson2022-04-051-0/+3
|
* Post 1.56.0 release tidy up (#12379)Sean Quah2022-04-051-1/+1
|
* Fix edge case where a `Linearizer` could get stuck (#12358)Sean Quah2022-04-051-1/+5
| | | | | | | Just after a task acquires a contended `Linearizer` lock, it sleeps. If the task is cancelled during this sleep, we need to release the lock. Signed-off-by: Sean Quah <seanq@element.io>
* Make `StreamToken` and `RoomStreamToken` methods propagate cancellations ↵Sean Quah2022-04-051-0/+5
| | | | | | | | | (#12366) `StreamToken.from_string` and `RoomStreamToken.parse` are both async methods that could be cancelled. These methods must not replace `CancelledError`s with `SynapseError`s. Signed-off-by: Sean Quah <seanq@element.io>
* Refactor and convert `Linearizer` to async (#12357)Sean Quah2022-04-0519-113/+101
| | | | | | | | | | | Refactor and convert `Linearizer` to async. This makes a `Linearizer` cancellation bug easier to fix. Also refactor to use an async context manager, which eliminates an unlikely footgun where code that doesn't immediately use the context manager could forget to release the lock. Signed-off-by: Sean Quah <seanq@element.io>
* Merge branch 'master' into developSean Quah2022-04-052-2/+2
|\
| * 1.56.0Sean Quah2022-04-051-1/+1
| |
| * Pin signedjson to <= 1.1.1 as a temporary workaround for #12324Sean Quah2022-04-051-1/+1
| | | | | | | | | | | | To be reverted after the Synapse 1.56 release. Signed-off-by: Sean Quah <seanq@element.io>
| * Bump `black` and `click` versions (#12320)David Robertson2022-04-0511-18/+21
| |
* | Prefill more stream change caches. (#12372)Erik Johnston2022-04-055-61/+91
| |
* | Fix a spec compliance issue where requests to the `/publicRooms` federation ↵reivilibre2022-04-051-2/+2
| | | | | | | | API would specify `limit` as a string. (#12364)
* | Merge tag 'v1.56.0rc1' into developRichard van der Hoff2022-04-051-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Synapse 1.56.0rc1 (2022-03-29) ============================== Features -------- - Allow modules to store already existing 3PID associations. ([\#12195](https://github.com/matrix-org/synapse/issues/12195)) - Allow registering server administrators using the module API. Contributed by Famedly. ([\#12250](https://github.com/matrix-org/synapse/issues/12250)) Bugfixes -------- - Fix a long-standing bug which caused the `/_matrix/federation/v1/state` and `/_matrix/federation/v1/state_ids` endpoints to return incorrect or invalid data when called for an event which we have stored as an "outlier". ([\#12087](https://github.com/matrix-org/synapse/issues/12087)) - Fix a long-standing bug where events from ignored users would still be considered for relations. ([\#12227](https://github.com/matrix-org/synapse/issues/12227), [\#12232](https://github.com/matrix-org/synapse/issues/12232), [\#12285](https://github.com/matrix-org/synapse/issues/12285)) - Fix a bug introduced in Synapse 1.53.0 where an unnecessary query could be performed when fetching bundled aggregations for threads. ([\#12228](https://github.com/matrix-org/synapse/issues/12228)) - Fix a bug introduced in Synapse 1.52.0 where admins could not deactivate and GDPR-erase a user if Synapse was configured with limits on avatars. ([\#12261](https://github.com/matrix-org/synapse/issues/12261)) Improved Documentation ---------------------- - Fix the link to the module documentation in the legacy spam checker warning message. ([\#12231](https://github.com/matrix-org/synapse/issues/12231)) - Remove incorrect prefixes in the worker documentation for some endpoints. ([\#12243](https://github.com/matrix-org/synapse/issues/12243)) - Correct `check_username_for_spam` annotations and docs. ([\#12246](https://github.com/matrix-org/synapse/issues/12246)) - Correct Authentik OpenID typo, and add notes on troubleshooting. Contributed by @IronTooch. ([\#12275](https://github.com/matrix-org/synapse/issues/12275)) - HAProxy reverse proxy guide update to stop sending IPv4-mapped address to homeserver. Contributed by @villepeh. ([\#12279](https://github.com/matrix-org/synapse/issues/12279)) Internal Changes ---------------- - Rename `shared_rooms` to `mutual_rooms` ([MSC2666](https://github.com/matrix-org/matrix-doc/pull/2666)), as per proposal changes. ([\#12036](https://github.com/matrix-org/synapse/issues/12036)) - Remove check on `update_user_directory` for shared rooms handler ([MSC2666](https://github.com/matrix-org/matrix-doc/pull/2666)), and update/expand documentation. ([\#12038](https://github.com/matrix-org/synapse/issues/12038)) - Refactor `create_new_client_event` to use a new parameter, `state_event_ids`, which accurately describes the usage with [MSC2716](https://github.com/matrix-org/matrix-doc/pull/2716) instead of abusing `auth_event_ids`. ([\#12083](https://github.com/matrix-org/synapse/issues/12083), [\#12304](https://github.com/matrix-org/synapse/issues/12304)) - Refuse to start if registration is enabled without email, captcha, or token-based verification unless the new config flag `enable_registration_without_verification` is set. ([\#12091](https://github.com/matrix-org/synapse/issues/12091)) - Add tests for database transaction callbacks. ([\#12198](https://github.com/matrix-org/synapse/issues/12198)) - Handle cancellation in `DatabasePool.runInteraction`. ([\#12199](https://github.com/matrix-org/synapse/issues/12199)) - Add missing type hints for cache storage. ([\#12216](https://github.com/matrix-org/synapse/issues/12216)) - Add missing type hints for storage. ([\#12248](https://github.com/matrix-org/synapse/issues/12248), [\#12255](https://github.com/matrix-org/synapse/issues/12255)) - Add type hints to tests files. ([\#12224](https://github.com/matrix-org/synapse/issues/12224), [\#12240](https://github.com/matrix-org/synapse/issues/12240), [\#12256](https://github.com/matrix-org/synapse/issues/12256)) - Use type stubs for `psycopg2`. ([\#12269](https://github.com/matrix-org/synapse/issues/12269)) - Improve type annotations for `execute_values`. ([\#12311](https://github.com/matrix-org/synapse/issues/12311)) - Clean-up logic around rebasing URLs for URL image previews. ([\#12219](https://github.com/matrix-org/synapse/issues/12219)) - Use the `ignored_users` table in additional places instead of re-parsing the account data. ([\#12225](https://github.com/matrix-org/synapse/issues/12225)) - Refactor the relations endpoints to add a `RelationsHandler`. ([\#12237](https://github.com/matrix-org/synapse/issues/12237)) - Generate announcement links in the release script. ([\#12242](https://github.com/matrix-org/synapse/issues/12242)) - Improve error message when dependencies check finds a broken installation. ([\#12244](https://github.com/matrix-org/synapse/issues/12244)) - Compress metrics HTTP resource when enabled. Contributed by Nick @ Beeper. ([\#12258](https://github.com/matrix-org/synapse/issues/12258)) - Refuse to start if the PostgreSQL database has a non-`C` locale, unless the config flag `allow_unsafe_db_locale` is set to true. ([\#12262](https://github.com/matrix-org/synapse/issues/12262), [\#12288](https://github.com/matrix-org/synapse/issues/12288)) - Optionally include account validity expiration information to experimental [MSC3720](https://github.com/matrix-org/matrix-doc/pull/3720) account status responses. ([\#12266](https://github.com/matrix-org/synapse/issues/12266)) - Add a new cache `_get_membership_from_event_id` to speed up push rule calculations in large rooms. ([\#12272](https://github.com/matrix-org/synapse/issues/12272)) - Re-enable Complement concurrency in CI. ([\#12283](https://github.com/matrix-org/synapse/issues/12283)) - Remove unused test utilities. ([\#12291](https://github.com/matrix-org/synapse/issues/12291)) - Enhance logging for inbound federation events. ([\#12301](https://github.com/matrix-org/synapse/issues/12301)) - Fix compatibility with the recently-released Jinja 3.1. ([\#12313](https://github.com/matrix-org/synapse/issues/12313)) - Avoid trying to calculate the state at outlier events. ([\#12314](https://github.com/matrix-org/synapse/issues/12314))
| * 1.56.0rc1Brendan Abolivier2022-03-291-1/+1
| |
* | Explain how to decipher live and historic pagination tokens (#12317)Eric Eastwood2022-04-051-11/+85
| |
* | Allow non-member state sent in room batch to resolve for historic events ↵Eric Eastwood2022-04-041-26/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | (MSC2716) (#12329) Part of https://github.com/matrix-org/synapse/issues/12110 Complement test: https://github.com/matrix-org/complement/pull/354 Previously, they didn't resolve because async `filter_events_for_client` removes all outlier state except for out-of-band membership. And fundamentally, we have the state at these events so they shouldn't be marked as outliers.
* | Prefill the device_list_stream_cache (#12367)Erik Johnston2022-04-042-2/+22
| | | | | | | | | | | | | | * Prefill the device_list_stream_cache * Newsfile * Newsfile
* | Track device list updates per room. (#12321)Erik Johnston2022-04-048-37/+362
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a first step in dealing with #7721. The idea is basically that rather than calculating the full set of users a device list update needs to be sent to up front, we instead simply record the rooms the user was in at the time of the change. This will allow a few things: 1. we can defer calculating the set of remote servers that need to be poked about the change; and 2. during `/sync` and `/keys/changes` we can avoid also avoid calculating users who share rooms with other users, and instead just look at the rooms that have changed. However, care needs to be taken to correctly handle server downgrades. As such this PR writes to both `device_lists_changes_in_room` and the `device_lists_outbound_pokes` table synchronously. In a future release we can then bump the database schema compat version to `69` and then we can assume that the new `device_lists_changes_in_room` exists and is handled. There is a temporary option to disable writing to `device_lists_outbound_pokes` synchronously, allowing us to test the new code path does work (and by implication upgrading to a future release and downgrading to this one will work correctly). Note: Ideally we'd do the calculation of room to servers on a worker (e.g. the background worker), but currently only master can write to the `device_list_outbound_pokes` table.
* | Default to `private` room visibility rather than `public` when a client does ↵reivilibre2022-04-011-1/+3
| | | | | | | | not specify one, according to spec. (#12350)
* | Use a sequence to generate AS transaction IDs, drop `last_txn` AS state (#12209)Nick Mills-Barrett2022-04-013-44/+67
| | | | | | | | | | | | | | | | Switching to a sequence means there's no need to track `last_txn` on the AS state table to generate new TXN IDs. This also means that there is no longer contention between the AS scheduler and AS handler on updates to the `application_services_state` table, which will prevent serialization errors during the complete AS txn transaction.
* | Move `update_client_ip` background job from the main process to the ↵reivilibre2022-04-019-153/+159
| | | | | | | | background worker. (#12251)
* | Raise an exception when getting state at an outlier (#12191)Richard van der Hoff2022-04-012-4/+32
| | | | | | | | | | | | It seems like calling `_get_state_group_for_events` for an event where the state is unknown is an error. Accordingly, let's raise an exception rather than silently returning an empty result.
* | Optimise `_get_state_after_missing_prev_event`: use `/state` (#12040)Richard van der Hoff2022-04-012-9/+42
| | | | | | If we're missing most of the events in the room state, then we may as well call the /state endpoint, instead of individually requesting each and every event.
* | Add a module callback to react to account data changes (#12327)Brendan Abolivier2022-04-012-1/+66
| | | | | | | | Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* | Add set_user_admin function to the module API (#12341)Amanda Graven2022-04-011-0/+11
| |
* | Move MSC2654 support behind an experimental configuration flag. (#12295)Patrick Cloke2022-03-312-1/+6
| | | | | | To match the current thinking on disabling experimental features by default.
* | Handle outliers in `/federation/v1/event` (#12332)Richard van der Hoff2022-03-311-106/+128
| | | | | | | | | | | | | | The intention here is to avoid doing state lookups for outliers in `/_matrix/federation/v1/event`. Unfortunately that's expanded into something of a rewrite of `filter_events_for_server`, which ended up trying to do that operation in a couple of places.
* | Add more type hints to the main state store. (#12267)Patrick Cloke2022-03-312-9/+15
| |
* | Add a callback to react to 3PID associations (#12302)Brendan Abolivier2022-03-313-0/+32
| |
* | Remove an unnecessary class from the relations code. (#12338)Patrick Cloke2022-03-313-74/+31
| | | | | | | | | | The PaginationChunk class attempted to bundle some properties together, but really just caused callers to jump through hoops and hid implementation details.
* | Ensure the type of URL attributes is always str when matching against ↵Brendan Abolivier2022-03-311-2/+7
| | | | | | | | preview blacklist (#12333)
* | Remove the unused and unstable `/aggregations` endpoint. (#12293)Patrick Cloke2022-03-304-271/+16
| | | | | | | | | | | | | | | | | | This endpoint was removed from MSC2675 before it was approved. It is currently unspecified (even in any MSCs) and therefore subject to removal. It is not implemented by any known clients. This also changes the bundled aggregation format for `m.annotation`, which previously included pagination tokens for the `/aggregations` endpoint, which are no longer useful.
* | Send device list updates to application services (MSC3202) - part 1 (#11881)Andrew Morgan2022-03-3011-62/+317
| | | | | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* | Start application service stream token tracking from 1 (#12193)Andrew Morgan2022-03-302-2/+3
| | | | | | Co-authored-by: Erik Johnston <erik@matrix.org>
* | Disable proactive sends for remote joins (#12330)Richard van der Hoff2022-03-301-0/+6
| | | | | | | | Do not attempt to send remote joins out over federation. Normally, it will do nothing; occasionally, it will do the wrong thing.
* | Add a configuration to exclude rooms from sync response (#12310)Brendan Abolivier2022-03-304-21/+66
| |
* | Fix typechecker problems exposed by signedjson 1.1.2 (#12326)David Robertson2022-03-295-17/+20
| |
* | Room batch: fix up handling of unknown prev_event_ids (#12316)Richard van der Hoff2022-03-291-8/+13
| |
* | Update `LoggingTransaction.call_after` and `call_on_exception` docstrings ↵Sean Quah2022-03-291-3/+20
| | | | | | | | | | | | | | | | (#12315) Document the behaviour of `LoggingTransaction.call_after` and `LoggingTransaction.call_on_exception` when transactions are retried. Signed-off-by: Sean Quah <seanq@element.io>
* | Bump `black` and `click` versions (#12320)David Robertson2022-03-2911-18/+21
|/
* Remove unused `auth_event_ids` argument plumbing (#12304)Eric Eastwood2022-03-292-27/+0
| | | | | | | | | | | | | | Follow-up to https://github.com/matrix-org/synapse/pull/12083 Since we are now using the new `state_event_ids` parameter to do all of the heavy lifting. We can remove any spots where we plumbed `auth_event_ids` just for MSC2716 things in https://github.com/matrix-org/synapse/pull/9247/files. Removing `auth_event_ids` from following functions: - `create_and_send_nonmember_event` - `_local_membership_update` - `update_membership` - `update_membership_locked`
* Exclude outliers in `on_backfill_request` (#12314)Richard van der Hoff2022-03-281-3/+9
| | | | | | When we are processing a `/backfill` request from a remote server, exclude any outliers from consideration early on. We can't return outliers anyway (since we don't know the state at the outlier), and filtering them out earlier means that we won't attempt to calulate the state for them.
* Add some type hints to datastore. (#12255)Dirk Klimpel2022-03-288-39/+60
|
* Un-revert Jinja2 fix (#12313)Brendan Abolivier2022-03-282-6/+9
| | | Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Allow modules to store already existing 3PID associations (#12195)Brendan Abolivier2022-03-281-1/+26
|
* Improve type annotations for `execute_values`. (#12311)reivilibre2022-03-281-10/+7
|
* Add restrictions by default to open registration in Synapse (#12091)Shay2022-03-252-1/+30
|
* Add cache for `get_membership_from_event_ids` (#12272)Erik Johnston2022-03-255-22/+71
| | | | | This should speed up push rule calculations for rooms with large numbers of local users when the main push rule cache fails. Co-authored-by: reivilibre <oliverw@matrix.org>
* Enhance logging for inbound federation events (#12301)Richard van der Hoff2022-03-251-1/+1
| | | | It is currently rather hard to see which rooms are causing inbound federation traffic. Add the room id to the logs.
* Refactor `create_new_client_event` to use a new parameter, ↵Eric Eastwood2022-03-254-65/+164
| | | | | | | `state_event_ids`, which accurately describes the usage with MSC2716 instead of abusing `auth_event_ids` (#12083) Spawned from https://github.com/matrix-org/synapse/pull/10975#discussion_r813183430 Part of [MSC2716](https://github.com/matrix-org/matrix-spec-proposals/pull/2716)
* Always allow the empty string as an avatar_url. (#12261)David Robertson2022-03-251-0/+6
| | | | | Hopefully this fixes #12257. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Merge branch 'master' into developRichard van der Hoff2022-03-243-8/+7
|\
| * 1.55.2Richard van der Hoff2022-03-241-1/+1
| |
| * Pin Jinja to <3.1.0 (#12297)Andrew Morgan2022-03-241-1/+2
| | | | | | as 3.1.0 removed the deprecated jinja2.Markup class which we still rely on.
| * Revert "Replace instances of deprecated `Jinja2.Markup` with ↵Andrew Morgan2022-03-242-6/+4
| | | | | | | | | | `markupsafe.Markup`" (#12296) This reverts commit 8810c93e828a9ed1dcb008d08be8aa9fcb4d28c3.
* | Merge branch 'master' into developAndrew Morgan2022-03-243-5/+7
|\|
| * 1.55.1Andrew Morgan2022-03-241-1/+1
| |
| * Replace instances of deprecated `Jinja2.Markup` with `markupsafe.Markup` ↵Andrew Morgan2022-03-242-4/+6
| | | | | | | | | | (#12289) Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* | Do not consider events by ignored users for relations (#12285)Patrick Cloke2022-03-241-1/+8
| | | | | | | | Filter the events returned from `/relations` for the requester's ignored users in a similar way to `/messages` (and `/sync`).
* | Optionally include account validity in MSC3720 account status responses (#12266)Brendan Abolivier2022-03-242-0/+15
| |
* | Refuse to start if DB has an unsafe locale (#12262)Shay2022-03-232-15/+36
| |
* | Use psycopg2 type stubs (#12269)David Robertson2022-03-232-4/+12
| |
* | Remove mutual_rooms `update_user_directory` check, and add extra ↵Jonathan de Jong2022-03-231-4/+6
| | | | | | | | | | documentation (#12038) Resolves #10339
* | Allow registering admin users using the module API (#12250)Nicolas Werner2022-03-231-0/+4
| | | | | | Signed-off-by: Nicolas Werner <n.werner@famedly.com>
* | Rename shared_rooms to mutual_rooms (#12036)Jonathan de Jong2022-03-233-10/+11
| | | | | | Co-authored-by: reivilibre <olivier@librepush.net>
* | Merge branch 'master' into developAndrew Morgan2022-03-224-7/+7
|\|
| * 1.55.0Andrew Morgan2022-03-221-1/+1
| |
| * Tweak copy for sso account details template (#12265)Michael Telatynski2022-03-223-6/+6
| | | | | | | | | | | | | | * Tweak copy for sso account details template * Update sso footer copyright year * Add newsfragment Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* | Merge branch 'release-v1.55' into developDavid Robertson2022-03-211-1/+1
|\|
| * Reword 'Choose your user name' as 'Choose your account name' in the SSO ↵reivilibre2022-03-211-1/+1
| | | | | | | | | | | | | | | | | | registration template, in order to comply with SIWA guidelines. (#12260) * Reword as 'Choose your account name' * Newsfile Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
* | Make it possible to enable compression for the metrics HTTP resource (#12258)Nick Mills-Barrett2022-03-211-1/+4
| | | | | | | | | | | | | | | | | | | | * Make it possible to enable compression for the metrics HTTP resource This can provide significant bandwidth savings pulling metrics from synapse instances. * Add changelog file. * Fix type hint
* | Return a 404 from `/state` for an outlier (#12087)Richard van der Hoff2022-03-212-44/+24
| | | | | | | | | | * Replace `get_state_for_pdu` with `get_state_ids_for_pdu` and `get_events_as_list`. * Return a 404 from `/state` and `/state_ids` for an outlier
* | Try to detect borked package installations. (#12244)David Robertson2022-03-181-1/+23
| | | | | | | | | | | | | | * Try to detect borked package installations. Fixes #12223. Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* | Move get_bundled_aggregations to relations handler. (#12237)Patrick Cloke2022-03-188-157/+172
| | | | | | | | | | The get_bundled_aggregations code is fairly high-level and uses a lot of store methods, we move it into the handler as that seems like a better fit.
* | Only fetch thread participation for events with threads. (#12228)Patrick Cloke2022-03-181-1/+3
| | | | | | | | | | | | | | | | | | We fetch the thread summary in two phases: 1. The summary that is shared by all users (count of messages and latest event). 2. Whether the requesting user has participated in the thread. There's no use in attempting step 2 for events which did not return a summary from step 1.
* | Add some type hints to datastore (#12248)Dirk Klimpel2022-03-182-78/+116
| | | | | | | | | | * inherit `MonthlyActiveUsersStore` from `RegistrationWorkerStore` Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* | Correct `check_username_for_spam` annotations and docs (#12246)David Robertson2022-03-186-12/+39
| | | | | | | | | | | | | | * Formally type the UserProfile in user searches * export UserProfile in synapse.module_api * Update docs Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* | Merge branch 'release-v1.55' into developPatrick Cloke2022-03-162-4/+7
|\|
| * Fix bundling aggregations if unsigned is not a returned event field. (#12234)Patrick Cloke2022-03-161-3/+6
| | | | | | | | | | | | | | An error occured if a filter was supplied with `event_fields` which did not include `unsigned`. In that case, bundled aggregations are still added as the spec states it is allowed for servers to add additional fields.
| * 1.55.0rc1David Robertson2022-03-151-1/+1
| |
* | Handle cancellation in `DatabasePool.runInteraction()` (#12199)Sean Quah2022-03-161-24/+37
| | | | | | | | | | | | | | | | | | | | | | | | To handle cancellation, we ensure that `after_callback`s and `exception_callback`s are always run, since the transaction will complete on another thread regardless of cancellation. We also wait until everything is done before releasing the `CancelledError`, so that logging contexts won't get used after they have been finished. Signed-off-by: Sean Quah <seanq@element.io>
* | Add a relations handler to avoid duplication. (#12227)Patrick Cloke2022-03-164-69/+133
| | | | | | Adds a handler layer between the REST and datastore layers for relations.
* | Add some missing type hints to cache datastore. (#12216)Patrick Cloke2022-03-161-21/+36
| |
* | Fix dead link in spam checker warning (#12231)David Robertson2022-03-161-2/+2
| |
* | Clean-up logic for rebasing URLs during URL preview. (#12219)Patrick Cloke2022-03-162-48/+14
| | | | | | | | By using urljoin from the standard library and reducing the number of places URLs are rebased.
* | Use the ignored_users table to test event visibility & sync. (#12225)Patrick Cloke2022-03-154-47/+44
|/ | | | | Instead of fetching the raw account data and re-parsing it. The ignored_users table is a denormalised version of the account data for quick searching.
* Add cancellation support to `@cached` and `@cachedList` decorators (#12183)Sean Quah2022-03-141-0/+11
| | | | | | | | These decorators mostly support cancellation already. Add cancellation tests and fix use of finished logging contexts by delaying cancellation, as suggested by @erikjohnston. Signed-off-by: Sean Quah <seanq@element.io>
* Add cancellation support to `ReadWriteLock` (#12120)Sean Quah2022-03-142-35/+44
| | | | | | Also convert `ReadWriteLock` to use async context managers. Signed-off-by: Sean Quah <seanq@element.io>
* Fix broken background updates when using sqlite with `enable_search` off ↵Sean Quah2022-03-141-6/+7
| | | | | (#12215) Signed-off-by: Sean Quah <seanq@element.io>
* Add `delay_cancellation` utility function (#12180)Sean Quah2022-03-141-6/+42
| | | | | | | | | `delay_cancellation` behaves like `stop_cancellation`, except it delays `CancelledError`s until the original `Deferred` resolves. This is handy for unifying cleanup paths and ensuring that uncancelled coroutines don't use finished logcontexts. Signed-off-by: Sean Quah <seanq@element.io>
* Deprecate the groups/communities endpoints and add an experimental ↵Patrick Cloke2022-03-125-7/+20
| | | | configuration flag. (#12200)
* Add config settings for background update parameters (#11980)Shay2022-03-114-14/+97
|
* Implement a Jinja2 filter to extract localparts from email addresses (#12212)Brendan Abolivier2022-03-113-1/+13
|
* Improve code documentation for the typing stream over replication. (#12211)reivilibre2022-03-114-6/+19
|
* Add an additional HTTP pusher + push rule tests. (#12188)Nick Mills-Barrett2022-03-113-25/+25
| | | And rename the field used for caching from _id to _cache_key.
* Update the SSO username picker template to comply with SIWA guidelines (#12210)Brendan Abolivier2022-03-115-9/+34
| | | Fixes https://github.com/matrix-org/synapse/issues/12205
* Remove unnecessary pass statements. (#12206)Patrick Cloke2022-03-119-14/+0
|
* fix misleading comment in `check_events_for_spam` (#12203)Shay2022-03-101-2/+2
|
* Remove workaround introduced in Synapse v1.50.0rc1 for Mjolnir ↵reivilibre2022-03-101-7/+0
| | | | compatibility. Breaks compatibility with Mjolnir v1.3.1 and earlier. (#11700)
* Support stable identifiers for MSC3440: Threading (#12151)Patrick Cloke2022-03-109-54/+90
| | | | The unstable identifiers are still supported if the experimental configuration flag is enabled. The unstable identifiers will be removed in a future release.
* Allow retrieving the relations of a redacted event. (#12130)Patrick Cloke2022-03-104-77/+80
| | | | | | | | | This is allowed per MSC2675, although the original implementation did not allow for it and would return an empty chunk / not bundle aggregations. The main thing to improve is that the various caches get cleared properly when an event is redacted, and that edits must not leak if the original event is redacted (as that would presumably leak something similar to the original event content).
* Rename get_tcp_replication to get_replication_command_handler. (#12192)Patrick Cloke2022-03-1010-14/+14
| | | | | | Since the object it returns is a ReplicationCommandHandler. This is clean-up from adding support to Redis where the command handler was added as an additional layer of abstraction from the TCP protocol.
* Add third_party module callbacks to check if a user can delete a room and ↵Will Hunt2022-03-095-1/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | deactivate a user (#12028) * Add check_can_deactivate_user * Add check_can_shutdown_rooms * Documentation * callbacks, not functions * Various suggested tweaks * Add tests for test_check_can_shutdown_room and test_check_can_deactivate_user * Update check_can_deactivate_user to not take a Requester * Fix check_can_shutdown_room docs * Renegade and use `by_admin` instead of `admin_user_id` * fix lint * Update docs/modules/third_party_rules_callbacks.md Co-authored-by: Brendan Abolivier <babolivier@matrix.org> * Update docs/modules/third_party_rules_callbacks.md Co-authored-by: Brendan Abolivier <babolivier@matrix.org> * Update docs/modules/third_party_rules_callbacks.md Co-authored-by: Brendan Abolivier <babolivier@matrix.org> * Update docs/modules/third_party_rules_callbacks.md Co-authored-by: Brendan Abolivier <babolivier@matrix.org> Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Allow for ignoring some arguments when caching. (#12189)Patrick Cloke2022-03-092-18/+60
| | | | | * `@cached` can now take an `uncached_args` which is an iterable of names to not use in the cache key. * Requires `@cached`, @cachedList` and `@lru_cache` to use keyword arguments for clarity. * Asserts that keyword-only arguments in cached functions are not accepted. (I tested this briefly and I don't believe this works properly.)
* Remove some unused variables/parameters. (#12187)Patrick Cloke2022-03-091-9/+5
|
* Retry some http replication failures (#12182)Nick Mills-Barrett2022-03-091-11/+36
| | | | | | | | This allows for the target process to be down for around a minute which provides time for restarts during synapse upgrades/config updates. Closes: #12178 Signed off by Nick Mills-Barrett nick@beeper.com
* Skip attempt to get state at backwards-extremities (#12173)Richard van der Hoff2022-03-091-57/+3
| | | | We don't *have* the state at a backwards-extremity, so this is never going to do anything useful.
* Use `ParamSpec` in type hints for `synapse.logging.context` (#12150)Sean Quah2022-03-084-25/+36
| | | | Signed-off-by: Sean Quah <seanq@element.io>
* Merge branch 'master' into developOlivier Wilkinson (reivilibre)2022-03-082-2/+3
|\
| * 1.54.0Olivier Wilkinson (reivilibre)2022-03-081-1/+1
| |
| * Fix a bug introduced in 1.54.0rc1 which meant that Synapse would refuse to ↵reivilibre2022-03-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | start if pre-release versions of dependencies were installed. (#12177) * Add failing test to characterise the regression #12176 * Permit pre-release versions of specified packages * Newsfile (bugfix) Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
* | Add experimental environment variable to enable asyncio reactor (#12135)Erik Johnston2022-03-081-0/+21
| |
* | Do not return allowed_room_ids from /hierarchy response. (#12175)Patrick Cloke2022-03-081-2/+13
| | | | | | | | | | This field is only to be used in the Server-Server API, and not the Client-Server API, but was being leaked when a federation response was used in the /hierarchy API.
* | Fix incorrect type hints for txredis. (#12042)Patrick Cloke2022-03-083-7/+7
| | | | | | | | Some properties were marked as RedisProtocol instead of ConnectionHandler, which wraps RedisProtocol instance(s).
* | Fix a bug in background updates wherein background updates are never run ↵Shay2022-03-071-3/+5
| | | | | | | | using the default batch size (#12157)
* | Invalidate caches when an event with a relation is redacted. (#12121)Patrick Cloke2022-03-072-5/+35
| | | | | | | | | | The caches for the target of the relation must be cleared so that the bundled aggregations are re-calculated after the redaction is processed.
* | Merge remote-tracking branch 'origin/release-v1.54' into developRichard van der Hoff2022-03-044-12/+71
|\|
| * Relax version guard for packaging (#12166)David Robertson2022-03-041-2/+2
| | | | | | | | | | | | | | It’s just occurred to me that #12088 pulled in the “packaging” package (~=21.3). I pulled in the newest version I had at the time. I only use it for packaging.requirements.Requirements. Which was added in packaging 16.1: https://github.com/pypa/packaging/releases/tag/16.1 https://pkgs.org/download/python3-packaging suggests that the oldest version we care about is 17.1 in Ubuntu Bionic. So I think with this bound we're hunky dory.
| * Don't impose version checks on dev extras at runtime (#12129)David Robertson2022-03-031-7/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix incorrect argument in test case * Add copyright header * Docstring and __all__ * Exclude dev depenencies * Use changelog from #12088 * Include version in error messages This will hopefully distinguish between the version of the source code and the version of the distribution package that is installed. * Linter script is your friend
| * Correctly register deactivation and profile update module callbacks (#12141)Brendan Abolivier2022-03-032-3/+15
| |
* | Reduce to-device queries for /sync. (#12163)Erik Johnston2022-03-041-0/+3
| |
* | Add type hints for `ObservableDeferred` attributes (#12159)Sean Quah2022-03-041-3/+11
| | | | | | Signed-off-by: Sean Quah <seanq@element.io>
* | Remove backwards compatibility with RelationPaginationToken. (#12138)Patrick Cloke2022-03-042-72/+14
| |
* | Move synctl into `synapse._scripts` and expose as an entrypoint (#12140)David Robertson2022-03-041-0/+360
| |
* | Spread out sending device lists to remote hosts (#12132)Erik Johnston2022-03-045-12/+30
| |
* | Update client-visibility filtering for outlier events (#12155)Richard van der Hoff2022-03-041-1/+16
| | | | | | Avoid trying to get the state for outliers, which isn't a sensible thing to do.
* | Fix type of `events` in `StateGroupStorage` and `StateHandler` (#12156)Richard van der Hoff2022-03-042-7/+7
| | | | | | We make multiple passes over this, so a regular iterable won't do.
* | Avoid generating state groups for local out-of-band leaves (#12154)Richard van der Hoff2022-03-031-1/+1
| | | | | | | | | | | | | | | | | | If we locally generate a rejection for an invite received over federation, it is stored as an outlier (because we probably don't have the state for the room). However, currently we still generate a state group for it (even though the state in that state group will be nonsense). By setting the `outlier` param on `create_event`, we avoid the nonsensical state.
* | Rename various ApplicationServices interested methods (#11915)Andrew Morgan2022-03-035-51/+98
| |
* | Use the proper serialization format when bundling aggregations. (#12090)Patrick Cloke2022-03-037-140/+125
| | | | | | | | This ensures that the `latest_event` field of the bundled aggregation for threads uses the same format as the other events in the response.
* | Limit the size of the aggregation_key (#12101)Erik Johnston2022-03-031-0/+3
| | | | | | There's no reason to let people use long keys.
* | Merge tag 'v1.54.0rc1' into developOlivier Wilkinson (reivilibre)2022-03-021-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Synapse 1.54.0rc1 (2022-03-02) ============================== Please note that this will be the last release of Synapse that is compatible with Mjolnir 1.3.1 and earlier. Administrators of servers which have the Mjolnir module installed are advised to upgrade Mjolnir to version 1.3.2 or later. Features -------- - Add support for [MSC3202](https://github.com/matrix-org/matrix-doc/pull/3202): sending one-time key counts and fallback key usage states to Application Services. ([\#11617](https://github.com/matrix-org/synapse/issues/11617)) - Improve the generated URL previews for some web pages. Contributed by @AndrewRyanChama. ([\#11985](https://github.com/matrix-org/synapse/issues/11985)) - Track cache invalidations in Prometheus metrics, as already happens for cache eviction based on size or time. ([\#12000](https://github.com/matrix-org/synapse/issues/12000)) - Implement experimental support for [MSC3720](https://github.com/matrix-org/matrix-doc/pull/3720) (account status endpoints). ([\#12001](https://github.com/matrix-org/synapse/issues/12001), [\#12067](https://github.com/matrix-org/synapse/issues/12067)) - Enable modules to set a custom display name when registering a user. ([\#12009](https://github.com/matrix-org/synapse/issues/12009)) - Advertise Matrix 1.1 and 1.2 support on `/_matrix/client/versions`. ([\#12020](https://github.com/matrix-org/synapse/issues/12020), ([\#12022](https://github.com/matrix-org/synapse/issues/12022)) - Support only the stable identifier for [MSC3069](https://github.com/matrix-org/matrix-doc/pull/3069)'s `is_guest` on `/_matrix/client/v3/account/whoami`. ([\#12021](https://github.com/matrix-org/synapse/issues/12021)) - Use room version 9 as the default room version (per [MSC3589](https://github.com/matrix-org/matrix-doc/pull/3589)). ([\#12058](https://github.com/matrix-org/synapse/issues/12058)) - Add module callbacks to react to user deactivation status changes (i.e. deactivations and reactivations) and profile updates. ([\#12062](https://github.com/matrix-org/synapse/issues/12062)) Bugfixes -------- - Fix a bug introduced in Synapse 1.48.0 where an edit of the latest event in a thread would not be properly applied to the thread summary. ([\#11992](https://github.com/matrix-org/synapse/issues/11992)) - Fix long-standing bug where the `get_rooms_for_user` cache was not correctly invalidated for remote users when the server left a room. ([\#11999](https://github.com/matrix-org/synapse/issues/11999)) - Fix a 500 error with Postgres when looking backwards with the [MSC3030](https://github.com/matrix-org/matrix-doc/pull/3030) `/timestamp_to_event?dir=b` endpoint. ([\#12024](https://github.com/matrix-org/synapse/issues/12024)) - Properly fix a long-standing bug where wrong data could be inserted into the `event_search` table when using SQLite. This could block running `synapse_port_db` with an `argument of type 'int' is not iterable` error. This bug was partially fixed by a change in Synapse 1.44.0. ([\#12037](https://github.com/matrix-org/synapse/issues/12037)) - Fix slow performance of `/logout` in some cases where refresh tokens are in use. The slowness existed since the initial implementation of refresh tokens in version 1.38.0. ([\#12056](https://github.com/matrix-org/synapse/issues/12056)) - Fix a long-standing bug where Synapse would make additional failing requests over federation for missing data. ([\#12077](https://github.com/matrix-org/synapse/issues/12077)) - Fix occasional `Unhandled error in Deferred` error message. ([\#12089](https://github.com/matrix-org/synapse/issues/12089)) - Fix a bug introduced in Synapse 1.51.0 where incoming federation transactions containing at least one EDU would be dropped if debug logging was enabled for `synapse.8631_debug`. ([\#12098](https://github.com/matrix-org/synapse/issues/12098)) - Fix a long-standing bug which could cause push notifications to malfunction if `use_frozen_dicts` was set in the configuration. ([\#12100](https://github.com/matrix-org/synapse/issues/12100)) - Fix an extremely rare, long-standing bug in `ReadWriteLock` that would cause an error when a newly unblocked writer completes instantly. ([\#12105](https://github.com/matrix-org/synapse/issues/12105)) - Make a `POST` to `/rooms/<room_id>/receipt/m.read/<event_id>` only trigger a push notification if the count of unread messages is different to the one in the last successfully sent push. This reduces server load and load on the receiving device. ([\#11835](https://github.com/matrix-org/synapse/issues/11835)) Updates to the Docker image --------------------------- - The Docker image no longer automatically creates a temporary volume at `/data`. This is not expected to affect normal usage. ([\#11997](https://github.com/matrix-org/synapse/issues/11997)) - Use Python 3.9 in Docker images by default. ([\#12112](https://github.com/matrix-org/synapse/issues/12112)) Improved Documentation ---------------------- - Document support for the `to_device`, `account_data`, `receipts`, and `presence` stream writers for workers. ([\#11599](https://github.com/matrix-org/synapse/issues/11599)) - Explain the meaning of spam checker callbacks' return values. ([\#12003](https://github.com/matrix-org/synapse/issues/12003)) - Clarify information about external Identity Provider IDs. ([\#12004](https://github.com/matrix-org/synapse/issues/12004)) Deprecations and Removals ------------------------- - Deprecate using `synctl` with the config option `synctl_cache_factor` and print a warning if a user still uses this option. ([\#11865](https://github.com/matrix-org/synapse/issues/11865)) - Remove support for the legacy structured logging configuration (please see the the [upgrade notes](https://matrix-org.github.io/synapse/develop/upgrade#legacy-structured-logging-configuration-removal) if you are using `structured: true` in the Synapse configuration). ([\#12008](https://github.com/matrix-org/synapse/issues/12008)) - Drop support for [MSC3283](https://github.com/matrix-org/matrix-doc/pull/3283) unstable flags now that the stable flags are supported. ([\#12018](https://github.com/matrix-org/synapse/issues/12018)) - Remove the unstable `/spaces` endpoint from [MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946). ([\#12073](https://github.com/matrix-org/synapse/issues/12073)) Internal Changes ---------------- - Make the `get_room_version` method use `get_room_version_id` to benefit from caching. ([\#11808](https://github.com/matrix-org/synapse/issues/11808)) - Remove unnecessary condition on knock -> leave auth rule check. ([\#11900](https://github.com/matrix-org/synapse/issues/11900)) - Add tests for device list changes between local users. ([\#11972](https://github.com/matrix-org/synapse/issues/11972)) - Optimise calculating `device_list` changes in `/sync`. ([\#11974](https://github.com/matrix-org/synapse/issues/11974)) - Add missing type hints to storage classes. ([\#11984](https://github.com/matrix-org/synapse/issues/11984)) - Refactor the search code for improved readability. ([\#11991](https://github.com/matrix-org/synapse/issues/11991)) - Move common deduplication code down into `_auth_and_persist_outliers`. ([\#11994](https://github.com/matrix-org/synapse/issues/11994)) - Limit concurrent joins from applications services. ([\#11996](https://github.com/matrix-org/synapse/issues/11996)) - Preparation for faster-room-join work: when parsing the `send_join` response, get the `m.room.create` event from `state`, not `auth_chain`. ([\#12005](https://github.com/matrix-org/synapse/issues/12005), [\#12039](https://github.com/matrix-org/synapse/issues/12039)) - Preparation for faster-room-join work: parse MSC3706 fields in send_join response. ([\#12011](https://github.com/matrix-org/synapse/issues/12011)) - Preparation for faster-room-join work: persist information on which events and rooms have partial state to the database. ([\#12012](https://github.com/matrix-org/synapse/issues/12012)) - Preparation for faster-room-join work: Support for calling `/federation/v1/state` on a remote server. ([\#12013](https://github.com/matrix-org/synapse/issues/12013)) - Configure `tox` to use `venv` rather than `virtualenv`. ([\#12015](https://github.com/matrix-org/synapse/issues/12015)) - Fix bug in `StateFilter.return_expanded()` and add some tests. ([\#12016](https://github.com/matrix-org/synapse/issues/12016)) - Use Matrix v1.1 endpoints (`/_matrix/client/v3/auth/...`) in fallback auth HTML forms. ([\#12019](https://github.com/matrix-org/synapse/issues/12019)) - Update the `olddeps` CI job to use an old version of `markupsafe`. ([\#12025](https://github.com/matrix-org/synapse/issues/12025)) - Upgrade Mypy to version 0.931. ([\#12030](https://github.com/matrix-org/synapse/issues/12030)) - Remove legacy `HomeServer.get_datastore()`. ([\#12031](https://github.com/matrix-org/synapse/issues/12031), [\#12070](https://github.com/matrix-org/synapse/issues/12070)) - Minor typing fixes. ([\#12034](https://github.com/matrix-org/synapse/issues/12034), [\#12069](https://github.com/matrix-org/synapse/issues/12069)) - After joining a room, create a dedicated logcontext to process the queued events. ([\#12041](https://github.com/matrix-org/synapse/issues/12041)) - Tidy up GitHub Actions config which builds distributions for PyPI. ([\#12051](https://github.com/matrix-org/synapse/issues/12051)) - Move configuration out of `setup.cfg`. ([\#12052](https://github.com/matrix-org/synapse/issues/12052), [\#12059](https://github.com/matrix-org/synapse/issues/12059)) - Fix error message when a worker process fails to talk to another worker process. ([\#12060](https://github.com/matrix-org/synapse/issues/12060)) - Fix using the `complement.sh` script without specifying a directory or a branch. Contributed by Nico on behalf of Famedly. ([\#12063](https://github.com/matrix-org/synapse/issues/12063)) - Add type hints to `tests/rest/client`. ([\#12066](https://github.com/matrix-org/synapse/issues/12066), [\#12072](https://github.com/matrix-org/synapse/issues/12072), [\#12084](https://github.com/matrix-org/synapse/issues/12084), [\#12094](https://github.com/matrix-org/synapse/issues/12094)) - Add some logging to `/sync` to try and track down #11916. ([\#12068](https://github.com/matrix-org/synapse/issues/12068)) - Inspect application dependencies using `importlib.metadata` or its backport. ([\#12088](https://github.com/matrix-org/synapse/issues/12088)) - Use `assertEqual` instead of the deprecated `assertEquals` in test code. ([\#12092](https://github.com/matrix-org/synapse/issues/12092)) - Move experimental support for [MSC3440](https://github.com/matrix-org/matrix-doc/pull/3440) to `/versions`. ([\#12099](https://github.com/matrix-org/synapse/issues/12099)) - Add `stop_cancellation` utility function to stop `Deferred`s from being cancelled. ([\#12106](https://github.com/matrix-org/synapse/issues/12106)) - Improve exception handling for concurrent execution. ([\#12109](https://github.com/matrix-org/synapse/issues/12109)) - Advertise support for Python 3.10 in packaging files. ([\#12111](https://github.com/matrix-org/synapse/issues/12111)) - Move CI checks out of tox, to facilitate a move to using poetry. ([\#12119](https://github.com/matrix-org/synapse/issues/12119))
| * 1.54.0rc1Olivier Wilkinson (reivilibre)2022-03-021-1/+1
| |
* | Check if instances are lists, not sequences. (#12128)Patrick Cloke2022-03-022-5/+5
| | | | | | | | | | As a str is a sequence, the checks were not granular enough and would allow lists or strings, when only lists were valid.
* | Move scripts directory inside synapse, exposing as setuptools entry_points ↵David Robertson2022-03-029-1/+1852
|/ | | | | | | | | | | | (#12118) * Two scripts are basically entry_points already * Move and rename scripts/* to synapse/_scripts/*.py * Delete sync_room_to_group.pl * Expose entry points in setup.py * Update linter script and config * Fixup scripts & docs mentioning scripts that moved Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Back out in-flight state caching changes. (#12126)reivilibre2022-03-021-218/+25
|
* Make get_room_version use cached get_room_version_id. (#11808)lukasdenk2022-03-021-14/+13
|
* Use importlib.metadata to read requirements (#12088)David Robertson2022-03-0111-115/+141
| | | | | | | | | | | | | | | | | | * Pull runtime dep checks into their own module * Reimplement `check_requirements` using `importlib` I've tried to make this clearer. We start by working out which of Synapse's requirements we need to be installed here and now. I was surprised that there wasn't an easier way to see which packages were installed by a given extra. I've pulled out the error messages into functions that deal with "is this for an extra or not". And I've rearranged the loop over two different sets of requirements into one loop with a "must be instaled" flag. I hope you agree that this is clearer. * Test cases
* Fix rare error in `ReadWriteLock` when writers complete immediately (#12105)Sean Quah2022-03-011-1/+4
| | | | Signed-off-by: Sean Quah <seanq@element.io>
* Add module callbacks called for reacting to deactivation status change and ↵Brendan Abolivier2022-03-014-5/+86
| | | | profile update (#12062)
* Add `stop_cancellation` utility function (#12106)Sean Quah2022-03-011-0/+19
|
* Order in-flight state group queries in biggest-first order (#11610)reivilibre2022-03-011-3/+27
| | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Faster joins: persist to database (#12012)Richard van der Hoff2022-03-0110-5/+264
| | | | | | | | | | | | When we get a partial_state response from send_join, store information in the database about it: * store a record about the room as a whole having partial state, and stash the list of member servers too. * flag the join event itself as having partial state * also, for any new events whose prev-events are partial-stated, note that they will *also* be partial-stated. We don't yet make any attempt to interpret this data, so API calls (and a bunch of other things) are just going to get incorrect data.
* Fix 'Unhandled error in Deferred' (#12089)Richard van der Hoff2022-03-011-32/+32
| | | | | | | | | | | | | * Fix 'Unhandled error in Deferred' Fixes a CRITICAL "Unhandled error in Deferred" log message which happened when a function wrapped with `@cachedList` failed * Minor optimisation to cachedListDescriptor we can avoid re-using `missing`, which saves looking up entries in `deferreds_map`, and means we don't need to copy it. * Improve type annotation on CachedListDescriptor
* Improve exception handling for concurrent execution (#12109)Richard van der Hoff2022-03-013-25/+37
| | | | | | | | | | | | | | | * fix incorrect unwrapFirstError import this was being imported from the wrong place * Refactor `concurrently_execute` to use `yieldable_gather_results` * Improve exception handling in `yieldable_gather_results` Try to avoid swallowing so many stack traces. * mark unwrapFirstError deprecated * changelog
* Remove the unstable `/spaces` endpoint. (#12073)Patrick Cloke2022-02-285-683/+43
| | | | | | | | ...and various code supporting it. The /spaces endpoint was from an old version of MSC2946 and included both a Client-Server and Server-Server API. Note that the unstable /hierarchy endpoint (from the final version of MSC2946) is not yet removed.
* Move experimental support for MSC3440 to /versions. (#12099)Patrick Cloke2022-02-282-3/+2
| | | | Instead of being part of /capabilities, this matches a change to MSC3440 to properly use these endpoints.
* Fix `PushRuleEvaluator` and `Filter` to work on frozendicts (#12100)Richard van der Hoff2022-02-282-6/+7
| | | | | | | | | | * Fix `PushRuleEvaluator` to work on frozendicts frozendicts do not (necessarily) inherit from dict, so this needs to handle them correctly. * Fix event filtering for frozen events Looks like this one was introduced by #11194.
* Actually fix bad debug logging rejecting device list & signing key ↵David Robertson2022-02-281-1/+1
| | | | transactions (#12098)
* Properly failover for unknown endpoints from Conduit/Dendrite. (#12077)Patrick Cloke2022-02-281-9/+13
| | | | | Before this fix, a legitimate 404 from a federation endpoint (e.g. due to an unknown room) would be treated as an unknown endpoint. This could cause unnecessary federation traffic.
* Ensure that `get_datastores().main` is typed (#12070)Sean Quah2022-02-251-1/+2
| | | Signed-off-by: Sean Quah <seanq@element.io>
* Minor typing fixes for `synapse/storage/persist_events.py` (#12069)Sean Quah2022-02-252-23/+25
| | | Signed-off-by: Sean Quah <seanq@element.io>
* Add support for MSC3202: sending one-time key counts and fallback key usage ↵reivilibre2022-02-247-14/+294
| | | | | states to Application Services. (#11617) Co-authored-by: Erik Johnston <erik@matrix.org>
* Fix non-strings in the `event_search` table (#12037)Sean Quah2022-02-243-9/+57
| | | | | | | Don't attempt to add non-string `value`s to `event_search` and add a background update to clear out bad rows from `event_search` when using sqlite. Signed-off-by: Sean Quah <seanq@element.io>
* Add logging to `/sync` for debugging #11916 (#12068)Erik Johnston2022-02-231-0/+9
|
* Remove more references to `get_datastore` (#12067)Richard van der Hoff2022-02-232-5/+2
| | | | | These have snuck in since #12031 was started. Also a couple of other cleanups while we're in the area.
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-23124-243/+246
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Remove excess condition on `knock->leave` check (#11900)Travis Ralston2022-02-221-3/+3
|
* Better error message when failing to request from another process (#12060)Erik Johnston2022-02-221-1/+3
|
* Implement account status endpoints (MSC3720) (#12001)Brendan Abolivier2022-02-229-2/+310
| | | | | See matrix-org/matrix-doc#3720 Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* Cap the number of in-flight requests for state from a single group (#11608)reivilibre2022-02-221-0/+16
|
* Use room version 9 as the default room version (per MSC3589). (#12058)Patrick Cloke2022-02-221-1/+1
|
* Run `_handle_queued_pdus` as a background process (#12041)Richard van der Hoff2022-02-221-2/+4
| | | ... to ensure it gets a proper log context, mostly.
* Fix slow performance of `/logout` in some cases where refresh tokens are in ↵reivilibre2022-02-222-2/+44
| | | | use. The slowness existed since the initial implementation of refresh tokens. (#12056)
* Merge remote-tracking branch 'origin/master' into developErik Johnston2022-02-221-1/+1
|\
| * 1.53.0 v1.53.0Erik Johnston2022-02-221-1/+1
| |
* | Faster joins: Support for calling `/federation/v1/state` (#12013)Richard van der Hoff2022-02-224-17/+206
| | | | | | | | This is an endpoint that we have server-side support for, but no client-side support. It's going to be useful for resyncing partial-stated rooms, so let's introduce it.
* | Fetch images when previewing Twitter URLs. (#11985)AndrewRyanChama2022-02-222-4/+10
| | | | | | | | By including "bot" in the User-Agent, which some sites use to decide whether to include additional Open Graph information.
* | Use v3 endpoints for fallback auth (Matrix 1.1) (#12019)Travis Ralston2022-02-221-4/+4
| |
* | remote join processing: get create event from state, not auth_chain (#12039)Richard van der Hoff2022-02-213-5/+7
| | | | | | A follow-up to #12005, in which I apparently missed that there are a bunch of other places that assume the create event is in the auth chain.
* | Minor typing fixes (#12034)Richard van der Hoff2022-02-213-16/+18
| | | | | | | | | | | | These started failing in https://github.com/matrix-org/synapse/pull/12031... I'm a bit mystified by how they ever worked.
* | Add type hints to `synapse/storage/databases/main` (#11984)Dirk Klimpel2022-02-215-50/+78
| |
* | Advertise Matrix 1.2 in `/_matrix/client/versions` (#12022)Travis Ralston2022-02-211-0/+1
| | | | | | Co-authored-by: Patrick Cloke <patrickc@matrix.org>
* | Document why auth providers aren't validated in the admin API. (#12004)Patrick Cloke2022-02-182-1/+26
| | | | | | | | Since it is reasonable to give a future or past auth provider, which might not be in the current configuration.
* | Track and deduplicate in-flight requests to `_get_state_for_groups`. (#10870)reivilibre2022-02-181-25/+178
| | | | | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* | Upgrade mypy to version 0.931 (#12030)Sean Quah2022-02-186-13/+21
| | | | | | Upgrade mypy to 0.931, mypy-zope to 0.3.5 and fix new complaints.
* | Fix bug in `StateFilter.return_expanded()` and add some tests. (#12016)reivilibre2022-02-181-1/+7
| |
* | Advertise Matrix 1.1 in `/_matrix/client/versions` (#12020)Travis Ralston2022-02-181-0/+1
| |
* | Use stable MSC3069 `is_guest` flag on `/whoami`. (#12021)Travis Ralston2022-02-181-0/+2
| | | | | | Keeping backwards compatibility with the unstable flag for now.
* | Fix 500 error with Postgres when looking backwards with the MSC3030 ↵Eric Eastwood2022-02-181-1/+1
| | | | | | | | `/timestamp_to_event` endpoint (#12024)
* | Remove unstable MSC3283 flags (#12018)Erik Johnston2022-02-172-17/+0
| | | | | | Fixes #11962
* | Allow modules to set a display name on registration (#12009)Brendan Abolivier2022-02-173-0/+70
| | | | | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* | Faster joins: parse msc3706 fields in send_join response (#12011)Richard van der Hoff2022-02-174-33/+107
| | | | | | Part of my work on #11249: add code to handle the new fields added in MSC3706.
* | Remove support for the legacy structured logging configuration. (#12008)Patrick Cloke2022-02-172-167/+8
| |
* | `send_join` response: get create event from `state`, not `auth_chain` (#12005)Richard van der Hoff2022-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | msc3706 proposes changing the `/send_join` response: > Any events returned within `state` can be omitted from `auth_chain`. Currently, we rely on `m.room.create` being returned in `auth_chain`, but since the `m.room.create` event must necessarily be part of the state, the above change will break this. In short, let's look for `m.room.create` in `state` rather than `auth_chain`.
* | Prevent duplicate push notifications for room reads (#11835)lukasdenk2022-02-171-1/+6
| |
* | Fix a typo in a comment.Patrick Cloke2022-02-161-1/+1
| |
* | Limit concurrent AS joins (#11996)Brendan Abolivier2022-02-161-19/+27
| | | | | | | | | | | | | | Initially introduced in matrix-org-hotfixes by e5537cf (and tweaked by later commits). Fixes #11995 See also #4826
* | Optimise calculating device_list changes in `/sync`. (#11974)Erik Johnston2022-02-153-15/+125
| | | | | | | | | | | | For users with large accounts it is inefficient to calculate the set of users they share a room with (and takes a lot of space in the cache). Instead we can look at users whose devices have changed since the last sync and check if they share a room with the syncing user.
* | `_auth_and_persist_outliers`: drop events we have already seen (#11994)Richard van der Hoff2022-02-151-24/+20
| | | | | | | | | | We already have two copies of this code, in 2/3 of the callers of `_auth_and_persist_outliers`. Before I add a third, let's push it down.
* | Track cache invalidations (#12000)Erik Johnston2022-02-153-1/+9
| | | | | | Currently we only track evictions due to size or time constraints.
* | Fix incorrect `get_rooms_for_user` for remote user (#11999)Erik Johnston2022-02-151-11/+16
| | | | | | | | | | | | | | When the server leaves a room the `get_rooms_for_user` cache is not correctly invalidated for the remote users in the room. This means that subsequent calls to `get_rooms_for_user` for the remote users would incorrectly include the room (it shouldn't be included because the server no longer knows anything about the room).