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

Commit 2f31cc7

Browse files
committed
Merge remote-tracking branch 'origin/clokep/threads-notif-2' into clokep/threads-notif-3
2 parents 9fd41f5 + 56c21e4 commit 2f31cc7

File tree

147 files changed

+2921
-1045
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+2921
-1045
lines changed

.ci/scripts/postgres_exec.py

-31
This file was deleted.

.ci/scripts/test_export_data_command.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ else
3232
fi
3333

3434
# Create the PostgreSQL database.
35-
poetry run .ci/scripts/postgres_exec.py "CREATE DATABASE synapse"
35+
psql -c "CREATE DATABASE synapse"
3636

3737
# Port the SQLite databse to postgres so we can check command works against postgres
3838
echo "+++ Port SQLite3 databse to postgres"

.ci/scripts/test_synapse_port_db.sh

+25-11
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22
#
33
# Test script for 'synapse_port_db'.
44
# - configures synapse and a postgres server.
5-
# - runs the port script on a prepopulated test sqlite db
6-
# - also runs it against an new sqlite db
5+
# - runs the port script on a prepopulated test sqlite db. Checks that the
6+
# return code is zero.
7+
# - reruns the port script on the same sqlite db, targetting the same postgres db.
8+
# Checks that the return code is zero.
9+
# - runs the port script against a new sqlite db. Checks the return code is zero.
710
#
811
# Expects Synapse to have been already installed with `poetry install --extras postgres`.
912
# Expects `poetry` to be available on the `PATH`.
1013

11-
set -xe
14+
set -xe -o pipefail
1215
cd "$(dirname "$0")/../.."
1316

1417
echo "--- Generate the signing key"
15-
16-
# Generate the server's signing key.
1718
poetry run synapse_homeserver --generate-keys -c .ci/sqlite-config.yaml
1819

1920
echo "--- Prepare test database"
20-
21-
# Make sure the SQLite3 database is using the latest schema and has no pending background update.
21+
# Make sure the SQLite3 database is using the latest schema and has no pending background updates.
2222
poetry run update_synapse_database --database-config .ci/sqlite-config.yaml --run-background-updates
2323

2424
# Create the PostgreSQL database.
25-
poetry run .ci/scripts/postgres_exec.py "CREATE DATABASE synapse"
25+
psql -c "CREATE DATABASE synapse"
2626

2727
echo "+++ Run synapse_port_db against test database"
2828
# TODO: this invocation of synapse_port_db (and others below) used to be prepended with `coverage run`,
@@ -45,9 +45,23 @@ rm .ci/test_db.db
4545
poetry run update_synapse_database --database-config .ci/sqlite-config.yaml --run-background-updates
4646

4747
# re-create the PostgreSQL database.
48-
poetry run .ci/scripts/postgres_exec.py \
49-
"DROP DATABASE synapse" \
50-
"CREATE DATABASE synapse"
48+
psql \
49+
-c "DROP DATABASE synapse" \
50+
-c "CREATE DATABASE synapse"
5151

5252
echo "+++ Run synapse_port_db against empty database"
5353
poetry run synapse_port_db --sqlite-database .ci/test_db.db --postgres-config .ci/postgres-config.yaml
54+
55+
echo "--- Create a brand new postgres database from schema"
56+
cp .ci/postgres-config.yaml .ci/postgres-config-unported.yaml
57+
sed -i -e 's/database: synapse/database: synapse_unported/' .ci/postgres-config-unported.yaml
58+
psql -c "CREATE DATABASE synapse_unported"
59+
poetry run update_synapse_database --database-config .ci/postgres-config-unported.yaml --run-background-updates
60+
61+
echo "+++ Comparing ported schema with unported schema"
62+
# Ignore the tables that portdb creates. (Should it tidy them up when the porting is completed?)
63+
psql synapse -c "DROP TABLE port_from_sqlite3;"
64+
pg_dump --format=plain --schema-only --no-tablespaces --no-acl --no-owner synapse_unported > unported.sql
65+
pg_dump --format=plain --schema-only --no-tablespaces --no-acl --no-owner synapse > ported.sql
66+
# By default, `diff` returns zero if there are no changes and nonzero otherwise
67+
diff -u unported.sql ported.sql | tee schema_diff

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
!build_rust.py
1212

