Skip to content

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

Open
ltoenjes wants to merge 1 commit 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 1 commit 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

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

1 participant