Skip to content

fix(msc4186): make timeline_limit optional in sliding sync request#4

Open
ltoenjes wants to merge 6 commits intomatrix-construct:tuwunel-changesfrom
ltoenjes:fix/sliding-sync-timeline-limit-optional
Open

fix(msc4186): make timeline_limit optional in sliding sync request#4
ltoenjes wants to merge 6 commits intomatrix-construct:tuwunel-changesfrom
ltoenjes:fix/sliding-sync-timeline-limit-optional

Conversation

@ltoenjes
Copy link

Summary

Add #[serde(default)] to ListConfig::timeline_limit so that clients which omit timeline_limit from their sliding sync list requests don't get a 400 M_BAD_JSON deserialization error.

While MSC4186 marks timeline_limit as required, older matrix-rust-sdk builds (e.g. matrix-rust-components-swift ≤ 26.01.04) omit it from list configurations. The server currently rejects these requests with:

M_BAD_JSON: deserialization failed: missing field `timeline_limit` at line 1 column 62

Synapse resolved the same issue (element-hq/synapse#17704) by accepting requests without timeline_limit and defaulting to 0.

The ListConfig struct already derives Default, so UInt::default() (0) is the natural fallback — no timeline events returned unless the client explicitly requests them.

References

velikopter and others added 6 commits February 10, 2026 11:49
Signed-off-by: Jason Volk <jason@zemos.net>
Signed-off-by: Jason Volk <jason@zemos.net>
…joined_members

Signed-off-by: June Strawberry <june@vern.cc>
Add `#[serde(default)]` to `ListConfig::timeline_limit` so that clients
which omit `timeline_limit` from their sliding sync list requests don't
get a 400 M_BAD_JSON deserialization error.

While MSC4186 marks `timeline_limit` as required, older matrix-rust-sdk
builds (e.g. matrix-rust-components-swift ≤ 26.01.04) omit it from list
configurations. Synapse resolved the same issue (element-hq/synapse#17704)
by accepting requests without `timeline_limit` and defaulting to 0.

The `ListConfig` struct already derives `Default`, so `UInt::default()`
(0) is the natural fallback — no timeline events returned unless the
client explicitly requests them.

Ref: ruma#1914, element-hq/synapse#17704
@ltoenjes ltoenjes force-pushed the fix/sliding-sync-timeline-limit-optional branch from 84ac6e3 to 45ff72e Compare March 16, 2026 07:22
@ltoenjes
Copy link
Author

Force-pushed to rebase onto the correct base commit (30d063c4) — the one Tuwunel actually pins in its Cargo.toml. The original branch was based on the tuwunel-changes branch tip, which caused build failures due to API differences (e.g. missing aliases() method on RoomCanonicalAliasEventContent).

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.

5 participants