Commit Graph

11066 Commits

Author SHA1 Message Date
Ivan Enderlin
8fcd5a91c4 test(sdk): Update tests.
This patch updates 3 tests that were expected to read all events: a
pagination is now necessary.
2025-02-18 17:13:12 +01:00
Ivan Enderlin
155042e46c task(common): LinkedChunkBuilder gains from_last_chunk and insert_new_first_chunk.
This patch adds two methods on `LinkedChunkBuilder`: `from_last_chunk`
to build a new `LinkedChunk` with a single provided chunk, and
`insert_new_first_chunk` to insert a new chunk at the beginning of the
provided `LinkedChunk`.
2025-02-18 17:13:12 +01:00
Ivan Enderlin
e03d40e946 chore(sdk): Rename RoomEvents::with_initial_chunks.
This patch renames `RoomEvents::with_initial_chunks` to
`with_initial_linked_chunk`. It avoids a confusion between several
chunks, like `RawChunk`s, and `LinkedChunk` which represents several
`Chunk`s.
2025-02-18 17:13:12 +01:00
Benjamin Bouvier
2671769d9f fix(compilation): fix benchmark compilation on non-linux platforms 2025-02-18 13:58:23 +01:00
Jorge Martín
8d9d83f15f feat(ffi): add history_visibility_override param to the create room fn 2025-02-18 13:08:02 +01:00
Ivan Enderlin
6bc9dc5c6a test(sdk): Improve a test.
This patch adds an event to be sure it is removed later during the error
recovery.
2025-02-18 11:38:24 +01:00
Ivan Enderlin
d6566484a1 doc(sqlite): Fix typos in comments. 2025-02-18 11:38:24 +01:00
Ivan Enderlin
0e4d8ec62f feat(sqlite): Detect cycles when loading last chunk of LinkedChunk.
This patch updates `SqliteEventCacheStore::load_last_chunk` to detect
cycle for the last chunk only.
2025-02-18 11:38:24 +01:00
Ivan Enderlin
f9c6f897c8 feat(common): Detect cycles when loading last chunk of LinkedChunk.
This patch updates `RelationalLinkedChunk::load_last_chunk` to detect
cycle for the last chunk only.
2025-02-18 11:38:24 +01:00
Ivan Enderlin
7252a685a6 test(common): Test RelationalLinkedChunk::load_last_chunk and load_previous_chunk.
This patch adds tests for the `load_last_chunk` and
`load_previous_chunk` methods on `RelationalLinkedChunk`.
2025-02-18 11:38:24 +01:00
Ivan Enderlin
bed4d5034e test(sqlite): Test SqliteEventCacheStore::load_last_chunk and load_previous_chunk.
This patch adds tests for the `SqliteEventCacheStore::load_last_chunk`
and `load_previous_chunk` methods.
2025-02-18 11:38:24 +01:00
Ivan Enderlin
e2a2f32e82 task(sqlite): Implement load_last_chunk and last_previous_chunk.
This patch replaces `todo!()` by real implementations for the
`load_last_chunk` and `last_previous_chunk` methods.
2025-02-18 11:38:24 +01:00
Ivan Enderlin
334c66b0a0 task(base): Update EventCacheStore to add load_last_chunk and load_previous_chunk.
This patch update the `EventCacheStore` trait to:

1. rename `reload_linked_chunk` into `load_all_chunks` and put this
   method behind `#[cfg(test)]` so that it is removed from the public API,
2. add `load_last_chunk`,
3. add `load_previous_chunk`.

These 2 new methods are implemented inside the `MemoryStore` (with its
real implementation in the `RelationalLinkedChunk`), but `todo!()` are
added for the SQLite implementation.
2025-02-18 11:38:24 +01:00
Kévin Commaille
ca392b08c9 chore: Add changelog for UserSession deserialization
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-18 11:32:44 +01:00
Kévin Commaille
e9a34f6359 refactor(oidc): Remove support for deserializing previous UserSession format
The format changed 10 months ago and since it contains the tokens, it should have be reserialized already in that time.

