Commit Graph

15751 Commits

Author SHA1 Message Date
Stefan Ceriu
6bed07f5b4 feat(event cache): enable automatic back-pagination via ClientBuilder
Move `experimental_auto_back_pagination` off `EventCacheConfig` and onto
`ClientBuilder`, mirroring `enable_share_history_on_invite`. Previously the flag lived
behind an `RwLock`, was checked exactly once at first `subscribe()`,
and silently became a no-op if set afterwards.
2026-07-28 09:58:55 +03:00
Stefan Ceriu
d300b3a9a4 test(event cache): search backfill makes history searchable
End-to-end integration test through the public `SearchService`: a term that
exists only in a room's history (behind a gap) becomes searchable after
`run_search_backfill` pulls the history in and the search indexing task picks
it up. Exercises the whole chain: back-pagination queue -> event cache ->
search indexing task -> SearchService.
2026-07-28 09:58:49 +03:00
Stefan Ceriu
13d465225f feat(ffi): add a dedicated trace pack for the back-pagination queue
Add `matrix_sdk::event_cache::back_pagination_queue` as its own log target,
and a `TraceLogPacks::BackPagination` pack for it, instead of folding it into
the `EventCache`/`LatestEvents` packs. This lets a client capture the queue's
progress logs (requests, scheduling, per-room and per-sweep summaries) on
their own, without turning the whole event-cache subtree to trace.
2026-07-28 09:58:49 +03:00
Stefan Ceriu
143be37990 feat(ffi): expose the search back-pagination sweep
Add `Client::run_search_backfill(BackPaginationStrategy)`, which starts the
sweep in the background and returns a `TaskHandle` to stop it (e.g. from an
iOS background-task expiration handler). `BackPaginationStrategy`
(`Foreground`/`Background`) lets the client tune how gently it runs.

Rename `enable_automatic_backpagination` to `enable_automatic_back_pagination`
for naming consistency.
2026-07-28 09:58:46 +03:00
Stefan Ceriu
2fa71b05b4 feat(event cache): resolve a room's latest event via back-pagination 2026-07-28 09:58:20 +03:00
Stefan Ceriu
a4633ae467 feat(event cache): wire the queue into the event cache, replacing the credit system 2026-07-28 09:58:19 +03:00
Stefan Ceriu
164fbdac1b feat(event cache): add the back-pagination consumer entry points 2026-07-27 17:33:19 +03:00
Stefan Ceriu
331147d375 feat(event cache): add the back-pagination queue scheduler 2026-07-27 16:39:17 +03:00
Stefan Ceriu
3fe3a3dcc6 feat(event cache): add back-pagination request and stop-condition types 2026-07-27 16:27:09 +03:00
manuroe
3d74f21050 revert: undo oauth refresh commits accidentally pushed to main
These two commits were pushed directly to `main` by mistake, bypassing the PR review process:

  - b6c521a85 test(oauth): reproduce hard logout from stale refresh after suspension
  - 111567e2e fix(oauth): fetch server metadata before capturing the refresh token

This reverts both so `main` returns to its previous state. The change will be resubmitted as a normal pull request.
2026-07-24 19:11:26 +02:00
manuroe
111567e2e2 fix(oauth): fetch server metadata before capturing the refresh token
refresh_access_token validated the session hash and captured the refresh token before awaiting server_metadata(). On iOS the process can be suspended during that request; while suspended the cross-process lock lease lapses and a sibling process (the NSE) can refresh and rotate the token. On resume the app exchanged the now-stale token and was hard logged out with invalid_grant.

Fetch the server metadata and client id before taking the cross-process lock, and read the refresh token after the hash check, so a rotation that happens during the metadata request is detected as a hash mismatch and handled via the existing optimistic exit instead of exchanging a stale token.
2026-07-24 17:33:13 +02:00
manuroe
b6c521a857 test(oauth): reproduce hard logout from stale refresh after suspension
When the app is suspended during the server_metadata() request of a token refresh, its cross-process lock lease lapses and a sibling process (the NSE) rotates the refresh token. On resume the app exchanges the now-stale token, gets invalid_grant, and is hard logged out.

This test reproduces that race. It fails on the current code, demonstrating the bug, and passes once refresh_access_token re-checks the session hash after fetching the server metadata.

