Repository navigation
Conversation
sandhose
force-pushed
the
quenting/context-required-fields
branch
from
November 13, 2026 10:03
b200738 to
eed9f7e
Compare
sandhose
marked this pull request as ready for review
November 13, 2026 13:59
3 tasks done
richvdh
requested changes
Nov 17, 2026
richvdh
left a comment
Member
There was a problem hiding this comment.
For me, the fact that Dendrite, Conduit and Synapse do different things is enough to say there should be an MSC before we change this. event would be fine; the rest not so much.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This clarifies which fields are required on
GET /_matrix/client/v3/rooms/{roomId}/context/{eventId}. There's a sibling PR to document the "404" response: #2474Currently, none of them are required: the response has had no
requiredlist since the original definition (matrix-org/matrix-spec-proposals#139).I made them all required here. This is the reasoning for each field, and I'm open to relaxing some of them:
event: sure, else it definitely should be 404events_before/events_after: if there are no events before or after, an empty array feels more appropriate. Problem is that Ruma-based homeservers and Dendrite omit the field if it's empty, so they would need fixingstate: this can legitimately be empty, for example when the filter excludes everything, so an empty array feels more appropriate here too. Same problem: Ruma-based HSes omit the field if it's empty, and Dendrite omits it whenlimitis 0. (If the server cannot know the state around the event at all, it should return a 404 as per Document the 404 response of /context #2474.)start/end: arguably, we could omit them if it's the start or end of the timeline, but this is a cursor position, not a guarantee that there is something before or after. Clients should IMO instead try those cursors in/messagesif they really want to check and get more events around./messages, which omitsendwhen there are no more events (Clarifications to pagination parameters for various APIs matrix-spec-proposals#3353). There, the server has just paginated and knows it reached the end; here, the tokens are only positions around the event.starttoken, and/messages?dir=bfrom it returns an emptychunkwith noend.On why to make them all required: Synapse always sent all 6 for 200 responses, and omitting broke clients in the past element-hq/element-web#31349 because they make assumptions about those fields being there.
There's a Complement test for this in matrix-org/complement#964. It passes on Synapse; the cases where Dendrite omits
stateor sends emptystart/endtokens are skipped there.Signed-off-by: Quentin Gliech quenting@element.io
Pull Request Checklist
Preview: https://pr2473--matrix-spec-previews.netlify.app