Commit Graph

11232 Commits

Author SHA1 Message Date
Andy Balaam
074c0e59e0 fix(common): Shorten the name of the snapshot_test_encryption_info 2025-03-05 14:03:51 +00:00
Kévin Commaille
1d7c60c46a chore: Add changelog about ID tokens support removal
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-05 14:19:27 +01:00
Kévin Commaille
377f34fae2 refactor(oidc): Get rid of OidcBackend
Now that we don't use it for tests, we don't need it anymore.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-05 14:19:27 +01:00
Kévin Commaille
26cb805e0f test(oidc): Use MatrixMockServer in the remaining tests
Gets rid of the MockImpl for OidcBackend.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-05 14:19:27 +01:00
Kévin Commaille
81dbe2060c refactor(oidc): Remove support for ID tokens
ID tokens are a feature of OpenID Connect, we don't need them to support OAuth 2.0.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-05 14:19:27 +01:00
Ivan Enderlin
fd0fca436b chore(sdk): Remove the request_body instrument's field.
Many fields here are not argument of the `send` method, but are set
later with `Span::record`. Grepping all these fields reveal they are all
set except `request_body` apparently.
2025-03-05 14:15:29 +01:00
Ivan Enderlin
3d653d3fdc fix(sqlite): Design a new schema to get faster insertions.
This patch is twofold. First off, it provides a new schema allowing to
improve the performance of `SqliteEventCacheStore` for 100_000 events
from 6.7k events/sec to 284k events/sec on my machine.

Second, it now assumes that `EventCacheStore` does NOT store invalid
events. It was already the case, but the SQLite schema was not rejecting
invalid event in case some were handled. It's now explicitely forbidden.
2025-03-05 13:57:08 +01:00
Ivan Enderlin
b22bb3ee9f fix(sqlite): Use a prepared statement to insert events.
This patch uses a prepared statement to insert events in the linked
chunks. It offers more predictable performance, and SQLite prefers that.
2025-03-05 13:57:08 +01:00
Ivan Enderlin
7f17b4be7b bench: Add a benchmark for the LinkedChunk with the EventCacheStore. 2025-03-05 13:57:08 +01:00
Benjamin Bouvier
fa3a9d81e3 refactor(event cache): use Ruma's is_redacted() method instead of original_content()
This is cheaper, as it doesn't require cloning the content and
immediately throw it away. This method was introduced recently, thanks
to Kevin for it.
2025-03-05 12:14:04 +01:00
Ivan Enderlin
892c99f0f3 test(sqlite): Improve a test to check uniqueness constraint. 2025-03-05 12:02:30 +01:00
Ivan Enderlin
8d8846a259 chore(sdk): Remove EventsPostProcessing.
This patch removes the `EventsPostProcessing` type, it assumes
`with_events_muts` will always return events that will be post-process.
The case where `EventsPostProcessing::None` becomes a `vec![]`.
2025-03-05 11:30:55 +01:00
Ivan Enderlin
9d63af6271 chore(sdk): maybe_apply_new_redaction no longer takes a &RoomVersionId.
This patch updates `maybe_apply_new_redaction` to remove the first
`&RoomVersionId` argument. Indeed, due to the refactoring, it's now
possible for `maybe_apply_new_redaction` to read this value directly
from `Self::room_version`.
2025-03-05 11:30:55 +01:00
Ivan Enderlin
37ad82adfc doc(sdk): Add missing documentation. 2025-03-05 11:30:55 +01:00
Ivan Enderlin
57953b9ae9 chore(sdk): Make Clippy happy. 2025-03-05 11:30:55 +01:00
Ivan Enderlin
777fb920f6 fix(sdk): maybe_apply_new_redaction updates in-store events.
This patch updates `maybe_apply_new_redaction` so that it is able to
update/redact an event found in the store.
2025-03-05 11:30:55 +01:00
Ivan Enderlin
05750e871b task(sdk): maybe_apply_new_redaction uses find_event.
This patch updates `maybe_apply_new_redaction` to use `find_event`, so
that the target event is looked up in memory or in the store.