The test failure here exists only to prove the bug, per the CONTRIBUTING commit guidelines.
2026-07-24 17:33:12 +02:00
Valere
c1db376b29 add changelog 2026-07-24 14:59:02 +01:00
Valere
d4a3c391e7 feat(widget): Implement MSC3819 encrypted flag or to-device 2026-07-24 14:59:02 +01:00
Stefan Ceriu
0065a0f6f0 fix(search): keep documents added then edited in the same batch indexed
When an original and its edit arrive in one batch, bulk_execute runs an Add
followed by an Edit of the same document. The Edit's removal only reconciled
committed documents, so the just-added uncommitted document was deleted by the
delete-by-term yet never re-added, dropping it from the index. Track each
uncommitted add's deletion key so the removal reconciles it too.
2026-07-24 12:17:49 +03:00
Hubert Chathi
b7d99da53e fix rcgen feature flags so that the X.509 tests run 2026-07-24 09:37:29 +01:00
Michael Goldenberg
fd95d90bf9 doc(indexeddb): add changelog file
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-07-23 17:30:19 +03:00
Michael Goldenberg
95037fce93 doc(base): add a changelog file
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-07-23 17:30:19 +03:00
Michael Goldenberg
c8cba492b3 fix(indexeddb): add migration to clear event cache store to remove corrupt event indices
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-07-23 17:30:19 +03:00
Michael Goldenberg
c672f5774c fix(indexeddb): add, rather than replace, event when processing Update::PushItems in event cache store
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-07-23 17:30:19 +03:00
Michael Goldenberg
13e61390b7 feat(indexeddb): create transaction fn for adding an event to event cache store
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-07-23 17:30:19 +03:00
Michael Goldenberg
737441a0d3 fix(indexeddb): remove erroneous event deletion in put_event for event cache store
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-07-23 17:30:19 +03:00
Michael Goldenberg
cf3afe817e fix(indexeddb): ensure event deletions in event cache store shift subsequent event positions
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-07-23 17:30:19 +03:00
Michael Goldenberg
fe6aba5172 refactor(indexeddb): add transaction fn for updating events by position in event cache store
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-07-23 17:30:19 +03:00
Michael Goldenberg
70b63bd4d3 refactor(indexeddb): add transaction fn for updating items in IndexedDB
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-07-23 17:30:19 +03:00
Michael Goldenberg
71f3f2712e fix(base): ensure linked_chunk_remove_item test enforces index shifting after removal
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-07-23 17:30:19 +03:00
Alexandros Lykesas
857ce381f4 feat(ffi): expose Room::load_user_receipt
Signed-off-by: Alexandros Lykesas <alexookah@me.com>
2026-07-23 15:23:50 +01:00
Andy Balaam
1eeb554831 Support compiling matrix-sdk-crpto to WASM by switching to ring crypto for X.509 stuff 2026-07-23 13:57:45 +01:00
Hugh Nimmo-Smith
4a414f6bbf feat(qr-code): Add continuation sender to WaitingForAuth 2026-07-23 14:34:24 +02:00
Andy Balaam
d6e100d502 In integration tests, use the real server name to construct an email so they work locally too 2026-07-23 11:58:39 +01:00
Stefan Ceriu
f8836568a9 fix(search): only index valid replacement edits
get_most_recent_edit indexed the latest m.replace regardless of whether it was
a valid replacement, letting any user rewrite another user's indexed message.
Validate edits with check_validity_of_replacement_events (matching sender, type,
etc.), as the timeline does, before indexing them.
2026-07-23 12:55:43 +03:00
Stefan Ceriu
870b27a603 feat(search): index media, stickers, polls and more message types
Previously the search index only handled plain-text `m.room.message` events and
everything else hit `MessageTypeNotSupported` and was silently dropped.

This decouples the index from Ruma event types and broadens coverage with the
search crate now being content-agnostic. `RoomIndexOperation::Add/Edit` carry a
new `IndexableEvent` instead of `OriginalSyncRoomMessageEvent` and `make_doc`
builds a document straight from that struct. The logic for extracting the text
from the messages is now within the main SDK crate.