Afaict EX clients do not serialize that type, the bindings have their own `Session` type for that.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-18 11:32:44 +01:00
dependabot[bot]
6411d27096 chore(deps): bump crate-ci/typos from 1.29.5 to 1.29.7
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.29.5 to 1.29.7.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.29.5...v1.29.7)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-17 16:47:15 +01:00
Ivan Enderlin
07f0017d30 feat(common): Introduce Chunk::lazy_previous in the LinkedChunk.
This patch introduces `Chunk::lazy_previous` which is a key feature to
support lazy-loading of a `LinkedChunk`. When a chunk is loaded, if it
is the first, it keeps in memory whether it has a previous chunk or not.
Thus, it is possible to insert new chunk in front of the `LinkedChunk`,
and `Update`s will correctly continue to link chunks between them (with
`NewItemsChunk` and `NewGapChunk`).

Example, imagine the following chunks: [0] <-> [1] <-> [2]. If [2] is
the only one being loaded. Then its previous chunk, [1], is loaded from
the store (because [2]'s previous is [1] in the store). Then [1] is
replaced by [3] and [4]. We get this: [4] <-> [3] <-> [1] <-> [2]. If
the `Update::New*Chunk` for [4] doesn't contain a `previous`, the store
is out of sync: in the store, [4] has no previous, but [0] still has [1]
for its `next`.

With this `lazy_previous`, the links are correctly computed.
2025-02-17 14:09:17 +01:00
Benjamin Bouvier
59f9d12da5 perf(timeline): make replacing replies much faster by indexing replies 2025-02-17 12:24:19 +01:00
Kévin Commaille
1c114978e4 refactor(oidc): Remove method to authorize arbitrary scope
Only the scopes necessary during login are specified in MSC2967 now.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-17 12:02:43 +01:00
Stefan Ceriu
629421214f change(crypto): have the RoomIdentityProvider return processing changes when identities transition to IdentityState::Verified too (#4670)
While implementing user verification on Element X I realized that the
`IdentityStatusChanges` stream does not notify us when an user becomes
`Verified`, which is a shame as it's perfect for powering app updates
after verifying users (i.e. all the decorations we show throughout the
app: room header, room details, room member list, room member profile
etc.)

Had a look at the existing code and, while that seems completely
intentional, there is no reason why we can't expand its purview.
2025-02-17 11:48:35 +02:00
Jorge Martín
97d772dd05 test: reverse the logic behind test_focused_timeline_reacts so it checks no reactions are received 2025-02-17 09:47:23 +01:00
Jorge Martín
f28c64ba21 test: modify pinned event tests to make sure we don't add events from paginations or syncs to the timeline 2025-02-17 09:47:23 +01:00
Jorge Martín
20dd15e256 fix(timeline): Don't add events to the pinned events timeline when we receive them on paginations/syncs 2025-02-17 09:47:23 +01:00
Ivan Enderlin
f33d10468d refactor(base): Remove the sliding_sync::http re-export.
This patch removes the `pub use ruma::api::client::sync::sync_events::v5
as http` re-export in `matrix_sdk_base::sliding_sync`.
2025-02-14 14:00:39 +01:00
Ivan Enderlin
d3b3b4db10 chore(base): Remove the sliding_sync module.
This patch inlines `sliding_sync::http` inside `sliding_sync`. Then, the
`sliding_sync/mod.rs` file is renamed to `sliding_sync.rs`.
2025-02-14 14:00:39 +01:00
Ivan Enderlin
38e28643f1 fix: Remove support for MSC3575. 2025-02-14 14:00:39 +01:00
Valere
9de6d28270 logging(crypto): Add more logs when identity or devices change 2025-02-14 10:43:42 +01:00
Benjamin Bouvier
9f47201bab bench: add a profiling profile that doesn't enable LTO for quick rebuilds 2025-02-14 09:02:38 +01:00
Benjamin Bouvier
0b7140c123 bench: add a benchmark to measure how long it takes to fill a timeline with lots of initial items 2025-02-14 09:02:38 +01:00
Damir Jelić
28a4918ff6 chore(test): Increase the timeout for the sync service offline mode test 2025-02-13 17:00:42 +01:00
Benjamin Bouvier
534cd599f4 doc: remove internal links to macro
Those worked fine until now, but it seems they started to fail after
including the `testing` feature in the benchmark repository. Oh well.
2025-02-13 16:02:10 +01:00
Benjamin Bouvier
910a5ce90a ci: add a task to compile benchmarks
This adds a task to compile the benchmarks in CI, without running them,
and with the lowest level of optimization that's available (the `dev`
profile).
2025-02-13 16:02:10 +01:00
Benjamin Bouvier
dadd01a4ea chore: fix benchmarks and use the MatrixMockServer in there too 2025-02-13 16:02:10 +01:00
Damir Jelić
c4a9059814 Merge branch 'oidc_e2e' 2025-02-13 15:59:20 +01:00
Damir Jelić
51a1cd3c67 Merge pull request #4604 from zecakeh/qr-login-oauth2
refactor(auth-qrcode): Use oauth2 crate instead of openidconnect
2025-02-13 15:42:51 +01:00
Kévin Commaille
c6d2ab4637 chore: Fix changelog location
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-13 15:26:11 +01:00
Kévin Commaille
c6c7307d6e Merge branch 'main' into qr-login-oauth2 2025-02-13 15:20:10 +01:00
Kévin Commaille
9c9944aa0c chore: Update changelog for TLS 1.2
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-13 14:21:25 +01:00
Kévin Commaille
b311197d41 feat(sdk): Only allow TLS 1.2 or newer
As recommended by BCP 195.

It shouldn't be a problem with rustls that only supports TLS 1.2 and 1.3, but with native-tls it depends on the implementation.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-13 14:21:25 +01:00
Benjamin Bouvier
1068d88c3e fix(event cache store): shortcut when there's no duplicate events to check at all
Otherwise this causes a panic when repeating the events variable, when
generating the SQL query below.
2025-02-13 13:43:49 +01:00
Damir Jelić
861078a95e feat: Add a memoized variant of Oidc::fetch_account_management_url 2025-02-13 12:32:42 +01:00
Damir Jelić
aa9aef44f7 refactor: Rename Oidc::account_management_url to fetch_account_management_url 2025-02-13 12:32:42 +01:00
Damir Jelić
f2ad11a56a refactor(client): Create a common struct for client caches 2025-02-13 12:32:42 +01:00
Damir Jelić
12c327292f feat(common): Add a simple TTL cache implementation 2025-02-13 12:32:42 +01:00
Kévin Commaille
31e78c2a1b refactor(oidc): Only support public clients (#4634)
This should be the most common case, and is already the only case
supported by the higher level APIs like `url_for_oidc` and
`login_with_qr_code`. It simplifies the API because we can call
`restore_registered_client` directly from `register_client`, which was a
TODO.

- [x] Public API changes documented in changelogs (optional)

---------

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-13 11:40:17 +01:00
Benjamin Bouvier
8a64922130 test(event cache): address review comments and add a test for storage deduplication 2025-02-13 10:53:20 +01:00
Benjamin Bouvier
2ae142f257 refactor(event cache): get rid of a few generics
The YAGNI crew strikes again.
2025-02-13 10:53:20 +01:00
Benjamin Bouvier
faa0e6e554 feat(event cache): allow using the bloom filter OR the store to deduplicate events 2025-02-13 10:53:20 +01:00
Benjamin Bouvier
b95cf79a6d refactor(event cache): move the gist of deduplication into BloomFilterDeduplicator 2025-02-13 10:53:20 +01:00
Benjamin Bouvier
28cd8beb77 refactor(event cache): rename Deduplicator to BloomFilterDeduplicator 2025-02-13 10:53:20 +01:00