Skip to content

Conversation

@poljar
Copy link
Contributor

@poljar poljar commented Dec 11, 2025

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 #5954.

This closes: #5798. Probably #5703 as well but I still need to write a test for that one.

@poljar poljar requested a review from a team as a code owner December 11, 2025 14:53
@poljar poljar requested review from stefanceriu and removed request for a team December 11, 2025 14:53
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 11, 2025

CodSpeed Performance Report

Merging #5955 will not alter performance

Comparing poljar/focused-timeline-react-to-redecryption (d1b095b) with main (4e90cea)

Summary

✅ 50 untouched

@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

❌ Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.53%. Comparing base (95dac01) to head (d1b095b).
⚠️ Report is 22 commits behind head on main.
✅ 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 ⚠️
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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@poljar
Copy link
Contributor Author

poljar commented Dec 11, 2025

@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.

@stefanceriu
Copy link
Member

I don't know what to say, it's not looking good

Simulator.Screen.Recording.-.iPhone.Air.-.2025-12-12.at.12.36.13.mov
  1. It's not auto decrypting, app's been running for 5 mins before I started recording
  2. Reloading the list doesn't do it
  3. Triggering a backpagination does although not all items are from the first backpaginated page. Some are much older.
  4. Even when decrypted it's showing me a super old version of my pinned items
  5. Leaving the room and coming back in makes it show me the right pinned items (which I just added this morning)

This should allow us in the future to create more such tests with
many more events.
This time we're testing the redecryption of pinned events that were not
part of the main timeline, more importantly we never backpaginated
enough for them to be part of the main timeline and thus never got put
into the event cache.

This test expectedly fails for now.
@poljar poljar force-pushed the poljar/focused-timeline-react-to-redecryption branch from 0ef55e3 to 27be8e5 Compare December 16, 2025 13:42
@poljar
Copy link
Contributor Author

poljar commented Dec 16, 2025

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.

Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go with that as a first step. Thanks!

@poljar poljar enabled auto-merge (rebase) December 16, 2025 14:31
@poljar poljar merged commit 504d15f into main Dec 16, 2025
51 checks passed
@poljar poljar deleted the poljar/focused-timeline-react-to-redecryption branch December 16, 2025 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UTDs on pinned messages are not retried after key is received

4 participants