feat(sdk): Add ThreadInfo with its own ReadReceipts - #6893
Draft
Hywan wants to merge 9 commits into
Draft
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6893 +/- ##
==========================================
- Coverage 90.10% 90.08% -0.02%
==========================================
Files 407 408 +1
Lines 115745 115976 +231
Branches 115745 115976 +231
==========================================
+ Hits 104294 104481 +187
- Misses 7540 7562 +22
- Partials 3911 3933 +22 ☔ View full report in Codecov by Harness. |
Merging this PR will not alter performance
Comparing Footnotes
|
Hywan
force-pushed
the
feat-sdk-event-cache-thread-read-receipt
branch
4 times, most recently
from
August 19, 2026 07:18
b7e6a3b to
55b86ff
Compare
This patch refactors `compute_unread_counts` to filter events candidates for the read receipt calculation. This patch does that by introducing a new `EventFilter` trait. This trait is implemented in a single type for the moment: `ReadReceiptsForRoom`. Another type for threads will follow.
In `RoomEventCacheState::handle_sync`, when all events are duplicated, there is nothing left to do, except running the post-processing. Because the post-processing consists of iterating over all the new events + updating the read receipts, the previous author took a shortcut by not calling the post-processing method, and by updating the read receipts directly. I believe this is error-prone as (i) it hides the fact we want to run the post-processing here, (ii) if the post-processing method is updated, it's easy to forget this place in particular. This patch updates the code by calling `post_process_upserted_events` with an empty iterator of events, as it is supposed to be. The semantics is clearer and the code is more robust.
This patch introduces the new `ThreadInfo` type. This patch also updates all stores to store this new `ThreadInfo` in the `threads` table.
Hywan
force-pushed
the
feat-sdk-event-cache-thread-read-receipt
branch
2 times, most recently
from
August 19, 2026 07:29
9df4a34 to
df54bb0
Compare
This patch removes `EventCacheStore::remember_threads` and adds `load_thread_info` along with `update_thread_info`. Notice that `ThreadEventCacheState` gains a new `thread_info: ThreadInfo` field at the same time!
…de_helpers`. This patch moves `extract_read_receipt` from `matrix_sdk::event_cache::caches::room::state` to `matrix_sdk_common::serde_helpers`. This way, it can be re-used elsewhere, like in `matrix_sdk::event_cache::caches::thread::state` ;-).
This patch updates `Caches` and `ThreadEventCache` to receive ephemeral events, up to extract read receipt events and passing them to `post_process_upserted_events`. This is an intermediate patch to facilitate the review.
…adReceipts`. This patch updates `ThreadEventCacheState` to add the `update_read_receipts` method, to run `compute_unread_counts` with a dedicated `ReadReceiptsForThread` value. This allows to compute the `ReadReceipts` for a thread!
Hywan
force-pushed
the
feat-sdk-event-cache-thread-read-receipt
branch
from
August 19, 2026 09:34
df54bb0 to
bff5d12
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These patches add the ability to compute
ReadReceiptsfor thread. It does several things (in logical order):threadstable to add a newinfocolumn/field,EventCacheStoreto removeremember_threadand to addload_thread_infoandupdate_thread_info,event_cache::read_receipts::compute_unread_counts“timeline agnostic” so that it supports both room and thread,ThreadEventCache::handle_timelineto receive ephemeral events (which include the read receipt events),Tasks
Stacked on top of feat(sdk):ThreadEventCache's pagination and in-memory UTD resolution post-process upserted events #6888, waiting to be merged.Signed-off-by: