Commit Graph

14800 Commits

Author SHA1 Message Date
Benjamin Bouvier
1afd4e9fa1 fix(test): fix test_back_pagination_aborted expectations
Even though the task which started the back-pagination is aborted, since
it's now the event cache owning it, it keeps on running in the
background.
2026-03-19 14:32:07 +01:00
Benjamin Bouvier
b5153a8b23 feat(event cache): have the event cache own the back-pagination task 2026-03-19 14:32:07 +01:00
Benjamin Bouvier
9c4a47b20b refactor(event cache): allow deref state lock read/write guards to the state
This makes it possible to common out the implementations of functions
that should be available to both kinds.

Also, moves a bit of code that could easily live in the
`RoomEventCacheState` impl block, instead of being free functions.
2026-03-19 14:21:27 +01:00
Benjamin Bouvier
43e468e149 refactor(timeline): replace a bool::to_owned() call with a dereference
booleans can be copied \o/
2026-03-19 11:53:30 +01:00
Benjamin Bouvier
993e02e02c doc(event cache): explain when the missing active receipt case can happen
And simplify a double `map()` call.
2026-03-19 11:51:34 +01:00
Benjamin Bouvier
cd99520a6e chore(event cache): add logs in select_best_receipt
These will make debugging much easier in the future, even though they're
quite verbose.
2026-03-19 11:51:34 +01:00
Benjamin Bouvier
69a1bd5019 fix(event cache): stop at the active receipt, if found, when computing unread counts
There was a subtle bug that a receipt would be considered active, and
then on the subsequent call to `select_best_receipt`, it could be
forgotten in favor of an older receipt. The regression test shows one
such case, where before this patch, the count would incorrectly say 3,
not 2, because the active read receipt moved backwards to the implicit
receipt.

The solution is to stop looking for a better receipt, if we run into the
latest active read receipt. Having `found` set to `None` in this case
means we hadn't found any better read receipt anyways.
2026-03-19 11:51:34 +01:00
Kévin Commaille
1d87b33b79 Upgrade Ruma
Handle a breaking change around request `AuthScheme`s.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-03-19 09:55:25 +01:00
Ivan Enderlin
cbc7228e08 doc(sdk): Add #6316 in the `CHANGELOG.md. 2026-03-19 09:18:37 +01:00
Ivan Enderlin
affce2d43c fix(sdk): Remove an unwrap on a Result<T, JoinError>.
This patch removes the `unwrap` in `spawn().await.unwrap()` to replace
it by a proper error propagation.
2026-03-19 09:18:37 +01:00
Jorge Martín
29aa3c2e08 fix(ffi): Using rustls in Android
It turns out on Android, rustls needs [a custom setup](https://github.com/rustls/rustls-platform-verifier#android) and adding the `rustls-platform-verifier-android` library that's [not available on Maven](https://github.com/rustls/rustls-platform-verifier/issues/115).

Then, from the Android clients we'd need to call some exposed JNI function so we can provide a JVM context from where Rust can take the `Application` component and access its contents to read its credentials storage. Thanks to some tricks we can use `libloading` to simulate this call from Rust itself and properly initialise the platform verifier.

Note self-signed certificates will no longer work with these changes on Android, and providing them in `ClientBuilder::add_root_certificates` will make most requests fail. This can be handled separately.
2026-03-18 17:07:55 +01:00
Skye Elliot
81bed18550 Merge pull request #6292 from matrix-org/kaylendog/history-sharing/respect-visibility
feat(sdk): Rotate session keys when a member leaves the room
2026-03-18 14:44:03 +00:00
Skye Elliot
9082cb94a9 docs(sdk): Update CHANGELOG.md 2026-03-18 14:30:53 +00:00
Skye Elliot
fd806a9c11 tests: Assert room key rotated on leave event after being offline
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2026-03-18 14:25:22 +00:00
Skye Elliot
7a26db66b5 tests: Assert room key is rotated when a member leaves the room
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2026-03-18 14:25:22 +00:00
Skye Elliot
635fdd3f80 refactor(crypto): Lock GroupSessionCache::get to cfg(test)
This method is now only used by tests, so I opted to lock it
behind the test configuration to appease CI.

Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2026-03-18 14:25:21 +00:00
Skye Elliot
ba9e876dfe docs(sdk): Outline key rotation scenario on discard handler
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2026-03-18 14:25:21 +00:00
Skye Elliot
bfe24d90cd feat(sdk): Rotate session key when member leaves the room
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
2026-03-18 14:25:19 +00:00
Andy Balaam
60ce062ac5 Shorten the impl of reset on IdentityResetHandle 2026-03-18 12:59:45 +00:00
Ivan Enderlin
daa1120286 chore(ui): Always enable the latest event Room List sorter.
This patch removes the `enable_latest_event_sorter` flag in
`RoomList::entry_with_dynamic_adapters_with`. This sorter is now stable
enough, we can always enable it.
2026-03-18 10:47:31 +01:00
Stefan Ceriu
4ad046d4b8 change(thread_list): update public documentation 2026-03-17 19:29:28 +02:00
Stefan Ceriu
33c156f231 feat(threads): convert the types exposed from Room.list_threads to UI crates TimelineItem types
... and closer to what we do for latest events, reply details etc.
2026-03-17 19:29:28 +02:00
Stefan Ceriu
9405908eb8 fix(ffi): actually expose the ThreadRoot details over FFI 2026-03-17 19:29:28 +02:00
Mauro Romito
5742f49886 docs: changelog updated
# Conflicts:
#	crates/matrix-sdk/CHANGELOG.md
2026-03-17 18:19:44 +01:00
Mauro Romito
cabaede7fc feat: added beacon_info start event to the latest_event that can be displayed 2026-03-17 18:19:44 +01:00
Benjamin Bouvier
a4bb2f3ff4 chore: add changelog entry for the cloneable EventCacheError 2026-03-17 15:47:39 +01:00
Benjamin Bouvier
816530c89c feat(event cache): make EventCacheError cloneable
This makes it possible to share futures which output is a result that
has the error type set to `EventCacheError`. See also
https://github.com/matrix-org/matrix-rust-sdk/pull/6304 for usage.
2026-03-17 15:47:39 +01:00
Ivan Enderlin
e72950ea15 refactor(sdk): Inline RoomEventCacheStateLockWriteGuard::load_more_events_backwards in RoomPagination.
The method
`RoomEventCacheStateLockWriteGuard::load_more_events_backwards` is used
only in one-place: in `RoomPagination::load_more_events_backwards`. This
patch inlines this method as it aims at living in `RoomPagination`, not
somewhere else.

It's purely code move. Nothing else has changed.

This patch also updates a test that was accessing
`load_more_events_backwards` directly. Now it runs it via
`RoomPagination`.
2026-03-17 13:49:00 +01:00
Ivan Enderlin
793f62049a chore(sdk): Rename *Lock to Locked*. 2026-03-17 13:44:14 +01:00
Ivan Enderlin
2652db661b chore(sdk): Add a temporary `allow(clippy). 2026-03-17 13:44:14 +01:00
Ivan Enderlin
2459348b2e doc(sdk): Add #6280 in the CHANGELOG.md. 2026-03-17 13:44:14 +01:00
Ivan Enderlin
b85bb5463f refactor(sdk): In ThreadPagination, replace RoomEventCacheInner by ThreadEventCacheInner.
This patch updates `ThreadPagination` to hold a `ThreadEventCacheInner`
instead of a `RoomEventCacheInner`! It makes more sense and it
splits/isolates the types even more.

`RoomEventCache::thread_pagination` is now async and returns a
`Result<ThreadPagination>` because it needs to load its state to fetch
a `ThreadEventCache`. Later, accessing a thread wouldn't happen in
`RoomEventCache` but in `Caches`, one step at a time.
2026-03-17 13:44:14 +01:00
Ivan Enderlin
7929bcc956 chore(sdk): Add ThreadEventCacheInner::weak_room.
This patch adds the `weak_room: WeakRoom` field to
`ThreadEventCacheInner`. This is a prerequisite to have
`ThreadPagination` uses `ThreadEventCacheInner` instead of
`RoomEventCacheInner`!
2026-03-17 13:44:14 +01:00
Ivan Enderlin
a91d24c53e refactor(sdk): Create ThreadEventCacheState.
This patch creates the `ThreadEventCacheState` type. It uses
`caches::lock::StateLock`, just like `RoomEventCacheState`. It allows
to have the `read()` and `write()` method to access the state, and to
reload it when necessary, see the `caches::lock::Store` implementation.

This patch thus creates `ThreadEventCacheStateLockReadGuard` and
`ThreadEventCacheStateLockWriteGuard`. The methods touching the state in
`ThreadEventCacheInner` are moved to these lock types.

They are purely code moves (plus changes to reach the correct data): no
change in the semantics.
2026-03-17 13:44:14 +01:00
Ivan Enderlin
e55db521a4 refactor(sdk): Create ThreadEventCacheInner.
This patch creates `ThreadEventCacheInner` so that `ThreadEventCache`
can be shallow cloned (which will be useful for `ThreadPagination`).
That's also the first step to introduce `ThreadEventCacheState`!
2026-03-17 13:44:14 +01:00
Ivan Enderlin
c71e5c14c1 chore(sdk): Move the has_new_gap definition a bit earlier.
This patch moves up the `has_new_gap` definition to clarify the code
even more.
2026-03-17 13:44:14 +01:00
dependabot[bot]
33f3a67020 chore(deps): update dtolnay/rust-toolchain requirement to 631a55b12751854ce901bb631d5902ceb48146f7
Updates the requirements on [dtolnay/rust-toolchain](https://github.com/dtolnay/rust-toolchain) to permit the latest version.
- [Release notes](https://github.com/dtolnay/rust-toolchain/releases)
- [Commits](631a55b127)

---
updated-dependencies:
- dependency-name: dtolnay/rust-toolchain
  dependency-version: 631a55b12751854ce901bb631d5902ceb48146f7
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-17 13:29:15 +01:00
Stefan Ceriu
290650c6b1 change(live_location): Move LiveLocation out of TimelineItemContent and into MsgLikeKind
... so that it has access to `MsgLikeContent` reactions
2026-03-17 13:39:29 +02:00
dependabot[bot]
538afaf252 chore(deps): bump actions/checkout from 6.0.0 to 6.0.2
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.0 to 6.0.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...de0fac2e4500dabe0009e67214ff5f5447ce83dd)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-17 10:52:30 +01:00
dependabot[bot]
6a408d673f chore(deps): bump bnjbvr/cargo-machete
Bumps [bnjbvr/cargo-machete](https://github.com/bnjbvr/cargo-machete) from 8a8e0cd1046f54206f6d2e050cf028e6db9dbc75 to 2e2703d664c176156a22936b9203c38cc7a273dd.
- [Release notes](https://github.com/bnjbvr/cargo-machete/releases)
- [Changelog](https://github.com/bnjbvr/cargo-machete/blob/main/CHANGELOG.md)
- [Commits](8a8e0cd104...2e2703d664)

---
updated-dependencies:
- dependency-name: bnjbvr/cargo-machete
  dependency-version: 2e2703d664c176156a22936b9203c38cc7a273dd
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-17 10:48:41 +01:00
dependabot[bot]
8a6f822993 chore(deps): bump codecov/test-results-action from 1.1.1 to 1.2.1
Bumps [codecov/test-results-action](https://github.com/codecov/test-results-action) from 1.1.1 to 1.2.1.
- [Release notes](https://github.com/codecov/test-results-action/releases)
- [Commits](https://github.com/codecov/test-results-action/compare/v1.1.1...0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3)

---
updated-dependencies:
- dependency-name: codecov/test-results-action
  dependency-version: 1.2.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-17 10:43:36 +01:00
Damir Jelić
aa669585b4 ci: Pin our github actions to commit hashes 2026-03-17 10:24:44 +01:00
dependabot[bot]
109db5ee58 chore(deps): bump lz4_flex from 0.11.5 to 0.11.6
Bumps [lz4_flex](https://github.com/pseitz/lz4_flex) from 0.11.5 to 0.11.6.
- [Release notes](https://github.com/pseitz/lz4_flex/releases)
- [Changelog](https://github.com/PSeitz/lz4_flex/blob/main/CHANGELOG.md)
- [Commits](https://github.com/pseitz/lz4_flex/compare/0.11.5...0.11.6)

---
updated-dependencies:
- dependency-name: lz4_flex
  dependency-version: 0.11.6
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-17 00:28:31 +01:00
Benjamin Bouvier
abc6b4ad01 doc(event cache): improve documentation around select_best_receipt 2026-03-16 17:03:00 +01:00
Benjamin Bouvier
241584366d refactor(event cache): remove ReceiptSelector and associated tests
Now that we use `select_best_receipt` and that it's properly tested, we
can entirely get rid of the `ReceiptSelector` and associated tests.
2026-03-16 17:03:00 +01:00
Benjamin Bouvier
8a611305cf test(event cache): add unit tests for select_best_receipt 2026-03-16 17:03:00 +01:00
Benjamin Bouvier
0c149155be refactor(event cache): directly use the linked chunk for computing unread counts 2026-03-16 17:03:00 +01:00
Benjamin Bouvier
bc69d36d3e refactor(event cache): remove test-only compute_unread_counts_legacy and associated tests
The new integration tests for the event cache cover the same situations
that were tested by the previous tests on compute_unread_count_legacy,
so we're fine here.
2026-03-16 17:03:00 +01:00
Benjamin Bouvier
a453f019d9 fix(unread counts): after a gappy sync, don't decrease unread counts
A gappy sync may cause a linked chunk to shrink, waiting for callers to
lazy-reload it again in the future. But, because the unread counts
computation rely on the in-memory linked chunk, this means that the
values computed for the unread count may be incorrect (and decrease).

Fortunately, this situation is rather easy to detect, because the latest
active read receipt doesn't change in this case, so we can first check
that, and then manually readjust the unread counts, if they've
decreased.

Future work should trigger back-pagination in those cases, so the unread
counts keeps on being precise, despite the gappy sync.
2026-03-16 16:41:31 +01:00
Benjamin Bouvier
f1a50bb68f test(event cache): cache shrinking confuses the unread count computation
This test exhibits an edge case: when a room event cache is shrunk
(because of a gappy/limited sync), then the unread count might decrease,
without the latest active read receipt changing.
2026-03-16 16:41:31 +01:00