Types added:
* Image, Video, Audio and File for filename + caption
* Emote, Notice and ServerNotice for body
* Location for description
* Sticker for Sticker and alt text
* and finally Polls for question and answers
2026-07-23 12:55:43 +03:00
dependabot[bot]
1c62eba722 chore(deps): bump EmbarkStudios/cargo-deny-action from 2.0.20 to 2.1.1
Bumps [EmbarkStudios/cargo-deny-action](https://github.com/embarkstudios/cargo-deny-action) from 2.0.20 to 2.1.1.
- [Release notes](https://github.com/embarkstudios/cargo-deny-action/releases)
- [Commits](bb137d7af7...3c6349835b)

---
updated-dependencies:
- dependency-name: EmbarkStudios/cargo-deny-action
  dependency-version: 2.1.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-23 11:08:43 +02:00
dependabot[bot]
c9b0aaeaae chore(deps): bump CodSpeedHQ/action from 4.18.1 to 4.18.5
Bumps [CodSpeedHQ/action](https://github.com/codspeedhq/action) from 4.18.1 to 4.18.5.
- [Release notes](https://github.com/codspeedhq/action/releases)
- [Changelog](https://github.com/CodSpeedHQ/action/blob/main/CHANGELOG.md)
- [Commits](a4a36bb07c...f99becdce5)

---
updated-dependencies:
- dependency-name: CodSpeedHQ/action
  dependency-version: 4.18.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-23 11:07:49 +02:00
Doug
279402e0e2 FFI: Add a Client::is_user_status_supported check for apps to gate the feature against. (#6778)
- Adds a method to check whether the server supports everything
necessary to use the User Status feature.
- Removes the `unstable-msc4426` feature as it was enabled by default in
the FFI and there seems little benefit to disabling it at this level.
2026-07-22 17:47:12 +03:00
Jorge Martín
6c91da883a Fix: make the ContentScannerMediaFetcher decrypt the encrypted media sources
This wasn't already there by mistake: I thought this step was handled in `matrix_sdk::Media`, it turns out it was done in the media fetcher
2026-07-22 15:58:16 +02:00
Ivan Enderlin
2c7876c532 doc: Add changelog files. 2026-07-22 15:38:53 +02:00
Ivan Enderlin
b00088c1b4 test: Use non-faulty timestamp.
This patch changes the `origin_server_ts` value from 151393755000000
(which is Sun Oct 15 2451 01:46:40 GMT+0000) to 1784626598
which is today. Otherwise, it makes Tantivy to panic, see
https://github.com/matrix-org/matrix-rust-sdk/issues/6772 to learn more.
2026-07-22 15:38:53 +02:00
Ivan Enderlin
2c2547a9a4 test(base): Test the new remember_thread method. 2026-07-22 15:38:53 +02:00
Ivan Enderlin
44b5b9291e test(base): Test the new clear_all_events API.
This patch improves the `test_clear_all_events` test by
testing all possible `LinkedChunkId`, and adds the new
`test_clear_all_events_for_specific_room` test to test the new `room_id:
Option<&RoomId>` argument of `clear_all_tests`.

This patch also removes the `test_remove_room` since the `remove_room`
method has been… removed.
2026-07-22 15:38:53 +02:00
Ivan Enderlin
28fb16e52c test(base): Fix an incorrect data for a test.
This patch fixes a test data: it uses `r0` to create an event for room
`r1`. This doesn't change the test but the data was wrong.
2026-07-22 15:38:53 +02:00
Ivan Enderlin
2b3c40213b fix(base,sdk): Revisit how a room is forgotten within the Event Cache.
`matrix_sdk_base::Client::forget_room` calls
`EventCacheStore::remove_room` to forget a room. This is wrong for
multiple reasons:

- it hits the store directly without emptying the in-memory data in the
  Event Cache caches (like `RoomEventCache` or `ThreadEventCache`),
- it removes data related to `RoomEventCache` only: it misses
  `ThreadEventCache`s.

This patch removes the default implementation for
`EventCacheStore::remove_room`. It removes the method entirely from the
trait. Instead, it improves `EventCacheStore::clear_all_events` to add
an optional `RoomId`.

Then, this patch adds `EventCache::forget_room` which reuses the
`event_cache::states::StateLock::clear_and_reload` method, with the
addition of the optional `RoomId`.
2026-07-22 15:38:53 +02:00
Ivan Enderlin
bdb5ce38c3 feat(base): Add EventCacheStore::remember_thread.
This patch adds the `EventCacheStore::remember_thread` to remember
a thread exists. It doesn't create any `LinkedChunk`, it's just
here list all threads. It's going to be useful to fix a bug with
`Client::forget_room`, but next to implement proper thread list support.
2026-07-22 15:38:53 +02:00
Ivan Enderlin
d6f884d8b2 chore(indexeddb): Remove an unused import. 2026-07-22 15:38:53 +02:00
Ivan Enderlin
99bc2d0c0c chore(sdk): Merge 2 ThreadEventCacheState implementations.
This patch merges 2 implementations of `ThreadEventCacheState`. It's an
artefact of a previous refactoring. Oopsy.
2026-07-22 15:38:53 +02:00
Ivan Enderlin
68672cfc12 feat(sqlite): Add Encryption::encode_linked_chunk.
This patch moves

```rust
self.encryption.encode_key(keys::LINKED_CHUNK, linked_chunk_id.storage_key())
```

to a new `Encryption::encode_linked_chunk` method, so that the code
becomes:

```rust
self.encryption.encode_linked_chunk_id(keys::LINKED_CHUNK, &linked_chunk_id)
```
2026-07-22 15:38:53 +02:00
Ivan Enderlin
b8750610b7 chore(sqlite): Add LinkedChunkId::room_id.
This patch implements `LinkedChunkId::room_id` to avoid cloning a
`LinkedChunkId` just to get the room ID of it.
2026-07-22 15:38:53 +02:00
Ivan Enderlin
9e623b0c27 chore(sqlite): Remove linked_chunk_id in each log because it's already a field of the method.
This patch removes all references to `linked_chunk_id` in `trace!` and
`error!` logs because `linked_chunk_id` is already a span field of the
method.
2026-07-22 15:38:53 +02:00
dependabot[bot]
b641f505f7 chore(deps): bump qmaru/wasm-pack-action from 0.5.3 to 0.6.0
Bumps [qmaru/wasm-pack-action](https://github.com/qmaru/wasm-pack-action) from 0.5.3 to 0.6.0.
- [Release notes](https://github.com/qmaru/wasm-pack-action/releases)
- [Commits](785fe709cd...82e10bdbc3)

---
updated-dependencies:
- dependency-name: qmaru/wasm-pack-action
  dependency-version: 0.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-22 12:07:09 +02:00
Richard van der Hoff
bbba62df1f Merge pull request #6727 from matrix-org/kaylendog/x509/impl
Experimental X.509-based cross-signing identity verification
2026-07-21 17:47:22 +01:00