Allow focused timelines to replace UTDs after redecryption
This partially and very hackishly fixes a problem where focused timelines don't replace UTDs after the event cache redecrypts the event.
The problem is more closely described in https://github.com/matrix-org/matrix-rust-sdk/issues/5954.
This closes: #5798. Probably https://github.com/matrix-org/matrix-rust-sdk/issues/5703 as well but I still need to write a test for that one.
CodSpeed Performance Report
Merging #5955 will not alter performance
Comparing poljar/focused-timeline-react-to-redecryption (d1b095b) with main (4e90cea)
Summary
✅ 50 untouched
Codecov Report
:x: Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 88.53%. Comparing base (95dac01) to head (d1b095b).
:warning: Report is 22 commits behind head on main.
:white_check_mark: All tests successful. No failed tests found.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...dk-ui/src/timeline/controller/state_transaction.rs | 98.07% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #5955 +/- ##
==========================================
+ Coverage 88.51% 88.53% +0.01%
==========================================
Files 363 363
Lines 103480 103510 +30
Branches 103480 103510 +30
==========================================
+ Hits 91594 91641 +47
+ Misses 7532 7513 -19
- Partials 4354 4356 +2
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@jmartinesp or @stefanceriu this would probably be a good candidate for live testing with EX.
I don't think I changed anything except the UTD -> decrypted codepath, and there are some tests confirming this, but it would be wise to double check that this didn't break something accidentally.
A good test would be to login and open a pinned timeline and see if UTDs get resolved correctly and if nothing else is broken with the pinned timeline.
I don't know what to say, it's not looking good
https://github.com/user-attachments/assets/8cd0345c-f0d5-4310-a4ba-c4b0eca72971
- It's not auto decrypting, app's been running for 5 mins before I started recording
- Reloading the list doesn't do it
- Triggering a backpagination does although not all items are from the first backpaginated page. Some are much older.
- Even when decrypted it's showing me a super old version of my pinned items
- Leaving the room and coming back in makes it show me the right pinned items (which I just added this morning)
Alright, I added another test which confirms what we suspected.
If the pinned events aren't part of the main timeline and thus never get put into the event cache, then R2D2 can't find them to decrypt them. This is why the events in the video aren't decrypted.
I also found another issue where we would replace events with the incorrect thing because the mapping from event cache index to timeline index is broken.