matrix-org / matrix-org/matrix-spec
No existing server implementations follow the spec for `GET /_matrix/client/v3/rooms/{roomId}/members` query parameters
Nobody has claimed this yet.
- 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.17/client-server-api/#get_matrixclientv3roomsroomidmembers
**Issue**
Server behavior when both `membership` and `not_membership` are present is currently specced as:
> When specified alongside `not_membership`, the two parameters create an ‘or’ condition: either the membership is the same as `membership` or is not the same as `not_membership`.
No existing server implementations do this - Synapse, Dendrite and Conduwuits read this with an 'and' in place of 'or'.
For example if `membership`=`join` and `not_membership`=`join` is specified, all implementations return nothing, while if the code was following what the spec says it should return all member events ( x == join OR x != join is always true ).
Support for `membership` and `not_membership` parameters across implementations:
* Synapse (introduced in https://github.com/matrix-org/synapse/commit/2f78f432c421702e3756d029b3c669db837d8bcd): [code](https://github.com/matrix-org/synapse/blob/2f78f432c421702e3756d029b3c669db837d8bcd/synapse/rest/client/v1/room.py#L416-L420)
* Dendrite (introduced in https://github.com/element-hq/dendrite/commit/313cb3fd193397536b069d819f8346d625d82af8): [code](https://github.com/element-hq/dendrite/blob/313cb3fd193397536b069d819f8346d625d82af8/syncapi/storage/postgres/memberships_table.go#L77-L78)
* Conduwuit (introduced in https://github.com/x86pup/conduwuit/commit/0877f294393954bbe49279456f012e1fbb604f78): [code](https://github.com/x86pup/conduwuit/blob/0877f294393954bbe49279456f012e1fbb604f78/src/api/client/membership.rs#L796-L799)
All three are broken in the same way, if both filters are present the results of comparisons are combined with an 'and' instead of an 'or'. Conduit ignores the `membership` and `not_membership` query parameters.
Neither Complement nor Sytest has tests with both `membership` and `not_membership` set. Complement has a [test](https://github.com/matrix-org/complement/blob/3c3f7de63f3fc37bf200924f395a584d522b7d19/tests/csapi/room_members_test.go#L122) for the two parameters individually, but not combined.
The parameters were introduced in MSC1227, which doesn't specify the behavior when both are present:
> We extend the /members API to let the user query which members are present in a given room (for populating MemberList), filtered based on membership state and as of a given sync token.
The parameters were added to the spec in https://github.com/matrix-org/matrix-doc/pull/2035, which post-dates the Synapse implementation. It looks like this was done incorrectly.
**Expected behaviour**
The spec should be changed to match all current implementations.
Current:
> `membership`:
> When specified alongside `not_membership`, the two parameters create an ‘or’ condition: either the membership is the same as `membership` or is not the same as `not_membership`.
Proposed:
> `membership`:
> When specified alongside `not_membership`, the two parameters create an ‘and’ condition: the membership is the same as `membership` and is not the same as `not_membership`.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Matrix Client-Server API section for GET /_matrix/client/v3/rooms/{roomId}/members and review the current membership and not_membership wording. Compare it with the cited Synapse, Dendrite, and Conduwuit behavior; done means the specification text reflects the proposed condition and any relevant tests or references remain consistent.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100