fix(client-server): Fix a typo in /rooms/{roomId}/relations/{eventId}#2357
fix(client-server): Fix a typo in /rooms/{roomId}/relations/{eventId}#2357Hywan wants to merge 4 commits into
/rooms/{roomId}/relations/{eventId}#2357Conversation
This patch fixes a typo in `/rooms/{roomId}/relations/{eventId}`. The
specification says about the `from` request query parameter:
> The pagination token to start returning results from. If not supplied,
> results start at the most recent topological event known to the
> server.
>
> Can be a `next_batch` or `prev_batch` token from a previous call,
> or a returned `start` token from `/messages`, or a `next_batch` token
> from `/sync`.
The last part is wrong. It should be:
> … or a `prev_batch` token from `/sync`.
Signed-off-by: Ivan Enderlin <ivan@mnt.io>
79551b3 to
1d7846b
Compare
|
I did some archaeology here. Originally, the spec PR for Note that the MSC that added Later, MSC3715 added the I think this is probably a fair change, though it does make me wonder if changing the spec in this way will make any existing implementations non-compliant. Do we know what Synapse allows here? |
| Fixes a typo in `/rooms/{roomId}/relations/{eventId}`. | ||
|
|
||
| The specification says about the `from` request query parameter: | ||
|
|
||
| > The pagination token to start returning results from. If not supplied, results start at the most recent topological event known to the server. | ||
| > | ||
| > Can be a `next_batch` or `prev_batch` token from a previous call, or a returned `start` token from `/messages`, or a `next_batch` token from `/sync`. | ||
|
|
||
| The last part is wrong. It should be: | ||
|
|
||
| > … or a `prev_batch` token from `/sync`. |
There was a problem hiding this comment.
We just need a once-sentence summary of the change here. See previous changelog entries for examples: https://spec.matrix.org/v1.18/changelog/v1.18/
|
Thank you for the archaeological session. Synapse supports using a |
1d7846b to
619c667
Compare
And to confirm: it doesn't allow a |
|
I don't know. Synapse uses a The only constraint I see is with this sentence from the specification:
So However, nothing seems to forbid to use I contradict myself with my initial goal though. Having a second thought about this: it's not an error to use I think the
So I propose to rephrase the
Ideally, the specification would create a type for these tokens instead of having a What do you think? |
|
Those excerpts from the spec are quite hard to parse, without context. It would be helpful if you could link to the relevant section of the spec. I guess we're talking about https://spec.matrix.org/v1.18/client-server-api/#get_matrixclientv1roomsroomidrelationseventid?
I think that's mostly fine, but it does worry me that this is a breaking change in the spec, and as such really ought to have an MSC. We're asking server implementations to support something they might currently disallow, which means that really people ought to have a chance to object to it. We can make an exception if we can say "this is clearly what was meant", but I'm not 100% sure we can, in this case. @erikjohnston what is your feeling here? |
Yes. |
|
The intention with these sort of pagination APIs is to be able to fill in the gaps between two syncs, which you can either do via:
I think clarifying the above in the spec should be non-controversial. Synapse does support any combination of |
I kinda wish that it only allowed you do to things that were explicitly permitted in the spec, to stop clients relying on things that aren't so permitted, and thus ending up being incompatible with other servers. But 🤷. @Hywan can we make the text match Erik's description? |
|
@richvdh Hope the new version is right and concise. |
94ebe19 to
c4307fa
Compare
c4307fa to
a0cc3f3
Compare
| If `dir=b`, then `from` can be `next_batch` from a previous call, or a | ||
| `prev_batch` token from a [`/sync`] or a `start` token from a [`/messages`]. |
There was a problem hiding this comment.
Starting a proper thread for this discussion.
Pagination tokens are positions between events. You should be able to further paginate from any position.
While this information is coming from my Synapse knowledge, I don't think that idea is Synapse specific.
You can see the sort of Complement tests I added around this kind of thing for /timestamp_to_event where you can paginate backwards from the start or end tokens,
There was a problem hiding this comment.
Any suggestion of how it should be phrased then?
There was a problem hiding this comment.
Why would you want to paginate backwards from an end token?
There was a problem hiding this comment.
It boils down to "because you can" and client flexibility. They may not want to process the event from /context and instead are only using it to get a pagination token to use as part of their normal pagination flows (uniform handling).
A more technical reason is perhaps you're using the filter query parameter: with /context, "It is not applied to the event itself" but it will apply consistently with /messages.
There was a problem hiding this comment.
Honestly "because Synapse lets me get away with it" doesn't hold much water for me here. We need to be mindful of meeting the requirements of a client without unduly constraining server implementations. Further, since we are talking about changing the definition of an existing, specified endpoint, there is a fine line between "correcting an obvious error" and "changing the way the endpoint works". It is not fair to other server implementations to suddenly add requirements without following the MSC process.
Nevertheless, an analogy with /messages is somewhat compelling. The spec for that has no restriction against paginating backwards from a next_batch in /sync, so we should probably replicate that. (Though it does appear to preclude paginating in either direction from the results of /context or /search, which I don't think is deliberate.)
(Also, why would we only permit paginating backwards from the start of a /messages rather than an end?)
So I guess we should loosen these constraints.
| If `dir=b`, then `from` can be `next_batch` from a previous call, or a | |
| `prev_batch` token from a [`/sync`] or a `start` token from a [`/messages`]. | |
| This token can be any of: | |
| * `next_batch` from the response to a previous call. | |
| * a `prev_batch` or `next_batch` token from a [`/sync`] response. | |
| * a `start` or `end` token from a [`/messages`], [`/context`] or [`/search`] response |
(And remove the separate description for dir=f)
I'm hoping for insight from the rest of the SCT on this, because frankly I'm struggling to decide.
richvdh
left a comment
There was a problem hiding this comment.
This looks sensible to me now, though waiting for Eric's comments before merging
| If `dir=b`, then `from` can be `next_batch` from a previous call, or a | ||
| `prev_batch` token from a [`/sync`] or a `start` token from a [`/messages`]. |
There was a problem hiding this comment.
Honestly "because Synapse lets me get away with it" doesn't hold much water for me here. We need to be mindful of meeting the requirements of a client without unduly constraining server implementations. Further, since we are talking about changing the definition of an existing, specified endpoint, there is a fine line between "correcting an obvious error" and "changing the way the endpoint works". It is not fair to other server implementations to suddenly add requirements without following the MSC process.
Nevertheless, an analogy with /messages is somewhat compelling. The spec for that has no restriction against paginating backwards from a next_batch in /sync, so we should probably replicate that. (Though it does appear to preclude paginating in either direction from the results of /context or /search, which I don't think is deliberate.)
(Also, why would we only permit paginating backwards from the start of a /messages rather than an end?)
So I guess we should loosen these constraints.
| If `dir=b`, then `from` can be `next_batch` from a previous call, or a | |
| `prev_batch` token from a [`/sync`] or a `start` token from a [`/messages`]. | |
| This token can be any of: | |
| * `next_batch` from the response to a previous call. | |
| * a `prev_batch` or `next_batch` token from a [`/sync`] response. | |
| * a `start` or `end` token from a [`/messages`], [`/context`] or [`/search`] response |
(And remove the separate description for dir=f)
I'm hoping for insight from the rest of the SCT on this, because frankly I'm struggling to decide.
This patch fixes a typo in
/rooms/{roomId}/relations/{eventId}. The specification says about thefromrequest query parameter:The last part is wrong. It should be:
This change has been discussed with @erikjohnston.
Pull Request Checklist
Preview: https://pr2357--matrix-spec-previews.netlify.app