Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: matrix-org/synapse
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3075b29770384e80323d8589f5e3c0feefcca3bf
Choose a base ref
..
head repository: matrix-org/synapse
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 603b78112ee50f3c02a5a24c32e11a4935b95956
Choose a head ref
Showing with 4,478 additions and 739 deletions.
  1. +4 −0 .ci/latest_deps_build_failed_issue_template.md
  2. +0 −4 .dockerignore
  3. +156 −0 .github/workflows/latest_deps.yml
  4. +1 −1 .github/workflows/tests.yml
  5. +1 −2 .gitignore
  6. +24 −3 CHANGES.md
  7. +0 −54 MANIFEST.in
  8. +18 −15 README.rst
  9. +1 −0 changelog.d/11398.feature
  10. +1 −0 changelog.d/12337.feature
  11. +1 −0 changelog.d/12368.doc
  12. +1 −0 changelog.d/12427.feature
  13. +1 −0 changelog.d/12449.misc
  14. +1 −0 changelog.d/12451.doc
  15. +1 −0 changelog.d/12454.misc
  16. +1 −0 changelog.d/12455.misc
  17. +1 −0 changelog.d/12457.doc
  18. +1 −0 changelog.d/12464.misc
  19. +1 −0 changelog.d/12465.feature
  20. +1 −0 changelog.d/12466.misc
  21. +1 −0 changelog.d/12467.misc
  22. +1 −0 changelog.d/12472.misc
  23. +1 −0 changelog.d/12474.misc
  24. +1 −0 changelog.d/12475.doc
  25. +1 −0 changelog.d/12476.bugfix
  26. +1 −0 changelog.d/12478.misc
  27. +1 −0 changelog.d/12483.misc
  28. +1 −0 changelog.d/12495.doc
  29. +1 −0 changelog.d/12496.bugfix
  30. +1 −0 changelog.d/12497.misc
  31. +1 −0 changelog.d/12510.bugfix
  32. +1 −0 changelog.d/12511.misc
  33. +1 −0 changelog.d/12514.misc
  34. +16 −4 debian/build_virtualenv
  35. +18 −0 debian/changelog
  36. +1 −0 debian/clean
  37. +2 −4 docker/Dockerfile
  38. +14 −3 docker/Dockerfile-workers
  39. +7 −33 docker/complement/SynapseWorkers.Dockerfile
  40. +50 −0 docker/complement/conf-workers/start-complement-synapse-workers.sh
  41. +3 −0 docker/conf-workers/supervisord.conf.j2
  42. +36 −23 docker/configure_workers_and_start.py
  43. +1 −0 docs/SUMMARY.md
  44. +15 −39 docs/code_style.md
  45. +25 −21 docs/development/contributing_guide.md
  46. +239 −0 docs/development/dependencies.md
  47. +5 −5 docs/systemd-with-workers/README.md
  48. +0 −13 docs/systemd-with-workers/workers/federation_reader.yaml
  49. +13 −0 docs/systemd-with-workers/workers/generic_worker.yaml
  50. +20 −16 docs/upgrade.md
  51. +3,412 −0 docs/usage/configuration/config_documentation.md
  52. +8 −10 docs/workers.md
  53. +2 −3 mypy.ini
  54. +8 −4 poetry.lock
  55. +3 −3 pyproject.toml
  56. +6 −1 scripts-dev/federation_client.py
  57. +14 −2 scripts-dev/lint.sh
  58. +1 −1 scripts-dev/release.py
  59. +0 −9 setup.cfg
  60. +0 −183 setup.py
  61. +3 −1 synapse/__init__.py
  62. +18 −0 synapse/api/errors.py
  63. +3 −0 synapse/config/experimental.py
  64. +13 −8 synapse/events/utils.py
  65. +9 −17 synapse/federation/federation_server.py
  66. +31 −8 synapse/federation/transport/server/_base.py
  67. +1 −1 synapse/federation/transport/server/federation.py
  68. +7 −3 synapse/handlers/device.py
  69. +13 −2 synapse/handlers/events.py
  70. +10 −2 synapse/http/matrixfederationclient.py
  71. +0 −151 synapse/python_dependencies.py
  72. +1 −1 synapse/res/templates/notif.html
  73. +9 −0 synapse/rest/client/login.py
  74. +48 −2 synapse/rest/client/room.py
  75. +2 −0 synapse/rest/client/versions.py
  76. +3 −1 synapse/storage/databases/main/devices.py
  77. +5 −3 synapse/storage/databases/main/events_forward_extremities.py
  78. +18 −0 synapse/storage/databases/main/events_worker.py
  79. +1 −1 synapse/storage/databases/main/state.py
  80. +0 −4 sytest-blacklist
  81. +42 −1 tests/federation/test_federation_sender.py
  82. +2 −39 tests/federation/test_federation_server.py
  83. +26 −1 tests/rest/client/test_login.py
  84. +62 −34 tests/rest/client/test_relations.py
  85. +3 −3 tests/storage/test_devices.py
