Commit Graph

8626 Commits

Author SHA1 Message Date
Benjamin Bouvier
845f65400a test: add integration test for a room preview 2024-04-18 11:29:24 +02:00
Benjamin Bouvier
d5cbf77b84 tests: prefix some more tests with test_ 2024-04-18 11:29:24 +02:00
Benjamin Bouvier
f322dcd200 sdk: give the ability to get a room's preview 2024-04-18 11:29:24 +02:00
Benjamin Bouvier
f7329c71bb test: test that getting kicked/banned marks the room as left in sliding sync matrix-sdk-crypto-ffi-0.4.0 2024-04-15 11:41:37 +02:00
Benjamin Bouvier
b977a239c3 tests: prefix more tests with test_ 2024-04-15 11:41:37 +02:00
Benjamin Bouvier
3aa62a265d sliding sync: also mark kicked/banned users as leaving a room 2024-04-15 11:41:37 +02:00
Benjamin Bouvier
fc4cd530fb event cache: introduce the Paginator API (#3309)
This introduces a new helper object to run arbitrary pagination requests, backwards- or forward-. At the moment they're disconnected from the event cache, although I've put the files there for future convenience, since at some point we'll want to merge the retrieved events with the cache (? maybe).

This little state machine makes it possible to retrieve the initial data, given an initial event id, using the /context endpoint; then allow stateful pagination using a paginator kind of API. Paginating in the timeline indicates whether we've reached the start/end of the timeline.

The test for the state subscription is quite extensive and makes sure the basic functionality works as intended.

Some testing helpers have been (re)introduced in the SDK crate, simplifying the code, and introducing a better `EventFactory` / `EventBuilder` pattern than the existing one in the `matrix-sdk-test` crate. In particular, this can make use of some types in `matrix-sdk`, notably `SyncTimelineEvent` and `TimelineEvent`, and I've found the API to be simpler to use as well.

Part of #3234.
2024-04-12 17:57:10 +02:00
Benjamin Bouvier
7c68096237 multiverse: allow setting a proxy
This is handy when running mitmproxy on multiverse.
2024-04-11 16:45:05 +02:00
Stefan Ceriu
e12f917559 ffi: expose method for parsing Matrix URIs and converting them into actual Matrix entities 2024-04-11 16:27:20 +02:00
Stefan Ceriu
20f0346733 ffi: expose method for genering user matrix.to permalinks 2024-04-11 16:27:20 +02:00
Benjamin Bouvier
8e98252be3 event cache: only forward a read marker update once per JoinedRoomUpdates
This protects against the sliding sync proxy (or synapse) sending lots
of duplicate fully read marker events for the same room in case of
reset. This would lead to forwarding lots and lots of
`RoomEventCacheUpdate`s to the timeline, cluttering the channel, and
resulting in a lag. This lag would then clear the timeline, seemingly
cause missing chunks from history.

https://github.com/matrix-org/matrix-rust-sdk/pull/3312 is likely the
long term fix (after a clear(), the timeline should retrieve all the
memoized events from the event cache), but this should prevent the root
cause of the spamming in the first place, getting us back to a safe
state.
2024-04-11 14:02:57 +02:00
Benjamin Bouvier
1053bc9148 sync service: only log sliding sync errors when it's not a sliding sync expiration 2024-04-11 12:12:31 +02:00
Benjamin Bouvier
1dd497e9de sync service(refactor): let start task methods be self-less functions
This removes one (1) level of indent in both tasks and makes the code a
bit simpler to read.
2024-04-11 12:12:31 +02:00
Benjamin Bouvier
81f1292660 sync service: show the termination report debug info in the error logs
We do see lots of "broken channel" log lines for these two log
statements, and since I'm unclear why they happened, I'd like to add a
bit more logging to those.

Also makes the log level consistent, both are set to "warn" instead of
one warn and one error. Usually it's not a big deal because the only
error that may happen is that the channel is broken, indicating the task
died before, so there's no need to stop it manually.
2024-04-11 12:12:31 +02:00
Benjamin Bouvier
5671121b21 timeline: add comments about insertion order to the front of the timeline 2024-04-11 12:11:54 +02:00
Kévin Commaille
88c4dec35f sdk: Upgrade image crate
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-11 11:40:32 +02:00
Kévin Commaille
6d9aa14ccd qrcode: Upgrade qrcode crate
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-11 11:40:32 +02:00
Benjamin Bouvier
16551feea3 timeline: lower log severity of read receipts issues
Those two issues really aren't errors we should be too scared of:

- on the one hand, they don't prevent correct usage of the timeline, but
slightly decrease the UX's quality
- on the other hand, they may indicate that read receipts haven't been
received yet, OR some events are unknown (can be happening if the
previous read receipt refers to an event the timeline doesn't know
about).

So I lowered their severity to debug instead of error, since only
outstanding issues should errors or warnings in my opinion.
2024-04-11 11:26:16 +02:00
Andy Balaam
1e7182e820 Merge pull request #3253 from matrix-org/andybalaam/add-backup_version-arg
crypto: Add a backup_version argument to group session backup methods
2024-04-09 16:44:50 +01:00
Andy Balaam
a843125fa4 crypto: Share code to get backup_version in tests 2024-04-09 16:31:13 +01:00
Benjamin Bouvier
fcfdaadb25 room(refactor): reuse code to decrypt an event instead of duplicating it 2024-04-08 16:16:44 +02:00
Benjamin Bouvier
222f969e2f integration tests: add tests for /context
Update testing/matrix-sdk-integration-testing/src/tests/room.rs

Co-authored-by: Damir Jelić <poljar@termina.org.uk>
Signed-off-by: Benjamin Bouvier <public@benj.me>
2024-04-08 16:16:44 +02:00
Benjamin Bouvier
406fd011ff room: extend event_with_context so it returns a fully decrypted /context response 2024-04-08 16:16:44 +02:00
Benjamin Bouvier
b903ee4b42 room(style): remove one level of indent with an early let/else statement
Classic Benji.
2024-04-08 16:16:44 +02:00
Stefan Ceriu
b9b5286f8a ffi: fix the experimental-room-list-with-unified-invites feature, the sliding sync is_invite field should be None when they are allowed in the room list 2024-04-08 15:37:28 +02:00
dependabot[bot]
2f5d8c212a chore(deps): bump h2 from 0.3.24 to 0.3.26
Bumps [h2](https://github.com/hyperium/h2) from 0.3.24 to 0.3.26.
- [Release notes](https://github.com/hyperium/h2/releases)
- [Changelog](https://github.com/hyperium/h2/blob/v0.3.26/CHANGELOG.md)
- [Commits](https://github.com/hyperium/h2/compare/v0.3.24...v0.3.26)

---
updated-dependencies:
- dependency-name: h2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-08 15:20:10 +02:00
Benjamin Bouvier
797532815a room: warn at most once per room if the room version is missing
This should avoid spamming the logs about missing room versions.
2024-04-08 09:41:56 +02:00
Andy Balaam
f11aeafd58 crypto: Add an optional backup_version param to inbound_group_session_counts 2024-04-05 16:24:55 +01:00
Kévin Commaille
327e0aef99 sdk: Enable matrix-sdk-base feature conditionally
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-05 13:00:04 +02:00
Benjamin Bouvier
742700b7fa event cache: increase the number of pending updates for a sender
And also log the number of skipped updates, when lagging behind in the
event cache or the timeline.
2024-04-05 10:59:28 +02:00
Benjamin Bouvier
03f4a56bff timeline(optimization): don't call force_update_sender_profiles when there are no member_ambiguity_changes
`force_update_sender_profiles` goes through all the timeline items, even
though the `ambiguity_changes` map should be empty, leading to wasted
work. It might not be a big deal, but it's nice to avoid awaiting locks
when we don't have to.
2024-04-05 10:59:28 +02:00
Benjamin Bouvier
d8b0b9e2f4 event cache: better handle room updates lag
First, add a log line, since this is a pretty big deal if we start
lagging behind, and we should understand this clearly in rageshakes.

Second: don't remove existing `RoomEventCache`s, but instead clear them:
we shouldn't re-create new `RoomEventCache`s for the same room id,
otherwise a previous subscriber to updates to `RoomEventCache` would not
get newer updates coming later on.

Third: let consumers know that we cleared the events from the
`RoomEventCaches`.
2024-04-05 10:59:28 +02:00
Benjamin Bouvier
dbb9c60d09 linked chunks: cosmetic changes
This tweaks assert and error messages, avoids indent by returning early,
etc.
2024-04-05 10:59:12 +02:00
Benjamin Bouvier
b6db3af882 room list service: always include the m.room.create state event in a room subscription 2024-04-05 10:58:55 +02:00
Kévin Commaille
8a8ad22961 ffi: Use async functions in AuthenticationService (#3294)
* ffi: Use async functions in AuthenticationService
* Fix swift tests
* Set async_runtime for uniffi::export attribute
* Rename RwLocks
* Get rid of unnecessary map_err

---------

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-04 15:54:20 +00:00
Benjamin Bouvier
b78bbc01a0 timeline: pin all the local echoes to the bottom
Before this patch, only local echoes that were messages not sent or
messages succesfully sent (but not ack'd yet by sync) would be pinned to
the bottom.

This fixes it by also pinning events that failed to send.

Fixes #3287.
2024-04-04 15:02:13 +02:00
Andy Balaam
f51865e1ae crypto: Add a backup_version argument to group session backup methods 2024-04-04 11:00:59 +01:00
Stefan Ceriu
682c17c9d8 feat: add support for storing breacrumbs in the state store 2024-04-04 11:23:55 +02:00
Damir Jelić
4da1c01963 chore: Fix some typos 2024-04-04 11:17:18 +02:00
Benjamin Bouvier
96a4b06ca6 timeline: use the day divider adjuster when updating the send state of a message 2024-04-02 16:16:45 +02:00
Benjamin Bouvier
ef5b12035d day dividers: explicitly chase trailing day dividers
The algorithm works on the basis that we remove a previous day divider
if it was spurious. But we'd never do this, for a final item that would
be a day divider! So chase these explicitly, also ignore read markers
that would be in the way.
2024-04-02 16:16:45 +02:00
Kévin Commaille
38978dacd7 crypto: Define both bounds in the same place
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-02 15:05:41 +02:00
Kévin Commaille
74ea661438 chore: Use only extern attributes for test modules
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-02 15:05:41 +02:00
Kévin Commaille
da2abccc0d chore: Disable clippy::assigning_clones lint
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-02 15:05:41 +02:00
Benjamin Bouvier
6731c52b12 base: extract changes to profile into a small function helper
and detail the comment about why we need to remove a previous profile
first.
2024-04-02 14:30:19 +02:00
Benjamin Bouvier
a3ca28f1a5 test: add regression test for #3278 2024-04-02 14:30:19 +02:00
Benjamin Bouvier
450ceaa241 base: remove previous profiles of member when they're invited 2024-04-02 14:30:19 +02:00
Benjamin Bouvier
6cd655ba7c state store: add Changes::profile_to_delete field
So as to remove existing profiles from the storage.
2024-04-02 14:30:19 +02:00
Kévin Commaille
f9ab073adf chore: Avoid redundant imports
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-02 13:27:58 +02:00
Kévin Commaille
b5d7c40029 tests: Use .contains_key() instead of .get().is_some()/.is_none()
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-02 13:27:58 +02:00