matrix-org / matrix-org/matrix-spec

Clarify `limit` parameter on `/context`

Open
#2,202 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

clarification
Dominant language
HTML
Stars
330
Forks
150
Avg merge
2h 21m
Merged PRs (30d)
3

Description

**Link to problem area**: https://spec.matrix.org/v1.15/client-server-api/#get_matrixclientv3roomsroomidcontexteventid

**Issue**

> limit integer
> The maximum number of context events to return. The limit applies to the sum of the events_before and events_after arrays. The requested event ID is always returned in event even if limit is 0. Defaults to 10.

The limit is specified as divided between `events_before` and `events_after`, which for odd limits implies a remainder. Rust-SDK tests that this remainder is given to `events_after`, despite a naive implementation discarding it with two truncated integer divisions. It probably derived this idea from some other implementation, establishing a de facto specification which should be reflected here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Matrix Client-Server API section for GET /rooms/{roomId}/context/{eventId}, then compare its limit wording with the Rust-SDK behavior described in the issue. Clarify how an odd limit is divided between events_before and events_after, including where the remainder goes; done means the specification removes this ambiguity.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.