Commit Graph

13831 Commits

Author SHA1 Message Date
Damir Jelić
fd4821c3ec refactor(redecryptor): Make the filter closure a function 2025-11-20 13:27:13 +01:00
Damir Jelić
5dea64b0ef feat(linked-chunk): Add method to get the items of an Update
This patch adds a convenience function for the Update enum. If one only
cares about the items contained in the Update, then they can chose to
use this method to extract them out of the enum.
2025-11-20 13:26:23 +01:00
Damir Jelić
2388acaf33 test(redecryptor): Add a test confirming a race condition in the redecryptor
This patch adds a test confirming that the redecryptor has a race
condition.

Namely, events and room keys are received over two different sync
streams from the homeserver. When events are received over the sync, we
first try to decrypt them, this might fail because the room key hasn't
yet arrived over the other sync stream. The event cache will then
persist the event as a UTD.

At the same time, the redecryptor will listen to room keys that arrive
on the other sync stream. Once the redecryptor gets notified about a
room key, it will attempt to fetch the event from the event cache to
decrypt the event and replace it.

Crucially if the key arrives before the event gets persisted but after
the initial decryption attempt we might never attempt to redecrypt such
an event.
2025-11-20 13:20:12 +01:00
Damir Jelić
91bc1ef28f test(redecryptor): Factor out common code in the redecryptor tests 2025-11-20 13:19:49 +01:00
Richard van der Hoff
b1eaa5edca sdk: improve logging for received history bundles
We had an instance where a user joined a room on Element X but did not download
the key bundle, so let's add some logging to help figure out what was going on.
2025-11-19 11:38:58 +01:00
Doug
0b5e1fb9c5 xtask: Add support for building watchOS targets. 2025-11-19 11:36:53 +01:00
Ivan Enderlin
2eb4323fe1 test(ui): Test long-polling in RoomListService.
This patch tests whether long-polling is used for Sliding Sync requests
made by `RoomListService`.
2025-11-19 10:39:11 +01:00
Ivan Enderlin
db806f6b8d test(ui): Simplify macro usage.
This patch declares the type of the expected value for `assert pos`.
2025-11-19 10:39:11 +01:00
Ivan Enderlin
64a51af18d feat(ui): Manually define when to do long-polling in the RoomListService.
This patch uses the newly introduced
`SlidingSyncListBuilder::requires_timeout` to define when the
`RoomListService` must apply a long-polling depending on its state
machine.
2025-11-19 10:39:11 +01:00
Ivan Enderlin
da52532b60 feat(sdk): Add SlidingSyncListBuilder::requires_timeout.
This patch adds a new `SlidingSyncListBuilder::requires_timeout` method
that takes a function deciding whether the list requires a timeout, i.e.
if the list should trigger a `http::Request::timeout`, i.e. if it
deserves a long-polling or not.

The default behaviour is kept for compatibility purposes.
2025-11-19 10:39:11 +01:00
Ivan Enderlin
f846eea7a3 doc(sdk): Update outdated documentation of SlidingSyncList::set_sync_mode.
This patch updates the documentation of `SlidingSyncList::set_sync_mode`
to remove an outdated reference to a `reset` method that no longer
exists.
2025-11-19 10:39:11 +01:00
Ivan Enderlin
475db3e640 refactor(sdk) Change RwLock<Observable> to SharedObservable.
This patch updates `SlidingSyncListInner::state` from a
`RwLock<Observable>` to a `SharedObservable`. It is semantically and
programmatically identical, but the API is simpler.
2025-11-19 10:39:11 +01:00
Damir Jelić
efe511e5e8 Merge pull request #5869 from matrix-org/poljar/event-cache/remove-timeline-redecrypion-logic 2025-11-19 10:31:32 +01:00
Damir Jelić
4ae82dd634 feat(bindings): Allow user identities to only be fetched from storage 2025-11-19 09:42:26 +01:00
Jorge Martin Espinosa
d860749f95 Revert "doc: Add warnings about overriding the server URL"
This reverts commit 95d8ba94e1.
matrix-sdk-ffi/20251118
2025-11-18 15:58:19 +01:00
Jorge Martin Espinosa
012a9825a4 Revert "refactor(ffi): Remove unused Session::homeserver_url value"
This reverts commit 4eb3cc9812.
2025-11-18 15:58:19 +01:00
Jorge Martín
1c22d0b25b doc: add changelogs 2025-11-18 12:26:30 +01:00
Jorge Martín
be86fe4aa9 doc: Improve doc comments
Also move `EventMeta::thread_root_id` next to `event_id`
2025-11-18 12:26:30 +01:00
Jorge Martín
385f7aa86d doc: Fix docs for ffi::Timeline::latest_event_id 2025-11-18 12:26:30 +01:00
Jorge Martín
5f996f77c6 reafactor(ffi): Have ffi::Timeline::latest_event_id use ui::Timeline::latest_event_id, instead of ui::Timeline::latest_event
This is important because `latest_event` would also return local events, which won't have an event id.
2025-11-18 12:26:30 +01:00
Jorge Martín
02491fc6ec test: Add test for TimelineController::latest_event_id 2025-11-18 12:26:30 +01:00
Jorge Martín
0f62ff991d fix clippy 2025-11-18 12:26:30 +01:00
Jorge Martín
6b245264e1 fix(test): Fix broken test locally: it was using a previous cached value before 2025-11-18 12:26:30 +01:00
Jorge Martín
f7b92c84e7 fix(ui): Sending read receipt in live timeline when latest event is in a thread
Previously, this used the latest event in the thread as the event to mark as read, while this is not right if we're in a context that hides thread events
2025-11-18 12:26:30 +01:00
Jorge Martín
4eb3cc9812 refactor(ffi): Remove unused Session::homeserver_url value 2025-11-18 12:16:28 +01:00
Jorge Martín
95d8ba94e1 doc: Add warnings about overriding the server URL
This may be dangerous when done while restoring an existing session.
2025-11-18 12:16:28 +01:00
Andy Balaam
ca436016b4 base: Bump ruma to 91424b1fc
And update to reflect the new feature name unstable-msc4362, which
provides the new unstable prefix io.element.msc4362.encrypt_state_events
2025-11-18 11:10:55 +00:00
Andy Balaam
5b82550199 crypto: Wait for a stream in state encryption test
This was sometimes failing for me locally, so use a macro that expects a
value from a stream soon, rather than immediately.
2025-11-18 11:10:55 +00:00
Andy Balaam
5d396e4795 crypto: Refer to MSC4362 when we are talking about encrypted state 2025-11-17 09:40:47 +02:00
Damir Jelić
e9c8f101d6 chore: Remove the various redecrytion tasks 2025-11-14 12:54:00 +01:00
Damir Jelić
6e97607c2d refactor(timeline): Replace the various decryption tasks with one R2D2 task 2025-11-14 12:54:00 +01:00
Damir Jelić
4e71b7c351 feat(ui): Create a task to listen to redecryptor reports in the timeline
This task is still necessary because the redecryptor in the event cache
might miss some room keys.

