Commit Graph

15093 Commits

Author SHA1 Message Date
Stefan Ceriu
487640fa1f feat(client): expose a client pause/resume mechanism throughout the SDK
This patch exposes the pause/resume mechanism for SDK stores all the way up to
the FFI `Client`, so apps can temporarily release SQLite resources when moving
to the background and re-acquire them on resume.

The main use case is iOS backgrounding, where keeping SQLite file descriptors and
locks open can contribute to `0xdead10cc` terminations by the operating system.
2026-04-23 18:52:41 +03:00
Stefan Ceriu
0ea0c94bd0 chore(tests): add pause/resume mechanism tests for all the stores 2026-04-23 18:18:58 +03:00
Stefan Ceriu
30875cac1f feat(stores): implement pause/resume support in the crypto, event cache, state and media SQLite stores
This patch implements the main pause/resume logic in the underlying SDK stores.
The in memory stores no-op trough the default trait implementations.

The main change are limited to the sqlite crate:
- a new type called `SqliteConnections` has been introduced which now holds a
store's read connection pools as well as the always on write connection. This
lives as an optional on each store's level and gets set to None whenever the
store is paused
- during the pausing phase `SqliteConnections` (through its `pause_connections`
method) does the following:
    - closes the read pool, directly dropping idle connections
    - waits for in flight writes to finish
    - tries a best effort WAL checkpoint
    - drops the write connection on a blocking thread
    - and waits for in-flight read connections to drain
    - this is all best effort with an eventual timeout
- resuming connections is also shared between the stores through
`SqliteConnections` and consists in building a new pool with the previous
configuration and creating a new write connection
2026-04-23 18:18:58 +03:00
Stefan Ceriu
f89ae339b2 feat(stores): add pause and resume trait definitions and default implementations for all the stores 2026-04-23 13:13:17 +03:00
Andy Balaam
103ff7d3ec Use stable identifier for m.shared_history 2026-04-21 13:47:19 +01:00
Andy Balaam
efa28a1ffd Use stable identifiers for m.room_key_bundle and m.history_not_shared 2026-04-21 13:47:19 +01:00
Andy Balaam
c4640897d4 Test for serialization and deserialization of a room key bundle 2026-04-21 13:47:19 +01:00
Benjamin Bouvier
0487a143ed test(integration): workaround non-working subscription to make the test pass in CI 2026-04-21 14:43:55 +02:00
Benjamin Bouvier
7ab97d59b8 test(integration): add an integration test for computing latest events in a few rooms 2026-04-21 14:43:55 +02:00
Benjamin Bouvier
940862ebed chore: bump the integration testing synapse version to v1.151.0 2026-04-21 14:43:55 +02:00
Jorge Martín
e507eaabf6 feat(ffi): Expose ffi::NotificationRoomInfo::service_members
This is needed in some clients to know if a direct room is a DM or not
2026-04-21 13:22:58 +02:00
Jorge Martín
a2bbc33920 doc(ffi): Add changelog entry matrix-sdk-ffi/20260421 2026-04-21 10:38:14 +01:00
Jorge Martín
db787c28b8 refactor(sdk-crypto): Fix several issues related to the newly enabled experimental-push-secrets feature 2026-04-21 10:38:14 +01:00
Jorge Martín
a3d6114ddd refactor(ffi): Use the shared default features for the Kotlin bindings
This should align them with iOS.
2026-04-21 10:38:14 +01:00
Jorge Martín
58a139bf96 feat(ffi): Enable experimental-push-secrets feature by default 2026-04-21 10:38:14 +01:00
Kévin Commaille
012bc03014 refactor: Use TaskMonitor::spawn_finite_task
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-04-21 11:18:43 +02:00
Kévin Commaille
38adf952bd chore: Fix typo
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-04-21 11:18:43 +02:00
Kévin Commaille
99d675d85a feat(sdk): Refresh supported versions cache in the background
The previous behavior was making the data unavailable as soon as it is
expired, forcing the user to make a request to access fresh data. This
change keeps the data after it is expired, allowing the function to
return quickly, and triggers a background task to refresh it so that
later calls will be able to use the updated data.

This is a step towards #6090. While it's not clear in the issue what
should be the trigger for the background refreshes, this implements at
least the background refresh while keeping the expiry time as a trigger.

The next steps are to apply this to other cached values and shorten the
expiry time to something like 1 day, which should be more helpful.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-04-21 11:18:43 +02:00
Kévin Commaille
be5eebaa35 refactor(base): Move and rename TtlStoreValue
Its is now available as `matrix_sdk_common::ttl_cache::TtlValue`,
allowing to use it outside of a store.

