Commit Graph
25850 Commits
Author SHA1 Message Date
Erik Johnston 4c7d2b50e9 Revert "Replace Clone with shallow_copy"
This reverts commit 1ace5316ae.
2026-06-25 10:13:03 +01:00
Erik Johnston 64d33f3275 Fix merge 2026-06-24 17:50:40 +01:00
Erik Johnston 15a1eea8b6 Merge remote-tracking branch 'origin/develop' into erikj/rust_event_serialization 2026-06-24 17:49:53 +01:00
Erik Johnston 1ace5316ae Replace Clone with shallow_copy 2026-06-24 17:46:45 +01:00
Erik Johnston 18d488ca01 Add FIXME 2026-06-24 17:34:05 +01:00
Erik Johnston 74616d6e22 simplify object_entry_mut 2026-06-24 17:32:40 +01:00
Erik Johnston 7124eeb339 Expand 'age' comment 2026-06-24 17:30:43 +01:00
Erik JohnstonandEric Eastwood 1abf5e7561 Apply suggestions from code review
Co-authored-by: Eric Eastwood <madlittlemods@gmail.com>
2026-06-24 17:21:57 +01:00
Andrew Morgan 287195db06 Bump poetry in the Dockerfile and when building the debian venv (#19877) 2026-06-24 12:46:44 +00:00
dependabot[bot] 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
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
Erik Johnston a6c349e57c Add create_config helper
Rather than implicitly updating the config in `serialize_event`, let's
add a helper for creating the config that does the necessary
checks/updates itself.
2026-06-22 14:04:22 +01:00
Erik Johnston 3254557da8 Error if object_entry_mut finds non-object 2026-06-22 13:31:47 +01:00
Erik Johnston 586368ce9c Create and use Event::redacts() 2026-06-22 11:21:36 +01:00
Erik Johnston a1cd8f3a53 Add Unsigned::age_ts function 2026-06-22 11:11:53 +01:00
Erik Johnston 32b0eafdb3 Comment on what transaction IDs are 2026-06-22 11:01:58 +01:00
Erik Johnston 1cb9fabade Comment why as i64 is safe 2026-06-22 10:59:24 +01:00
Erik Johnston ebb587e426 Use unsigned_mut for stripping room state 2026-06-22 10:59:24 +01:00
Erik Johnston 722407f341 Use unsigned_mut in age and update comment. 2026-06-22 10:59:24 +01:00
Erik Johnston 3aa6fe8dd3 Clarify event_id comment 2026-06-22 10:59:24 +01:00
Erik JohnstonandClaude Sonnet 4.6 812180f933 Rename serialize_core_inner -> serialize_event
The old name was an implementation-detail label. serialize_event better
describes what the function does: serialize a single event, recursing
into its redactions and bundled aggregations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 10:59:24 +01:00
Erik Johnston d6110fa064 Add field-level doc comments to SerializeEventConfig 2026-06-22 10:59:24 +01:00
Erik JohnstonandClaude Sonnet 4.6 a3c430256d Rename SerializeEventConfig.only_event_fields -> event_field_allowlist
The previous name was ambiguous — it sounds like a list of field names
to include *or* exclude. "allowlist" makes the direction explicit.
Updates the Rust struct field, the Python-facing getter, and all call
sites.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 10:59:24 +01: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
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
Erik JohnstonandClaude Sonnet 4.6 e6f7bf5bc3 Fix misleading doc comment on JsonObject::as_map
The previous comment said the method returned "a clone … in a
Value::Object", but it actually returns a plain reference to the
underlying BTreeMap.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 13:50:58 +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
Sami Olmari 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 'reivilibre 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 Markert 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 Eastwood 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 Ferrazzutti 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
Jason LittleandQuentin Gliech 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
Erik Johnston 7d5dc63cd6 Add changelog 2026-06-16 11:20:10 +01:00
Erik JohnstonandClaude Opus 4.8 fc56cf9b90 Port the synchronous event serialization core to Rust
Move the synchronous core of client event serialization out of
`synapse/events/utils.py` and into `rust/src/events/serialize.rs`. The
Python `EventClientSerializer` now performs all DB/IO (fetching
redactions, running module callbacks, resolving admin/MSC4354 config) up
front in `_prepare_serialization`, then hands the pre-fetched data to the
Rust `serialize_event`, which recurses entirely in Rust. Bundled
aggregations are read directly from the Rust `BundledAggregations`
pyclass.

`SerializeEventConfig` and the `event_format` callable become a Rust
pyclass and the `EventFormat` enum respectively; call sites are updated
to pass the enum.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 11:20:10 +01:00
Olivier 'reivilibreandEric Eastwood 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
Erik Johnston 40a21806fa Split event serialization into async/sync parts
This is in prep for doing the actual serialization in Rust.
2026-06-16 10:32:14 +01:00
Erik JohnstonandClaude Opus 4.8 4b0fd01aef Port the BundledAggregations class to Rust
Move `BundledAggregations` and `_ThreadAggregation` from the Python
`RelationsHandler` into frozen Rust pyclasses exposed from
`synapse.synapse_rust.events`. They are re-exported from
`synapse.handlers.relations` so existing call sites are unaffected.

The referenced events are stored by value (the `Event` pyclass now
derives a cheap, Arc-sharing `Clone`). The `references` field uses the
`JsonObject` type, which gains a `FromPyObject` impl so it can be built
from any Python mapping in place of a plain dict.

As the pyclass is immutable, `get_bundled_aggregations` is reworked to
collect each kind of aggregation and build one instance per event.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 10:32:10 +01:00
Andrew Ferrazzutti 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