In this case the timeline can tell the redecryptor which events it
should retry to decrypt.

We're collecting all the UTDs in the timeline and telling the
redecryptor to do its best.
2025-11-14 12:52:44 +01:00
Richard van der Hoff
9ab886fa2b crypto: Merge inbound Megolm sessions [#5865]
When we receive two copies of the same inbound Megolm session from two sources, merge them together intelligently.

Fixes: #5108, #4698
2025-11-13 19:06:44 +00:00
Richard van der Hoff
60072b3456 Integ test for merging megolm sessions with history sharing
Add an integration test that checks that, when we receive a copy of a megolm
session directly after having previously received it via history sharing, we
get the best bits of both.
2025-11-13 18:37:18 +00:00
Richard van der Hoff
822b1c9787 crypto: replace uses of compare_group_session
... with `merge_received_group_session`.

`merge_received_group_session` expands the logic of `compare_group_session` to
handle the fact that there is more than one axis of "better" or "worse" and we
may need to take the best bits of two copies of the session.
2025-11-13 18:37:18 +00:00
Richard van der Hoff
52344fad77 crypto: Add new method Store::merge_received_group_session
Add a method which can be used to merge a received `InboundGroupSession` into
whatever we find in the store.
2025-11-13 18:37:18 +00:00
Damir Jelić
e0427767aa refactor(timeline): Use the event cache to request redecryption 2025-11-13 16:57:36 +01:00
Damir Jelić
927c82f97a refactor(timeilne): Add a method to compute redecryption candidates 2025-11-13 16:56:36 +01:00
Richard van der Hoff
97ba0b1bbb crypto: factor out InboundGroupSession.compare_ratchet
In order to correctly merge sessions, we need more granular comparisons between
two sessions than just "Better" or "Worse", so factor out a method that *just*
looks at the ratchet states.
2025-11-13 13:51:25 +00:00
JoFrost
17df3f84d0 feat(ffi): expose join_rules in OtherState::RoomJoinRules (#5863)
Expose the room join rules in the `OtherState::RoomJoinRules` event 
for the FFI timeline.

It reuses the existing `JoinRules` type from the client module and
converts the event content accordingly. This allows clients to inspect
the room’s current join rule directly from the event. Like `m.federate`,
this field was previously unavailable in the FFI variant of the SDK.

---------

Signed-off-by: JoFrost <20685007+JoFrost@users.noreply.github.com>
2025-11-13 15:20:17 +02:00
Damir Jelić
4fbc83af44 Merge pull request #5746 from matrix-org/poljar/event-cache/redecryptor 2025-11-13 12:19:51 +01:00
Damir Jelić
9508675aca fix(redecryptor): Early return if we don't have any events to process 2025-11-13 11:59:21 +01:00
Damir Jelić
0d08ed0758 refactor(redecryptor): Add some type aliases for the event ID/event tuples 2025-11-13 11:59:21 +01:00
Damir Jelić
913ebe9fa9 docs(redecryptor): Clarify that we're talking about the UI timeline in the r2d2 docs 2025-11-13 11:59:05 +01:00
Jorge Martin Espinosa
f702364fe9 feat(sdk): Add a power level value field for StateEventType::SpaceChild (#5857)
Closes https://github.com/matrix-org/matrix-rust-sdk/issues/5839

Co-authored-by: Stefan Ceriu <stefanc@matrix.org>
2025-11-13 07:17:57 +00:00
Jonas Platte
1db4a4cb9a Use MSRV-aware resolver 2025-11-12 14:58:30 +01:00
Damir Jelić
2e9e9aedd7 chore(redecryptor): Ensure the upgrade_event_cache method is inlined 2025-11-12 13:31:37 +01:00
Damir Jelić
38df621b8a chore(event-cache): Limit the visibility of post_process_new_events 2025-11-12 13:31:37 +01:00
Damir Jelić
f9c23b3612 refactor(redecryptor): Use an abort handle to manage the redecryption task 2025-11-12 13:31:37 +01:00
Damir Jelić
952c5af07c chore(redecryptor): Time how long it takes to replace UTDs 2025-11-12 12:56:21 +01:00