Commit Graph

14776 Commits

Author SHA1 Message Date
Mauro Romito
cabaede7fc feat: added beacon_info start event to the latest_event that can be displayed 2026-03-17 18:19:44 +01:00
Benjamin Bouvier
a4bb2f3ff4 chore: add changelog entry for the cloneable EventCacheError 2026-03-17 15:47:39 +01:00
Benjamin Bouvier
816530c89c feat(event cache): make EventCacheError cloneable
This makes it possible to share futures which output is a result that
has the error type set to `EventCacheError`. See also
https://github.com/matrix-org/matrix-rust-sdk/pull/6304 for usage.
2026-03-17 15:47:39 +01:00
Ivan Enderlin
e72950ea15 refactor(sdk): Inline RoomEventCacheStateLockWriteGuard::load_more_events_backwards in RoomPagination.
The method
`RoomEventCacheStateLockWriteGuard::load_more_events_backwards` is used
only in one-place: in `RoomPagination::load_more_events_backwards`. This
patch inlines this method as it aims at living in `RoomPagination`, not
somewhere else.

It's purely code move. Nothing else has changed.

This patch also updates a test that was accessing
`load_more_events_backwards` directly. Now it runs it via
`RoomPagination`.
2026-03-17 13:49:00 +01:00
Ivan Enderlin
793f62049a chore(sdk): Rename *Lock to Locked*. 2026-03-17 13:44:14 +01:00
Ivan Enderlin
2652db661b chore(sdk): Add a temporary `allow(clippy). 2026-03-17 13:44:14 +01:00
Ivan Enderlin
2459348b2e doc(sdk): Add #6280 in the CHANGELOG.md. 2026-03-17 13:44:14 +01:00
Ivan Enderlin
b85bb5463f refactor(sdk): In ThreadPagination, replace RoomEventCacheInner by ThreadEventCacheInner.
This patch updates `ThreadPagination` to hold a `ThreadEventCacheInner`
instead of a `RoomEventCacheInner`! It makes more sense and it
splits/isolates the types even more.

`RoomEventCache::thread_pagination` is now async and returns a
`Result<ThreadPagination>` because it needs to load its state to fetch
a `ThreadEventCache`. Later, accessing a thread wouldn't happen in
`RoomEventCache` but in `Caches`, one step at a time.
2026-03-17 13:44:14 +01:00
Ivan Enderlin
7929bcc956 chore(sdk): Add ThreadEventCacheInner::weak_room.
This patch adds the `weak_room: WeakRoom` field to
`ThreadEventCacheInner`. This is a prerequisite to have
`ThreadPagination` uses `ThreadEventCacheInner` instead of
`RoomEventCacheInner`!
2026-03-17 13:44:14 +01:00
Ivan Enderlin
a91d24c53e refactor(sdk): Create ThreadEventCacheState.
This patch creates the `ThreadEventCacheState` type. It uses
`caches::lock::StateLock`, just like `RoomEventCacheState`. It allows
to have the `read()` and `write()` method to access the state, and to
reload it when necessary, see the `caches::lock::Store` implementation.

This patch thus creates `ThreadEventCacheStateLockReadGuard` and
`ThreadEventCacheStateLockWriteGuard`. The methods touching the state in
`ThreadEventCacheInner` are moved to these lock types.

They are purely code moves (plus changes to reach the correct data): no
change in the semantics.
2026-03-17 13:44:14 +01:00
Ivan Enderlin
e55db521a4 refactor(sdk): Create ThreadEventCacheInner.
This patch creates `ThreadEventCacheInner` so that `ThreadEventCache`
can be shallow cloned (which will be useful for `ThreadPagination`).
That's also the first step to introduce `ThreadEventCacheState`!
2026-03-17 13:44:14 +01:00
Ivan Enderlin
c71e5c14c1 chore(sdk): Move the has_new_gap definition a bit earlier.
This patch moves up the `has_new_gap` definition to clarify the code
even more.
2026-03-17 13:44:14 +01:00
dependabot[bot]
33f3a67020 chore(deps): update dtolnay/rust-toolchain requirement to 631a55b12751854ce901bb631d5902ceb48146f7
Updates the requirements on [dtolnay/rust-toolchain](https://github.com/dtolnay/rust-toolchain) to permit the latest version.
- [Release notes](https://github.com/dtolnay/rust-toolchain/releases)
- [Commits](631a55b127)

---
updated-dependencies:
- dependency-name: dtolnay/rust-toolchain
  dependency-version: 631a55b12751854ce901bb631d5902ceb48146f7
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-17 13:29:15 +01:00
Stefan Ceriu
290650c6b1 change(live_location): Move LiveLocation out of TimelineItemContent and into MsgLikeKind
... so that it has access to `MsgLikeContent` reactions
2026-03-17 13:39:29 +02:00
dependabot[bot]
538afaf252 chore(deps): bump actions/checkout from 6.0.0 to 6.0.2
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.0 to 6.0.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...de0fac2e4500dabe0009e67214ff5f5447ce83dd)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-17 10:52:30 +01:00
dependabot[bot]
6a408d673f chore(deps): bump bnjbvr/cargo-machete
Bumps [bnjbvr/cargo-machete](https://github.com/bnjbvr/cargo-machete) from 8a8e0cd1046f54206f6d2e050cf028e6db9dbc75 to 2e2703d664c176156a22936b9203c38cc7a273dd.
- [Release notes](https://github.com/bnjbvr/cargo-machete/releases)
- [Changelog](https://github.com/bnjbvr/cargo-machete/blob/main/CHANGELOG.md)
- [Commits](8a8e0cd104...2e2703d664)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-17 10:48:41 +01:00
dependabot[bot]
8a6f822993 chore(deps): bump codecov/test-results-action from 1.1.1 to 1.2.1
Bumps [codecov/test-results-action](https://github.com/codecov/test-results-action) from 1.1.1 to 1.2.1.
- [Release notes](https://github.com/codecov/test-results-action/releases)
- [Commits](https://github.com/codecov/test-results-action/compare/v1.1.1...0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3)

---
updated-dependencies:
- dependency-name: codecov/test-results-action
  dependency-version: 1.2.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-17 10:43:36 +01:00
Damir Jelić
aa669585b4 ci: Pin our github actions to commit hashes 2026-03-17 10:24:44 +01:00
dependabot[bot]
109db5ee58 chore(deps): bump lz4_flex from 0.11.5 to 0.11.6
Bumps [lz4_flex](https://github.com/pseitz/lz4_flex) from 0.11.5 to 0.11.6.
- [Release notes](https://github.com/pseitz/lz4_flex/releases)
- [Changelog](https://github.com/PSeitz/lz4_flex/blob/main/CHANGELOG.md)
- [Commits](https://github.com/pseitz/lz4_flex/compare/0.11.5...0.11.6)

---
updated-dependencies:
- dependency-name: lz4_flex
  dependency-version: 0.11.6
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-17 00:28:31 +01:00
Benjamin Bouvier
abc6b4ad01 doc(event cache): improve documentation around select_best_receipt 2026-03-16 17:03:00 +01:00
Benjamin Bouvier
241584366d refactor(event cache): remove ReceiptSelector and associated tests
Now that we use `select_best_receipt` and that it's properly tested, we
can entirely get rid of the `ReceiptSelector` and associated tests.
2026-03-16 17:03:00 +01:00
Benjamin Bouvier
8a611305cf test(event cache): add unit tests for select_best_receipt 2026-03-16 17:03:00 +01:00
Benjamin Bouvier
0c149155be refactor(event cache): directly use the linked chunk for computing unread counts 2026-03-16 17:03:00 +01:00
Benjamin Bouvier
bc69d36d3e refactor(event cache): remove test-only compute_unread_counts_legacy and associated tests
The new integration tests for the event cache cover the same situations
that were tested by the previous tests on compute_unread_count_legacy,
so we're fine here.
2026-03-16 17:03:00 +01:00
Benjamin Bouvier
a453f019d9 fix(unread counts): after a gappy sync, don't decrease unread counts
A gappy sync may cause a linked chunk to shrink, waiting for callers to
lazy-reload it again in the future. But, because the unread counts
computation rely on the in-memory linked chunk, this means that the
values computed for the unread count may be incorrect (and decrease).

Fortunately, this situation is rather easy to detect, because the latest
active read receipt doesn't change in this case, so we can first check
that, and then manually readjust the unread counts, if they've
decreased.

Future work should trigger back-pagination in those cases, so the unread
counts keeps on being precise, despite the gappy sync.
2026-03-16 16:41:31 +01:00
Benjamin Bouvier
f1a50bb68f test(event cache): cache shrinking confuses the unread count computation
This test exhibits an edge case: when a room event cache is shrunk
(because of a gappy/limited sync), then the unread count might decrease,
without the latest active read receipt changing.
2026-03-16 16:41:31 +01:00
Benjamin Bouvier
9cae7ba44f doc(base): improve the doc comments around unread_notification_counts
And also move the `Room::read_receipts` method below the three `unread_`
methods, for tidiness.
2026-03-16 15:50:34 +01:00
Benjamin Bouvier
f00f6103c8 fix(test): bump the wait time between room-info diffs in integration testing
`test_room_notification_count` started to intermittently fail on main,
because the computation of unread counts has moved from the sliding sync
processing to the event cache. As a result, new irrelevant RoomInfo
updates (related to the unread counts) can happen, and they might happen
quickly enough that the server reponse for sending an event happens
after 2 seconds (remember, we need to factor in the time to do the e2ee
key exchange, and so on and so forth).

Bumping the time between two RoomInfo updates should be sufficient to
avoid the intermittent failure.
2026-03-16 15:50:34 +01:00
Jorge Martín
d0980b6608 refactor(ffi): Remove unnecessary match branch in ffi::Client::new
This was just instantiating a value that was never used.
2026-03-16 14:22:49 +01:00
Kévin Commaille
74c1044b7d Add changelog
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-03-16 12:53:47 +01:00
Kévin Commaille
14b21e2a9a feat(sdk): Use stable OAuth 2.0 login scopes
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2026-03-16 12:53:47 +01:00
Ivan Enderlin
d6c666a88d fix(xtask): The pos field can be absent when computing log sync.
This patch fixes a bug in `xtask log sync` which can miss a `sync_once`
log when the `pos` field is absent. It happens when there is no `pos`!

Example where `pos` is absent before `timeout`. Note the double space
before `timeout`:

```
… > sync_once{conn_id="room-list"  timeout=0} > send{request_id="REQ-15" …
```

While when the `pos` is present, it's:

```
… > sync_once{conn_id="room-list" pos="0/m67590980…" timeout=30000} > send{request_id="REQ-23" …
```
2026-03-16 11:16:44 +01:00
Hugh Nimmo-Smith
acda2e88e3 Add HumanQrLoginError::UnsupportedQrCodeType and HumanQrGrantLoginError::UnsupportedQrCodeType 2026-03-13 08:10:19 +01:00
Skye Elliot
b6c4bca5a0 Merge pull request #6275 from matrix-org/kaylendog/history-sharing/respect-visibility
feat(sdk): Only share history if room history visibility is shared
2026-03-12 14:55:15 +00:00
Damir Jelić
3f7d53a3ce feat(ffi): Add some more getters to the QRcodeData struct 2026-03-12 15:13:38 +01:00
Benjamin Bouvier
a99e79ac5d chore(sdk): add a changelog entry for the new unread count computation 2026-03-12 13:28:13 +01:00
Benjamin Bouvier
a191ab45ad doc(event cache): update read receipts module comment 2026-03-12 13:28:13 +01:00
Benjamin Bouvier
b5cf360111 doc(event cache): precise strategy to avoid all_events cloning 2026-03-12 13:28:13 +01:00
Benjamin Bouvier
56d5086aa4 doc: depersonalize doc comment 2026-03-12 13:28:13 +01:00
Benjamin Bouvier
6309498f20 refactor(event cache): parse as little as possible when computing read receipts 2026-03-12 13:28:13 +01:00
Benjamin Bouvier
f4bee4b7a5 test(event cache): add event-cache specific tests for read receipts 2026-03-12 13:28:13 +01:00
Benjamin Bouvier
9a257a4ca3 test(unread count): check that the unread counts get updated after event decryption 2026-03-12 13:28:13 +01:00
Benjamin Bouvier
cca8b0898f refactor(unread counts): use a bool to indicate thread support 2026-03-12 13:28:13 +01:00
Benjamin Bouvier
a0ce0cfaf2 feat(event cache): compute read receipts in the event cache (part 2)
This is a basic implementation that works, but it should unlock
improvements already (getting the unread count updated whenever a UTD
has been resolved) and it will pave the way for future improvements
(notably with respect to performance).
2026-03-12 13:28:13 +01:00
Benjamin Bouvier
627e118ef3 refactor(sdk): move the read receipt code handling to the event cache (part 1)
This is almost only code motion in this commit.

At this point, some tests don't pass, as the support for using the read
receipt code in the event cache isn't plugged in to the event cache
itself.
2026-03-12 13:28:13 +01:00
Benjamin Bouvier
c55935f92c fix(base): don't accumulate unreads when a receipt is pending 2026-03-12 13:28:13 +01:00
Benjamin Bouvier
be1f525ccc refactor(base): rejigger unread count code to use iterators on all events
This will allow it to run on the room linked chunk's events immediately,
with minimal changes.
2026-03-12 13:28:13 +01:00
Ivan Enderlin
a48f23881d chore(sdk): Make RoomEventCacheInner more private.
This patch makes `RoomEventCacheInner` more private, from `event_cache`
to `event_cache::caches`.

Consequently, `PinnedEventCacheState`, `RoomPagination::new` and
`ThreadPagination::new` follows the same restriction.
2026-03-12 10:07:05 +01:00
Ivan Enderlin
95aaa6558c chore(sdk): Make RoomEventCache::new, handle_*_room_update more private.
This patch makes `RoomEventCache::new`,
`RoomEventCache::handle_joined_room_update` and
`RoomEventCache::handle_left_room_update` more private. They are no more
accessible from `event_cache` but only from `event_cache::caches`.
2026-03-12 10:07:05 +01:00
Ivan Enderlin
375d3a4921 test(sdk): Move the test_uniq_read_marker test.
This patch moves `test_uniq_read_marker` from `event_cache` to
`event-cache::caches::room`.

This patch is a prerequisite to the next patch where the
`RoomEventCache::handle_joined_room_update` will become more private.
Moving this test is necessary.
2026-03-12 10:07:05 +01:00