Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(timeline): Don't add events to the pinned events timeline on paginations/syncs #4645

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jmartinesp
Copy link
Contributor

This will cause index out of bounds errors in some scenarios, and the events that do belong in this timeline would already have been loaded before.

  • Public API changes documented in changelogs (optional)

Signed-off-by:

@jmartinesp jmartinesp requested a review from Hywan February 7, 2025 14:43
@jmartinesp jmartinesp requested a review from a team as a code owner February 7, 2025 14:43
@jmartinesp jmartinesp marked this pull request as draft February 7, 2025 14:59
@jmartinesp jmartinesp marked this pull request as ready for review February 7, 2025 15:12
Copy link

codecov bot commented Feb 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.73%. Comparing base (83dd11e) to head (fd8f90e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4645   +/-   ##
=======================================
  Coverage   85.72%   85.73%           
=======================================
  Files         292      292           
  Lines       33492    33493    +1     
=======================================
+ Hits        28712    28714    +2     
+ Misses       4780     4779    -1     

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

@jmartinesp
Copy link
Contributor Author

The broken tests were fixed to reflect the new behaviour, so it should be ready for review now.

@bnjbvr bnjbvr requested review from bnjbvr and removed request for Hywan February 10, 2025 10:05
@bnjbvr
Copy link
Member

bnjbvr commented Feb 10, 2025

I'll steal this review. We need to think a bit more about the implications of this change, this may break aggregations targeting pinned events received in real-time, among other things (although I see you've opened an issue that they are not received :|).

@bnjbvr
Copy link
Member

bnjbvr commented Feb 11, 2025

The broken tests were fixed to reflect the new behaviour

Sorry, I'm not following here. Can you explain why some tests have been entirely removed, please?

@jmartinesp
Copy link
Contributor Author

The broken tests were fixed to reflect the new behaviour

Sorry, I'm not following here. Can you explain why some tests have been entirely removed, please?

test_new_pinned_events_are_added_on_sync was removed by mistake, since we could just invert its behaviour to make sure those events aren't added on sync (although the other edit, redact tests also test this indirectly). For test_edited_events_survive_pinned_event_ids_change, since we already test that edits aren't taken into account in another test I don't see why we'd have to test this behaviour again.

Also, I'm not against having the live updates for edits/redactions in the pinned event timeline. I just don't know how to properly make it happen anymore and I'm not sure I have the bandwidth to work on this if the answer turns out to be quite complex.

Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

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

Thanks for the explanation about the test removal. I agree that if we could keep the test, and invert its semantics (what it's checking), it would be super nice. The fix sounds good for the time being, and we should try to think about it a bit more thoroughly as a group, but let's not have this PR wait for this to happen before getting merged. Thank you for the patch!

Comment on lines +267 to +271
// Adding items coming from paginations or syncs will cause errors
// in the pinned event timeline, so we avoid that here.
if is_pinned_events {
continue;
}
Copy link
Member

Choose a reason for hiding this comment

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

Having thought about it: i think we want to react to room event cache timeline updates if and only if this is a live timeline:

  • a pinned events timeline handles its events by itself
  • ditto for the permalink timeline
  • a future focus like "threads" would likely also manage its events by itself

We need to find a more general solution to this problem, so as to be able to handle sync events live for those timeline focus, but, in the meanwhile, let's disable it entirely with a condition like if !is_live { continue ; }, and a comment similar (but more general) to what you've written.

cc @Hywan

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm trying adding the suggested change, but that seems to cause the timeline::focus_event::test_focused_timeline_reacts test to never finish. Wouldn't this mean it's breaking reactions in the focused event timeline?

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.

2 participants