David Robertson
db10f2c037
No longer permit empty body when sending receipts ( #12709 )
2022-05-11 15:34:17 +00:00
Sean Quah
6ee61b9052
Complain if a federation endpoint has the @cancellable
flag ( #12705 )
...
`BaseFederationServlet` wraps its endpoints in a bunch of async code
that has not been vetted for compatibility with cancellation.
Fail CI if a `@cancellable` flag is applied to a federation endpoint.
Signed-off-by: Sean Quah <seanq@element.io>
2022-05-11 14:52:26 +01:00
David Robertson
d38d242411
Reload cache factors from disk on SIGHUP ( #12673 )
2022-05-11 13:43:22 +00:00
Sean Quah
a559c8b0d9
Respect the @cancellable
flag for ReplicationEndpoint
s ( #12700 )
...
While `ReplicationEndpoint`s register themselves via `JsonResource`,
they pass a method that calls the handler, instead of the handler itself,
to `register_paths`. As a result, `JsonResource` will not correctly pick
up the `@cancellable` flag and we have to apply it ourselves.
Signed-off-by: Sean Quah <seanq@element.io>
2022-05-11 12:25:39 +01:00
Sean Quah
9d8e380d2e
Respect the @cancellable
flag for RestServlet
s and BaseFederationServlet
s ( #12699 )
...
Both `RestServlet`s and `BaseFederationServlet`s register their handlers
with `HttpServer.register_paths` / `JsonResource.register_paths`. Update
`JsonResource` to respect the `@cancellable` flag on handlers registered
in this way.
Although `ReplicationEndpoint` also registers itself using
`register_paths`, it does not pass the handler method that would have the
`@cancellable` flag directly, and so needs separate handling.
Signed-off-by: Sean Quah <seanq@element.io>
2022-05-11 12:25:13 +01:00
Sean Quah
dffecade7d
Respect the @cancellable
flag for DirectServe{Html,Json}Resource
s ( #12698 )
...
`DirectServeHtmlResource` and `DirectServeJsonResource` both inherit
from `_AsyncResource`. These classes expect to be subclassed with
`_async_render_*` methods.
This commit has no effect on `JsonResource`, despite inheriting from
`_AsyncResource`. `JsonResource` has its own `_async_render` override
which will need to be updated separately.
Signed-off-by: Sean Quah <seanq@element.io>
2022-05-11 12:24:48 +01:00
Patrick Cloke
a4c75918b3
Remove unneeded ActionGenerator
class. ( #12691 )
...
It simply passes through to `BulkPushRuleEvaluator`, which can be
called directly instead.
2022-05-11 07:15:21 -04:00
Eric Eastwood
84facf769e
Fix /messages
throwing a 500 when querying for non-existent room ( #12683 )
...
Fix https://github.com/matrix-org/synapse/issues/12678
Complement test added: https://github.com/matrix-org/complement/pull/369
**Before:** 500 internal server error
**After:** According to the [spec](https://spec.matrix.org/latest/client-server-api/#get_matrixclientv3roomsroomidmessages ), calling `/messages` against a non-existent `room_id` should throw a 403 forbidden (since you're not part of the room). This also matches the behavior before https://github.com/matrix-org/synapse/pull/12370 which regressed Synapse to the 500 behavior.
```json
{
"errcode": "M_FORBIDDEN",
"error": "User @test:my.synapse.server not in room !dne:my.synapse.server, and room previews are disabled"
}
```
2022-05-10 23:39:14 -05:00
Erik Johnston
c72d26c1e1
Refactor EventContext
( #12689 )
...
Refactor how the `EventContext` class works, with the intention of reducing the amount of state we fetch from the DB during event processing.
The idea here is to get rid of the cached `current_state_ids` and `prev_state_ids` that live in the `EventContext`, and instead defer straight to the database (and its caching).
One change that may have a noticeable effect is that we now no longer prefill the `get_current_state_ids` cache on a state change. However, that query is relatively light, since its just a case of reading a table from the DB (unlike fetching state at an event which is more heavyweight). For deployments with workers this cache isn't even used.
Part of #12684
2022-05-10 19:43:13 +00:00
Sean Quah
c997bfb926
Capture the Deferred
for request cancellation in _AsyncResource
( #12694 )
...
All async request processing goes through `_AsyncResource`, so this is
the only place where a `Deferred` needs to be captured for cancellation.
Unfortunately, the same isn't true for determining whether a request
can be cancelled. Each of `RestServlet`, `BaseFederationServlet`,
`DirectServe{Html,Json}Resource` and `ReplicationEndpoint` have
different wrappers around the method doing the request handling and they
all need to be handled separately.
Signed-off-by: Sean Quah <seanq@element.io>
2022-05-10 20:39:05 +01:00
Patrick Cloke
29f06704b8
Fix incorrect type hint in filtering code. ( #12695 )
2022-05-10 14:10:22 -04:00
Dirk Klimpel
989fa33096
Add some type hints to datastore. ( #12477 )
2022-05-10 14:07:48 -04:00
Richard van der Hoff
147f098fb4
Stop writing to event_reference_hashes
( #12679 )
...
This table is never read, since #11794 . We stop writing to it; in future we can
drop it altogether.
2022-05-10 15:35:08 +01:00
Sean Quah
5cfb004595
Add ability to cancel disconnected requests to SynapseRequest
( #12588 )
...
Signed-off-by: Sean Quah <seanq@element.io>
2022-05-10 14:06:08 +01:00
Sean Quah
5c00151c28
Add @cancellable
decorator, for use on request handlers ( #12586 )
...
Signed-off-by: Sean Quah <seanq@element.io>
2022-05-10 14:05:22 +01:00
David Robertson
2aad0ae57f
Synapse 1.59.0rc1 (2022-05-10)
...
==============================
This release makes several changes that server administrators should be aware of:
- Device name lookup over federation is now disabled by default. ([\#12616](https://github.com/matrix-org/synapse/issues/12616 ))
- The `synapse.app.appservice` and `synapse.app.user_dir` worker application types are now deprecated. ([\#12452](https://github.com/matrix-org/synapse/issues/12452 ), [\#12654](https://github.com/matrix-org/synapse/issues/12654 ))
See [the upgrade notes](https://github.com/matrix-org/synapse/blob/develop/docs/upgrade.md#upgrading-to-v1590 ) for more details.
Additionally, this release removes the non-standard `m.login.jwt` login type from Synapse. It can be replaced with `org.matrix.login.jwt` for identical behaviour. This is only used if `jwt_config.enabled` is set to `true` in the configuration. ([\#12597](https://github.com/matrix-org/synapse/issues/12597 ))
Features
--------
- Support [MSC3266](https://github.com/matrix-org/matrix-doc/pull/3266 ) room summaries over federation. ([\#11507](https://github.com/matrix-org/synapse/issues/11507 ))
- Implement [changes](4a77139249
) to [MSC2285 (hidden read receipts)](https://github.com/matrix-org/matrix-spec-proposals/pull/2285 ). Contributed by @SimonBrandner. ([\#12168](https://github.com/matrix-org/synapse/issues/12168 ), [\#12635](https://github.com/matrix-org/synapse/issues/12635 ), [\#12636](https://github.com/matrix-org/synapse/issues/12636 ), [\#12670](https://github.com/matrix-org/synapse/issues/12670 ))
- Extend the [module API](https://github.com/matrix-org/synapse/blob/release-v1.59/synapse/module_api/__init__.py ) to allow modules to change actions for existing push rules of local users. ([\#12406](https://github.com/matrix-org/synapse/issues/12406 ))
- Add the `notify_appservices_from_worker` configuration option (superseding `notify_appservices`) to allow a generic worker to be designated as the worker to send traffic to Application Services. ([\#12452](https://github.com/matrix-org/synapse/issues/12452 ))
- Add the `update_user_directory_from_worker` configuration option (superseding `update_user_directory`) to allow a generic worker to be designated as the worker to update the user directory. ([\#12654](https://github.com/matrix-org/synapse/issues/12654 ))
- Add new `enable_registration_token_3pid_bypass` configuration option to allow registrations via token as an alternative to verifying a 3pid. ([\#12526](https://github.com/matrix-org/synapse/issues/12526 ))
- Implement [MSC3786](https://github.com/matrix-org/matrix-spec-proposals/pull/3786 ): Add a default push rule to ignore `m.room.server_acl` events. ([\#12601](https://github.com/matrix-org/synapse/issues/12601 ))
- Add new `mau_appservice_trial_days` configuration option to specify a different trial period for users registered via an appservice. ([\#12619](https://github.com/matrix-org/synapse/issues/12619 ))
Bugfixes
--------
- Fix a bug introduced in Synapse 1.48.0 where the latest thread reply provided failed to include the proper bundled aggregations. ([\#12273](https://github.com/matrix-org/synapse/issues/12273 ))
- Fix a bug introduced in Synapse 1.22.0 where attempting to send a large amount of read receipts to an application service all at once would result in duplicate content and abnormally high memory usage. Contributed by Brad & Nick @ Beeper. ([\#12544](https://github.com/matrix-org/synapse/issues/12544 ))
- Fix a bug introduced in Synapse 1.57.0 which could cause `Failed to calculate hosts in room` errors to be logged for outbound federation. ([\#12570](https://github.com/matrix-org/synapse/issues/12570 ))
- Fix a long-standing bug where status codes would almost always get logged as `200!`, irrespective of the actual status code, when clients disconnect before a request has finished processing. ([\#12580](https://github.com/matrix-org/synapse/issues/12580 ))
- Fix race when persisting an event and deleting a room that could lead to outbound federation breaking. ([\#12594](https://github.com/matrix-org/synapse/issues/12594 ))
- Fix a bug introduced in Synapse 1.53.0 where bundled aggregations for annotations/edits were incorrectly calculated. ([\#12633](https://github.com/matrix-org/synapse/issues/12633 ))
- Fix a long-standing bug where rooms containing power levels with string values could not be upgraded. ([\#12657](https://github.com/matrix-org/synapse/issues/12657 ))
- Prevent memory leak from reoccurring when presence is disabled. ([\#12656](https://github.com/matrix-org/synapse/issues/12656 ))
Updates to the Docker image
---------------------------
- Explicitly opt-in to using [BuildKit-specific features](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md ) in the Dockerfile. This fixes issues with building images in some GitLab CI environments. ([\#12541](https://github.com/matrix-org/synapse/issues/12541 ))
- Update the "Build docker images" GitHub Actions workflow to use `docker/metadata-action` to generate docker image tags, instead of a custom shell script. Contributed by @henryclw. ([\#12573](https://github.com/matrix-org/synapse/issues/12573 ))
Improved Documentation
----------------------
- Update SQL statements and replace use of old table `user_stats_historical` in docs for Synapse Admins. ([\#12536](https://github.com/matrix-org/synapse/issues/12536 ))
- Add missing linebreak to `pipx` install instructions. ([\#12579](https://github.com/matrix-org/synapse/issues/12579 ))
- Add information about the TCP replication module to docs. ([\#12621](https://github.com/matrix-org/synapse/issues/12621 ))
- Fixes to the formatting of `README.rst`. ([\#12627](https://github.com/matrix-org/synapse/issues/12627 ))
- Fix docs on how to run specific Complement tests using the `complement.sh` test runner. ([\#12664](https://github.com/matrix-org/synapse/issues/12664 ))
Deprecations and Removals
-------------------------
- Remove unstable identifiers from [MSC3069](https://github.com/matrix-org/matrix-doc/pull/3069 ). ([\#12596](https://github.com/matrix-org/synapse/issues/12596 ))
- Remove the unspecified `m.login.jwt` login type and the unstable `uk.half-shot.msc2778.login.application_service` from
[MSC2778](https://github.com/matrix-org/matrix-doc/pull/2778 ). ([\#12597](https://github.com/matrix-org/synapse/issues/12597 ))
- Synapse now requires at least Python 3.7.1 (up from 3.7.0), for compatibility with the latest Twisted trunk. ([\#12613](https://github.com/matrix-org/synapse/issues/12613 ))
Internal Changes
----------------
- Use supervisord to supervise Postgres and Caddy in the Complement image to reduce restart time. ([\#12480](https://github.com/matrix-org/synapse/issues/12480 ))
- Immediately retry any requests that have backed off when a server comes back online. ([\#12500](https://github.com/matrix-org/synapse/issues/12500 ))
- Use `make_awaitable` instead of `defer.succeed` for return values of mocks in tests. ([\#12505](https://github.com/matrix-org/synapse/issues/12505 ))
- Consistently check if an object is a `frozendict`. ([\#12564](https://github.com/matrix-org/synapse/issues/12564 ))
- Protect module callbacks with read semantics against cancellation. ([\#12568](https://github.com/matrix-org/synapse/issues/12568 ))
- Improve comments and error messages around access tokens. ([\#12577](https://github.com/matrix-org/synapse/issues/12577 ))
- Improve docstrings for the receipts store. ([\#12581](https://github.com/matrix-org/synapse/issues/12581 ))
- Use constants for read-receipts in tests. ([\#12582](https://github.com/matrix-org/synapse/issues/12582 ))
- Log status code of cancelled requests as 499 and avoid logging stack traces for them. ([\#12587](https://github.com/matrix-org/synapse/issues/12587 ), [\#12663](https://github.com/matrix-org/synapse/issues/12663 ))
- Remove special-case for `twisted` logger from default log config. ([\#12589](https://github.com/matrix-org/synapse/issues/12589 ))
- Use `getClientAddress` instead of the deprecated `getClientIP`. ([\#12599](https://github.com/matrix-org/synapse/issues/12599 ))
- Add link to documentation in Grafana Dashboard. ([\#12602](https://github.com/matrix-org/synapse/issues/12602 ))
- Reduce log spam when running multiple event persisters. ([\#12610](https://github.com/matrix-org/synapse/issues/12610 ))
- Add extra debug logging to federation sender. ([\#12614](https://github.com/matrix-org/synapse/issues/12614 ))
- Prevent remote homeservers from requesting local user device names by default. ([\#12616](https://github.com/matrix-org/synapse/issues/12616 ))
- Add a consistency check on events which we read from the database. ([\#12620](https://github.com/matrix-org/synapse/issues/12620 ))
- Remove use of the `constantly` library and switch to enums for `EventRedactBehaviour`. Contributed by @andrewdoh. ([\#12624](https://github.com/matrix-org/synapse/issues/12624 ))
- Remove unused code related to receipts. ([\#12632](https://github.com/matrix-org/synapse/issues/12632 ))
- Minor improvements to the scripts for running Synapse in worker mode under Complement. ([\#12637](https://github.com/matrix-org/synapse/issues/12637 ))
- Move `pympler` back in to the `all` extras. ([\#12652](https://github.com/matrix-org/synapse/issues/12652 ))
- Fix spelling of `M_UNRECOGNIZED` in comments. ([\#12665](https://github.com/matrix-org/synapse/issues/12665 ))
- Release script: confirm the commit to be tagged before tagging. ([\#12556](https://github.com/matrix-org/synapse/issues/12556 ))
- Fix a typo in the announcement text generated by the Synapse release development script. ([\#12612](https://github.com/matrix-org/synapse/issues/12612 ))
- Fix scripts-dev to pass typechecking. ([\#12356](https://github.com/matrix-org/synapse/issues/12356 ))
- Add some type hints to datastore. ([\#12485](https://github.com/matrix-org/synapse/issues/12485 ))
- Remove unused `# type: ignore`s. ([\#12531](https://github.com/matrix-org/synapse/issues/12531 ))
- Allow unused `# type: ignore` comments in bleeding edge CI jobs. ([\#12576](https://github.com/matrix-org/synapse/issues/12576 ))
- Remove redundant lines of config from `mypy.ini`. ([\#12608](https://github.com/matrix-org/synapse/issues/12608 ))
- Update to mypy 0.950. ([\#12650](https://github.com/matrix-org/synapse/issues/12650 ))
- Use `Concatenate` to better annotate `_do_execute`. ([\#12666](https://github.com/matrix-org/synapse/issues/12666 ))
- Use `ParamSpec` to refine type hints. ([\#12667](https://github.com/matrix-org/synapse/issues/12667 ))
- Fix mypy against latest pillow stubs. ([\#12671](https://github.com/matrix-org/synapse/issues/12671 ))
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE1508oLYUKainYFJakD7OEIo53t0FAmJ6UDoACgkQkD7OEIo5
3t3XMw/9GfROfC///lio77EhdI0lh39bkgvfqkFE/wRYtTs4n3ZSiclgVBnNmgnN
WnLvjL/4wXRjzJZ8vcO+qG0OasT3H9l5xdGE+7h8oUMIYCG7Xdyx37xnhv5IC8Y5
dAjqs2mMnIWnAqyOAVZQVgmNLDhRAb9YGCJ3fJY9cV8dmzr8/RzR8gXrFPaBT9Nj
w5Xag0jkiJuff4+Y5oan2yBxMvHT/zAb8rQf5wNjen00lwYHSAr/5aiAsbnHcMYM
q0ZahVB/hVaA5GqxwrySlE0mqrPP6M/CpbcLr1h8LlmLdgA6f3vcf/sREGq6wCRK
Z8yYXM4RyvNTyYirQfnP5QseVazJqcCY0pCXrMnQxwXda7nSDKjXo0WFBmyIQpK4
YqDvlOhECr+Pcac/EAviH2OEvTMBg4cUs1xdm4/CBElIOZQPyXHJ0DLku8R0CRx/
i01fN0I/r/wX1Oliy4wFJgSYt/uUQzZaJmRieK8fznlFibM3Gk1GvniX0M5Hu6cZ
PQuHdPqRxQzvBmEAA1hxTfyOaDeP3g29NnOz9cjsBiAVNqUbEV5KFusjwksI4kcT
Bsdk+v/i8/Kx6t0ovRI2i3JJAFNWmUzpY0iDzY3kJCn1YmEMZ7rs+e5qRmv2eBLW
oS9dhLGsW7A/mJC6fLM+CATwbFiL/SqB5ocnl4POodZ/b27eDyw=
=NPHq
-----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE1508oLYUKainYFJakD7OEIo53t0FAmJ6V/YACgkQkD7OEIo5
3t0ANA/7BZ762LAjLNsFvJVxnH8LjDEjsjCyjHQ/zzVkAete3354zcW/mqN2YzMl
shaxHucfZ9sKCXlOSuwY9N+1Q24ALMAb8QebCQZjNamxKqddpMD0+ijeaKRoFq8P
6VY5saL+rjW0g2QaKE/IHc99UKnw/cNN/vGa3xc3dJFRiiNkK95jS8R7aaaT2mXB
9frbbN0Q45Q6JTU9qJTP6jqdYmKZNjvIHBJcEXkstGqS8NPJXpfVKMZIgTj/8nGL
RVJqOStsnHdx4vywZ76GPTAxQ+ZjXMilIbz+bF/6Zw1SCJEZfwFOelYApwMi0qU7
yDK7xeokKxzXyykzmptmiqmePCbr9fHbk+BJtE7VblMdj7OaM7jX7foSX6J1elIp
zwDwBK0VH3CJzk9SRoy4JW3PI9K45DZodev33CT+sT39/wYTiV3mbGIYkgP8oSDH
rd588QZDovVDy6NWzxkT0MsutHE5Rhx2aP+hkIFDHL4WWnKeFRD5HbiZfg/eC6r0
0nPRY2CCikvqLRqefTi4dgxb+twVBnioPZiDBTEKA/M1/qVg978SIpdHsfmaDJf9
BzWsvfsns0t54J2QnazOjKx2yxIYH6pZ2VFnrb47404O5O3+TuKZL9eX8oNZeBFl
JKZKD2xii/ktkw5p27RxEpBJ13hrssN+RMd0JrvS3LTa5G9aIUM=
=2gaD
-----END PGP SIGNATURE-----
Merge tag 'v1.59.0rc1' into develop
Synapse 1.59.0rc1 (2022-05-10)
==============================
This release makes several changes that server administrators should be aware of:
- Device name lookup over federation is now disabled by default. ([\#12616](https://github.com/matrix-org/synapse/issues/12616 ))
- The `synapse.app.appservice` and `synapse.app.user_dir` worker application types are now deprecated. ([\#12452](https://github.com/matrix-org/synapse/issues/12452 ), [\#12654](https://github.com/matrix-org/synapse/issues/12654 ))
See [the upgrade notes](https://github.com/matrix-org/synapse/blob/develop/docs/upgrade.md#upgrading-to-v1590 ) for more details.
Additionally, this release removes the non-standard `m.login.jwt` login type from Synapse. It can be replaced with `org.matrix.login.jwt` for identical behaviour. This is only used if `jwt_config.enabled` is set to `true` in the configuration. ([\#12597](https://github.com/matrix-org/synapse/issues/12597 ))
Features
--------
- Support [MSC3266](https://github.com/matrix-org/matrix-doc/pull/3266 ) room summaries over federation. ([\#11507](https://github.com/matrix-org/synapse/issues/11507 ))
- Implement [changes](4a77139249
) to [MSC2285 (hidden read receipts)](https://github.com/matrix-org/matrix-spec-proposals/pull/2285 ). Contributed by @SimonBrandner. ([\#12168](https://github.com/matrix-org/synapse/issues/12168 ), [\#12635](https://github.com/matrix-org/synapse/issues/12635 ), [\#12636](https://github.com/matrix-org/synapse/issues/12636 ), [\#12670](https://github.com/matrix-org/synapse/issues/12670 ))
- Extend the [module API](https://github.com/matrix-org/synapse/blob/release-v1.59/synapse/module_api/__init__.py ) to allow modules to change actions for existing push rules of local users. ([\#12406](https://github.com/matrix-org/synapse/issues/12406 ))
- Add the `notify_appservices_from_worker` configuration option (superseding `notify_appservices`) to allow a generic worker to be designated as the worker to send traffic to Application Services. ([\#12452](https://github.com/matrix-org/synapse/issues/12452 ))
- Add the `update_user_directory_from_worker` configuration option (superseding `update_user_directory`) to allow a generic worker to be designated as the worker to update the user directory. ([\#12654](https://github.com/matrix-org/synapse/issues/12654 ))
- Add new `enable_registration_token_3pid_bypass` configuration option to allow registrations via token as an alternative to verifying a 3pid. ([\#12526](https://github.com/matrix-org/synapse/issues/12526 ))
- Implement [MSC3786](https://github.com/matrix-org/matrix-spec-proposals/pull/3786 ): Add a default push rule to ignore `m.room.server_acl` events. ([\#12601](https://github.com/matrix-org/synapse/issues/12601 ))
- Add new `mau_appservice_trial_days` configuration option to specify a different trial period for users registered via an appservice. ([\#12619](https://github.com/matrix-org/synapse/issues/12619 ))
Bugfixes
--------
- Fix a bug introduced in Synapse 1.48.0 where the latest thread reply provided failed to include the proper bundled aggregations. ([\#12273](https://github.com/matrix-org/synapse/issues/12273 ))
- Fix a bug introduced in Synapse 1.22.0 where attempting to send a large amount of read receipts to an application service all at once would result in duplicate content and abnormally high memory usage. Contributed by Brad & Nick @ Beeper. ([\#12544](https://github.com/matrix-org/synapse/issues/12544 ))
- Fix a bug introduced in Synapse 1.57.0 which could cause `Failed to calculate hosts in room` errors to be logged for outbound federation. ([\#12570](https://github.com/matrix-org/synapse/issues/12570 ))
- Fix a long-standing bug where status codes would almost always get logged as `200!`, irrespective of the actual status code, when clients disconnect before a request has finished processing. ([\#12580](https://github.com/matrix-org/synapse/issues/12580 ))
- Fix race when persisting an event and deleting a room that could lead to outbound federation breaking. ([\#12594](https://github.com/matrix-org/synapse/issues/12594 ))
- Fix a bug introduced in Synapse 1.53.0 where bundled aggregations for annotations/edits were incorrectly calculated. ([\#12633](https://github.com/matrix-org/synapse/issues/12633 ))
- Fix a long-standing bug where rooms containing power levels with string values could not be upgraded. ([\#12657](https://github.com/matrix-org/synapse/issues/12657 ))
- Prevent memory leak from reoccurring when presence is disabled. ([\#12656](https://github.com/matrix-org/synapse/issues/12656 ))
Updates to the Docker image
---------------------------
- Explicitly opt-in to using [BuildKit-specific features](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md ) in the Dockerfile. This fixes issues with building images in some GitLab CI environments. ([\#12541](https://github.com/matrix-org/synapse/issues/12541 ))
- Update the "Build docker images" GitHub Actions workflow to use `docker/metadata-action` to generate docker image tags, instead of a custom shell script. Contributed by @henryclw. ([\#12573](https://github.com/matrix-org/synapse/issues/12573 ))
Improved Documentation
----------------------
- Update SQL statements and replace use of old table `user_stats_historical` in docs for Synapse Admins. ([\#12536](https://github.com/matrix-org/synapse/issues/12536 ))
- Add missing linebreak to `pipx` install instructions. ([\#12579](https://github.com/matrix-org/synapse/issues/12579 ))
- Add information about the TCP replication module to docs. ([\#12621](https://github.com/matrix-org/synapse/issues/12621 ))
- Fixes to the formatting of `README.rst`. ([\#12627](https://github.com/matrix-org/synapse/issues/12627 ))
- Fix docs on how to run specific Complement tests using the `complement.sh` test runner. ([\#12664](https://github.com/matrix-org/synapse/issues/12664 ))
Deprecations and Removals
-------------------------
- Remove unstable identifiers from [MSC3069](https://github.com/matrix-org/matrix-doc/pull/3069 ). ([\#12596](https://github.com/matrix-org/synapse/issues/12596 ))
- Remove the unspecified `m.login.jwt` login type and the unstable `uk.half-shot.msc2778.login.application_service` from
[MSC2778](https://github.com/matrix-org/matrix-doc/pull/2778 ). ([\#12597](https://github.com/matrix-org/synapse/issues/12597 ))
- Synapse now requires at least Python 3.7.1 (up from 3.7.0), for compatibility with the latest Twisted trunk. ([\#12613](https://github.com/matrix-org/synapse/issues/12613 ))
Internal Changes
----------------
- Use supervisord to supervise Postgres and Caddy in the Complement image to reduce restart time. ([\#12480](https://github.com/matrix-org/synapse/issues/12480 ))
- Immediately retry any requests that have backed off when a server comes back online. ([\#12500](https://github.com/matrix-org/synapse/issues/12500 ))
- Use `make_awaitable` instead of `defer.succeed` for return values of mocks in tests. ([\#12505](https://github.com/matrix-org/synapse/issues/12505 ))
- Consistently check if an object is a `frozendict`. ([\#12564](https://github.com/matrix-org/synapse/issues/12564 ))
- Protect module callbacks with read semantics against cancellation. ([\#12568](https://github.com/matrix-org/synapse/issues/12568 ))
- Improve comments and error messages around access tokens. ([\#12577](https://github.com/matrix-org/synapse/issues/12577 ))
- Improve docstrings for the receipts store. ([\#12581](https://github.com/matrix-org/synapse/issues/12581 ))
- Use constants for read-receipts in tests. ([\#12582](https://github.com/matrix-org/synapse/issues/12582 ))
- Log status code of cancelled requests as 499 and avoid logging stack traces for them. ([\#12587](https://github.com/matrix-org/synapse/issues/12587 ), [\#12663](https://github.com/matrix-org/synapse/issues/12663 ))
- Remove special-case for `twisted` logger from default log config. ([\#12589](https://github.com/matrix-org/synapse/issues/12589 ))
- Use `getClientAddress` instead of the deprecated `getClientIP`. ([\#12599](https://github.com/matrix-org/synapse/issues/12599 ))
- Add link to documentation in Grafana Dashboard. ([\#12602](https://github.com/matrix-org/synapse/issues/12602 ))
- Reduce log spam when running multiple event persisters. ([\#12610](https://github.com/matrix-org/synapse/issues/12610 ))
- Add extra debug logging to federation sender. ([\#12614](https://github.com/matrix-org/synapse/issues/12614 ))
- Prevent remote homeservers from requesting local user device names by default. ([\#12616](https://github.com/matrix-org/synapse/issues/12616 ))
- Add a consistency check on events which we read from the database. ([\#12620](https://github.com/matrix-org/synapse/issues/12620 ))
- Remove use of the `constantly` library and switch to enums for `EventRedactBehaviour`. Contributed by @andrewdoh. ([\#12624](https://github.com/matrix-org/synapse/issues/12624 ))
- Remove unused code related to receipts. ([\#12632](https://github.com/matrix-org/synapse/issues/12632 ))
- Minor improvements to the scripts for running Synapse in worker mode under Complement. ([\#12637](https://github.com/matrix-org/synapse/issues/12637 ))
- Move `pympler` back in to the `all` extras. ([\#12652](https://github.com/matrix-org/synapse/issues/12652 ))
- Fix spelling of `M_UNRECOGNIZED` in comments. ([\#12665](https://github.com/matrix-org/synapse/issues/12665 ))
- Release script: confirm the commit to be tagged before tagging. ([\#12556](https://github.com/matrix-org/synapse/issues/12556 ))
- Fix a typo in the announcement text generated by the Synapse release development script. ([\#12612](https://github.com/matrix-org/synapse/issues/12612 ))
- Fix scripts-dev to pass typechecking. ([\#12356](https://github.com/matrix-org/synapse/issues/12356 ))
- Add some type hints to datastore. ([\#12485](https://github.com/matrix-org/synapse/issues/12485 ))
- Remove unused `# type: ignore`s. ([\#12531](https://github.com/matrix-org/synapse/issues/12531 ))
- Allow unused `# type: ignore` comments in bleeding edge CI jobs. ([\#12576](https://github.com/matrix-org/synapse/issues/12576 ))
- Remove redundant lines of config from `mypy.ini`. ([\#12608](https://github.com/matrix-org/synapse/issues/12608 ))
- Update to mypy 0.950. ([\#12650](https://github.com/matrix-org/synapse/issues/12650 ))
- Use `Concatenate` to better annotate `_do_execute`. ([\#12666](https://github.com/matrix-org/synapse/issues/12666 ))
- Use `ParamSpec` to refine type hints. ([\#12667](https://github.com/matrix-org/synapse/issues/12667 ))
- Fix mypy against latest pillow stubs. ([\#12671](https://github.com/matrix-org/synapse/issues/12671 ))
2022-05-10 13:17:56 +01:00
Patrick Cloke
b44fbdffa4
Move free functions into PushRuleEvaluatorForEvent. ( #12677 )
...
* Move `_condition_checker` into `PushRuleEvaluatorForEvent`.
* Move the condition cache into `PushRuleEvaluatorForEvent`.
* Improve docstrings.
* Inline a method which is only called once.
2022-05-10 07:54:30 -04:00
Patrick Cloke
02cdace707
Add class-diagrams and notes for push. ( #12676 )
2022-05-10 07:43:34 -04:00
reivilibre
699192fc1a
Add the update_user_directory_from_worker
configuration option (superseding update_user_directory
) to allow a generic worker to be designated as the worker to update the user directory. ( #12654 )
...
Co-authored-by: Shay <hillerys@element.io>
2022-05-10 11:08:45 +01:00
Erik Johnston
8dd3e0e084
Immediately retry any requests that have backed off when a server comes back online. ( #12500 )
...
Otherwise it can take up to a minute for any in-flight `/send` requests to be retried.
2022-05-10 10:39:54 +01:00
Šimon Brandner
ade3008821
Implement MSC3786: Add a default push rule to ignore m.room.server_acl events ( #12601 )
...
Fixes vector-im/element-web#20788
Implements matrix-org/matrix-spec-proposals#3786
2022-05-10 08:57:36 +01:00
Shay
d80a7ab151
Update replication.md
with info on TCP module structure ( #12621 )
2022-05-09 14:46:43 -07:00
Val Lorentz
bf0c3ca20a
Fix inconsistent spelling of 'M_UNRECOGNIZED'. ( #12665 )
2022-05-09 20:29:07 +00:00
Sean Quah
a00462dd99
Implement cancellation support/protection for module callbacks ( #12568 )
...
There's no guarantee that module callbacks will handle cancellation
appropriately. Protect module callbacks with read semantics from
cancellation and avoid swallowing `CancelledError`s that arise.
Other module callbacks, such as the `on_*` callbacks, are presumed to
live on code paths that involve writes and aren't cancellation-friendly.
These module callbacks have been left alone.
Signed-off-by: Sean Quah <seanq@element.io>
2022-05-09 12:31:14 +01:00
David Robertson
8de0facaae
Fix mypy against latest pillow stubs ( #12671 )
2022-05-09 10:48:14 +00:00
David Robertson
fa0eab9c8e
Use ParamSpec
in a few places ( #12667 )
2022-05-09 10:27:39 +00:00
Erik Johnston
c5969b346d
Don't error on unknown receipt types ( #12670 )
...
Fixes #12669
2022-05-09 11:09:19 +01:00
David Robertson
26c1ad71c5
Use Concatenate
to annotate do_execute
( #12666 )
2022-05-09 10:28:38 +01:00
David Robertson
051a1c3f22
Convert stringy power levels to integers on room upgrade ( #12657 )
2022-05-07 13:37:29 +01:00
Erik Johnston
4337d33a73
Prevent memory leak from reoccurring when presence is disabled. ( #12656 )
2022-05-06 16:41:57 +00:00
David Robertson
2607b3e181
Update mypy to 0.950 and fix complaints ( #12650 )
2022-05-06 12:35:20 +00:00
reivilibre
c2d50e9f6c
Add the notify_appservices_from_worker
configuration option (superseding notify_appservices
) to allow a generic worker to be designated as the worker to send traffic to Application Services. ( #12452 )
2022-05-06 11:43:53 +01:00
DeepBlueV7.X
a377a43386
Support MSC3266 room summaries over federation ( #11507 )
...
Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de>
2022-05-05 15:25:00 +01:00
Šimon Brandner
ef86cf3d28
Update _on_new_receipts()
to work with MSC2285 changes. ( #12636 )
2022-05-05 13:25:51 +00:00
reivilibre
07fa53ec40
Improve comments and error messages around access tokens. ( #12577 )
2022-05-05 13:39:59 +01:00
Šimon Brandner
9ae0253f4e
Use private
instead of hidden
in MSC2285 related code. ( #12635 )
2022-05-05 12:31:25 +00:00
Patrick Cloke
f90d381c7b
Edits/annotations should not have any bundled aggregations calculated. ( #12633 )
...
Fixes a regression from 8b309adb43
(#11660 )
and b65acead42
(#11752 ) where events which
themselves were an edit or an annotation could have bundled aggregations calculated,
which is not allowed.
2022-05-05 08:15:12 -04:00
Patrick Cloke
ddc8bba00f
Remove unused receipt datastore methods. ( #12632 )
...
The last usage was removed in 5a1dd297c3
(#8059 ).
2022-05-05 07:51:19 -04:00
Will Hunt
cc7656099d
Fix typo in some instances of enable_registration_token_3pid_bypass. ( #12639 )
2022-05-05 07:11:52 -04:00
Erik Johnston
c0379d6e5b
Reduce log spam when running multiple event persisters ( #12610 )
2022-05-05 10:20:23 +01:00
Will Hunt
2d74a8c178
Add mau_appservice_trial_days
config ( #12619 )
...
* Add mau_appservice_trial_days
* Add a test
* Tweaks
* changelog
* Ensure we sync after the delay
* Fix types
* Add config statement
* Fix test
* Reinstate logging that got removed
* Fix feature name
2022-05-04 19:33:26 +01:00
Patrick Cloke
7fbf42499d
Use getClientAddress
instead of getClientIP
. ( #12599 )
...
getClientIP was deprecated in Twisted 18.4.0, which also added
getClientAddress. The Synapse minimum version for Twisted is
currently 18.9.0, so all supported versions have the new API.
2022-05-04 14:11:21 -04:00
Šimon Brandner
116a4c8340
Implement changes to MSC2285 (hidden read receipts) ( #12168 )
...
* Changes hidden read receipts to be a separate receipt type
(instead of a field on `m.read`).
* Updates the `/receipts` endpoint to accept `m.fully_read`.
2022-05-04 11:59:22 -04:00
Andrew Morgan
332cce8dcf
Disable device name lookup over federation by default ( #12616 )
2022-05-04 16:41:40 +01:00
Patrick Cloke
ba3fd54bad
Remove unstable/unspecced login types. ( #12597 )
...
* `m.login.jwt`, which was never specced and has been deprecated
since Synapse 1.16.0. (`org.matrix.login.jwt` can be used instead.)
* `uk.half-shot.msc2778.login.application_service`, which was
stabilized as part of the Matrix spec v1.2 release.
2022-05-04 13:53:21 +00:00
Sean Quah
b2df0716bc
Improve logging for cancelled requests ( #12587 )
...
Don't log stack traces for cancelled requests and use a custom HTTP
status code of 499.
Signed-off-by: Sean Quah <seanq@element.io>
2022-05-04 13:38:55 +01:00
Patrick Cloke
75dff3dc98
Include bundled aggregations for the latest event in a thread. ( #12273 )
...
The `latest_event` field of the bundled aggregations for `m.thread` relations
did not include bundled aggregations itself. This resulted in clients needing to
immediately request the event from the server (and thus making it useless that
the latest event itself was serialized instead of just including an event ID).
2022-05-04 08:38:18 -04:00
andrew do
01e625513a
remove constantly lib use and switch to enums. ( #12624 )
2022-05-04 11:26:11 +00:00
Richard van der Hoff
96e0cdbc5a
Add a consistency check on events read from the database ( #12620 )
...
I've seen a few errors which can only plausibly be explained by the calculated
event id for an event being different from the ID of the event in the
database. It should be cheap to check this, so let's do so and raise an
exception.
2022-05-03 21:27:52 +01:00
Patrick Cloke
aa5f5ede33
Remove unstable identifiers for MSC3069. ( #12596 )
2022-05-03 12:43:12 -04:00
Richard van der Hoff
d66d68f917
Add extra debug logging to federation sender ( #12614 )
...
... in order to debug some problems we've been having with certain events not
being sent when expected.
2022-05-03 16:32:40 +01:00
Richard van der Hoff
77dee1b451
fix imports
...
broken in 5938928
:-S
2022-05-03 13:59:28 +01:00
Richard van der Hoff
5938928c59
minor wording fix in docstring
2022-05-03 13:50:50 +01:00
Richard van der Hoff
db2edf5a65
Exclude OOB memberships from the federation sender ( #12570 )
...
As the comment says, there is no need to process such events, and indeed we
need to avoid doing so.
Fixes #12509 .
2022-05-03 12:47:56 +00:00
Erik Johnston
ae7858f184
Fix race when persisting an event and deleting a room ( #12594 )
...
This works by taking a row level lock on the `rooms` table at the start of both transactions, ensuring that they don't run at the same time. In the event persistence transaction we also check that there is an entry still in the `rooms` table.
I can't figure out how to do this in SQLite. I was just going to lock the table, but it seems that we don't support that in SQLite either, so I'm *really* confused as to how we maintain integrity in SQLite when using `lock_table`....
2022-05-03 11:47:21 +01:00
Richard van der Hoff
8d156ec0ba
Remove special-case for twisted
logger ( #12589 )
...
This was originally added when we first added a `MemoryHandler` to the default
log config back in https://github.com/matrix-org/synapse/pull/8040 , to ensure
that we didn't explode with an infinite loop if there was an error formatting
the logs.
Since then, we made additional improvements to logging which make this
workaround redundant. In particular:
* we no longer attempt to log un-UTF8-decodable byte sequences, which were the
most likely cause of an error in the first place.
* https://github.com/matrix-org/synapse/pull/8268 ensures that in the unlikely
case that there *is* an error, it won't cause an infinite loop.
2022-04-29 22:05:18 +01:00
Patrick Cloke
3ae56d125c
Improve the docstrings for the receipts store. ( #12581 )
2022-04-28 17:58:58 +00:00
Sean Quah
0b684b59e5
Fix logging of incorrect status codes for disconnected requests ( #12580 )
...
The status code of requests must always be set, regardless of client
disconnection, otherwise they will always be logged as 200!.
Broken for `respond_with_json` in
f48792eec4
.
Broken for `respond_with_json_bytes` in
3e58ce72b4
.
Broken for `respond_with_html_bytes` in
ea26e9a98b
.
Signed-off-by: Sean Quah <seanq@element.io>
2022-04-28 15:49:50 +00:00
Sean Quah
78b99de7c2
Prefer make_awaitable
over defer.succeed
in tests ( #12505 )
...
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>
2022-04-27 14:58:26 +01:00
Brendan Abolivier
5ef673de4f
Add a module API to allow modules to edit push rule actions ( #12406 )
...
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2022-04-27 13:55:33 +00:00
David Robertson
6463244375
Remove unused # type: ignore
s ( #12531 )
...
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.
2022-04-27 14:03:44 +01:00
Patrick Cloke
8a23bde823
Consistently use collections.abc.Mapping to check frozendict. ( #12564 )
2022-04-27 09:00:07 -04:00
Will Hunt
e8d1ec0e92
Add option to enable token registration without requiring 3pids ( #12526 )
2022-04-27 12:57:53 +00:00
Dirk Klimpel
b76f1a4d5f
Add some type hints to datastore ( #12485 )
2022-04-27 13:05:00 +01:00
Nick Mills-Barrett
63ba9ba38b
Bound ephemeral events by key ( #12544 )
...
Co-authored-by: Brad Murray <bradtgmurray@gmail.com>
Co-authored-by: Andrew Morgan <andrewm@element.io>
2022-04-26 20:14:21 +01:00
Erik Johnston
f59e3f4c90
Mark remote device list updates as already handled ( #12557 )
2022-04-26 17:07:21 +01:00
David Robertson
6d89f1239c
Comment out dodgy log-kv ( #12554 )
2022-04-26 15:53:06 +01:00
Erik Johnston
c48ab3734e
Fix sending opentracing contexts to remote servers ( #12555 )
2022-04-26 14:48:16 +00:00
Richard van der Hoff
17d99f758a
Optimise backfill calculation ( #12522 )
...
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.
2022-04-26 10:27:11 +01:00
Sean Quah
8a87b4435a
Handle cancellation in EventsWorkerStore._get_events_from_cache_or_db
( #12529 )
...
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>
2022-04-25 19:39:17 +01:00
Patrick Cloke
185da8f0f2
Misc. clean-ups to the relations code ( #12519 )
...
* Corrects some typos / copy & paste errors in tests.
* Clarifies docstrings.
* Removes an unnecessary method.
2022-04-25 08:25:56 -04:00
Sean Quah
a50fb411b3
Update delay_cancellation
to accept any awaitable ( #12468 )
...
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>
2022-04-22 18:20:06 +01:00
Will Hunt
b82fff66df
MSC3202: Fix device_unused_fallback_keys -> device_unused_fallback_key_types ( #12520 )
...
* Fix device_unused_fallback_keys -> device_unused_fallback_key_types
* changelog
2022-04-22 16:03:46 +01:00
Richard van der Hoff
f5668f0b4a
Await un-partial-stating after a partial-state join ( #12399 )
...
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.
2022-04-21 07:42:03 +01:00
David Robertson
e5a76ec00b
Dump setuptools; correct pyproject version number ( #12478 )
2022-04-20 17:33:20 +01:00
Patrick Cloke
103f51d867
Fix Jinja templating error when generating thumbnail URLs. ( #12510 )
...
scale is meant to be a constant string, not refer to a variable.
2022-04-20 12:03:03 -04:00
Tulir Asokan
4bc8cb4669
Implement MSC2815: allow room moderators to view redacted event content ( #12427 )
...
Implements matrix-org/matrix-spec-proposals#2815
Signed-off-by: Tulir Asokan <tulir@maunium.net>
2022-04-20 12:57:39 +01:00
Erik Johnston
c1482a352a
Fix returned count of delete extremities admin API ( #12496 )
2022-04-19 16:49:45 +01:00
Richard van der Hoff
b80bb7e452
Fix /room/.../event/...
to return the *original* event after any edits ( #12476 )
...
This is what the MSC (now) requires. Fixes https://github.com/matrix-org/synapse/issues/10310 .
2022-04-19 16:42:19 +01:00
Jan Christian Grünhage
a1f87f57ff
Implement MSC3383: include destination in X-Matrix auth header ( #11398 )
...
Co-authored-by: Jan Christian Grünhage <jan.christian@gruenhage.xyz>
Co-authored-by: Marcus Hoffmann <bubu@bubu1.eu>
2022-04-19 16:23:53 +01:00
Olivier Wilkinson (reivilibre)
0921d93dcd
Merge branch 'master' into develop
2022-04-19 13:28:28 +01:00
Richard van der Hoff
b121a3ad2b
Back out implementation of MSC2314 ( #12474 )
...
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.
2022-04-19 11:17:29 +00:00
Olivier Wilkinson (reivilibre)
88fe72cc1e
1.57.0
2022-04-19 11:00:37 +01:00
Travis Ralston
f8d3ee9570
Fix grammatical error in error message ( #12483 )
...
* Fix grammatical error in error message
* changelog
2022-04-18 12:41:55 -06:00
Erik Johnston
0b014eb25e
Only send out device list updates for our own users ( #12465 )
...
Broke in #12365
2022-04-14 13:05:31 +01:00
Shay
8e2759f2d8
Limit device_id
size to 512B ( #12454 )
...
*
2022-04-13 10:04:01 -07:00
David Baker
73d8ded0b0
Prevent a sync request from removing a user's busy presence status ( #12213 )
...
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.
2022-04-13 16:21:07 +01:00
Nick Mills-Barrett
e3a49f4784
Fix missing sync events during historical batch imports ( #12319 )
...
Discovered after much in-depth investigation in #12281 .
Closes : #12281
Closes : #3305
Signed off by: Nick Mills-Barrett nick@beeper.com
2022-04-13 11:38:35 +01:00
Jonathan de Jong
36d8b83888
Rename Mutual Rooms unstable_features
flag to match MSC ( #12445 )
...
Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>
2022-04-13 10:32:44 +01:00
Erik Johnston
aa28110264
Process device list updates asynchronously ( #12365 )
2022-04-12 16:50:40 +01:00
Patrick Cloke
4bdbebccb9
Remove the unstable event field for /send_join
per MSC3083. ( #12395 )
...
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).
2022-04-12 11:27:45 -04:00
Erik Johnston
a468768104
Merge branch 'release-v1.57' into develop
2022-04-12 15:28:41 +01:00
Patrick Cloke
9535fd0f9c
Disable groups/communities by default. ( #12344 )
...
This disables the endpoints (and sync response fields) for
groups/communities by default.
2022-04-12 10:20:46 -04:00
Richard van der Hoff
320186319a
Resync state after partial-state join ( #12394 )
...
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.
2022-04-12 13:23:43 +00:00
Patrick Cloke
86cf6a3a17
Remove references to unstable identifiers from MSC3440. ( #12382 )
...
Removes references to unstable thread relation, unstable
identifiers for filtering parameters, and the experimental
config flag.
2022-04-12 08:42:03 -04:00
Erik Johnston
641f43ba81
1.57.0rc1
2022-04-12 13:39:35 +01:00
Dirk Klimpel
1783156dbc
Add some type hints to datastore ( #12423 )
...
* 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`
2022-04-12 11:54:00 +01:00
Erik Johnston
3ad74b63e5
Specify tls extra for Twisted dependency. ( #12444 )
...
* 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.
2022-04-12 10:49:02 +00:00
Patrick Cloke
ab3165efb7
Remove experimental configuration flag for MSC3666. ( #12436 )
2022-04-11 15:37:46 -04:00
Patrick Cloke
4586119f0b
Add missing type hints to config classes. ( #12402 )
2022-04-11 12:07:23 -04:00
Patrick Cloke
772bad2562
Do not consider events by ignored users for bundled aggregations ( #12235 )
...
Consider the requester's ignored users when calculating the
bundled aggregations.
See #12285 / 4df10d3214
for corresponding changes for the `/relations` endpoint.
2022-04-11 10:09:57 -04:00
David Robertson
961ee75a9b
Disallow untyped defs in synapse._scripts ( #12422 )
...
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.
2022-04-11 12:41:55 +01:00
reivilibre
85ca963c1a
Add Module API for reading and writing global account data. ( #12391 )
2022-04-11 10:05:43 +01:00
reivilibre
e630722f11
Optimise _update_client_ips_batch_txn
to batch together database operations. ( #12252 )
...
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-04-08 15:29:13 +01:00
David Robertson
0cd182f296
Make synapse._scripts
pass typechecks ( #12421 )
2022-04-08 14:00:12 +00:00
David Robertson
95a038c106
Unify HTTP query parameter type hints ( #12415 )
...
* Pull out query param types to `synapse.http.types`
* Use QueryParams everywhere
* Simplify `encode_query_args`
* Add annotation which would have caught #12410
2022-04-08 13:06:51 +01:00
Jorge Florian
2e2d8cc2f9
Update the server notices user profile in room if changed. ( #12115 )
2022-04-08 07:51:27 -04:00
Erik Johnston
7732c4902c
Fix rejecting invites over federation ( #12409 )
...
Currently causes future incremental syncs to fail.
Broke by #12191
2022-04-07 15:54:16 +01:00
Erik Johnston
36af768c13
Fix fetching public rooms over federation ( #12410 )
...
Broke by #12364
2022-04-07 14:18:02 +00:00
Patrick Cloke
1a90c1e3af
Do not add groups to sync results if disabled. ( #12408 )
2022-04-07 09:29:56 -04:00
Erik Johnston
d1cd96ce29
Add opentracing spans to calls to external cache ( #12380 )
2022-04-07 13:18:29 +01:00
Patrick Cloke
0bcb651b3f
Support the v1 endpoint for /relations
. ( #12403 )
...
Now that MSC2675 has passed FCP and the implementation is
compliant with the final version.
2022-04-07 07:08:23 -04:00
Patrick Cloke
05a37f4008
Remove support for the unstable identifier from MSC3288. ( #12398 )
2022-04-06 13:27:46 -04:00
David Robertson
2cf74cf2fc
Narrow the importlib_metadata
dependency ( #12400 )
2022-04-06 17:37:56 +01:00
Richard van der Hoff
6fe757d69e
Fix synapse_event_persisted_position
metric ( #12390 )
...
Fixes a bug introduced in #11417 where we would only included backfilled events
in `synapse_event_persisted_position`
2022-04-06 13:52:39 +00:00
Richard van der Hoff
ae01a7edd3
Update type annotations for compatiblity with prometheus_client 0.14 ( #12389 )
...
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.
2022-04-06 12:59:04 +00:00
Eric Eastwood
793d03e2c5
Generate historic pagination token for /messages
when no ?from
token provided ( #12370 )
2022-04-06 11:40:28 +01:00
David Robertson
573cd0f92f
Add missing dependency on importlib_metadata ( #12384 )
2022-04-05 18:25:56 +00:00
Sean Quah
fd1e7d0fc2
Post 1.56.0 release tidy up ( #12379 )
2022-04-05 17:35:20 +01:00
Sean Quah
79e7c2c426
Fix edge case where a Linearizer
could get stuck ( #12358 )
...
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>
2022-04-05 17:19:16 +01:00
Sean Quah
31c1209c50
Make StreamToken
and RoomStreamToken
methods propagate cancellations ( #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>
2022-04-05 16:56:52 +01:00
Sean Quah
800ba87cc8
Refactor and convert Linearizer
to async ( #12357 )
...
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>
2022-04-05 15:43:52 +01:00
Sean Quah
ab3fdcf960
Merge branch 'master' into develop
2022-04-05 15:14:53 +01:00
Erik Johnston
66053b6bfb
Prefill more stream change caches. ( #12372 )
2022-04-05 14:26:41 +01:00
reivilibre
42d8710f38
Fix a spec compliance issue where requests to the /publicRooms
federation API would specify limit
as a string. ( #12364 )
2022-04-05 12:45:36 +01:00
Sean Quah
7a95e80418
1.56.0
2022-04-05 12:44:00 +01:00
Richard van der Hoff
efdbcfd6af
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 ))
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEdVkXOgzrGzds0jtrHgFcFF8ZFs0FAmJC33MACgkQHgFcFF8Z
Fs0IFhAAhz45kNCqWfBip8yc7GE95ZnMfX4PymrIQeJOtloecQCyRrcS8r0GJhvq
j5cRfMNoaoMZKOQsqyjLiY02QUX/8hUOgAD4SEa9Jmc4a2ZwjJ3hxy8dKx89gdZ+
E+uUhJZUNV9UovDIOYd+DPB1//tFdzfYtZmbmddJbWv2jZwb4fmTEnK+j5dp4TMR
Z6/aA1IQB2PZqihQLmtKHCC6xCv7zaCmvS7Z1oUACOm7W1cX0F2P51M11+rK5ipi
tasRBhdGmMu9eGm9QfeQkY++5HLjTfNuSwSP37tP5RMjKckpJS7f6vooJ7EtVtaY
YPlTsjsngWaDk+ETK9ZN3ATtI1StB+6agiTAjO3kJzai++eKQaNrkzIhhftLYfsa
2CIoy2BM7iPp/u+MF5VkxN/QCcnK43VuDU+iR8MCzjTQJPSxsAYrjsd8MMD0rCBa
dib2IdF1Xlijg0iSdV/ToeMx/KDYh+l5hcltkLy1To68IvFqf0kGvlcDk2rtLWzz
QsWf5PGc+YXQM8IMF38BmuE1HCI0rEJH5V/Jl1UkXFaQdf1bIXmWxKTNHjVP/2Uq
dfI4qPtszWOjJT7bBgJbjqX1QBzzIU7ShM8cRlj4Lfc6bdhWG3G+CCACl29t/T9K
NBboIPEbCqw2GJMz1EoNciRHhFnsvQyG1QaHywRwaIuzNX8ohEw=
=J5w/
-----END PGP SIGNATURE-----
Merge tag 'v1.56.0rc1' into develop
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 ))
2022-04-05 12:26:20 +01:00
Sean Quah
ca7e34cb57
Pin signedjson to <= 1.1.1 as a temporary workaround for #12324
...
To be reverted after the Synapse 1.56 release.
Signed-off-by: Sean Quah <seanq@element.io>
2022-04-05 12:13:44 +01:00
David Robertson
a7293ef16f
Bump black
and click
versions ( #12320 )
2022-04-05 11:04:28 +01:00
Eric Eastwood
5218fe7670
Explain how to decipher live and historic pagination tokens ( #12317 )
2022-04-05 10:57:09 +01:00
Eric Eastwood
9633eb2162
Allow non-member state sent in room batch to resolve for historic events (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.
2022-04-04 14:54:50 -05:00
Erik Johnston
b446c99ac9
Prefill the device_list_stream_cache ( #12367 )
...
* Prefill the device_list_stream_cache
* Newsfile
* Newsfile
2022-04-04 20:12:25 +01:00
Erik Johnston
5c9e39e619
Track device list updates per room. ( #12321 )
...
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.
2022-04-04 15:25:20 +01:00
reivilibre
c4cf916ed7
Default to private
room visibility rather than public
when a client does not specify one, according to spec. ( #12350 )
2022-04-01 15:55:09 +01:00
Nick Mills-Barrett
993d90f82b
Use a sequence to generate AS transaction IDs, drop last_txn
AS state ( #12209 )
...
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.
2022-04-01 13:33:25 +00:00
reivilibre
f871222880
Move update_client_ip
background job from the main process to the background worker. ( #12251 )
2022-04-01 13:08:55 +01:00
Richard van der Hoff
319a805cd3
Raise an exception when getting state at an outlier ( #12191 )
...
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.
2022-04-01 13:01:49 +01:00
Richard van der Hoff
9b43df1f7b
Optimise _get_state_after_missing_prev_event
: use /state
( #12040 )
...
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.
2022-04-01 12:53:42 +01:00
Brendan Abolivier
e4409301ba
Add a module callback to react to account data changes ( #12327 )
...
Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2022-04-01 11:22:48 +02:00
Amanda Graven
4e900ece42
Add set_user_admin function to the module API ( #12341 )
2022-04-01 09:31:30 +01:00
Patrick Cloke
bebf994ee8
Move MSC2654 support behind an experimental configuration flag. ( #12295 )
...
To match the current thinking on disabling experimental features by default.
2022-03-31 15:05:13 -04:00
Richard van der Hoff
6927d87254
Handle outliers in /federation/v1/event
( #12332 )
...
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.
2022-03-31 17:39:34 +00:00
Patrick Cloke
11df4ec6c2
Add more type hints to the main state store. ( #12267 )
2022-03-31 13:38:09 -04:00
Brendan Abolivier
5e88143dff
Add a callback to react to 3PID associations ( #12302 )
2022-03-31 18:27:21 +02:00
Patrick Cloke
adbf975623
Remove an unnecessary class from the relations code. ( #12338 )
...
The PaginationChunk class attempted to bundle some properties
together, but really just caused callers to jump through hoops and
hid implementation details.
2022-03-31 07:13:49 -04:00
Brendan Abolivier
f96b85eca8
Ensure the type of URL attributes is always str when matching against preview blacklist ( #12333 )
2022-03-31 11:49:49 +02:00
Patrick Cloke
c31c1091d4
Remove the unused and unstable /aggregations
endpoint. ( #12293 )
...
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.
2022-03-30 11:45:32 -04:00
Andrew Morgan
d8d0271977
Send device list updates to application services (MSC3202) - part 1 ( #11881 )
...
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-03-30 14:39:27 +01:00
Andrew Morgan
c8cbd66d3b
Start application service stream token tracking from 1 ( #12193 )
...
Co-authored-by: Erik Johnston <erik@matrix.org>
2022-03-30 11:10:12 +00:00
Richard van der Hoff
9b67715bc3
Disable proactive sends for remote joins ( #12330 )
...
Do not attempt to send remote joins out over federation. Normally, it will do
nothing; occasionally, it will do the wrong thing.
2022-03-30 12:04:35 +01:00
Brendan Abolivier
437a8ed9ef
Add a configuration to exclude rooms from sync response ( #12310 )
2022-03-30 09:43:04 +00:00
David Robertson
e0bb268134
Fix typechecker problems exposed by signedjson 1.1.2 ( #12326 )
2022-03-29 21:37:50 +00:00
Richard van der Hoff
1f32b90b0f
Room batch: fix up handling of unknown prev_event_ids ( #12316 )
2022-03-29 14:56:25 +01:00
Sean Quah
8a519f8abc
Update LoggingTransaction.call_after
and call_on_exception
docstrings ( #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>
2022-03-29 12:31:05 +01:00
David Robertson
a2b00a4486
Bump black
and click
versions ( #12320 )
2022-03-29 10:41:19 +00:00
Brendan Abolivier
b690fe749b
1.56.0rc1
2022-03-29 10:41:04 +01:00
Eric Eastwood
6f2943714b
Remove unused auth_event_ids
argument plumbing ( #12304 )
...
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`
2022-03-29 09:18:52 +01:00
Richard van der Hoff
287a9c1e20
Exclude outliers in on_backfill_request
( #12314 )
...
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.
2022-03-28 19:20:14 +01:00
Dirk Klimpel
ac95167d2f
Add some type hints to datastore. ( #12255 )
2022-03-28 14:11:14 -04:00
Brendan Abolivier
4ba55a620f
Un-revert Jinja2 fix ( #12313 )
...
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2022-03-28 17:02:57 +00:00
Brendan Abolivier
8cd760fca8
Allow modules to store already existing 3PID associations ( #12195 )
2022-03-28 18:57:19 +02:00
reivilibre
89f11f8c6f
Improve type annotations for execute_values
. ( #12311 )
2022-03-28 17:21:23 +01:00
Shay
3c41d87b67
Add restrictions by default to open registration in Synapse ( #12091 )
2022-03-25 10:11:01 -07:00
Erik Johnston
7ca8ee67a5
Add cache for get_membership_from_event_ids
( #12272 )
...
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>
2022-03-25 14:58:56 +00:00
Richard van der Hoff
38adf14998
Enhance logging for inbound federation events ( #12301 )
...
It is currently rather hard to see which rooms are causing inbound federation
traffic. Add the room id to the logs.
2022-03-25 14:44:57 +00:00
Eric Eastwood
14662d3c18
Refactor create_new_client_event
to use a new parameter, 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 )
2022-03-25 09:21:06 -05:00
David Robertson
fffb3c4c8f
Always allow the empty string as an avatar_url. ( #12261 )
...
Hopefully this fixes #12257 .
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-03-25 13:28:42 +00:00
Richard van der Hoff
b0659a112d
Merge branch 'master' into develop
2022-03-24 19:39:45 +00:00
Richard van der Hoff
1642abd77e
1.55.2
2022-03-24 19:13:20 +00:00
Andrew Morgan
84eb14c4d2
Pin Jinja to <3.1.0 ( #12297 )
...
as 3.1.0 removed the deprecated jinja2.Markup class which we still rely on.
2022-03-24 18:59:31 +00:00
Andrew Morgan
0004260952
Revert "Replace instances of deprecated Jinja2.Markup
with markupsafe.Markup
" ( #12296 )
...
This reverts commit 8810c93e82
.
2022-03-24 18:42:04 +00:00
Andrew Morgan
a503c2c388
Merge branch 'master' into develop
2022-03-24 18:14:26 +00:00
Andrew Morgan
088f3ae182
1.55.1
2022-03-24 17:47:03 +00:00
Andrew Morgan
8810c93e82
Replace instances of deprecated Jinja2.Markup
with markupsafe.Markup
( #12289 )
...
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-03-24 17:16:13 +00:00
Patrick Cloke
4df10d3214
Do not consider events by ignored users for relations ( #12285 )
...
Filter the events returned from `/relations` for the requester's ignored users
in a similar way to `/messages` (and `/sync`).
2022-03-24 10:25:42 -04:00
Brendan Abolivier
5436b014f4
Optionally include account validity in MSC3720 account status responses ( #12266 )
2022-03-24 11:19:41 +01:00
Shay
e78d4f61fc
Refuse to start if DB has an unsafe locale ( #12262 )
2022-03-23 10:23:05 -07:00
David Robertson
f4c5e5864c
Use psycopg2 type stubs ( #12269 )
2022-03-23 14:03:24 +00:00
Jonathan de Jong
c5776780f0
Remove mutual_rooms update_user_directory
check, and add extra documentation ( #12038 )
...
Resolves #10339
2022-03-23 12:47:07 +00:00
Nicolas Werner
692b82838e
Allow registering admin users using the module API ( #12250 )
...
Signed-off-by: Nicolas Werner <n.werner@famedly.com>
2022-03-23 12:48:47 +01:00
Jonathan de Jong
516d092ff9
Rename shared_rooms to mutual_rooms ( #12036 )
...
Co-authored-by: reivilibre <olivier@librepush.net>
2022-03-23 11:19:20 +00:00
Andrew Morgan
831d4797ab
Merge branch 'master' into develop
2022-03-22 16:31:28 +00:00
Andrew Morgan
34baf76451
1.55.0
2022-03-22 14:02:52 +00:00
Michael Telatynski
01211e0c16
Tweak copy for sso account details template ( #12265 )
...
* Tweak copy for sso account details template
* Update sso footer copyright year
* Add newsfragment
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2022-03-22 10:22:25 +00:00
David Robertson
0a59f977a2
Merge branch 'release-v1.55' into develop
2022-03-21 12:29:53 +00:00
reivilibre
6134b3079e
Reword 'Choose your user name' as 'Choose your account name' in the SSO 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>
2022-03-21 12:16:46 +00:00
Nick Mills-Barrett
1530cef192
Make it possible to enable compression for the metrics HTTP resource ( #12258 )
...
* 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
2022-03-21 11:52:10 +00:00
Richard van der Hoff
afa17f0eab
Return a 404 from /state
for an outlier ( #12087 )
...
* 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
2022-03-21 11:23:32 +00:00
David Robertson
bf9d549e3a
Try to detect borked package installations. ( #12244 )
...
* Try to detect borked package installations.
Fixes #12223 .
Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
2022-03-18 19:03:46 +00:00
Patrick Cloke
8fe930c215
Move get_bundled_aggregations to relations handler. ( #12237 )
...
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.
2022-03-18 17:49:32 +00:00
Patrick Cloke
80e0e1f35e
Only fetch thread participation for events with threads. ( #12228 )
...
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.
2022-03-18 17:15:45 +00:00
Dirk Klimpel
c46065fa3d
Add some type hints to datastore ( #12248 )
...
* inherit `MonthlyActiveUsersStore` from `RegistrationWorkerStore`
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-03-18 15:24:18 +00:00
David Robertson
872dbb0181
Correct check_username_for_spam
annotations and docs ( #12246 )
...
* 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>
2022-03-18 13:51:41 +00:00
Patrick Cloke
3f7cfbc9e5
Merge branch 'release-v1.55' into develop
2022-03-16 12:22:07 -04:00
Patrick Cloke
96274565ff
Fix bundling aggregations if unsigned is not a returned event field. ( #12234 )
...
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.
2022-03-16 12:17:39 -04:00
Sean Quah
6121056740
Handle cancellation in DatabasePool.runInteraction()
( #12199 )
...
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>
2022-03-16 15:07:41 +00:00
Patrick Cloke
fc9bd620ce
Add a relations handler to avoid duplication. ( #12227 )
...
Adds a handler layer between the REST and datastore layers for relations.
2022-03-16 10:39:15 -04:00
Patrick Cloke
c486fa5fd9
Add some missing type hints to cache datastore. ( #12216 )
2022-03-16 10:37:04 -04:00
David Robertson
86965605a4
Fix dead link in spam checker warning ( #12231 )
2022-03-16 13:52:59 +00:00
Patrick Cloke
4587b35929
Clean-up logic for rebasing URLs during URL preview. ( #12219 )
...
By using urljoin from the standard library and reducing the number
of places URLs are rebased.
2022-03-16 07:21:36 -04:00