1313
rust/target
14+
synapse/*.so
1415

1516
**/__pycache__

.github/workflows/tests.yml

+28-8
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ jobs:
3232
steps:
3333
- uses: actions/checkout@v2
3434
- uses: actions/setup-python@v2
35-
- run: pip install .
36-
- run: scripts-dev/generate_sample_config.sh --check
37-
- run: scripts-dev/config-lint.sh
35+
- uses: matrix-org/setup-python-poetry@v1
36+
with:
37+
extras: "all"
38+
- run: poetry run scripts-dev/generate_sample_config.sh --check
39+
- run: poetry run scripts-dev/config-lint.sh
3840

3941
check-schema-delta:
4042
runs-on: ubuntu-latest
@@ -76,7 +78,6 @@ jobs:
7678
- uses: actions/checkout@v2
7779
with:
7880
ref: ${{ github.event.pull_request.head.sha }}
79-
fetch-depth: 0
8081
- uses: matrix-org/setup-python-poetry@v1
8182
with:
8283
extras: "all"
@@ -361,18 +362,22 @@ jobs:
361362
362363
steps:
363364
- uses: actions/checkout@v2
364-
- run: sudo apt-get -qq install xmlsec1
365+
- run: sudo apt-get -qq install xmlsec1 postgresql-client
365366
- uses: matrix-org/setup-python-poetry@v1
366367
with:
367368
extras: "postgres"
368369
- run: .ci/scripts/test_export_data_command.sh
370+
env:
371+
PGHOST: localhost
372+
PGUSER: postgres
373+
PGPASSWORD: postgres
374+
PGDATABASE: postgres
375+
369376

370377
portdb:
371378
if: ${{ !failure() && !cancelled() }} # Allow previous steps to be skipped, but not fail
372379
needs: linting-done
373380
runs-on: ubuntu-latest
374-
env:
375-
TOP: ${{ github.workspace }}
376381
strategy:
377382
matrix:
378383
include:
@@ -398,12 +403,27 @@ jobs:
398403
399404
steps:
400405
- uses: actions/checkout@v2
401-
- run: sudo apt-get -qq install xmlsec1
406+
- run: sudo apt-get -qq install xmlsec1 postgresql-client
402407
- uses: matrix-org/setup-python-poetry@v1
403408
with:
404409
python-version: ${{ matrix.python-version }}
405410
extras: "postgres"
406411
- run: .ci/scripts/test_synapse_port_db.sh
412+
id: run_tester_script
413+
env:
414+
PGHOST: localhost
415+
PGUSER: postgres
416+
PGPASSWORD: postgres
417+
PGDATABASE: postgres
418+
- name: "Upload schema differences"
419+
uses: actions/upload-artifact@v3
420+
if: ${{ failure() && !cancelled() && steps.run_tester_script.outcome == 'failure' }}
421+
with:
422+
name: Schema dumps
423+
path: |
424+
unported.sql
425+
ported.sql
426+
schema_diff
407427
408428
complement:
409429
if: "${{ !failure() && !cancelled() }}"

.rustfmt.toml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
group_imports = "StdExternalCrate"

CHANGES.md

