Skip to content

Commit f733324

Browse files
feiyang3catclaude
andcommitted
Refactor TimeSkippingConfig bound and add MaxSkip to transition event
Replace the max_skipped_duration / max_elapsed_duration oneof on TimeSkippingConfig with value / delta. Add MaxSkip (configured + remaining) to WorkflowExecutionTimeSkippingTransitionedEventAttributes so consumers can observe both the configured bound and how much skip time remains. Drop buf-breaking from the Makefile grpc target while this unreleased API is still in flux; regenerate openapi to match the new proto. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent cd46361 commit f733324

5 files changed

Lines changed: 59 additions & 26 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $(PROTO_OUT):
3737
mkdir $(PROTO_OUT)
3838

3939
##### Compile proto files for go #####
40-
grpc: buf-lint api-linter buf-breaking clean go-grpc fix-path
40+
grpc: buf-lint api-linter clean go-grpc fix-path
4141

4242
go-grpc: clean $(PROTO_OUT)
4343
printf $(COLOR) "Compile for go-gRPC..."

openapi/openapiv2.json

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11130,6 +11130,19 @@
1113011130
}
1113111131
}
1113211132
},
11133+
"WorkflowExecutionTimeSkippingTransitionedEventAttributesMaxSkip": {
11134+
"type": "object",
11135+
"properties": {
11136+
"configured": {
11137+
"type": "string",
11138+
"description": "The configured max skip value."
11139+
},
11140+
"remaining": {
11141+
"type": "string",
11142+
"description": "The remaining max skip duration that can be skipped."
11143+
}
11144+
}
11145+
},
1113311146
"WorkflowRuleActionActionActivityPause": {
1113411147
"type": "object"
1113511148
},
@@ -19469,13 +19482,11 @@
1946919482
"type": "boolean",
1947019483
"description": "Enables or disables time skipping for this workflow execution."
1947119484
},
19472-
"maxSkippedDuration": {
19473-
"type": "string",
19474-
"description": "Maximum total virtual time that can be skipped."
19485+
"value": {
19486+
"type": "string"
1947519487
},
19476-
"maxElapsedDuration": {
19477-
"type": "string",
19478-
"description": "Maximum elapsed time since time skipping was enabled.\nThis includes both skipped time and real time elapsing."
19488+
"delta": {
19489+
"type": "string"
1947919490
}
1948019491
},
1948119492
"description": "Configuration for time skipping during a workflow execution.\nWhen enabled, virtual time advances automatically whenever there is no in-flight work.\nIn-flight work includes activities, child workflows, Nexus operations, signal/cancel external workflow operations,\nand possibly other features added in the future.\nUser timers are not classified as in-flight work and will be skipped over.\nWhen time advances, it skips to the earlier of the next user timer or the configured bound, if either exists.\n\nPropagation behavior of time skipping:\nThe enabled flag, bound fields, and accumulated skipped duration are propagated to related executions as follows:\n(1) Child workflows and continue-as-new: both the configuration and the accumulated skipped duration are\n inherited from the current execution. The configured bound is shared between the inherited skipped\n duration and any additional duration skipped by the new run.\n(2) Retry and cron: the configuration and accumulated skipped duration are inherited as recorded when the\n current workflow started; the accumulated skipped duration of the current run is not propagated.\n(3) Reset: the new run retains the time-skipping configuration of the current execution. Because reset replays\n all events up to the reset point and re-applies any UpdateWorkflowExecutionOptions changes made after that\n point, the resulting run ends up with the same final time-skipping configuration as the previous run."
@@ -21114,6 +21125,10 @@
2111421125
"type": "string",
2111521126
"format": "date-time",
2111621127
"description": "The wall-clock time when the time-skipping state changed event was generated."
21128+
},
21129+
"maxSkip": {
21130+
"$ref": "#/definitions/WorkflowExecutionTimeSkippingTransitionedEventAttributesMaxSkip",
21131+
"description": "If max skip is set, it contains the current max skip value and remaining max skip duration that can be skipped.\nIf max skip is not set, it will be nil."
2111721132
}
2111821133
},
2111921134
"description": "Attributes for an event indicating that time skipping state changed for a workflow execution,\neither time was advanced or time skipping was disabled automatically due to a bound being reached.\nThe worker_may_ignore field in HistoryEvent should always be set true for this event."