4 changes: 4 additions & 0 deletions .ci/latest_deps_build_failed_issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: CI run against latest deps is failing
---
See https://github.com/{{env.GITHUB_REPOSITORY}}/actions/runs/{{env.GITHUB_RUN_ID}}
4 changes: 0 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -8,8 +8,4 @@
!pyproject.toml
!poetry.lock

# TODO: remove these once we have moved over to using poetry-core in pyproject.toml
!MANIFEST.in
!setup.py

**/__pycache__
156 changes: 156 additions & 0 deletions .github/workflows/latest_deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# People who are freshly `pip install`ing from PyPI will pull in the latest versions of
# dependencies which match the broad requirements. Since most CI runs are against
# the locked poetry environment, run specifically against the latest dependencies to
# know if there's an upcoming breaking change.
#
# As an overview this workflow:
# - checks out develop,
# - installs from source, pulling in the dependencies like a fresh `pip install` would, and
# - runs mypy and test suites in that checkout.
#
# Based on the twisted trunk CI job.

name: Latest dependencies

on:
schedule:
- cron: 0 7 * * *
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# The dev dependencies aren't exposed in the wheel metadata (at least with current
# poetry-core versions), so we install with poetry.
- uses: matrix-org/setup-python-poetry@v1
with:
python-version: "3.x"
poetry-version: "1.2.0b1"
# Dump installed versions for debugging.
- run: poetry run pip list > before.txt
# Upgrade all runtime dependencies only. This is intended to mimic a fresh
# `pip install matrix-synapse[all]` as closely as possible.
- run: poetry update --no-dev
- run: poetry run pip list > after.txt && (diff -u before.txt after.txt || true)
- run: poetry run mypy
trial:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- database: "sqlite"
- database: "postgres"
postgres-version: "14"

steps:
- uses: actions/checkout@v2
- run: sudo apt-get -qq install xmlsec1
- name: Set up PostgreSQL ${{ matrix.postgres-version }}
if: ${{ matrix.postgres-version }}
run: |
docker run -d -p 5432:5432 \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_INITDB_ARGS="--lc-collate C --lc-ctype C --encoding UTF8" \
postgres:${{ matrix.postgres-version }}
- uses: actions/setup-python@v2
with:
python-version: "3.x"
- run: pip install .[all,test]
- name: Await PostgreSQL
if: ${{ matrix.postgres-version }}
timeout-minutes: 2
run: until pg_isready -h localhost; do sleep 1; done
- run: python -m twisted.trial --jobs=2 tests
env:
SYNAPSE_POSTGRES: ${{ matrix.database == 'postgres' || '' }}
SYNAPSE_POSTGRES_HOST: localhost
SYNAPSE_POSTGRES_USER: postgres
SYNAPSE_POSTGRES_PASSWORD: postgres
- name: Dump logs
# Logs are most useful when the command fails, always include them.
if: ${{ always() }}
# Note: Dumps to workflow logs instead of using actions/upload-artifact
# This keeps logs colocated with failing jobs
# It also ignores find's exit code; this is a best effort affair
run: >-
find _trial_temp -name '*.log'
-exec echo "::group::{}" \;
-exec cat {} \;
-exec echo "::endgroup::" \;
|| true
sytest:
runs-on: ubuntu-latest
container:
image: matrixdotorg/sytest-synapse:testing
volumes:
- ${{ github.workspace }}:/src
strategy:
fail-fast: false
matrix:
include:
- sytest-tag: focal

- sytest-tag: focal
postgres: postgres
workers: workers
redis: redis
env:
POSTGRES: ${{ matrix.postgres && 1}}
WORKERS: ${{ matrix.workers && 1 }}
REDIS: ${{ matrix.redis && 1 }}
BLACKLIST: ${{ matrix.workers && 'synapse-blacklist-with-workers' }}