+89
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,92 @@
1+
Synapse 1.68.0rc1 (2022-09-20)
2+
==============================
3+
4+
Please note that Synapse will now refuse to start if configured to use a version of SQLite earlier than 3.27.
5+
6+
In addition, please note that installing Synapse from a source checkout now requires a recent Rust compiler.
7+
Those using packages will not be affected. On most platforms, installing with `pip install matrix-synapse` will not be affected.
8+
See the [upgrade notes](https://matrix-org.github.io/synapse/v1.68/upgrade.html#upgrading-to-v1670).
9+
10+
11+
Features
12+
--------
13+
14+
- Keep track of when we fail to process a pulled event over federation so we can intelligently back off in the future. ([\#13589](https://github.com/matrix-org/synapse/issues/13589), [\#13814](https://github.com/matrix-org/synapse/issues/13814))
15+
- Add an [admin API endpoint to fetch messages within a particular window of time](https://matrix-org.github.io/synapse/v1.68/admin_api/rooms.html#room-messages-api). ([\#13672](https://github.com/matrix-org/synapse/issues/13672))
16+
- Add an [admin API endpoint to find a user based on their external ID in an auth provider](https://matrix-org.github.io/synapse/v1.68/admin_api/user_admin_api.html#find-a-user-based-on-their-id-in-an-auth-provider). ([\#13810](https://github.com/matrix-org/synapse/issues/13810))
17+
- Cancel the processing of key query requests when they time out. ([\#13680](https://github.com/matrix-org/synapse/issues/13680))
18+
- Improve validation of request bodies for the following client-server API endpoints: [`/account/3pid/msisdn/requestToken`](https://spec.matrix.org/v1.3/client-server-api/#post_matrixclientv3account3pidmsisdnrequesttoken), [`/org.matrix.msc3720/account_status`](https://github.com/matrix-org/matrix-spec-proposals/blob/babolivier/user_status/proposals/3720-account-status.md#post-_matrixclientv1account_status), [`/account/3pid/add`](https://spec.matrix.org/v1.3/client-server-api/#post_matrixclientv3account3pidadd), [`/account/3pid/bind`](https://spec.matrix.org/v1.3/client-server-api/#post_matrixclientv3account3pidbind), [`/account/3pid/delete`](https://spec.matrix.org/v1.3/client-server-api/#post_matrixclientv3account3piddelete) and [`/account/3pid/unbind`](https://spec.matrix.org/v1.3/client-server-api/#post_matrixclientv3account3pidunbind). ([\#13687](https://github.com/matrix-org/synapse/issues/13687), [\#13736](https://github.com/matrix-org/synapse/issues/13736))
19+
- Document the timestamp when a user accepts the consent, if [consent tracking](https://matrix-org.github.io/synapse/latest/consent_tracking.html) is used. ([\#13741](https://github.com/matrix-org/synapse/issues/13741))
20+
- Add a `listeners[x].request_id_header` configuration option to specify which request header to extract and use as the request ID in order to correlate requests from a reverse proxy. ([\#13801](https://github.com/matrix-org/synapse/issues/13801))
21+
22+
23+
Bugfixes
24+
--------
25+
26+
- Fix a bug introduced in Synapse v1.41.0 where the `/hierarchy` API returned non-standard information (a `room_id` field under each entry in `children_state`). ([\#13506](https://github.com/matrix-org/synapse/issues/13506))
27+
- Fix a long-standing bug where previously rejected events could end up in room state because they pass auth checks given the current state of the room. ([\#13723](https://github.com/matrix-org/synapse/issues/13723))
28+
- Fix a long-standing bug where Synapse fails to start if a signing key file contains an empty line. ([\#13738](https://github.com/matrix-org/synapse/issues/13738))
29+
- Fix a long-standing bug where Synapse would fail to handle malformed user IDs or room aliases gracefully in certain cases. ([\#13746](https://github.com/matrix-org/synapse/issues/13746))
30+
- Fix a long-standing bug where device lists would remain cached when remote users left and rejoined the last room shared with the local homeserver. ([\#13749](https://github.com/matrix-org/synapse/issues/13749), [\#13826](https://github.com/matrix-org/synapse/issues/13826))
31+
- Fix a long-standing bug that could cause stale caches in some rare cases on the first startup of Synapse with replication. ([\#13766](https://github.com/matrix-org/synapse/issues/13766))
32+
- Fix a long-standing spec compliance bug where Synapse would accept a trailing slash on the end of `/get_missing_events` federation requests. ([\#13789](https://github.com/matrix-org/synapse/issues/13789))
33+
- Delete associated data from `event_failed_pull_attempts`, `insertion_events`, `insertion_event_extremities`, `insertion_event_extremities`, `insertion_event_extremities` when purging the room. ([\#13825](https://github.com/matrix-org/synapse/issues/13825))
34+
35+
36+
Improved Documentation
37+
----------------------
38+
39+
- Note that `libpq` is required on ARM-based Macs. ([\#13480](https://github.com/matrix-org/synapse/issues/13480))
40+
- Fix a mistake in the config manual: the `event_cache_size` _is_ scaled by `caches.global_factor`. The documentation was incorrect since Synapse v1.22.0. ([\#13726](https://github.com/matrix-org/synapse/issues/13726))
41+
- Fix a typo in the documentation for the login ratelimiting configuration. ([\#13727](https://github.com/matrix-org/synapse/issues/13727))
42+
- Define Synapse's compatability policy for SQLite versions. ([\#13728](https://github.com/matrix-org/synapse/issues/13728))
43+
- Add docs for common fix of deleting the `matrix_synapse.egg-info/` directory for fixing Python dependency problems. ([\#13785](https://github.com/matrix-org/synapse/issues/13785))
44+
- Update request log format documentation to mention the format used when the authenticated user is controlling another user. ([\#13794](https://github.com/matrix-org/synapse/issues/13794))
45+
46+
47+
Deprecations and Removals
48+
-------------------------
49+
50+
- Synapse will now refuse to start if configured to use SQLite < 3.27. ([\#13760](https://github.com/matrix-org/synapse/issues/13760))
51+
- Don't include redundant `prev_state` in new events. Contributed by Denis Kariakin (@dakariakin). ([\#13791](https://github.com/matrix-org/synapse/issues/13791))
52+
53+
54+
Internal Changes
55+
----------------
56+
57+
- Add a stub Rust crate. ([\#12595](https://github.com/matrix-org/synapse/issues/12595), [\#13734](https://github.com/matrix-org/synapse/issues/13734), [\#13735](https://github.com/matrix-org/synapse/issues/13735), [\#13743](https://github.com/matrix-org/synapse/issues/13743), [\#13763](https://github.com/matrix-org/synapse/issues/13763), [\#13769](https://github.com/matrix-org/synapse/issues/13769), [\#13778](https://github.com/matrix-org/synapse/issues/13778))
58+
- Bump the minimum dependency of `matrix_common` to 1.3.0 to make use of the `MXCUri` class. Use `MXCUri` to simplify media retention test code. ([\#13162](https://github.com/matrix-org/synapse/issues/13162))
59+
- Add and populate the `event_stream_ordering` column on the `receipts` table for future optimisation of push action processing. Contributed by Nick @ Beeper (@fizzadar). ([\#13703](https://github.com/matrix-org/synapse/issues/13703))
60+
- Rename the `EventFormatVersions` enum values so that they line up with room version numbers. ([\#13706](https://github.com/matrix-org/synapse/issues/13706))
61+
- Update trial old deps CI to use Poetry 1.2.0. ([\#13707](https://github.com/matrix-org/synapse/issues/13707), [\#13725](https://github.com/matrix-org/synapse/issues/13725))
62+
- Add experimental configuration option to allow disabling legacy Prometheus metric names. ([\#13714](https://github.com/matrix-org/synapse/issues/13714), [\#13717](https://github.com/matrix-org/synapse/issues/13717), [\#13718](https://github.com/matrix-org/synapse/issues/13718))
63+
- Fix typechecking with latest types-jsonschema. ([\#13724](https://github.com/matrix-org/synapse/issues/13724))
64+
- Strip number suffix from instance name to consolidate services that traces are spread over. ([\#13729](https://github.com/matrix-org/synapse/issues/13729))
65+
- Instrument `get_metadata_for_events` for understandable traces in Jaeger. ([\#13730](https://github.com/matrix-org/synapse/issues/13730))
66+
- Remove old queries to join room memberships to current state events. Contributed by Nick @ Beeper (@fizzadar). ([\#13745](https://github.com/matrix-org/synapse/issues/13745))
67+
- Avoid raising an error due to malformed user IDs in `get_current_hosts_in_room`. Malformed user IDs cannot currently join a room, so this error would not be hit. ([\#13748](https://github.com/matrix-org/synapse/issues/13748))
68+
- Update the docstrings for `get_users_in_room` and `get_current_hosts_in_room` to explain the impact of partial state. ([\#13750](https://github.com/matrix-org/synapse/issues/13750))
69+
- Use an additional database query when persisting receipts. ([\#13752](https://github.com/matrix-org/synapse/issues/13752))
70+
- Preparatory work for storing thread IDs for notifications and receipts. ([\#13753](https://github.com/matrix-org/synapse/issues/13753))
71+
- Re-type hint some collections as read-only. ([\#13754](https://github.com/matrix-org/synapse/issues/13754))
72+
- Remove unused Prometheus recording rules from `synapse-v2.rules` and add comments describing where the rest are used. ([\#13756](https://github.com/matrix-org/synapse/issues/13756))
73+
- Add a check for editable installs if the Rust library needs rebuilding. ([\#13759](https://github.com/matrix-org/synapse/issues/13759))
74+
- Tag traces with the instance name to be able to easily jump into the right logs and filter traces by instance. ([\#13761](https://github.com/matrix-org/synapse/issues/13761))
75+
- Concurrently fetch room push actions when calculating badge counts. Contributed by Nick @ Beeper (@fizzadar). ([\#13765](https://github.com/matrix-org/synapse/issues/13765))
76+
- Update the script which makes full schema dumps. ([\#13770](https://github.com/matrix-org/synapse/issues/13770))
77+
- Deduplicate `is_server_notices_room`. ([\#13780](https://github.com/matrix-org/synapse/issues/13780))
78+
- Simplify the dependency DAG in the tests workflow. ([\#13784](https://github.com/matrix-org/synapse/issues/13784))
79+
- Remove an old, incorrect migration file. ([\#13788](https://github.com/matrix-org/synapse/issues/13788))
80+
- Remove unused method in `synapse.api.auth.Auth`. ([\#13795](https://github.com/matrix-org/synapse/issues/13795))
81+
- Fix a memory leak when running the unit tests. ([\#13798](https://github.com/matrix-org/synapse/issues/13798))
82+
- Use partial indices on SQLite. ([\#13802](https://github.com/matrix-org/synapse/issues/13802))
83+
- Check that portdb generates the same postgres schema as that in the source tree. ([\#13808](https://github.com/matrix-org/synapse/issues/13808))
84+
- Fix Docker build when Rust .so has been build locally first. ([\#13811](https://github.com/matrix-org/synapse/issues/13811))
85+
- Complement: Initialise the Postgres database directly inside the target image instead of the base Postgres image to fix building using Buildah. ([\#13819](https://github.com/matrix-org/synapse/issues/13819))
86+
- Support providing an index predicate clause when doing upserts. ([\#13822](https://github.com/matrix-org/synapse/issues/13822))
87+
- Minor speedups to linting in CI. ([\#13827](https://github.com/matrix-org/synapse/issues/13827))
88+
89+
190
Synapse 1.67.0 (2022-09-13)
291
===========================
392

changelog.d/12595.misc

-1
This file was deleted.

changelog.d/13162.misc

-1
This file was deleted.

changelog.d/13480.doc

-1
This file was deleted.

changelog.d/13506.bugfix

-1
This file was deleted.

changelog.d/13589.feature

-1
This file was deleted.

changelog.d/13667.feature

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add cache invalidation across workers to module API.

changelog.d/13672.feature

-1
This file was deleted.

changelog.d/13680.feature

-1
This file was deleted.

changelog.d/13687.feature

-1
This file was deleted.

changelog.d/13703.misc

-1
This file was deleted.

changelog.d/13706.misc

-1
This file was deleted.

changelog.d/13707.misc

-1
This file was deleted.

changelog.d/13714.misc

-1
This file was deleted.

changelog.d/13717.misc

-1
This file was deleted.

changelog.d/13718.misc

-1
This file was deleted.

changelog.d/13722.feature

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Experimental implementation of MSC3882 to allow an existing device/session to generate a login token for use on a new device/session.

0 commit comments

Comments
 (0)