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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSC2666: Get rooms in common with another user #2666
base: old_master
Are you sure you want to change the base?
MSC2666: Get rooms in common with another user #2666
Changes from 28 commits
c61790e
4264f32
008951f
29f02ed
2b75da8
630af1c
d885bcf
5254076
3f2faef
db99583
10a2df2
d3b17e6
4ac7ce8
a4f5bae
c453704
cd173d5
1a389f9
fbbb2d9
591d3e5
a1de65f
d59d051
6a4e523
b946cc3
ea49670
6f4f01b
60ae94f
7829c3b
92aef5b
d58d0a1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
user_id
can't be specified multiple times, it might belong in the HTTP path instead. Also, can it be specified multiple times?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, it's listed later in the MSC. Is there a technical reason preventing multiple users from being searched? It feels like an awkward thing to make a future MSC for when we're already here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The discussion context is here: #2666 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no technical reason preventing multiple users for being searched, but I don't see a convincing client usecase, while I agreed to keep the path open for one if the time came, to make it easily extendible.
In the past, this MSC had path-element handling, but I got convinced that that was a leftover pattern of an older way of handling things, and doing things via query was a newer way, so I applied that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we're not putting the user id in the path, then we shouldn't use the
/_matrix/client/v1/user
hierarchy, since most of the endpoints under that hierarchy do have a user_id as the next path component.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also realising that if we want to be able to get rooms in common with more users, there could just be another version of this endpoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the current MSC text (see "Forward-compatibility considerations"), this seems to be resolved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want some clear direction on this. The current version (that I merge in this branch via #4035) changes some labels around enough that i'd have to give it another unstable_features tag.
I haven't yet, as i want to sweep the result of this in that tag, before i propose it FCP again.
Should I change this back to a path component, or should I keep this as a query element endpoint? I can do either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boilerplate:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/res #4035
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the behaviour on invalid user IDs left as an implementation decision? (I think that's fine if so, but best to say so explicitly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC that would fall under some
400
Bad Request
semantics, implementation-specific, yeah.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this example includes a trailing
/
, which is inconsistent with the definition above.In general Matrix does not allow extra
/
s in endpoints.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that's an error from a previous change that moved path-element parameters to query parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/res #4035
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhere we need the words "this batch_token is only valid for use with this endpoint", and the semantics for expiration (does the homeserver need to remember the batch token forever?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an expiration time of 10 minutes could be reasonable here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which case we should specify an error case for clients supplying an unknown / expired batch token, so that they can retry.
We can't use
M_UNKNOWN_TOKEN
- as this error would also be returned if the user used an unknown access/refresh token to access this endpoint.We may need to define a new
errcode
- perhapsM_UNKNOWN_PAGINATION_TOKEN
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#4035
I have added the 10 minute timer, and added text that it will handle expired tokens the same as invalid tokens, so that implementations may forget those tokens entirely. Do you think this is a good method?
Then the clients' default response to "invalid token" is just to start over, without any token.
The only problem i see is that clients may loop on a broken implementation, where it is not passing the right token back to the server will cause it to get stuck in its mechanism where it continually retries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just leave the validity period up to the implementation, but recommend at least 10 minutes. Clients should be prepared to handle tokens that do have a ridiculously short window though.
I would also recommend clients limit the maximum number of retries before giving up, precisely to prevent infinite loops as you describe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just use https://github.com/matrix-org/matrix-spec-proposals/blob/rav/proposals/id_grammar/proposals/1597-id-grammar.md#opaque-ids please?
Ideally by name: "a batch_token is an opaque identifier, currently capable of containing the characters [0-9a-zA-Z._~-], must be at most 255 characters, and non-empty"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I was looking for something like that, will add it 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/res #4035
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a strong opinion here, but 422 is pretty obscure (and we don't use it anywhere else in matrix, afaik).
The idea in Matrix is that we shouldn't rely too heavily on HTTP response codes, to make it easier (one day) to move to alternative transports. So if we need to distinguish this from other error cases, we'd do that via a custom
errcode
rather than HTTP response code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ftr, CoAP doesn't have code 4.22 or anything semantically similar to HTTP's 422, and there don't seem to be subsequent RFCs addressing that (while 429, e.g., has got its CoAP equivalent in a later RFC).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this sounds like programmer error vs. something that would actually need to be explicitly handled in practice. So this could just be a
400
/M_UNKNOWN
- "you cannot request rooms in common with yourself".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed the error to 400 + M_UNKNOWN
/res #4035
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may also be worth reading #4024 to match the language there, as this seems like the sort of feature a client would want to use between FCP completing and spec release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I think with this original language I remember/wrote this down to "consider stable" to be "when it is included in a spec version"
Together with richvdh's comment here, i think that for this MSC it is unnecessary to introduce a
.stable
unstable_features
flag.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/res