Skip to content
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

Merged
merged 12 commits into from
Aug 21, 2018

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Aug 3, 2018

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 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.

@turt2live turt2live added the blocked Something needs to be done before action can be taken on this PR/issue. label Aug 3, 2018
@turt2live turt2live mentioned this pull request Aug 3, 2018
35 tasks
@turt2live turt2live force-pushed the travis/s2s/presence branch from f44d0cd to f1ebe8f Compare August 4, 2018 01:52
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.
@turt2live turt2live force-pushed the travis/s2s/presence branch from f1ebe8f to 05a2427 Compare August 8, 2018 14:24
@turt2live turt2live removed the blocked Something needs to be done before action can be taken on this PR/issue. label Aug 8, 2018
@turt2live turt2live requested a review from a team August 8, 2018 14:24
@@ -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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this used?

Copy link
Member

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?

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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
Copy link
Member

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.

Copy link
Member

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.)

Copy link
Member Author

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).

presence of the the observed user.
allOf:
- $ref: ../edu.yaml
- type: object
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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
Copy link
Member

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


{{definition_ss_event_schemas_m_presence_accept}}

{{definition_ss_event_schemas_m_presence_accept}}
Copy link
Member

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

Copy link
Member Author

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.
Copy link
Member

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'?

Copy link
Member Author

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)

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member Author

@turt2live turt2live Aug 17, 2018

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.

Copy link
Member

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:
Copy link
Member

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.

Copy link
Member Author

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}}
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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)

@richvdh
Copy link
Member

richvdh commented Aug 17, 2018

As discussed, the poll and unpoll fields seem to be redundant, and since they're unimplemented, we should just take them out.

@Half-Shot
Copy link
Contributor

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?

@turt2live
Copy link
Member Author

@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.

@turt2live turt2live requested a review from richvdh August 17, 2018 15:36
@turt2live turt2live assigned richvdh and unassigned turt2live Aug 17, 2018
@@ -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",
Copy link
Member

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}}
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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.
Copy link
Member

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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yum, cupcakes.

@Half-Shot
Copy link
Contributor

@turt2live Thank you, the description is much easier to follow now for invites.

@richvdh richvdh assigned turt2live and unassigned richvdh Aug 20, 2018
@turt2live turt2live assigned richvdh and unassigned turt2live Aug 20, 2018
@turt2live turt2live requested a review from richvdh August 20, 2018 20:39
@richvdh richvdh assigned turt2live and unassigned richvdh Aug 21, 2018
@turt2live turt2live merged commit 1d7ea31 into matrix-org:master Aug 21, 2018
@turt2live turt2live deleted the travis/s2s/presence branch August 21, 2018 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants