-
Notifications
You must be signed in to change notification settings - Fork 66
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
User metadata on workflows/events for user interface usage #371
Conversation
// Short-form text that provides a summary. This payload should be a "json/plain"-encoded payload | ||
// that is a single JSON string. Formatting may not apply to this text when used in "title" | ||
// situations. The payload data section is currently limited to 400 bytes. | ||
temporal.api.common.v1.Payload summary = 1; | ||
|
||
// Long-form text that provides details. This payload should be a "json/plain"-encoded payload | ||
// that is a single JSON string. Formatting may apply to this text in common use. The payload data | ||
// section is currently limited to 20000 bytes. | ||
temporal.api.common.v1.Payload details = 2; |
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.
Notes:
- Considered "description" instead of "details", but description isn't a general-purpose-enough term
- The 400 and 20000 bytes is an arbitrary ceiling based on expected use, happy to change
- These are payloads so they can be encrypted
- The use of JSON string as the type is a simple compatibility thing
- At this time, we are not defining the long-form format (but I suspect some very limited form of markdown)
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 file is safe for reworking in an incompatible way because it's just models for a well-known workflow query. See description to understand the changes.
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.
All of the fields are just plain text at the moment, right?
Would be nice to understand what the format is.
@@ -35,20 +35,19 @@ option csharp_namespace = "Temporalio.Api.Sdk.V1"; | |||
message WorkflowMetadata { | |||
// Metadata provided at declaration or creation time. | |||
WorkflowDefinition definition = 1; | |||
// Current long-form details of the workflow's state. This is used by user interfaces to show | |||
// long-form text. This text may be formatted by the user interface. | |||
string current_details = 2; |
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 is always returned in query responses and goes through the user's DC, right?
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
// An optional workflow description provided by the application. | ||
// By convention, external tools may interpret its first part, | ||
// i.e., ending with a line break, as a summary of the description. | ||
string description = 2; |
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 this okay to break? Do we have any consumers of this as protos?
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.
Yes it's ok to break, no we don't have any consumers of it except TypeScript SDK internally (and not this field and we only use this as JSON not proto). Explained in description and in comment.
Yes, this is documented on the field
Mentioned here, I am intentionally leaving that as out-of-scope for now pending some UI discussions. We should not block this progress on 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.
Looking good to me, just minor stuff.
@@ -35,20 +35,19 @@ option csharp_namespace = "Temporalio.Api.Sdk.V1"; | |||
message WorkflowMetadata { | |||
// Metadata provided at declaration or creation time. | |||
WorkflowDefinition definition = 1; | |||
// Current long-form details of the workflow's state. This is used by user interfaces to show | |||
// long-form text. This text may be formatted by the user interface. | |||
string current_details = 2; |
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.
Why a Payload in history and a string 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.
Because this object is a query result and query results are payloads already (so already subject to encryption in transit) whereas in history if you want something encrypted at rest it needs to be a payload.
// Short-form text that provides a summary. This payload should be a "json/plain"-encoded payload | ||
// that is a single JSON string. Formatting may not apply to this text when used in "title" | ||
// situations. The payload data section is limited to 400 bytes by default. | ||
temporal.api.common.v1.Payload summary = 1; |
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 assume we considered this as a map from string to Payload.. why not do that? (For the record I like this better, just wondering what the reasoning was.)
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 were a few of reasons that was rejected (there's an internal document discussing this). The primary reasons were that 1) the stringly-typed contract was too loose, 2) the keys are not user-defined, and 3) it unnecessarily increased history size for fixed keys.
# Conflicts: # buf.yaml
// are used by user interfaces to show fixed as-of-start workflow summary and details. | ||
// * start_timer_command_attributes - populates temporal.api.history.v1.HistoryEvent for timer | ||
// started where the summary is used to identify the timer. | ||
temporal.api.sdk.v1.UserMetadata user_metadata = 301; |
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.
why choose the field number 301? Why not 18 (next immediate available number) or 100 (if we want to group in hundreds)?
Just curious about the convention we use when picking field numbers in proto.
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.
Same reason why the person who added HistoryEvent.worker_may_ignore
as 300
, so that it would not interfere with our continually added, incrementally numbered attribute fields below. I chose 301 instead of 300 just to match history event's equivalent, but don't have to. The field number doesn't really matter much here, so it leaves room for attributes to keep adding.
# Conflicts: # buf.yaml # openapi/openapiv3.yaml
What changed?
temporal.api.sdk.v1.UserMetadata
containing payloads forsummary
anddetails
for general metadata usetemporal.api.command.v1.Command.user_metadata
for general use (initially only for timers and child workflow)temporal.api.history.v1.HistoryEvent.user_metadata
for general use (initially only for timers)temporal.api.workflowservice.v1.StartWorkflowExecutionRequest.user_metadata
for general use (initially for populating execution config)temporal.api.workflowservice.v1.SignalWithStartWorkflowExecutionRequest.user_metadata
for same reason as starttemporal.api.workflow.v1.NewWorkflowExecutionInfo.user_metadata
for same reason as starttemporal.api.workflow.v1.WorkflowExecutionConfig.user_metadata
for general use (initially for fixed as-of-start summary/details)temporal.api.sdk.v1.WorkflowMetadata.current_details
for the ability to have queryable long-form text representing current details of a workflowtemporal.api.sdk.v1.WorkflowDefinition.definition
because a workflow definition's description isn't best placed on a query (but "current details" is good on the metadata itself)Why?
Breaking changes