Commit Graph
25849 Commits
Author SHA1 Message Date
Eric Eastwood dc93a239af Fix grammar, add intended fix 2026-06-22 16:51:22 -05:00
Eric Eastwood 4eec02ce00 Explain possible better future for async fn that need to be Send 2026-06-22 16:47:31 -05:00
Eric Eastwood 1d6eb1e524 Remove await_result_with_rust in favor of updating await_result with the same tricks learned in https://github.com/element-hq/synapse/pull/19871 2026-06-22 15:14:08 -05:00
Eric Eastwood 5f23dc6c74 Fix lint 2026-06-22 14:11:56 -05:00
Eric Eastwood 19c0777fd6 Add changelog 2026-06-22 14:06:36 -05:00
Eric Eastwood d9a02d3c47 Merge branch 'develop' into madlittlemods/rust-db-access-using-python-db-pool-run-interaction-llm1
Conflicts:
	rust/src/deferred.rs
	rust/src/lib.rs
	rust/src/tokio_runtime.rs
2026-06-22 14:05:02 -05:00
Maximilian BoschandGitHub 1f0c2bc3e4 docs/config: make it explicit that auto_join_rooms can be used for invite-only rooms (#19660) 2026-06-22 08:57:10 +00:00
Eric EastwoodandGitHub 42138ad602 Split out deferred and tokio_runtime to their own Rust modules (#19868)
Spawning from https://github.com/element-hq/synapse/pull/19824 /
https://github.com/element-hq/synapse/pull/19846 and wanting to use
`create_deferred` in more than just the `http_client.rs`
2026-06-19 22:21:48 -05:00
wbobandGitHub 86c6a6ca4b Log table name in "No row found" error (#19869)
Bringing it up to parity with the other 404 StoreErrors naming the table
name already.

More helpful response when debugging issues with incomplete relations.
Concretly: a user that got partly removed and then reinstated, missing
an entry in 'profiles' table.

This should also contribute to a better understanding of #2807 and #2173
2026-06-19 14:22:40 +00:00
Eric Eastwood 7aec5a0786 Stub remaining features 2026-06-19 00:51:54 -05:00
Eric Eastwood 7c2790a48c Serde UnstableFeatureMap 2026-06-19 00:48:18 -05:00
Eric Eastwood 941188c05d Remove unused msc4222 2026-06-19 00:13:20 -05:00
Eric Eastwood 9688d48f33 Fix RoomCreationPreset 2026-06-19 00:13:03 -05:00
Eric Eastwood 5b1a1aef15 WIP: RoomCreationPreset 2026-06-19 00:07:13 -05:00
Eric Eastwood 29e5830610 Fix Rust warnings 2026-06-18 21:05:45 -05:00
Eric Eastwood f76c8c160b Refactor to remove SynapseConfig from shared code 2026-06-18 21:03:48 -05:00
Eric Eastwood ca1371e1a3 Refactor deferred and tokio_runtime to their own crates 2026-06-18 19:55:00 -05:00
Eric Eastwood 357860cb8e Specify features to enable 2026-06-18 19:37:03 -05:00
Eric Eastwood 1dcf17d9d8 Rename: await_rust_result -> await_result_with_rust 2026-06-18 18:29:20 -05:00
d3fc81974a MSC1763: Implement /_matrix/client/unstable/org.matrix.msc1763/retention/configuration (#19853)
Implements https://github.com/matrix-org/matrix-spec-proposals/pull/1763
Tracking issue https://github.com/element-hq/synapse/issues/19852

This only implements the MSC's configuration endpoint and does not add
new configuration fields or options. The reason for including this is to
allow clients to run global retention against locally stored events, and
to be able to offer configuration UI.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-18 17:37:02 +00:00
Andrew MorganandGitHub b38106d58b Update poetry in CI from 2.2.1 to 2.4.1 (#19866) 2026-06-18 15:21:55 +00:00
8cdac5297b Bump the minor-and-patches group across 1 directory with 6 updates (#19705)
Co-authored-by: Andrew Morgan <andrew@amorgan.xyz>
2026-06-18 14:48:06 +00:00
2487b31422 MSC4140: allow auth on management endpoints for delayed events (#19794)
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-18 13:27:37 +00:00
FrenchGithubUserandGitHub 75ee23a16b feat: Include allowed_room_ids in the /summary client-server API response for rooms with restricted join rules, as required by Matrix 1.15. (#19762)
Currently the `/summary` endpoint on the client and federation APIs does
not include the allowed_room_ids field, that is present on the
/hierarchy API. This is required by the 1.15 spec and this is what this
PR does.

Complement test: https://github.com/matrix-org/complement/pull/873

Part of https://github.com/element-hq/synapse/issues/18731
2026-06-18 14:12:51 +01:00
0640a3e838 Fix TCP listener startup log for ephemeral ports (#19810)
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2026-06-18 12:58:24 +00:00
Eric Eastwood e2ec3f1198 FakeChannel.await_rust_result
Fix Tokio thread waiting a different way
2026-06-17 20:51:23 -05:00
Eric Eastwood 158b4a01d0 Revert "Passing tests_versions.py: Wait real time for tokio thread pool to work on our async Rust function"
This reverts commit 0b6a9733a1.
2026-06-17 20:33:59 -05:00
Eric Eastwood 0b6a9733a1 Passing tests_versions.py: Wait real time for tokio thread pool to work on our async Rust function
Previously, we were running into this problem:
```
SYNAPSE_TEST_LOG_LEVEL=INFO poetry run trial tests.rest.client.test_versions.VersionsTestCase.test_authenticated
tests.rest.client.test_versions
  VersionsTestCase
    test_authenticated ...                                              [ERROR]

===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/home/eric/Documents/github/element/synapse/tests/rest/client/test_versions.py", line 85, in test_authenticated
    channel = self.make_request(
  File "/home/eric/Documents/github/element/synapse/tests/unittest.py", line 619, in make_request
    return make_request(
  File "/home/eric/Documents/github/element/synapse/tests/server.py", line 486, in make_request
    channel.await_result()
  File "/home/eric/Documents/github/element/synapse/tests/server.py", line 310, in await_result
    raise TimedOutException("Timed out waiting for request to finish.")
tests.server.TimedOutException: Timed out waiting for request to finish.

tests.rest.client.test_versions.VersionsTestCase.test_authenticated
-------------------------------------------------------------------------------
Ran 1 tests in 0.182s

FAILED (errors=1)
```
2026-06-17 20:33:02 -05:00
Eric Eastwood 8270087c3b Fix test failing with RuntimeError: Tokio runtime is not running
`_trial_temp/test.log`
```
2026-06-17 19:17:57-0500 [-] synapse.http.server - 147 - ERROR - GET-3 - Failed handle request via 'VersionsRestServlet': <SynapseRequest at 0x7ff02b1cf9d0 method='GET' uri='/_matrix/client/versions' clientproto='1.1' site='test'>
	Traceback (most recent call last):
	  File "/home/eric/Documents/github/element/synapse/synapse/http/server.py", line 335, in _async_render_wrapper
	    callback_return = await self._async_render(request)
	                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	  File "/home/eric/Documents/github/element/synapse/synapse/http/server.py", line 576, in _async_render
	    callback_return = await raw_callback_return
	                      ^^^^^^^^^^^^^^^^^^^^^^^^^
	  File "/home/eric/Documents/github/element/synapse/synapse/rest/client/versions.py", line 81, in on_GET
	    versions_response_body = await self.rust_handlers.versions.get_versions(user_id)
	                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
	RuntimeError: Tokio runtime is not running
```
2026-06-17 19:55:20 -05:00
Eric Eastwood 7bf4b6abd3 Non-working: Add test_versions.py 2026-06-17 19:10:39 -05:00
Eric Eastwood 0226a67858 Add comments why row expectations 2026-06-17 18:45:47 -05:00
Eric Eastwood 65ba851f2c Concrete Row type 2026-06-17 18:25:07 -05:00
Eric Eastwood d3af0c4e18 LLM further Row 2026-06-17 17:48:35 -05:00
Eric Eastwood 6b5e9f2577 Partial Row 2026-06-17 17:29:43 -05:00
Sami OlmariandGitHub 8cd695a78a Add stable room summary endpoint in worker docs. (#19788)
---------

Signed-off-by: Sami Olmari <sami@olmari.fi>
2026-06-17 16:40:24 +01:00
Olivier 'reivilibreandGitHub 2d06667661 Fix local events being deleted despite delete_local_events=False in room versions other than 1 and 2. (#19850)
Not aware of an open ticket for this.

I came across it when I accidentally broke the feature even more (as
part of another piece of work),
then discovered there weren't tests for this.

So this is overall a low-priority drive-by fix.

Requires a fix to SyTest https://github.com/matrix-org/sytest/pull/1426
(as it depended on the bug).

<ol>
<li>

Add a test for purging rooms with `delete_local_events=False` \
Parameterised by room version, this test currently succeeds
on v2 but fails on v12.

This is because the condition checking for local events relies
on the old event ID format, which has not been used since v2.


</li>
<li>

Fix delete_local_events=False for room versions above v2 \
The event ID format changing means that we have to rely on `sender`
to know the origin of an event


</li>
</ol>

---------

Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
2026-06-17 11:03:59 +01:00
Noah MarkertandGitHub d6d900675c resolves #19374 Refactor get_user_which_could_invite logic to reuse get_users_which_can_issue_invite. (#19732) 2026-06-16 15:34:22 +00:00
Olivier 'reivilibre e3397a9b02 Merge branch 'master' into develop 2026-06-16 16:05:25 +01:00
Eric EastwoodandGitHub f52b144c5f Explain natural behavior of events lost in the /make_join//send_join gap (#19856)
To better explain that this new thing we're doing in
https://github.com/element-hq/synapse/pull/19390 is a good citizen thing, not a requirement.

Follow-up to https://github.com/element-hq/synapse/pull/19390
2026-06-16 09:38:44 -05:00
Olivier 'reivilibre 3fad636880 1.155.0 v1.155.0 2026-06-16 14:48:25 +01:00
Andrew FerrazzuttiandGitHub 4100dacb54 Ignore ruff cache (#19854)
When I run `ruff` locally, either `ruff` or one of the linting scripts
adds `.ruff_cache` to the `.gitignore` file. This PR adds that line so
that running linters doesn't result in a dirty git working tree (and to
ignore ruff's cache, of course).

### Pull Request Checklist

<!-- Please read
https://element-hq.github.io/synapse/latest/development/contributing_guide.html
before submitting your pull request -->

* [x] Pull request is based on the develop branch
* [x] Pull request includes a [changelog
file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog).
The entry should:
- Be a short description of your change which makes sense to users.
"Fixed a bug that prevented receiving messages from other servers."
instead of "Moved X method from `EventStore` to `EventWorkerStore`.".
  - Use markdown where necessary, mostly for `code blocks`.
  - End with either a period (.) or an exclamation mark (!).
  - Start with a capital letter.
- Feel free to credit yourself, by adding a sentence "Contributed by
@github_username." or "Contributed by [Your Name]." to the end of the
entry.
* [x] [Code
style](https://element-hq.github.io/synapse/latest/code_style.html) is
correct (run the
[linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))
2026-06-16 14:05:00 +02:00
36822e3614 Stabilize support for sending ephemeral events to application services, as per MSC2409 (#19758)
Part of #18118 


[MSC2409](https://github.com/matrix-org/matrix-spec-proposals/pull/2409)
was merged into the spec on Oct 28, 2024 and is part of Matrix Spec 1.13

This adds the stable identifiers for MSC2409 while maintaining the
existing unstable identifier for backwards compatibility. The existing
`to_device` identifiers borrowed from MSC2409 for
[MSC4203](https://github.com/matrix-org/matrix-spec-proposals/pull/4203)
are also maintained.

(Includes one drive-by removal of a FIXME comment that was no longer
needed after [May 16,
2022](https://github.com/element-hq/synapse/commit/83be72d76ca171ceb0fc381aa4548c1d9fea0dc7))

### Pull Request Checklist

<!-- Please read
https://element-hq.github.io/synapse/latest/development/contributing_guide.html
before submitting your pull request -->

* [x] Pull request is based on the develop branch
* [x] Pull request includes a [changelog
file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog).
The entry should:
- Be a short description of your change which makes sense to users.
"Fixed a bug that prevented receiving messages from other servers."
instead of "Moved X method from `EventStore` to `EventWorkerStore`.".
  - Use markdown where necessary, mostly for `code blocks`.
  - End with either a period (.) or an exclamation mark (!).
  - Start with a capital letter.
- Feel free to credit yourself, by adding a sentence "Contributed by
@github_username." or "Contributed by [Your Name]." to the end of the
entry.
* [x] [Code
style](https://element-hq.github.io/synapse/latest/code_style.html) is
correct (run the
[linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))

---------

Co-authored-by: Quentin Gliech <quenting@element.io>
2026-06-16 13:02:29 +02:00
1b7807ae6b Fix /sync caching transient errors for the sync_response_cache_duration. (#19845)
Fixes: #19844

Concretely, this changes `ResponseCache` to unset cache entries once
they resolve to a `Failure`.

---------

Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
Co-authored-by: Eric Eastwood <erice@element.io>
2026-06-16 11:12:29 +01:00
Andrew FerrazzuttiandGitHub 64e09f134b Fix lint failures in Complement tests (#19855)
Running `scripts-dev/lint.sh` locally revealed a failure, so here are the fixes that the linter
applied + a manual change to address an issue that couldn't be
auto-fixed.
2026-06-15 16:31:08 -05:00
dependabot[bot]andGitHub 51805a0702 Bump python-multipart from 0.0.26 to 0.0.27 (#19761)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-15 16:30:22 +00:00
78827799df Upload Complement CI logs as artifacts instead of flooding stdout (#19840)
The Complement integration-test job prints the full raw `go test -json`
stream straight to the GitHub Actions build log. That's an enormous,
unreadable wall of JSON, and the GitHub web UI renders very large logs
poorly — making the run hard to view and slow to load.

Instead, let's store the raw JSON and upload it as an artefact. We still
render failing test output as before.

We will still stream when tests finish (i.e. PASS / FAIL) so that people
can see that things are actually running. However, all other output
(such as logs) are hidden.

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 16:11:58 +01:00
FrenchGithubUserandGitHub 0130929349 fix: provide remote servers a way to find out about an event created during the remote join handshake (#19390) 2026-06-15 11:43:05 +00:00
Olivier 'reivilibreandGitHub f2f159d6c1 Fix release script considering any workflow completion as successful. (#19843)
When building the v1.155.0rc1, the release notification said the
workflow was successful
but it had actually failed.

---------

Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
2026-06-15 12:29:49 +01:00
d7e9a3ff83 Fix inflated notification counts after /purge_history (#19834)
The sytest `After /purge_history users still get pushed for new
messages` is flaky. The flakiness exposes a real bug rather than a
test-timing issue.

Notification counts are stored in two places: `event_push_actions` (one
row per unread event) and `event_push_summary` (aggregate counts
populated periodically by `_rotate_notifs`, which runs on a 30-second
timer). `_purge_history_txn` deletes the purged events' rows from
`event_push_actions` but never adjusts `event_push_summary` (only the
full-room `purge_room` drops that table).

So the result depends on a race: if rotation hasn't fired, counts come
live from `event_push_actions`, the purge removes the right rows, and
the count is correct. If rotation fires before the purge — more likely
under the slower
multi-postgres/workers/asyncio CI config — the events get folded into
`event_push_summary`, the purge then deletes the underlying
`event_push_actions` rows but leaves the summary untouched, and the
count comes out inflated.

### Fix

Before deleting the rotated rows from `event_push_actions`, decrement
`event_push_summary` by the amount attributable to the events being
deleted. The decrement mirrors the counting logic in
`_rotate_notifs_before_txn`: only rows that were already rotated
(`stream_ordering <= event_push_summary_stream_ordering`) and that fall
after the summary's receipt are subtracted, so it stays correct in the
presence of read receipts and unread/highlight rows. The SQL avoids
`UPDATE ... FROM` and CTEs so it works on both SQLite and Postgres.
End-of-purge cache invalidation already covers
`get_unread_event_push_actions_by_room_for_user`.

### Tests

Adds `test_count_aggregation_after_purge`, which forces a rotation
before purging and asserts the aggregate count reflects only the
surviving events, covering read receipts and a subsequent re-rotation.
It fails (`3 != 1`) without the fix.

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 16:31:26 +01:00
Eric EastwoodandGitHub d11b012a81 Force keyword-args for clear default_config(server_name="test") usage (#19849)
I.e. `default_config("test")` and `default_config("test", False)` are so
opaque and hard to connect the dots with.

Spawning from trying to figure out what the `server_name` is set as for
our `HomeserverTestCase` in order to reference it in
https://github.com/element-hq/synapse/pull/19848#discussion_r3397455309
2026-06-12 09:45:22 -05:00