steps:
- uses: actions/checkout@v2
- name: Ensure sytest runs `pip install`
# Delete the lockfile so sytest will `pip install` rather than `poetry install`
run: rm /src/poetry.lock
working-directory: /src
- name: Prepare test blacklist
run: cat sytest-blacklist .ci/worker-blacklist > synapse-blacklist-with-workers
- name: Run SyTest
run: /bootstrap.sh synapse
working-directory: /src
- name: Summarise results.tap
if: ${{ always() }}
run: /sytest/scripts/tap_to_gha.pl /logs/results.tap
- name: Upload SyTest logs
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: Sytest Logs - ${{ job.status }} - (${{ join(matrix.*, ', ') }})
path: |
/logs/results.tap
/logs/**/*.log*
# TODO: run complement (as with twisted trunk, see #12473).

# open an issue if the build fails, so we know about it.
open-issue:
if: failure()
needs:
# TODO: should mypy be included here? It feels more brittle than the other two.
- mypy
- trial
- sytest

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: JasonEtco/create-an-issue@5d9504915f79f9cc6d791934b8ef34f2353dd74d # v2.5.0, 2020-12-06
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
update_existing: true
filename: .ci/latest_deps_build_failed_issue_template.md

2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install -e .
- run: pip install .
- run: scripts-dev/generate_sample_config.sh --check
- run: scripts-dev/config-lint.sh

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -15,8 +15,7 @@ _trial_temp*/
.DS_Store
__pycache__/

# We do want the poetry lockfile. TODO: is there a good reason for ignoring
# '*.lock' above? If not, let's nuke it.
# We do want the poetry lockfile.
!poetry.lock

# stuff that is likely to exist when you run a server locally
27 changes: 24 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
Synapse 1.57.0rc1 (2022-04-12)
==============================
Synapse 1.57.1 (2022-04-20)
===========================

This is a patch release that only affects the Docker image. It is only of interest to administrators using [the LDAP module][LDAPModule] to authenticate their users.
If you have already upgraded to Synapse 1.57.0 without problem, then you have no need to upgrade to this patch release.

[LDAPModule]: https://github.com/matrix-org/matrix-synapse-ldap3


Updates to the Docker image
---------------------------

