@temporalio/core-bridge 1.7.4 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/Cargo.lock +245 -247
  2. package/Cargo.toml +1 -1
  3. package/lib/errors.d.ts +9 -0
  4. package/lib/errors.js +13 -0
  5. package/lib/errors.js.map +1 -1
  6. package/lib/index.d.ts +19 -3
  7. package/lib/index.js.map +1 -1
  8. package/package.json +3 -3
  9. package/releases/aarch64-apple-darwin/index.node +0 -0
  10. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  11. package/releases/x86_64-apple-darwin/index.node +0 -0
  12. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  13. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  14. package/sdk-core/.github/workflows/heavy.yml +1 -1
  15. package/sdk-core/.github/workflows/semgrep.yml +25 -0
  16. package/sdk-core/README.md +2 -0
  17. package/sdk-core/cargo-tokio-console.sh +5 -0
  18. package/sdk-core/client/src/lib.rs +6 -41
  19. package/sdk-core/client/src/raw.rs +9 -0
  20. package/sdk-core/client/src/retry.rs +0 -16
  21. package/sdk-core/core/Cargo.toml +9 -5
  22. package/sdk-core/core/src/abstractions.rs +7 -75
  23. package/sdk-core/core/src/core_tests/activity_tasks.rs +16 -8
  24. package/sdk-core/core/src/core_tests/local_activities.rs +97 -5
  25. package/sdk-core/core/src/core_tests/mod.rs +1 -1
  26. package/sdk-core/core/src/core_tests/workers.rs +16 -16
  27. package/sdk-core/core/src/core_tests/workflow_tasks.rs +247 -28
  28. package/sdk-core/core/src/lib.rs +2 -3
  29. package/sdk-core/core/src/pollers/mod.rs +30 -3
  30. package/sdk-core/core/src/pollers/poll_buffer.rs +166 -77
  31. package/sdk-core/core/src/protosext/mod.rs +4 -8
  32. package/sdk-core/core/src/replay/mod.rs +1 -1
  33. package/sdk-core/core/src/telemetry/metrics.rs +9 -0
  34. package/sdk-core/core/src/telemetry/mod.rs +3 -0
  35. package/sdk-core/core/src/test_help/mod.rs +9 -16
  36. package/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +6 -31
  37. package/sdk-core/core/src/worker/activities/local_activities.rs +214 -110
  38. package/sdk-core/core/src/worker/activities.rs +72 -47
  39. package/sdk-core/core/src/worker/client/mocks.rs +1 -1
  40. package/sdk-core/core/src/worker/client.rs +45 -32
  41. package/sdk-core/core/src/worker/mod.rs +170 -122
  42. package/sdk-core/core/src/worker/workflow/driven_workflow.rs +0 -4
  43. package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +9 -2
  44. package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +9 -2
  45. package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +6 -3
  46. package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +74 -22
  47. package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +3 -2
  48. package/sdk-core/core/src/worker/workflow/managed_run.rs +16 -3
  49. package/sdk-core/core/src/worker/workflow/mod.rs +13 -22
  50. package/sdk-core/core/src/worker/workflow/run_cache.rs +5 -0
  51. package/sdk-core/core/src/worker/workflow/wft_extraction.rs +4 -7
  52. package/sdk-core/core/src/worker/workflow/wft_poller.rs +38 -8
  53. package/sdk-core/core/src/worker/workflow/workflow_stream.rs +1 -0
  54. package/sdk-core/core-api/src/worker.rs +43 -2
  55. package/sdk-core/protos/api_upstream/Makefile +1 -1
  56. package/sdk-core/protos/api_upstream/buf.yaml +1 -6
  57. package/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +12 -0
  58. package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +11 -0
  59. package/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +13 -2
  60. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +1 -0
  61. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +2 -0
  62. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +9 -0
  63. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +19 -0
  64. package/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +5 -0
  65. package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +36 -4
  66. package/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +24 -7
  67. package/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +4 -0
  68. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +76 -44
  69. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +23 -1
  70. package/sdk-core/protos/google/rpc/status.proto +52 -0
  71. package/sdk-core/protos/local/temporal/sdk/core/common/common.proto +16 -0
  72. package/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +4 -0
  73. package/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +6 -0
  74. package/sdk-core/sdk/src/lib.rs +31 -10
  75. package/sdk-core/sdk/src/workflow_future.rs +7 -5
  76. package/sdk-core/sdk-core-protos/src/history_builder.rs +2 -0
  77. package/sdk-core/sdk-core-protos/src/history_info.rs +1 -0
  78. package/sdk-core/sdk-core-protos/src/lib.rs +82 -73
  79. package/sdk-core/test-utils/Cargo.toml +1 -1
  80. package/sdk-core/test-utils/src/lib.rs +50 -37
  81. package/sdk-core/tests/integ_tests/metrics_tests.rs +143 -10
  82. package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +26 -15
  83. package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +1 -1
  84. package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +2 -2
  85. package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +5 -1
  86. package/sdk-core/tests/integ_tests/workflow_tests.rs +1 -0
  87. package/src/conversions.rs +9 -2
  88. package/src/runtime.rs +5 -7
  89. package/ts/errors.ts +15 -0
  90. package/ts/index.ts +22 -4