The case where it is in the store is a simple `todo!()` for the moment.
I wanted to separate the update of the `maybe_apply_new_redaction`
signature from the `InStore` implementation. The method is now async and
returns a `Result`.
2025-03-05 11:30:55 +01:00
Ivan Enderlin
5a11b8b836 task(sdk): RoomEventCacheState::find_event returns the event location.
This patch introduces `EventLocation` to know if an event has been found
in the memory (in `RoomEvents`) or in the store (in `EventCacheStore`).

This is used by the `RoomEventCacheState::find_event`.
2025-03-05 11:30:55 +01:00
Ivan Enderlin
8a785ea855 task(sdk): Move maybe_apply_new_redaction from RoomEvents inside RoomEventCacheState.
This patch moves the `maybe_apply_new_redaction` method from
`RoomEvents` inside `RoomEventCacheState` so that it has an access
to the store (necessary for the next patch). This patch creates a new
`RoomEvents::replace_event_at` method, which is a thin wrapper around
`LinkedChunk::replace_item_at`.
2025-03-05 11:30:55 +01:00
Ivan Enderlin
1874a76f67 task(sdk): Rename a variable, and AllEventsCache only stores valid events.
This patch renames `sync_timeline_events` into `timeline_events`.
Moreover, this change has spotted a possible improvement
in `AllEventsCache` where it now receives events from
`collect_valid_and_duplicated_events`, which allows to only store valid
events in it.
2025-03-05 11:30:55 +01:00
Ivan Enderlin
0b2b528962 task(sdk): Callback in with_events_mut returns an EventsPostProcessing.
This patch updates the callback passed to `with_events_mut`. It now
returns an `EventsPostProcessing` which can automatically run the, now
inlined, `on_new_events`.

This patch updates where the `RoomVersionId` is also stored. It's not
held by `RoomEventCacheState` instead of `RoomEventCacheInner`.
2025-03-05 11:30:55 +01:00
Ivan Enderlin
2036c3da9d doc(sdk): Fix documentation of with_events_mut. 2025-03-05 11:30:55 +01:00
Benjamin Bouvier
7694b016da chore: disable LTO on release builds
I have to disable LTO every time I'm building any final binary using the
SDK, because otherwise, the builds can take easily more than 10 minutes
to complete, killing iteration times, and making it almost impractical
to use the programs (benchmarks, or multiverse).

