Commit Graph
25888 Commits
Author SHA1 Message Date
Eric Eastwood 74ad3b2606 Merge branch 'develop' into madlittlemods/rust-db-access-using-python-db-pool-run-interaction-llm1 2026-06-24 17:57:32 -05:00
Eric Eastwood 5ce6b8a307 Better failure_to_pyerr 2026-06-24 17:53:28 -05:00
Eric Eastwood b5ea2f7154 Avoid String allocation 2026-06-24 17:40:59 -05:00
Eric Eastwood 619507482a Only return runInteraction result if it succeeded
Previous logic (LLM summary):

> The current logic always prefers captured over outcome, even when outcome is an Err. Consider: callback runs successfully → slot = Some(Ok(value)) → returns None → but then runInteraction's commit fails and the deferred errbacks. Now captured = Some(Ok(value)) and outcome = Err(...), and we'd return Ok(value) — silently swallowing the commit failure.
>
> Whether that's reachable depends on Synapse's retry behavior (it may retry the whole interaction on commit failure, re-running the callback). It's likely a narrow edge case, but the comment ("we only trust this slot once the deferred has fired") implies the slot is authoritative once fired, which isn't quite true if the deferred fires with an error after a successful callback run.
2026-06-24 17:28:57 -05:00
Eric Eastwood 0090330585 Iterate on python_db_pool comments 2026-06-24 16:40:28 -05:00
Eric Eastwood a2e68adb1c Explain more about python_db_pool 2026-06-24 16:17:00 -05:00
dependabot[bot]andGitHub 4e9f7757f1 Bump msgpack from 1.1.2 to 1.2.1 (#19873)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-24 21:16:03 +00:00
Eric Eastwood 79a8cc1f71 Rename Row -> DbRow 2026-06-24 16:12:43 -05:00
Eric Eastwood 8ddab4f23e Iterate on Database trait comments 2026-06-24 16:09:29 -05:00
Eric Eastwood 7ed525ddd1 Rename SynapseConfig -> SynapseHomeServerConfig 2026-06-24 16:02:19 -05:00
Eric Eastwood 55d89f972b Use time.sleep(0) to align with decision in #19871
See https://github.com/element-hq/synapse/pull/19871#discussion_r3462533989
2026-06-24 15:54:15 -05:00
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
dependabot[bot]andGitHub c386ab8f85 Bump bleach from 6.3.0 to 6.4.0 (#19864)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-24 20:14:47 +00:00
dependabot[bot]andGitHub d304743057 Bump pyjwt from 2.12.0 to 2.13.0 (#19861)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-24 20:12:15 +00:00
dependabot[bot]andGitHub 732de34bc4 Bump tornado from 6.5.5 to 6.5.7 (#19860)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-24 20:11:42 +00: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
dependabot[bot]andGitHub 98d28b8ac7 Bump python-multipart from 0.0.27 to 0.0.31 (#19859)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-24 19:00:24 +00:00
Andrew MorganandGitHub 287195db06 Bump poetry in the Dockerfile and when building the debian venv (#19877) 2026-06-24 12:46:44 +00:00
dependabot[bot]andGitHub 5248ea0bc2 Bump the minor-and-patches group across 1 directory with 6 updates (#19863)
Signed-off-by: dependabot[bot] <support@github.com>
2026-06-24 11:38:22 +00: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 'reivilibreandGitHub 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
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]andGitHub 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 CeriuandGitHub 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 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