atagen

matrix-rust-sdk

public
Star0
Watch0

Commit f4492538e13d

tarball

atagen <boss@atagen.co>2026-10-26 10:51 UTC

2 files changed+13-0
event-cache: log how each sync timeline is stored and when a gap goes unshown

A device build lost other users' messages from an encrypted room for good, with no gap row and no handle_sync error. Whether the batch came limited, kept its prev_batch, or left a history gap the timeline never rendered decides where those events went.
Modified file: crates/matrix-sdk-ui/src/timeline/controller/state_transaction.rs+1 additions
@@ -1125,6 +1125,7 @@ impl<'a, P: RoomDataProvider> TimelineStateTransaction<'a, P> {
11251125 let mut index = if let Some(next) = &position.next_event_id {
11261126 let mut events = self.items.all_remote_events().iter();
11271127 if !events.any(|event| &event.event_id == next) {
1128+ tracing::debug!(gap = ?position.gap.id, %next, "history gap not shown, its next event is unknown to the timeline");
11281129 continue;
11291130 }
11301131 self.items
Modified file: crates/matrix-sdk/src/event_cache/caches/room/state.rs+12 additions
@@ -1029,6 +1029,7 @@ impl<'a> RoomEventCacheStateLockWriteGuard<'a> {
10291029 prev_batch = None;
10301030 }
10311031
1032+ let retained = newest_retained.is_some();
10321033 let older_boundary = timeline.limited.then_some(newest_retained).flatten();
10331034 let newer_boundary =
10341035 timeline.limited.then(|| events.iter().find_map(Event::event_id)).flatten();
@@ -1041,6 +1042,17 @@ impl<'a> RoomEventCacheStateLockWriteGuard<'a> {
10411042 && !events.iter().any(|event| event.event_id() == older_boundary);
10421043 let has_new_gap = prev_batch.is_some();
10431044 let has_new_discontinuity = has_new_gap || limited_discontinuity;
1045+ debug!(
1046+ room_id = %self.state.room_id,
1047+ events = events.len(),
1048+ limited = timeline.limited,
1049+ had_prev_batch,
1050+ kept_prev_batch = has_new_gap,
1051+ history_gap = limited_discontinuity,
1052+ all_duplicates,
1053+ retained,
1054+ "handling a sync timeline"
1055+ );
10441056
10451057 if has_new_discontinuity {
10461058 // Sad time: there's a gap, somewhere, in the timeline, and there's at least one