I think it should be the decision of the final embedder to enable or
disable LTO, and that for the purpose of our own binaries hosted in the
SDK repository, we don't need the absolute best performance (or, for the
sake of benchmarking, we can tweak the profiling profile).
2025-03-05 10:55:15 +01:00
Benjamin Bouvier
6fdd59157a fix(timeline): steal hiddden receipts from the previous item, when inserting in the middle 2025-03-05 09:42:14 +01:00
Benjamin Bouvier
0d7096fa94 test(timeline): add regression test for duplicate read receipts 2025-03-05 09:42:14 +01:00
Benjamin Bouvier
a94dc4e89b chore(timeline): add more logs for read receipts 2025-03-05 09:42:14 +01:00
Benjamin Bouvier
bf965b2a17 feat(timeline): add an invariant check that there's no duplicate read receipts 2025-03-05 09:42:14 +01:00
Benjamin Bouvier
9c87625910 chore(event cache): include the room id in the sending linked chunk updates to the store log 2025-03-05 08:56:37 +01:00
Benjamin Bouvier
3f1543504a test(timeline): add an equivalent test when storage's enabled 2025-03-05 08:56:37 +01:00
Benjamin Bouvier
3773968d19 fix(timeline): remove events when back-paginating too
The previous strategy was incorrect, see the new doc comment explaining
why with the example taken from the regression test.
2025-03-05 08:56:37 +01:00
Kévin Commaille
d28d4ce799 test(timeline): add a regression test for the incorrect timeline ordering 2025-03-05 08:56:37 +01:00
Benjamin Bouvier
bffb19b23a refactor!(sdk): bump the MSRV, yay for async closures 🥳 2025-03-04 18:10:59 +01:00
Benjamin Bouvier
6aea4c827a feat(ffi): allow setting the media retention policy from the FFI layer 2025-03-04 18:10:59 +01:00
Benjamin Bouvier
ac3250c58b refactor(event cache): use u64 instead of usize in MediaCachePolicy
This is more predictible and we're still far from 128-bits wide cpu,
right? RIGHT?
2025-03-04 18:10:59 +01:00
Benjamin Bouvier
6fe0880e11 feat(ffi): add a method to clear all the non-critical caches of a client 2025-03-04 18:10:59 +01:00
Stefan Ceriu
78282bf1e1 chore(sdk-base): fix typos following typos crate bump to 1.30.0 2025-03-04 11:28:36 +02:00
dependabot[bot]
43d25127c3 chore(deps): bump crate-ci/typos from 1.29.7 to 1.30.0
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.29.7 to 1.30.0.
- [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.7...v1.30.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-04 11:28:36 +02:00
bitfriend
c33c61a256 feat(ci): Implement CI to detect long path in pushed commit 2025-03-03 16:57:36 +00:00
Benjamin Bouvier
def4be5a9f refactor(event cache): make use of Chunk::num_items when deciding whether to drop a previous empty event chunk 2025-03-03 16:04:15 +01:00
Benjamin Bouvier
9bc0d8b0d9 refactor(event cache): rename Chunk::len to Chunk::num_items 2025-03-03 16:04:15 +01:00
Benjamin Bouvier
0924b2e343 refactor(event cache): get rid of EmptyChunkRule::Keep which is only used in testing
This isn't useful to keep, since it's only used in testing. Worst case,
we can revert this commit in the future.
2025-03-03 16:04:15 +01:00
Benjamin Bouvier
8b6e75980b refactor(event cache): don't keep an empty events chunk before a gap
The linked chunk always starts with an empty events chunk. If we receive
a gap from sync, then we will immediately push a gap chunk; in this
case, it might be better to replace the events chunk with a gap chunk.
This is equivalent to removing the empty events chunk, after pushing
back the first one (we can't do it before, otherwise we might get rid of
the only chunk in the linked chunk, which breaks the invariant that a
linked chunk is never empty).
2025-03-03 16:04:15 +01:00
dependabot[bot]
5fd0cb0ddb chore(deps): bump bnjbvr/cargo-machete from 0.7.1 to 0.8.0
Bumps [bnjbvr/cargo-machete](https://github.com/bnjbvr/cargo-machete) from 0.7.1 to 0.8.0.
- [Release notes](https://github.com/bnjbvr/cargo-machete/releases)
- [Changelog](https://github.com/bnjbvr/cargo-machete/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bnjbvr/cargo-machete/compare/v0.7.1...v0.8.0)

---
updated-dependencies:
- dependency-name: bnjbvr/cargo-machete
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-03 15:38:57 +01:00
Benjamin Bouvier
b5edc86a52 refactor(event cache): rename clear to clear_pending 2025-03-03 14:56:33 +01:00
Benjamin Bouvier
d09655989d feat(event cache): don't include useless updates when clearing/resetting a linked chunk 2025-03-03 14:56:33 +01:00
Benjamin Bouvier
83415ac6ca refactor(event cache): clear all pending updates when resetting/shrinking a linked chunk 2025-03-03 14:56:33 +01:00
Kévin Commaille
cc7fb63c6d refactor(sdk): Remove clone_request method
http::Request implements Clone since http 1.0.0
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-03 14:32:34 +01:00
Benjamin Bouvier
f5195222a7 refactor(ffi): move the TimelineEventTypeFilter to timeline/configuration
Pure code motion, nothing else.
2025-03-03 12:40:54 +01:00
Benjamin Bouvier
cecf15a34a refactor(ffi): unify a bit more Room::timeline_with_configuration and RoomListItem::init_timeline
The two last missing pieces will be the UTD hook and loading events from
the persistent storage.
2025-03-03 12:40:54 +01:00
Damir Jelić
95b53d7e01 chore: Tweak the weekly-report command to include PR numbers 2025-02-28 15:51:38 +01:00