It also supports deserializing data without a timestamp, to allow to
add an expiration time to data that was already persisted.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-04-21 11:18:43 +02:00
Benjamin Bouvier
cf4d3cb492 doc(ffi): clarify when to call Client::enable_automatic_backpagination
Since the boolean is read only once when subscribing the event cache,
let's make it clear when the FFI function should be called (based on
most prominent types used at the FFI layer).
2026-04-21 10:14:52 +02:00
dependabot[bot]
ad5241b2e5 chore(deps): bump bnjbvr/cargo-machete
Bumps [bnjbvr/cargo-machete](https://github.com/bnjbvr/cargo-machete) from e82b6af0d3610e62ddf49bf7c62e662d7e31db0d to ac30a525c0a8d163a92d727b3ff079ee3f6ecb08.
- [Release notes](https://github.com/bnjbvr/cargo-machete/releases)
- [Changelog](https://github.com/bnjbvr/cargo-machete/blob/main/CHANGELOG.md)
- [Commits](e82b6af0d3...e82b6af0d3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-21 10:13:59 +02:00
dependabot[bot]
d083c56ccb chore(deps): bump codecov/codecov-action from 5.5.2 to 6.0.0
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.5.2 to 6.0.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](671740ac38...57e3a136b7)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-21 10:02:08 +02:00
dependabot[bot]
eb493de1b8 chore(deps): bump actions/cache from 5.0.4 to 5.0.5
Bumps [actions/cache](https://github.com/actions/cache) from 5.0.4 to 5.0.5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](668228422a...27d5ce7f10)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-21 10:01:44 +02:00
dependabot[bot]
6aa4fdaed4 chore(deps): bump actions/upload-pages-artifact from 4.0.0 to 5.0.0
Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 4.0.0 to 5.0.0.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](7b1f4a764d...fc324d3547)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-21 09:59:22 +02:00
dependabot[bot]
9c6bbd98a7 chore(deps): bump taiki-e/install-action from 2.68.26 to 2.75.10
Bumps [taiki-e/install-action](https://github.com/taiki-e/install-action) from 2.68.26 to 2.75.10.
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/install-action/compare/v2.68.26...85b24a67ef0c632dfefad70b9d5ce8fddb040754)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-version: 2.75.10
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-21 09:47:28 +02:00
Benjamin Bouvier
8b14a8920c doc(sdk): add a module doc code example for search 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
98b36fe5e0 chore: update changelogs 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
a1f32d741f refactor(ffi): remove unused struct 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
ce01854078 refactor(sdk): Room::search_messages and Client::search_messages 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
7f8c9b0244 refactor(search): pass the number of results per batch in the ctors 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
3621acb445 refactor(sdk): move the high-level search helpers back to the SDK crate 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
3789374951 refactor(sdk): move search related functions to a message_search module 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
e54a36a1ca refactor(search): simplify global search more by avoiding is_done tracking 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
cf95c3f4cc refactor(search): avoid using a HashMap for linear iteration 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
6ccfc92139 refactor(search): simplify code around global search 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
4ee20befa3 chore: address first batch of review comments 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
4348d9de23 chore: add changelog entries for search! 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
477ee70e1c feat(ffi): bindings for search 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
83989c030a feat(ffi): allow enabling search with a search index store 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
717b6371f8 feat(multiverse): add support for global search (ctrl+g) 2026-04-20 12:18:52 +02:00
Benjamin Bouvier
6fa832cfc8 feat(search): higher-level Search API 2026-04-20 12:18:52 +02:00
Ivan Enderlin
1bff8cbe5d chore(ffi): Do not log errors in ClientError::from_str.
This patch stops logging errors in `ClientError::from_str` as it was an
artifact of some old debugging sessions.
2026-04-20 11:33:15 +02:00
Ivan Enderlin
9bb67e8422 fix(ffi): Use the ERROR log level for errors.
This patch changes a `warn!` to an `error!` in `ClientError`. There are
errors, let's use the proper log level here.
2026-04-20 11:33:15 +02:00
Damir Jelić
c962a52f73 ci: Add a zizmor action 2026-04-20 09:49:55 +02:00
Damir Jelić
4d20b481c1 ci: Upload the coverage directly as part of the coverage workflow 2026-04-20 09:49:55 +02:00
Damir Jelić
a5136c7384 ci: Add a zizmor config and use correct hashes for our github actions 2026-04-20 09:49:55 +02:00
Andy Balaam
0e120549ce Remove unneeded TODO in RoomKeyBundleContent
Quoting @poljar:

> If you follow the stack till you get where the secret key is, you end up here:
> 6282fd8838/crates/ruma-events/src/room.rs (L269-L273)
> And that is now zeroized.
> So yeah, the TODO was resolved in Ruma.
2026-04-17 16:18:36 +02:00
Damir Jelić
1e74c48351 fix(thread): Only apply valid edits in the thread summary 2026-04-17 12:34:47 +02:00
Damir Jelić
9e242abda9 test(latest-event): Check that we don't apply invalid edits in the latest event 2026-04-17 12:34:47 +02:00
Damir Jelić
62ff895ce8 fix(latest-event): Don't apply invalid edits on the latest event 2026-04-17 12:34:47 +02:00