- Include version 0.2.0 of the Synapse LDAP Auth Provider module in the Docker image. This matches the version that was present in the Docker image for Synapse v1.56.0. ([\#12512](https://github.com/matrix-org/synapse/issues/12512))


Synapse 1.57.0 (2022-04-19)
===========================

This version includes a [change](https://github.com/matrix-org/synapse/pull/12209) to the way transaction IDs are managed for application services. If your deployment uses a dedicated worker for application service traffic, **it must be stopped** when the database is upgraded (which normally happens when the main process is upgraded), to ensure the change is made safely without any risk of reusing transaction IDs.

See the [upgrade notes](https://github.com/matrix-org/synapse/blob/develop/docs/upgrade.md#upgrading-to-v1570) for more details.
See the [upgrade notes](https://github.com/matrix-org/synapse/blob/v1.57.0rc1/docs/upgrade.md#upgrading-to-v1570) for more details.

No significant changes since 1.57.0rc1.


Synapse 1.57.0rc1 (2022-04-12)
==============================

Features
--------
54 changes: 0 additions & 54 deletions MANIFEST.in

This file was deleted.

33 changes: 18 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
@@ -293,39 +293,42 @@ directory of your choice::
git clone https://github.com/matrix-org/synapse.git
cd synapse

Synapse has a number of external dependencies, that are easiest
to install using pip and a virtualenv::
Synapse has a number of external dependencies. We maintain a fixed development
environment using [poetry](https://python-poetry.org/). First, install poetry. We recommend

python3 -m venv ./env
source ./env/bin/activate
pip install -e ".[all,dev]"
pip install --user pipx
pipx install poetry

This will run a process of downloading and installing all the needed
dependencies into a virtual env. If any dependencies fail to install,
try installing the failing modules individually::
as described `here <https://python-poetry.org/docs/#installing-with-pipx>`_.
(See `poetry's installation docs <https://python-poetry.org/docs/#installation>`
for other installation methods.) Then ask poetry to create a virtual environment
from the project and install Synapse's dependencies::

poetry install --extras "all test"

pip install -e "module-name"
This will run a process of downloading and installing all the needed
dependencies into a virtual env.

We recommend using the demo which starts 3 federated instances running on ports `8080` - `8082`

./demo/start.sh
poetry run ./demo/start.sh

(to stop, you can use `./demo/stop.sh`)
(to stop, you can use `poetry run ./demo/stop.sh`)

See the [demo documentation](https://matrix-org.github.io/synapse/develop/development/demo.html)
See the `demo documentation <https://matrix-org.github.io/synapse/develop/development/demo.html>`_
for more information.

If you just want to start a single instance of the app and run it directly::

# Create the homeserver.yaml config once
python -m synapse.app.homeserver \
poetry run synapse_homeserver \
--server-name my.domain.name \
--config-path homeserver.yaml \
--generate-config \
--report-stats=[yes|no]

# Start the app
python -m synapse.app.homeserver --config-path homeserver.yaml
poetry run synapse_homeserver --config-path homeserver.yaml


Running the unit tests
@@ -334,7 +337,7 @@ Running the unit tests
After getting up and running, you may wish to run Synapse's unit tests to
check that everything is installed correctly::

trial tests
poetry run trial tests

This should end with a 'PASSED' result (note that exact numbers will
differ)::
1 change: 1 addition & 0 deletions changelog.d/11398.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implement [MSC3383](https://github.com/matrix-org/matrix-spec-proposals/pull/3383) for including the destination in server-to-server authentication headers. Contributed by @Bubu and @jcgruenhage for Famedly GmbH.
1 change: 1 addition & 0 deletions changelog.d/12337.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use poetry to manage Synapse's dependencies.
1 change: 1 addition & 0 deletions changelog.d/12368.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a manual documenting config file options.
1 change: 1 addition & 0 deletions changelog.d/12427.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implement [MSC2815](https://github.com/matrix-org/matrix-spec-proposals/pull/2815) to allow room moderators to view redacted event content. Contributed by @tulir.
1 change: 1 addition & 0 deletions changelog.d/12449.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use `poetry` to manage the virtualenv in debian packages.
1 change: 1 addition & 0 deletions changelog.d/12451.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update documentation to reflect that both the `run_background_tasks_on` option and the options for moving stream writers off of the main process are no longer experimental.
1 change: 1 addition & 0 deletions changelog.d/12454.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Limit length of device_id to less than 512 characters.
1 change: 1 addition & 0 deletions changelog.d/12455.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reintroduce the list of targets to the linter script, to avoid linting unwanted local-only directories during development.
1 change: 1 addition & 0 deletions changelog.d/12457.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update worker documentation and replace old `federation_reader` with `generic_worker`.
1 change: 1 addition & 0 deletions changelog.d/12464.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dockerfile-workers: reduce the amount we install in the image.
1 change: 1 addition & 0 deletions changelog.d/12465.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enable processing of device list updates asynchronously.
1 change: 1 addition & 0 deletions changelog.d/12466.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dockerfile-workers: give the master its own log config.
1 change: 1 addition & 0 deletions changelog.d/12467.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
complement-synapse-workers: factor out separate entry point script.
1 change: 1 addition & 0 deletions changelog.d/12472.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a CI job which tests Synapse against the latest version of all dependencies.
1 change: 1 addition & 0 deletions changelog.d/12474.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Back out experimental implementation of [MSC2314](https://github.com/matrix-org/matrix-spec-proposals/pull/2314).
1 change: 1 addition & 0 deletions changelog.d/12475.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Strongly recommend `poetry` for development.
1 change: 1 addition & 0 deletions changelog.d/12476.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a long-standing bug which incorrectly caused `GET /_matrix/client/r3/rooms/{roomId}/event/{eventId}` to return edited events rather than the original.
1 change: 1 addition & 0 deletions changelog.d/12478.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use poetry-core instead of setuptools to build wheels.
1 change: 1 addition & 0 deletions changelog.d/12483.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix grammatical error in federation error response when the room version of a room is unknown.
1 change: 1 addition & 0 deletions changelog.d/12495.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a broken link in `README.rst`.
1 change: 1 addition & 0 deletions changelog.d/12496.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where the admin API for [deleting forward extremities](https://github.com/matrix-org/synapse/blob/erikj/fix_delete_event_response_count/docs/admin_api/rooms.md#deleting-forward-extremities) would always return a count of 1 no matter how many extremities were deleted. Broke in v1.27.0.
1 change: 1 addition & 0 deletions changelog.d/12497.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a minor typo in the Debian changelogs generated by the release script.
1 change: 1 addition & 0 deletions changelog.d/12510.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a long-standing bug where the image thumbanils embedded into email notifications were broken.
1 change: 1 addition & 0 deletions changelog.d/12511.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove unnecessary configuration overrides in tests.
1 change: 1 addition & 0 deletions changelog.d/12514.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use poetry-core instead of setuptools to build wheels.
Loading