-
Notifications
You must be signed in to change notification settings - Fork 383
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
Document how presence EDUs work between servers #1482
Conversation
f44d0cd
to
f1ebe8f
Compare
It's worth noting that Synapse does not make use of the `poll` or `unpoll` fields, and therefore the wording has been updated to permit servers to reject users. In the case of synapse, it would automatically reject everyone in the list by nature of ignoring it.
f1ebe8f
to
05a2427
Compare
@@ -49,6 +49,7 @@ | |||
os.path.join(matrix_doc_dir, "api/identity/definitions"): "is", | |||
os.path.join(matrix_doc_dir, "api/push-gateway/definitions"): "push", | |||
os.path.join(matrix_doc_dir, "api/server-server/definitions"): "ss", | |||
os.path.join(matrix_doc_dir, "api/server-server/definitions/presence"): "ss_presence", |
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 this used?
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.
indeed the spec seems to refer to ss_event_schemas which doesn't seem to be defined?
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.
that said it seems to be working somehow. I'm confused.
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 magic was added in an earlier commit: ea307b5
The TLDR is it adds another section to the templating.
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.
right. Nevertheless api/server-server/definitions/presence
doesn't seem to exist.
@@ -0,0 +1,45 @@ | |||
# Copyright 2018 New Vector Ltd |
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.
hum; the existing event schemas are in /event-schemas/schema.
I'm not entirely convinced there is a clear enough delineation between "events that are only for the S-S API" and "events that are only for clients" and "events that may be of interest to both" to justify putting them in separate directories.
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.
(Note to self for when I inevitably dig this up again: the existing schemas really are yaml, as per the rejected #320.)
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 concerned about doing this for two reasons:
- The server events are slightly different in some cases, and would like to keep them away from the c2s to avoid accidental use.
- This means another symlink, which I might just flip a table over if I have to keep fixing the damn things.
- One solution is to make
event-schemas
a magical directory that gets referenced/loaded in the python script, but that feels like a whole new PR to me (and potentially dangerous).
- One solution is to make
presence of the the observed user. | ||
allOf: | ||
- $ref: ../edu.yaml | ||
- type: object |
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 other schema files don't nest the 'type/properties' under 'allOf': is there a reason we are doing so 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.
I don't understand the question. This is to merge an EDU with more specific definitions for the type, content, etc
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.
right, but other files which use allOf do it like:
type: object
allOf:
- $ref: ../edu.yaml
properties:
...
(instead of nesting properties
under allOf
).
I'm not sure if one is more correct than the other, but I'd like to know if we're making a decision to change 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.
Where are you seeing the properties
at such a high level? The OpenAPI way is to put them with the definition under allOf
.
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.
for example, https://github.com/matrix-org/matrix-doc/blob/master/event-schemas/schema/m.room.message
I can see that's probably wrong, though.
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.
yea, I'm tempted to call that wrong and push forward with doing it the "OpenAPI" way (I think it technically works in either way though). Potentially fixing the other cases of it are worth doing in the last hours of August.
- type: object | ||
properties: | ||
edu_type: | ||
type: string |
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 other schema files use a single-member enum for this
specification/server_server_api.rst
Outdated
|
||
{{definition_ss_event_schemas_m_presence_accept}} | ||
|
||
{{definition_ss_event_schemas_m_presence_accept}} |
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.
s/accept/deny/ I guess
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.
oops
currently_active: | ||
type: boolean | ||
description: |- | ||
Whether or not the user is currently using a device of theirs. |
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 define this in a clearer way. What does "currently" mean? How does it interact with 'last active ago'?
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.
(github didn't collapse the thread - improved documentation by adding a blurb below this)
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.
OK, I'm afraid the first sentence here is still pretty tortuous.
"Whether the user is currently active." is probably just as helpful and doesn't involve an ugly dangling possessive
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.
Wording suggestions appreciated here - I'm having troubles coming up with a better way to word this at the moment.
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.
How does this sound:
True if the user is likely to be interacting with their client. This may be indicated by the user having a last_active_ago
within the last few minutes. Defaults to false.
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.
well, that sounds great :)
description: |- | ||
A list of presence updates that the receiving server is likely | ||
to be interested in, or is subscribed to. | ||
items: |
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 share the definitions with the C-S side m.presence
? It seems annoying that we have to maintain all this text twice.
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.
potentially, I'll take a closer look at the client-server format and make them link if I can.
|
||
.. TODO-doc | ||
- Explain the timing-based round-trip reduction mechanism for presence | ||
messages | ||
- Explain the zero-byte presence inference logic | ||
See also: docs/client-server/model/presence | ||
|
||
{{definition_ss_event_schemas_m_presence}} |
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's jarring that this ends up formatted very differently to the event schemas in the C-S spec.
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.
My dream is to put the c2s spec through the same treatment.
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.
Hum. the heading is fugly. can it be made to say "m.presence.invite
schema" or "m.presence.invite
EDU schema" rather than "Presence Invite EDU Schema" (cf also #1531)
As discussed, the |
Also worth mentioning you've explained the poll and unpoll stuff very clearly and then the invite event format is tacked on the end without explanation, can this get an explanation? |
@richvdh @Half-Shot please take another look. I'm still hesitant to make the client-server and server-server specs share events at this stage and kinda feel it's best left solved in matrix-org/matrix-spec#348. The typing EDU has been updated in this PR because it was missed in it's PR, and it feels minor enough to not bother with it's own PR. |
@@ -49,6 +49,7 @@ | |||
os.path.join(matrix_doc_dir, "api/identity/definitions"): "is", | |||
os.path.join(matrix_doc_dir, "api/push-gateway/definitions"): "push", | |||
os.path.join(matrix_doc_dir, "api/server-server/definitions"): "ss", | |||
os.path.join(matrix_doc_dir, "api/server-server/definitions/presence"): "ss_presence", |
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.
right. Nevertheless api/server-server/definitions/presence
doesn't seem to exist.
|
||
.. TODO-doc | ||
- Explain the timing-based round-trip reduction mechanism for presence | ||
messages | ||
- Explain the zero-byte presence inference logic | ||
See also: docs/client-server/model/presence | ||
|
||
{{definition_ss_event_schemas_m_presence}} |
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.
Hum. the heading is fugly. can it be made to say "m.presence.invite
schema" or "m.presence.invite
EDU schema" rather than "Presence Invite EDU Schema" (cf also #1531)
presence of the the observed user. | ||
allOf: | ||
- $ref: ../edu.yaml | ||
- type: object |
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.
right, but other files which use allOf do it like:
type: object
allOf:
- $ref: ../edu.yaml
properties:
...
(instead of nesting properties
under allOf
).
I'm not sure if one is more correct than the other, but I'd like to know if we're making a decision to change it.
type: integer | ||
format: int64 | ||
description: |- | ||
The number of milliseconds that have ellapsed since the user |
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.
elapsed
currently_active: | ||
type: boolean | ||
description: |- | ||
Whether or not the user is currently using a device of theirs. |
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.
OK, I'm afraid the first sentence here is still pretty tortuous.
"Whether the user is currently active." is probably just as helpful and doesn't involve an ugly dangling possessive
status_msg: | ||
type: string | ||
description: An optional description to accompany the presence. | ||
example: "Making cupcakes" |
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.
yum, cupcakes.
@turt2live Thank you, the description is much easier to follow now for invites. |
Rendered: see 'docs' commit status.
This PR is blocked on #1463 as it makes use of the "definitions embedded in the spec" feature, and builds upon EDUs.
Blocked on:
It's worth noting that Synapse does not make use of the
poll
orunpoll
fields, and therefore the wording has been updated to permit servers to reject users. In the case of synapse, it would automatically reject everyone in the list by nature of ignoring it.