@@ -124,17 +124,28 @@ message MeteringMetadata {
124
124
 
125
125
  // Identifies the version(s) of a worker that processed a task
126
126
  message WorkerVersionStamp {
127
- // An opaque whole-worker identifier
127
+ // An opaque whole-worker identifier. Replaces the deprecated `binary_checksum` field when this
128
+ // message is included in requests which previously used that.
128
129
  string build_id = 1;
129
130
  // Set if the worker used a dynamically loadable bundle to process
130
131
  // the task. The bundle could be a WASM blob, JS bundle, etc.
131
132
  string bundle_id = 2;
133
+
134
+ // If set, the worker is opting in to worker versioning. Otherwise, this is used only as a
135
+ // marker for workflow reset points and the BuildIDs search attribute.
136
+ bool use_versioning = 3;
132
137
  }
133
138
 
134
- // Identifies the version(s) that a worker is compatible with when polling or identifying itself
139
+ // Identifies the version(s) that a worker is compatible with when polling or identifying itself,
140
+ // and whether or not this worker is opting into the build-id based versioning feature. This is
141
+ // used by matching to determine which workers ought to receive what tasks.
135
142
  message WorkerVersionCapabilities {
136
143
  // An opaque whole-worker identifier
137
144
  string build_id = 1;
138
145
 
146
+ // If set, the worker is opting in to worker versioning, and wishes to only receive appropriate
147
+ // tasks.
148
+ bool use_versioning = 2;
149
+
139
150
  // Later, may include info like "I can process WASM and/or JS bundles"
140
151
  }
@@ -37,6 +37,7 @@ enum BatchOperationType {
37
37
  BATCH_OPERATION_TYPE_CANCEL = 2;
38
38
  BATCH_OPERATION_TYPE_SIGNAL = 3;
39
39
  BATCH_OPERATION_TYPE_DELETE = 4;
40
+ BATCH_OPERATION_TYPE_RESET = 5;
40
41
  }
41
42
 
42
43
  enum BatchOperationState {
@@ -122,4 +122,6 @@ enum ResourceExhaustedCause {
122
122
  RESOURCE_EXHAUSTED_CAUSE_SYSTEM_OVERLOADED = 3;
123
123
  // Namespace exceeds persistence rate limit.
124
124
  RESOURCE_EXHAUSTED_CAUSE_PERSISTENCE_LIMIT = 4;
125
+ // Workflow is busy
126
+ RESOURCE_EXHAUSTED_CAUSE_BUSY_WORKFLOW = 5;
125
127
  }
@@ -39,3 +39,12 @@ enum ResetReapplyType {
39
39
  RESET_REAPPLY_TYPE_SIGNAL = 1;
40
40
  RESET_REAPPLY_TYPE_NONE = 2;
41
41
  }
42
+
43
+ // Reset type options
44
+ enum ResetType {
45
+ RESET_TYPE_UNSPECIFIED = 0;
46
+ // Resets to event of the first workflow task completed, or if it does not exist, the event after task scheduled.
47
+ RESET_TYPE_FIRST_WORKFLOW_TASK = 1;
48
+ // Resets to event of the last workflow task completed, or if it does not exist, the event after task scheduled.
49
+ RESET_TYPE_LAST_WORKFLOW_TASK = 2;
50
+ }
@@ -57,3 +57,22 @@ enum TaskQueueType {
57
57
  // Activity type of task queue.
58
58
  TASK_QUEUE_TYPE_ACTIVITY = 2;
59
59
  }
60
+
61
+ // Specifies which category of tasks may reach a worker on a versioned task queue.
62
+ // Used both in a reachability query and its response.
63
+ enum TaskReachability {
64
+ TASK_REACHABILITY_UNSPECIFIED = 0;
65
+ // There's a possiblity for a worker to receive new workflow tasks. Workers should *not* be retired.
66
+ TASK_REACHABILITY_NEW_WORKFLOWS = 1;
67
+ // There's a possiblity for a worker to receive existing workflow and activity tasks from existing workflows. Workers
68
+ // should *not* be retired.
69
+ // This enum value does not distinguish between open and closed workflows.
70
+ TASK_REACHABILITY_EXISTING_WORKFLOWS = 2;
71
+ // There's a possiblity for a worker to receive existing workflow and activity tasks from open workflows. Workers
72
+ // should *not* be retired.
73
+ TASK_REACHABILITY_OPEN_WORKFLOWS = 3;
74
+ // There's a possiblity for a worker to receive existing workflow tasks from closed workflows. Workers may be
75
+ // retired dependending on application requirements. For example, if there's no need to query closed workflows.
76
+ TASK_REACHABILITY_CLOSED_WORKFLOWS = 4;
77
+ }
78
+
@@ -106,3 +106,8 @@ message SystemWorkflowFailure {
106
106
 
107
107
  message WorkflowNotReadyFailure {
108
108
  }
109
+
110
+ message NewerBuildExistsFailure {
111
+ // The current default compatible build ID which will receive tasks
112
+ string default_build_id = 1;
113
+ }
@@ -100,6 +100,11 @@ message WorkflowExecutionStartedEventAttributes {
100
100
  // It should be used together with parent_initiated_event_id to identify
101
101
  // a child initiated event for global namespace
102
102
  int64 parent_initiated_event_version = 26;
103
+ // This field is new in 1.21.
104
+ string workflow_id = 28;
105
+ // If this workflow intends to use anything other than the current overall default version for
106
+ // the queue, then we include it here.
107
+ temporal.api.common.v1.WorkerVersionStamp source_version_stamp = 29;
103
108
  }
104
109
 
105
110
  message WorkflowExecutionCompletedEventAttributes {
@@ -152,6 +157,9 @@ message WorkflowExecutionContinuedAsNewEventAttributes {
152
157
  temporal.api.common.v1.Header header = 12;
153
158
  temporal.api.common.v1.Memo memo = 13;
154
159
  temporal.api.common.v1.SearchAttributes search_attributes = 14;
160
+ // If this is set, the workflow executing this command wishes to continue as new using a version
161
+ // compatible with the version that this workflow most recently ran on.
162
+ bool use_compatible_version = 15;
155
163
 
156
164
  // workflow_execution_timeout is omitted as it shouldn't be overridden from within a workflow.
157
165
  }
@@ -193,13 +201,14 @@ message WorkflowTaskCompletedEventAttributes {
193
201
  string identity = 3;
194
202
  // Binary ID of the worker who completed this task
195
203
  string binary_checksum = 4;
196
- // Version info of the worker who processed this workflow task, or missing if worker is not
197
- // using versioning. If present, the `build_id` field within is also used as `binary_checksum`,
198
- // which may be omitted in that case (it may also be populated to preserve compatibility).
204
+ // Version info of the worker who processed this workflow task. If present, the `build_id` field
205
+ // within is also used as `binary_checksum`, which may be omitted in that case (it may also be
206
+ // populated to preserve compatibility).
199
207
  temporal.api.common.v1.WorkerVersionStamp worker_version = 5;
200
208
  // Data the SDK wishes to record for itself, but server need not interpret, and does not
201
209
  // directly impact workflow state.
202
210
  temporal.api.sdk.v1.WorkflowTaskCompletedMetadata sdk_metadata = 6;
211
+
203
212
  // Local usage data sent during workflow task completion and recorded here for posterity
204
213
  temporal.api.common.v1.MeteringMetadata metering_metadata = 13;
205
214
  }
@@ -228,8 +237,13 @@ message WorkflowTaskFailedEventAttributes {
228
237
  string new_run_id = 7;
229
238
  // TODO: ?
230
239
  int64 fork_event_version = 8;
231
- // If a worker explicitly failed this task, it's binary id
240
+ // DEPRECATED since 1.21 - use `worker_version` instead.
241
+ // If a worker explicitly failed this task, its binary id
232
242
  string binary_checksum = 9;
243
+ // Version info of the worker who processed this workflow task. If present, the `build_id` field
244
+ // within is also used as `binary_checksum`, which may be omitted in that case (it may also be
245
+ // populated to preserve compatibility).
246
+ temporal.api.common.v1.WorkerVersionStamp worker_version = 10;
233
247
  }
234
248
 
235
249
  message ActivityTaskScheduledEventAttributes {
@@ -270,6 +284,10 @@ message ActivityTaskScheduledEventAttributes {
270
284
  // configuration. Retries will happen up to `schedule_to_close_timeout`. To disable retries set
271
285
  // retry_policy.maximum_attempts to 1.
272
286
  temporal.api.common.v1.RetryPolicy retry_policy = 12;
287
+ // If this is set, the workflow executing this command wishes to start the activity using
288
+ // a version compatible with the version that this workflow most recently ran on, if such
289
+ // behavior is possible.
290
+ bool use_compatible_version = 13;
273
291
  }
274
292
 
275
293
  message ActivityTaskStartedEventAttributes {
@@ -295,6 +313,8 @@ message ActivityTaskCompletedEventAttributes {
295
313
  int64 started_event_id = 3;
296
314
  // id of the worker that completed this task
297
315
  string identity = 4;
316
+ // Version info of the worker who processed this workflow task.
317
+ temporal.api.common.v1.WorkerVersionStamp worker_version = 5;
298
318
  }
299
319
 
300
320
  message ActivityTaskFailedEventAttributes {
@@ -307,6 +327,8 @@ message ActivityTaskFailedEventAttributes {
307
327
  // id of the worker that failed this task
308
328
  string identity = 4;
309
329
  temporal.api.enums.v1.RetryState retry_state = 5;
330
+ // Version info of the worker who processed this workflow task.
331
+ temporal.api.common.v1.WorkerVersionStamp worker_version = 6;
310
332
  }
311
333
 
312
334
  message ActivityTaskTimedOutEventAttributes {
@@ -339,6 +361,8 @@ message ActivityTaskCanceledEventAttributes {
339
361
  int64 started_event_id = 4;
340
362
  // id of the worker who canceled this activity
341
363
  string identity = 5;
364
+ // Version info of the worker who processed this workflow task.
365
+ temporal.api.common.v1.WorkerVersionStamp worker_version = 6;
342
366
  }
343
367
 
344
368
  message TimerStartedEventAttributes {
@@ -556,6 +580,10 @@ message StartChildWorkflowExecutionInitiatedEventAttributes {
556
580
  temporal.api.common.v1.Header header = 15;
557
581
  temporal.api.common.v1.Memo memo = 16;
558
582
  temporal.api.common.v1.SearchAttributes search_attributes = 17;
583
+ // If this is set, the workflow executing this command wishes to start the child workflow using
584
+ // a version compatible with the version that this workflow most recently ran on, if such
585
+ // behavior is possible.
586
+ bool use_compatible_version = 19;
559
587
  }
560
588
 
561
589
  message StartChildWorkflowExecutionFailedEventAttributes {
@@ -697,6 +725,10 @@ message WorkflowExecutionUpdateAcceptedEventAttributes {
697
725
  message WorkflowExecutionUpdateCompletedEventAttributes {
698
726
  // The metadata about this update.
699
727
  temporal.api.update.v1.Meta meta = 1;
728
+
729
+ // The event ID indicating the acceptance of this update.
730
+ int64 accepted_event_id = 3;
731
+
700
732
  // The outcome of executing the workflow update function.
701
733
  temporal.api.update.v1.Outcome outcome = 2;
702
734
  }
@@ -45,6 +45,9 @@ message TaskQueue {
45
45
  string name = 1;
46
46
  // Default: TASK_QUEUE_KIND_NORMAL.
47
47
  temporal.api.enums.v1.TaskQueueKind kind = 2;
48
+ // Iff kind == TASK_QUEUE_KIND_STICKY, then this field contains the name of
49
+ // the normal task queue that the sticky worker is running on.
50
+ string normal_name = 3;
48
51
  }
49
52
 
50
53
  // Only applies to activity task queues
@@ -87,12 +90,26 @@ message StickyExecutionAttributes {
87
90
  google.protobuf.Duration schedule_to_start_timeout = 2 [(gogoproto.stdduration) = true];
88
91
  }
89
92
 
90
- // Used by the worker versioning APIs, represents an ordering of one or more versions which are
91
- // considered to be compatible with each other. Currently the versions are always worker build ids.
93
+ // Used by the worker versioning APIs, represents an unordered set of one or more versions which are
94
+ // considered to be compatible with each other. Currently the versions are always worker build IDs.
92
95
  message CompatibleVersionSet {
93
- // A unique identifier for this version set. Users don't need to understand or care about this
94
- // value, but it has value for debugging purposes.
95
- string version_set_id = 1;
96
- // All the compatible versions, ordered from oldest to newest
97
- repeated string build_ids = 2;
96
+ // All the compatible versions, unordered, except for the last element, which is considered the set "default".
97
+ repeated string build_ids = 1;
98
+ }
99
+
100
+ // Reachability of tasks for a worker on a single task queue.
101
+ message TaskQueueReachability {
102
+ string task_queue = 1;
103
+ // Task reachability for a worker in a single task queue.
104
+ // See the TaskReachability docstring for information about each enum variant.
105
+ // If reachability is empty, this worker is considered unreachable in this task queue.
106
+ repeated temporal.api.enums.v1.TaskReachability reachability = 2;
107
+ }
108
+
109
+ // Reachability of tasks for a worker by build id, in one or more task queues.
110
+ message BuildIdReachability {
111
+ // A build id or empty if unversioned.
112
+ string build_id = 1;
113
+ // Reachability per task queue.
114
+ repeated TaskQueueReachability task_queue_reachability = 2;
98
115
  }
@@ -109,8 +109,12 @@ message ResetPoints {
109
109
  }
110
110
 
111
111
  message ResetPointInfo {
112
+ // A worker binary version identifier, will be deprecated and superseded by a newer concept of
113
+ // build_id.
112
114
  string binary_checksum = 1;
115
+ // The first run ID in the execution chain that was touched by this worker build.
113
116
  string run_id = 2;
117
+ // Event ID of the first WorkflowTaskCompleted event processed by this worker build.
114
118
  int64 first_workflow_task_completed_id = 3;
115
119
  google.protobuf.Timestamp create_time = 4 [(gogoproto.stdtime) = true];
116
120
  // (-- api-linter: core::0214::resource-expiry=disabled
@@ -238,14 +238,12 @@ message PollWorkflowTaskQueueRequest {
238
238
  temporal.api.taskqueue.v1.TaskQueue task_queue = 2;
239
239
  // The identity of the worker/client who is polling this task queue
240
240
  string identity = 3;
241
+ // DEPRECATED since 1.21 - use `worker_version_capabilities` instead.
241
242
  // Each worker process should provide an ID unique to the specific set of code it is running
242
243
  // "checksum" in this field name isn't very accurate, it should be though of as an id.
243
244
  string binary_checksum = 4;
244
- // If set, the worker is opting in to versioning and wishes to only
245
- // receive tasks that are considered compatible with the version capabilities provided.
246
- // Doing so only makes sense in conjunction with the `UpdateWorkerBuildIdCompatibility` API.
247
- // When this field has a `worker_build_id`, and `binary_checksum` is not
248
- // set, that value should also be considered as the `binary_checksum`.
245
+ // Information about this worker's build identifier and if it is choosing to use the versioning
246
+ // feature. See the `WorkerVersionCapabilities` docstring for more.
249
247
  temporal.api.common.v1.WorkerVersionCapabilities worker_version_capabilities = 5;
250
248
  }
251
249
 
@@ -309,16 +307,15 @@ message RespondWorkflowTaskCompletedRequest {
309
307
  // something useful, but cannot complete it within the workflow task timeout. Local activities
310
308
  // which run for longer than the task timeout being the prime example.
311
309
  bool force_create_new_workflow_task = 6;
310
+ // DEPRECATED since 1.21 - use `worker_version_stamp` instead.
312
311
  // Worker process' unique binary id
313
312
  string binary_checksum = 7;
314
313
  // Responses to the `queries` field in the task being responded to
315
314
  map<string, temporal.api.query.v1.WorkflowQueryResult> query_results = 8;
316
315
  string namespace = 9;
317
- // If using versioning, the worker uses this field to indicate what version(s) it used to
318
- // process the task. When this field has a `worker_build_id`, and `binary_checksum` is not set,
319
- // that value should also be considered as the `binary_checksum`. Leaving this field empty when
320
- // replying to a task has had this field previously populated in history in an error, and such
321
- // a completion will be rejected.
316
+ // Version info of the worker who processed this task. This message's `build_id` field should
317
+ // always be set by SDKs. Workers opting into versioning will also set the `use_versioning`
318
+ // field to true. See message docstrings for more.
322
319
  temporal.api.common.v1.WorkerVersionStamp worker_version_stamp = 10;
323
320
  // Protocol messages piggybacking on a WFT as a transport
324
321
  repeated temporal.api.protocol.v1.Message messages = 11;
@@ -348,11 +345,16 @@ message RespondWorkflowTaskFailedRequest {
348
345
  temporal.api.failure.v1.Failure failure = 3;
349
346
  // The identity of the worker/client
350
347
  string identity = 4;
348
+ // DEPRECATED since 1.21 - use `worker_version_stamp` instead.
351
349
  // Worker process' unique binary id
352
350
  string binary_checksum = 5;
353
351
  string namespace = 6;
354
352
  // Protocol messages piggybacking on a WFT as a transport
355
353
  repeated temporal.api.protocol.v1.Message messages = 7;
354
+ // Version info of the worker who processed this task. This message's `build_id` field should
355
+ // always be set by SDKs. Workers opting into versioning will also set the `use_versioning`
356
+ // field to true. See message docstrings for more.
357
+ temporal.api.common.v1.WorkerVersionStamp worker_version = 8;
356
358
  }
357
359
 
358
360
  message RespondWorkflowTaskFailedResponse {
@@ -364,9 +366,8 @@ message PollActivityTaskQueueRequest {
364
366
  // The identity of the worker/client
365
367
  string identity = 3;
366
368
  temporal.api.taskqueue.v1.TaskQueueMetadata task_queue_metadata = 4;
367
- // If set, the worker is opting in to versioning and wishes to only
368
- // receive tasks that are considered compatible with the capabilities provided.
369
- // Doing so only makes sense in conjunction with the `UpdateWorkerBuildIdCompatibility` API.
369
+ // Information about this worker's build identifier and if it is choosing to use the versioning
370
+ // feature. See the `WorkerVersionCapabilities` docstring for more.
370
371
  temporal.api.common.v1.WorkerVersionCapabilities worker_version_capabilities = 5;
371
372
  }
372
373
 
@@ -463,6 +464,10 @@ message RespondActivityTaskCompletedRequest {
463
464
  // The identity of the worker/client
464
465
  string identity = 3;
465
466
  string namespace = 4;
467
+ // Version info of the worker who processed this task. This message's `build_id` field should
468
+ // always be set by SDKs. Workers opting into versioning will also set the `use_versioning`
469
+ // field to true. See message docstrings for more.
470
+ temporal.api.common.v1.WorkerVersionStamp worker_version = 5;
466
471
  }
467
472
 
468
473
  message RespondActivityTaskCompletedResponse {
@@ -496,6 +501,10 @@ message RespondActivityTaskFailedRequest {
496
501
  string namespace = 4;
497
502
  // Additional details to be stored as last activity heartbeat
498
503
  temporal.api.common.v1.Payloads last_heartbeat_details = 5;
504
+ // Version info of the worker who processed this task. This message's `build_id` field should
505
+ // always be set by SDKs. Workers opting into versioning will also set the `use_versioning`
506
+ // field to true. See message docstrings for more.
507
+ temporal.api.common.v1.WorkerVersionStamp worker_version = 6;
499
508
  }
500
509
 
501
510
  message RespondActivityTaskFailedResponse {
@@ -535,6 +544,10 @@ message RespondActivityTaskCanceledRequest {
535
544
  // The identity of the worker/client
536
545
  string identity = 3;
537
546
  string namespace = 4;
547
+ // Version info of the worker who processed this task. This message's `build_id` field should
548
+ // always be set by SDKs. Workers opting into versioning will also set the `use_versioning`
549
+ // field to true. See message docstrings for more.
550
+ temporal.api.common.v1.WorkerVersionStamp worker_version = 5;
538
551
  }
539
552
 
540
553
  message RespondActivityTaskCanceledResponse {
@@ -1071,6 +1084,13 @@ message UpdateWorkerBuildIdCompatibilityRequest {
1071
1084
  bool make_set_default = 3;
1072
1085
  }
1073
1086
 
1087
+ message MergeSets {
1088
+ // A build ID in the set whose default will become the merged set default
1089
+ string primary_set_build_id = 1;
1090
+ // A build ID in the set which will be merged into the primary set
1091
+ string secondary_set_build_id = 2;
1092
+ }
1093
+
1074
1094
  string namespace = 1;
1075
1095
  // Must be set, the task queue to apply changes to. Because all workers on a given task queue
1076
1096
  // must have the same set of workflow & activity implementations, there is no reason to specify
@@ -1097,6 +1117,12 @@ message UpdateWorkerBuildIdCompatibilityRequest {
1097
1117
  // (-- api-linter: core::0140::prepositions=disabled
1098
1118
  // aip.dev/not-precedent: Within makes perfect sense here. --)
1099
1119
  string promote_build_id_within_set = 6;
1120
+ // Merge two existing sets together, thus declaring all build IDs in both sets compatible
1121
+ // with one another. The primary set's default will become the default for the merged set.
1122
+ // This is useful if you've accidentally declared a new ID as incompatible you meant to
1123
+ // declare as compatible. The unusual case of incomplete replication during failover could
1124
+ // also result in a split set, which this operation can repair.
1125
+ MergeSets merge_sets = 7;
1100
1126
  }
1101
1127
  }
1102
1128
  message UpdateWorkerBuildIdCompatibilityResponse {
@@ -1114,12 +1140,6 @@ message GetWorkerBuildIdCompatibilityRequest {
1114
1140
  // Limits how many compatible sets will be returned. Specify 1 to only return the current
1115
1141
  // default major version set. 0 returns all sets.
1116
1142
  int32 max_sets = 3;
1117
- // If set, the response will include information about worker versions which are ready to be
1118
- // retired.
1119
- bool include_retirement_candidates = 4;
1120
- // If set, the response will include information about which versions have open workflows, and
1121
- // whether or not there are currently polling workers who are compatible with those versions.
1122
- bool include_poller_compatibility = 5;
1123
1143
  }
1124
1144
  message GetWorkerBuildIdCompatibilityResponse {
1125
1145
  // Major version sets, in order from oldest to newest. The last element of the list will always
@@ -1128,32 +1148,43 @@ message GetWorkerBuildIdCompatibilityResponse {
1128
1148
  //
1129
1149
  // There may be fewer sets returned than exist, if the request chose to limit this response.
1130
1150
  repeated temporal.api.taskqueue.v1.CompatibleVersionSet major_version_sets = 1;
1151
+ }
1131
1152
 
1132
- message RetirementCandidate {
1133
- // The worker build id which is ready for retirement
1134
- string build_id = 1;
1135
- // If true, there are no open *or* closed workflows, meaning there is no reason at all
1136
- // to keep the worker alive, not even to service queries on closed workflows. If not true,
1137
- // then there are no open workflows, but some closed ones.
1138
- bool all_workflows_are_archived = 2;
1139
- // Currently polling workers who match the build id ready for retirement
1140
- repeated temporal.api.taskqueue.v1.PollerInfo pollers = 3;
1141
- }
1142
-
1143
- // A list of workers who are still live and polling the task queue, but may no longer be needed
1144
- // to make progress on open workflows.
1145
- repeated RetirementCandidate retirement_candidates = 2;
1146
-
1147
- message VersionsWithCompatiblePollers {
1148
- // The latest build id which completed a workflow task on some open workflow
1149
- string most_recent_build_id = 1;
1150
- // Currently polling workers who are compatible with `most_recent_build_id`.
1151
- repeated temporal.api.taskqueue.v1.PollerInfo pollers = 2;
1152
- }
1153
-
1154
- // A list of versions and pollers who are capable of processing tasks at that version (if any)
1155
- // for which there are currently open workflows.
1156
- repeated VersionsWithCompatiblePollers active_versions_and_pollers = 3;
1153
+ message GetWorkerTaskReachabilityRequest {
1154
+ string namespace = 1;
1155
+ // Build ids to retrieve reachability for. An empty string will be interpreted as an unversioned worker.
1156
+ // The number of build ids that can be queried in a single API call is limited.
1157
+ // Open source users can adjust this limit by setting the server's dynamic config value for
1158
+ // `limit.reachabilityQueryBuildIds` with the caveat that this call can strain the visibility store.
1159
+ repeated string build_ids = 2;
1160
+
1161
+ // Task queues to retrieve reachability for. Leave this empty to query for all task queues associated with given
1162
+ // build ids in the namespace.
1163
+ // Must specify at least one task queue if querying for an unversioned worker.
1164
+ // The number of task queues that the server will fetch reachability information for is limited.
1165
+ // See the `GetWorkerTaskReachabilityResponse` documentation for more information.
1166
+ repeated string task_queues = 3;
1167
+
1168
+ // Type of reachability to query for.
1169
+ // `TASK_REACHABILITY_NEW_WORKFLOWS` is always returned in the response.
1170
+ // Use `TASK_REACHABILITY_EXISTING_WORKFLOWS` if your application needs to respond to queries on closed workflows.
1171
+ // Otherwise, use `TASK_REACHABILITY_OPEN_WORKFLOWS`. Default is `TASK_REACHABILITY_EXISTING_WORKFLOWS` if left
1172
+ // unspecified.
1173
+ // See the TaskReachability docstring for information about each enum variant.
1174
+ temporal.api.enums.v1.TaskReachability reachability = 4;
1175
+ }
1176
+
1177
+ message GetWorkerTaskReachabilityResponse {
1178
+ // Task reachability, broken down by build id and then task queue.
1179
+ // When requesting a large number of task queues or all task queues associated with the given build ids in a
1180
+ // namespace, all task queues will be listed in the response but some of them may not contain reachability
1181
+ // information due to a server enforced limit. When reaching the limit, task queues that reachability information
1182
+ // could not be retrieved for will be marked with a single TASK_REACHABILITY_UNSPECIFIED entry. The caller may issue
1183
+ // another call to get the reachability for those task queues.
1184
+ //
1185
+ // Open source users can adjust this limit by setting the server's dynamic config value for
1186
+ // `limit.reachabilityTaskQueueScan` with the caveat that this call can strain the visibility store.
1187
+ repeated temporal.api.taskqueue.v1.BuildIdReachability build_id_reachability = 1;
1157
1188
  }
1158
1189
 
1159
1190
  // (-- api-linter: core::0134=disabled
@@ -1208,6 +1239,7 @@ message StartBatchOperationRequest {
1208
1239
  temporal.api.batch.v1.BatchOperationSignal signal_operation = 11;
1209
1240
  temporal.api.batch.v1.BatchOperationCancellation cancellation_operation = 12;
1210
1241
  temporal.api.batch.v1.BatchOperationDeletion deletion_operation = 13;
1242
+ temporal.api.batch.v1.BatchOperationReset reset_operation = 14;
1211
1243
  }
1212
1244
  }
1213
1245
 
@@ -385,14 +385,36 @@ service WorkflowService {
385
385
  // version, forming sets of ids which are incompatible with each other, but whose contained
386
386
  // members are compatible with one another.
387
387
  //
388
+ // A single build id may be mapped to multiple task queues using this API for cases where a single process hosts
389
+ // multiple workers.
390
+ //
391
+ // To query which workers can be retired, use the `GetWorkerTaskReachability` API.
392
+ //
393
+ // NOTE: The number of task queues mapped to a single build id is limited by the `limit.taskQueuesPerBuildId`
394
+ // (default is 20), if this limit is exceeded this API will error with a FailedPrecondition.
395
+ //
388
396
  // (-- api-linter: core::0134::response-message-name=disabled
389
397
  // aip.dev/not-precedent: UpdateWorkerBuildIdCompatibility RPC doesn't follow Google API format. --)
390
398
  // (-- api-linter: core::0134::method-signature=disabled
391
399
  // aip.dev/not-precedent: UpdateWorkerBuildIdCompatibility RPC doesn't follow Google API format. --)
392
400
  rpc UpdateWorkerBuildIdCompatibility (UpdateWorkerBuildIdCompatibilityRequest) returns (UpdateWorkerBuildIdCompatibilityResponse) {}
393
- // Fetches the worker build id versioning sets for some task queue and related metadata.
401
+ // Fetches the worker build id versioning sets for a task queue.
394
402
  rpc GetWorkerBuildIdCompatibility (GetWorkerBuildIdCompatibilityRequest) returns (GetWorkerBuildIdCompatibilityResponse) {}
395
403
 
404
+ // Fetches task reachability to determine whether a worker may be retired.
405
+ // The request may specify task queues to query for or let the server fetch all task queues mapped to the given
406
+ // build IDs.
407
+ //
408
+ // When requesting a large number of task queues or all task queues associated with the given build ids in a
409
+ // namespace, all task queues will be listed in the response but some of them may not contain reachability
410
+ // information due to a server enforced limit. When reaching the limit, task queues that reachability information
411
+ // could not be retrieved for will be marked with a single TASK_REACHABILITY_UNSPECIFIED entry. The caller may issue
412
+ // another call to get the reachability for those task queues.
413
+ //
414
+ // Open source users can adjust this limit by setting the server's dynamic config value for
415
+ // `limit.reachabilityTaskQueueScan` with the caveat that this call can strain the visibility store.
416
+ rpc GetWorkerTaskReachability (GetWorkerTaskReachabilityRequest) returns (GetWorkerTaskReachabilityResponse) {}
417
+
396
418
  // Invokes the specified update function on user workflow code.
397
419
  // (-- api-linter: core::0134=disabled
398
420
  // aip.dev/not-precedent: UpdateWorkflowExecution doesn't follow Google API format --)
@@ -0,0 +1,52 @@
1
+ // Copyright 2022 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ // The canonical version of this proto can be found at
16
+ // https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto
17
+
18
+ syntax = "proto3";
19
+
20
+ package google.rpc;
21
+
22
+ import "google/protobuf/any.proto";
23
+
24
+ option cc_enable_arenas = true;
25
+ option go_package = "google.golang.org/genproto/googleapis/rpc/status;status";
26
+ option java_multiple_files = true;
27
+ option java_outer_classname = "StatusProto";
28
+ option java_package = "com.google.rpc";
29
+ option objc_class_prefix = "RPC";
30
+
31
+ // The `Status` type defines a logical error model that is suitable for
32
+ // different programming environments, including REST APIs and RPC APIs. It is
33
+ // used by [gRPC](https://github.com/grpc). Each `Status` message contains
34
+ // three pieces of data: error code, error message, and error details.
35
+ //
36
+ // You can find out more about this error model and how to work with it in the
37
+ // [API Design Guide](https://cloud.google.com/apis/design/errors).
38
+ message Status {
39
+ // The status code, which should be an enum value of
40
+ // [google.rpc.Code][google.rpc.Code].
41
+ int32 code = 1;
42
+
43
+ // A developer-facing error message, which should be in English. Any
44
+ // user-facing error message should be localized and sent in the
45
+ // [google.rpc.Status.details][google.rpc.Status.details] field, or localized
46
+ // by the client.
47
+ string message = 2;
48
+
49
+ // A list of messages that carry the error details. There is a common set of
50
+ // message types for APIs to use.
51
+ repeated google.protobuf.Any details = 3;
52
+ }
@@ -14,3 +14,19 @@ message NamespacedWorkflowExecution {
14
14
  // May be empty if the most recent run of the workflow with the given ID is being targeted
15
15
  string run_id = 3;
16
16
  }
17
+
18
+ // An indication of user's intent concerning what Build ID versioning approach should be used for
19
+ // a specific command
20
+ enum VersioningIntent {
21
+ // Indicates that core should choose the most sensible default behavior for the type of
22
+ // command, accounting for whether the command will be run on the same task queue as the current
23
+ // worker.
24
+ UNSPECIFIED = 0;
25
+ // Indicates that the command should run on a worker with compatible version if possible. It may
26
+ // not be possible if the target task queue does not also have knowledge of the current worker's
27
+ // build ID.
28
+ COMPATIBLE = 1;
29
+ // Indicates that the command should run on the target task queue's current overall-default
30
+ // build ID.
31
+ DEFAULT = 2;
32
+ }
@@ -35,6 +35,10 @@ message WorkflowActivation {
35
35
  // internal flags may be used. This is not a delta - all previously used flags always
36
36
  // appear since this representation is cheap.
37
37
  repeated uint32 available_internal_flags = 6;
38
+ // The history size in bytes as of the last WFT started event
39
+ uint64 history_size_bytes = 7;
40
+ // Set true if the most recent WFT started event had this suggestion
41
+ bool continue_as_new_suggested = 8;
38
42
  }
39
43
 
40
44
  message WorkflowActivationJob {
@@ -84,6 +84,8 @@ message ScheduleActivity {
84
84
  // activity. When unset/default, workers will always attempt to do so if activity execution
85
85
  // slots are available.
86
86
  bool do_not_eagerly_execute = 14;
87
+ // Whether this activity should run on a worker with a compatible build id or not.
88
+ coresdk.common.VersioningIntent versioning_intent = 15;
87
89
  }
88
90
 
89
91
  message ScheduleLocalActivity {
@@ -198,6 +200,8 @@ message ContinueAsNewWorkflowExecution {
198
200
  // If set, the new workflow will have this retry policy. If unset, re-uses the current
199
201
  // workflow's retry policy.
200
202
  temporal.api.common.v1.RetryPolicy retry_policy = 9;
203
+ // Whether the continued workflow should run on a worker with a compatible build id or not.
204
+ coresdk.common.VersioningIntent versioning_intent = 10;
201
205
  }
202
206
 
203
207
  // Indicate a workflow has completed as cancelled. Generally sent as a response to an activation
@@ -245,6 +249,8 @@ message StartChildWorkflowExecution {
245
249
  map<string, temporal.api.common.v1.Payload> search_attributes = 17;
246
250
  // Defines behaviour of the underlying workflow when child workflow cancellation has been requested.
247
251
  child_workflow.ChildWorkflowCancellationType cancellation_type = 18;
252
+ // Whether this child should run on a worker with a compatible build id or not.
253
+ coresdk.common.VersioningIntent versioning_intent = 19;
248
254
  }
249
255
 
250
256
  // Cancel a child workflow