Commit Graph
25871 Commits
Author SHA1 Message Date
Eric Eastwood 59228e5f58 Fill in the rest of the config 2026-06-24 15:37:42 -05:00
Eric Eastwood 2a609a5cdf Fill in missing experimental config 2026-06-24 15:32:38 -05:00
Eric Eastwood 590fd2b95b Fill in the rest of rust/src/handlers/versions.rs 2026-06-24 15:27:53 -05:00
Eric Eastwood 87ca67d4b6 Update comments 2026-06-24 15:03:51 -05:00
Eric Eastwood a4e4af7fa8 "Dyn-compatibility" is the new name for "object safety"
> This concept was formerly known as object safety.
>
> *-- https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility*
2026-06-24 14:55:47 -05:00
Eric Eastwood adeb03960c Sync trait not needed on run_interaction
LLM summary:

func only ever needs to be moved to a thread and called there sequentially, never shared by & across threads:

- In the erasure, func is captured by-move into the Box<dyn Fn ... + Send> callback (only Send is required to box it that way).
- The Python pool moves that callback into the runInteraction DB-thread closure and calls it there; the Rust pool calls it within a single async task. Neither sends &func to multiple threads concurrently.
2026-06-24 14:51:16 -05:00
Eric Eastwood 683f264a7f LLM simplify dyn DatabasePool
Prompt:
```
Compare this with a previous approach that was swapped out in `d9a111bdfaf51cd4cadfdc071f9956eec47aea43` (look at the removals). Anything we should change/simplify or something you like better/worse about that one? Give the new approach a review and simplify and make things more clear as necessary
```

Changes made (LLM summary):

1. #[async_trait] on the object-safe method. The core trait method is now async fn run_interaction_erased(...) -> ErasedResult instead of a hand-rolled fn ... -> BoxFuture<'a, _>. This is the convention already used by Transaction in the same file, and it removed the async move { ... }.boxed() wrapper (plus the BoxFuture/FutureExt imports) from both pool impls — their bodies are now plain async fns again.
2. Dropped the constrain / erase_interaction helper. I'd over-engineered the closure erasure out of a worry that higher-ranked-lifetime inference would fail. The previous code proved a direct let erased: ErasedInteraction = Box::new(move |txn| {...}) compiles — the type annotation on the binding is enough. ~30 lines gone.
3. Dropped the unneeded + Sync on the erased callback type. ErasedInteraction is + Send only now; the boxed callback is moved to a single DB thread and called there, never shared by reference.
2026-06-24 14:45:55 -05:00
Eric Eastwood 2860e4ea01 LLM attempt at switching back to Store with dyn DatabasePool 2026-06-24 14:34:47 -05:00
Eric Eastwood ce68c0f73b Merge branch 'develop' into madlittlemods/rust-db-access-using-python-db-pool-run-interaction-llm1 2026-06-23 21:22:06 -05:00
Eric Eastwood c21dbbdc1f Rename Value -> DbValue 2026-06-23 21:20:45 -05:00
Eric Eastwood f42ba674b6 Avoid circular import issues
```
[ERROR]
Traceback (most recent call last):
  File "/home/eric/.cache/pypoetry/virtualenvs/matrix-synapse-xCtC9ulO-py3.14/lib/python3.14/site-packages/twisted/trial/runner.py", line 711, in loadByName
    return self.suiteFactory([self.findByName(name, recurse=recurse)])
  File "/home/eric/.cache/pypoetry/virtualenvs/matrix-synapse-xCtC9ulO-py3.14/lib/python3.14/site-packages/twisted/trial/runner.py", line 474, in findByName
    obj = reflect.namedModule(searchName)
  File "/home/eric/.cache/pypoetry/virtualenvs/matrix-synapse-xCtC9ulO-py3.14/lib/python3.14/site-packages/twisted/python/reflect.py", line 156, in namedModule
    topLevel = __import__(name)
  File "/home/eric/Documents/github/element/synapse/tests/__init__.py", line 24, in <module>
    from synapse.util.patch_inline_callbacks import do_patch
  File "/home/eric/Documents/github/element/synapse/synapse/__init__.py", line 31, in <module>
    from synapse.util.rust import check_rust_lib_up_to_date
  File "/home/eric/Documents/github/element/synapse/synapse/util/__init__.py", line 41, in <module>
    from synapse.types import JsonDict
  File "/home/eric/Documents/github/element/synapse/synapse/types/__init__.py", line 63, in <module>
    from synapse.api.errors import Codes, SynapseError
  File "/home/eric/Documents/github/element/synapse/synapse/api/errors.py", line 33, in <module>
    from synapse.util.json import json_decoder
  File "/home/eric/Documents/github/element/synapse/synapse/util/json.py", line 23, in <module>
    from synapse.synapse_rust.events import JsonObject
  File "/home/eric/Documents/github/element/synapse/synapse/logging/context.py", line 55, in <module>
    from synapse.util.stringutils import random_string_insecure_fast
  File "/home/eric/Documents/github/element/synapse/synapse/util/stringutils.py", line 31, in <module>
    from synapse.api.errors import Codes, SynapseError
builtins.ImportError: cannot import name 'Codes' from partially initialized module 'synapse.api.errors' (most likely due to a circular import) (/home/eric/Documents/github/element/synapse/synapse/api/errors.py)
```
2026-06-23 20:38:04 -05:00
Eric Eastwood 37ff66099a Align imports on OnceCell which has get_or_try_init 2026-06-23 20:29:45 -05:00
Eric Eastwood 746657498a Less wordy 2026-06-23 20:10:38 -05:00
Eric Eastwood 441e580b53 Fix logcontext 2026-06-23 20:04:07 -05:00
Eric Eastwood 065c5cb4c8 Non-working: Try to save/restore logcontext 2026-06-23 19:32:29 -05:00
Olivier 'reivilibre 1c79397d7f Tweak wording of Rust crate dependency update policy. (#19829)
After looking into it, just a couple of things to pick a bone at in the
old wording,
which I thought could be clarified for when I next come to look at this
again.


- the claim that there's a fundamental difference; I'd argue there isn't
really, it's just by convention
  on some mainstream distros. So I have changed this to 'typically'
- statements that some distros fetch dependencies at build time
(probably does happen, but
traditional distros make a point of not doing this for the reasons you'd
expect).
- This was probably meant to be talking about Debian, but my observation
based on sample size of 3 is that some crates are packaged natively,
others are vendored in the respective application's source package (like
they do for us) and sometime they patch the bounds a bit

There could probably be room to talk about how distros vendoring
packages is a maintenance burden on them,
but I guess it's a bit moot as we would struggle to conform to wide
enough bounds to make everyone
happy (and anyway; I expect the distros that vendor packages have the
tooling to make this easy to
update and we do keep on top of security updates and release
frequently...)

---

Spawning from discussion in
[`#element-backend-internal:matrix.org`](https://matrix.to/#/!SGNQGPGUwtcPBUotTL:matrix.org/$VttYPPUevn2S_W_rrzg2ZOXWI6aKebk2ganTgrLEWUc?via=jki.re&via=element.io&via=matrix.org)

---------

Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
2026-06-23 18:40:38 +01:00
Olivier 'reivilibreandEric Eastwood 16fe5fb462 Expose MSC4354 Sticky Events over MSC4186 (Simplified) Sliding Sync. (#19591)
Follows: #19487
Part of: MSC4354 whose experimental feature tracking issue is #19409

This PR implements the Sliding Sync (MSC4186) extension described in
MSC4354, allowing sliding sync clients
to receive sticky events in a reliable way.

The logic is much the same as for oldschool sync (implementation in
#19487),
although in the sliding sync extension, the client can choose their own
limit
and must control their own pagination through an extra token in the
extension request/response bodies.

Note this does not yet send down existing sticky events in the
room when the room has been newly-joined.
This newly-discovered gap is tracked at #19662 and will be addressed for
both current sync and MSC4186 SSS soon.

---------

Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
Co-authored-by: Eric Eastwood <erice@element.io>
2026-06-23 13:04:36 +00:00
dependabot[bot] 047d9c4231 Bump the patches group across 1 directory with 3 updates (#19835)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-23 12:45:52 +00:00
Stefan Ceriu 6d289f7ce0 Fix permanent badge inflation from read receipts before first rotation (#19785) 2026-06-23 11:31:32 +00:00
Eric Eastwood d40adfad21 Explain why poll_once 2026-06-22 17:34:55 -05:00
Eric Eastwood 505b599332 Panic for programming error 2026-06-22 17:33:39 -05:00
Eric Eastwood 874178afac poll_once instead of futures::executor::block_on
See https://github.com/element-hq/synapse/pull/19846#discussion_r3394989664
2026-06-22 17:29:28 -05:00
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 Bosch 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 Eastwood 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
wbob 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
Will HuntandCopilot Autofix powered by AI 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 Morgan b38106d58b Update poetry in CI from 2.2.1 to 2.4.1 (#19866) 2026-06-18 15:21:55 +00:00
dependabot[bot]andAndrew Morgan 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
FrenchGithubUser 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
Simon KnottandAndrew Morgan 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