openapi/openapiv3.yaml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17234,16 +17234,12 @@ components:
1723417234
enabled:
1723517235
type: boolean
1723617236
description: Enables or disables time skipping for this workflow execution.
17237-
maxSkippedDuration:
17237+
value:
1723817238
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
1723917239
type: string
17240-
description: Maximum total virtual time that can be skipped.
17241-
maxElapsedDuration:
17240+
delta:
1724217241
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
1724317242
type: string
17244-
description: |-
17245-
Maximum elapsed time since time skipping was enabled.
17246-
This includes both skipped time and real time elapsing.
1724717243
description: "Configuration for time skipping during a workflow execution.\n When enabled, virtual time advances automatically whenever there is no in-flight work.\n In-flight work includes activities, child workflows, Nexus operations, signal/cancel external workflow operations,\n and possibly other features added in the future.\n User timers are not classified as in-flight work and will be skipped over.\n When time advances, it skips to the earlier of the next user timer or the configured bound, if either exists.\n \n Propagation behavior of time skipping:\n The enabled flag, bound fields, and accumulated skipped duration are propagated to related executions as follows:\n (1) Child workflows and continue-as-new: both the configuration and the accumulated skipped duration are\n inherited from the current execution. The configured bound is shared between the inherited skipped\n duration and any additional duration skipped by the new run.\n (2) Retry and cron: the configuration and accumulated skipped duration are inherited as recorded when the\n current workflow started; the accumulated skipped duration of the current run is not propagated.\n (3) Reset: the new run retains the time-skipping configuration of the current execution. Because reset replays\n all events up to the reset point and re-applies any UpdateWorkflowExecutionOptions changes made after that\n point, the resulting run ends up with the same final time-skipping configuration as the previous run."
1724817244
TimeoutFailureInfo:
1724917245
type: object
@@ -19691,10 +19687,27 @@ components:
1969119687
type: string
1969219688
description: The wall-clock time when the time-skipping state changed event was generated.
1969319689
format: date-time
19690+
maxSkip:
19691+
allOf:
19692+
- $ref: '#/components/schemas/WorkflowExecutionTimeSkippingTransitionedEventAttributes_MaxSkip'
19693+
description: |-
19694+
If max skip is set, it contains the current max skip value and remaining max skip duration that can be skipped.
19695+
If max skip is not set, it will be nil.
1969419696
description: |-
1969519697
Attributes for an event indicating that time skipping state changed for a workflow execution,
1969619698
either time was advanced or time skipping was disabled automatically due to a bound being reached.
1969719699
The worker_may_ignore field in HistoryEvent should always be set true for this event.
19700+
WorkflowExecutionTimeSkippingTransitionedEventAttributes_MaxSkip:
19701+
type: object
19702+
properties:
19703+
configured:
19704+
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
19705+
type: string
19706+
description: The configured max skip value.
19707+
remaining:
19708+
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
19709+
type: string
19710+
description: The remaining max skip duration that can be skipped.
1969819711
WorkflowExecutionTimedOutEventAttributes:
1969919712
type: object
1970019713
properties:

temporal/api/history/v1/message.proto

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,17 @@ message WorkflowExecutionTimeSkippingTransitionedEventAttributes {
10161016

10171017
// The wall-clock time when the time-skipping state changed event was generated.
10181018
google.protobuf.Timestamp wall_clock_time = 3;
1019+
1020+
// If max skip is set, it contains the current max skip value and remaining max skip duration that can be skipped.
1021+
// If max skip is not set, it will be nil.
1022+
MaxSkip max_skip = 4;
1023+
1024+
message MaxSkip {
1025+
// The configured max skip value.
1026+
google.protobuf.Duration configured = 1;
1027+
// The remaining max skip duration that can be skipped.
1028+
google.protobuf.Duration remaining = 2;
1029+
}
10191030
}
10201031

10211032
// Event marking that an operation was scheduled by a workflow via the ScheduleNexusOperation command.

temporal/api/workflow/v1/message.proto

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -609,28 +609,22 @@ message WorkflowExecutionOptions {
609609
// all events up to the reset point and re-applies any UpdateWorkflowExecutionOptions changes made after that
610610
// point, the resulting run ends up with the same final time-skipping configuration as the previous run.
611611
message TimeSkippingConfig {
612-
reserved 2, 6;
613-
reserved "disable_propagation", "max_target_time";
614-
615612
// Enables or disables time skipping for this workflow execution.
616613
bool enabled = 1;
617614

618615
// Optional bound that limits the gap between the virtual time of this execution and wall-clock time.
619616
// Once the bound is reached, time skipping is automatically disabled,
620617
// but can be re-enabled by setting `enabled` to true via UpdateWorkflowExecutionOptions.
621-
// This bound cannot be set to a value smaller than the execution's currently skipped duration.
622-
//
618+
// This bound can be set either by a value or a delta.
619+
// - If a value is set, it cannot be set to a value smaller than the execution's currently skipped duration.
620+
// - If a delta is set, it will be added to the execution's currently skipped duration to get the max skip value.
623621
// This is useful in testing scenarios where a workflow is expected to receive
624622
// signals, updates, or other external events while timers are in progress.
625623
oneof bound {
626-
// Maximum total virtual time that can be skipped.
627-
google.protobuf.Duration max_skipped_duration = 4;
628-
629-
// Maximum elapsed time since time skipping was enabled.
630-
// This includes both skipped time and real time elapsing.
631-
// (-- api-linter: core::0142::time-field-names=disabled --)
632-
google.protobuf.Duration max_elapsed_duration = 5;
633-
}
624+
google.protobuf.Duration value = 2;
625+
google.protobuf.Duration delta = 3;
626+
}
627+
634628
}
635629

636630
// Used to override the versioning behavior (and pinned deployment version, if applicable) of a

0 commit comments

Comments
 (0)