Sliding sync v5: list ranges always start from 0, breaking sliding window #1444

Closed
opened 2026-02-23 22:04:46 +00:00 by 0xnim · 0 comments
Contributor

In handle_lists in src/api/client/sync/v5.rs, the start of every requested range is unconditionally overwritten to 0:

for mut range in ranges {
range.0 = uint!(0);
range.1 = range.1.checked_add(uint!(1)).unwrap_or(range.1);

This means all list ranges are processed as [0, end] regardless of what the client requested.

Expected behavior:

A client requesting ranges [[20, 49]] should receive only rooms 20–49 from the sorted room list.

Actual behavior:

A client requesting ranges [[20, 49]] receives rooms 0–49. The requested rooms are included, but rooms 0–19 are also unnecessarily processed and returned.

Impact:

  • Extra rooms are processed and returned in every response where the range start is non-zero
  • Wastes bandwidth and server-side processing
  • Multiple offset windows (e.g. [[0, 19], [40, 59]]) effectively collapse into [[0, 19], [0, 59]], duplicating work for rooms 0–19
In handle_lists in src/api/client/sync/v5.rs, the start of every requested range is unconditionally overwritten to 0: https://forgejo.ellis.link/continuwuation/continuwuity/src/commit/cb9786466bee299c1260171cee2a5ca407bda108/src/api/client/sync/v5.rs#L338-L340 This means all list ranges are processed as [0, end] regardless of what the client requested. **Expected behavior:** A client requesting ranges `[[20, 49]]` should receive only rooms 20–49 from the sorted room list. **Actual behavior:** A client requesting ranges `[[20, 49]]` receives rooms 0–49. The requested rooms are included, but rooms 0–19 are also unnecessarily processed and returned. **Impact:** - Extra rooms are processed and returned in every response where the range start is non-zero - Wastes bandwidth and server-side processing - Multiple offset windows (e.g. `[[0, 19], [40, 59]]`) effectively collapse into `[[0, 19], [0, 59]]`, duplicating work for rooms 0–19
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
continuwuation/continuwuity#1444
No description provided.