Skip to content

timeskipping: add TimeSkippingConfig support to workflow-start APIs#9834

Merged
feiyang3cat merged 5 commits intotemporalio:mainfrom
feiyang3cat:ts/config-1
Apr 14, 2026
Merged

timeskipping: add TimeSkippingConfig support to workflow-start APIs#9834
feiyang3cat merged 5 commits intotemporalio:mainfrom
feiyang3cat:ts/config-1

Conversation

@feiyang3cat
Copy link
Copy Markdown
Contributor

@feiyang3cat feiyang3cat commented Apr 6, 2026

What changed?

Add time-skipping configuration support.

(1) Feature flag in dynamic config
- frontend.TimeSkippingEnabled (namespace bool, default false) gates the feature

(2) Frontend validation (validateTimeSkippingConfig)
- StartWorkflowExecution
- SignalWithStartWorkflowExecution
- ExecuteMultiOperation (via the shared prepareStartWorkflowRequest path)

(3) Persistence
- TimeSkippingInfo proto added to WorkflowExecutionInfo
- MutableState stores the config when a workflow starts or options are updated

(4) Tests
- New timeskipping functional tests in tests/timeskipping_test.go

Why?

first step of the time skipping project

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

@feiyang3cat feiyang3cat requested review from a team as code owners April 6, 2026 22:33
@feiyang3cat feiyang3cat changed the title time-skipping configuration (WIP) time-skipping configuration Apr 6, 2026
@feiyang3cat feiyang3cat force-pushed the ts/config-1 branch 3 times, most recently from 1346474 to 90f833c Compare April 7, 2026 00:56
@feiyang3cat feiyang3cat changed the title (WIP) time-skipping configuration time-skipping configuration in APIs of starting workflows Apr 7, 2026
@feiyang3cat feiyang3cat changed the title time-skipping configuration in APIs of starting workflows timeskipping: add TimeSkippingConfig support to workflow-start APIs Apr 7, 2026
@feiyang3cat feiyang3cat force-pushed the ts/config-1 branch 2 times, most recently from 5c264c5 to 3dd6b39 Compare April 7, 2026 01:04
@feiyang3cat feiyang3cat changed the title timeskipping: add TimeSkippingConfig support to workflow-start APIs (WIP) timeskipping: add TimeSkippingConfig support to workflow-start APIs Apr 7, 2026
@feiyang3cat feiyang3cat force-pushed the ts/config-1 branch 4 times, most recently from 3459a5c to 8461144 Compare April 7, 2026 03:07
@feiyang3cat feiyang3cat changed the title (WIP) timeskipping: add TimeSkippingConfig support to workflow-start APIs timeskipping: add TimeSkippingConfig support to workflow-start APIs Apr 7, 2026
@feiyang3cat feiyang3cat force-pushed the ts/config-1 branch 2 times, most recently from b26ae39 to 5572a38 Compare April 7, 2026 03:56
Comment thread service/frontend/workflow_handler.go Outdated
Comment thread service/history/workflow/mutable_state_impl.go
if timeSkippingConfig == nil {
return nil
}
if !wh.config.TimeSkippingEnabled(namespaceName.String()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What if TimeSkippingConfig is present and Enabled is set to false? Looks like this would return an error in that case. It should be ok if config.TimeSkippingEnabled is false and TimeSkippingConfig.Enabled in false.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is intentional — when enabled = false, the other configurations are also disallowed. Since the entire feature is flagged as unimplemented, allowing users to set these configurations would not make much sense.

Copy link
Copy Markdown
Contributor

@prathyushpv prathyushpv Apr 13, 2026

Choose a reason for hiding this comment

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

Hmm.. I wonder if we could get a default value of false in this field from any SDKs even if that was not explicitly set 🤔

And also it doesn't look right to return an error Time skipping is not enabled when the request explicitly set it to disabled.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the error is "the time skipping feature is not enabled for this namespace"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

share my thinking for this design:

Looking at the languages supported by our SDKs, I don't think protobuf translates an optional message field to a struct initialized with default values (false/zero) in any of them. The SDKs haven't started their design yet, and I'd be surprised if they went with an approach that initializes this message field and populates it with defaults.

There's also something worth considering on the server side. If we allow configurations to be stored in the database and events for a namespace where this feature has never been enabled or implemented, it could get tricky to distinguish whether an enabled = false was deliberately set by the user or is just a default value. We'd likely need to differentiate that to make sure the default values aren't persisted and thus not visible which will be hard.

We may discuss further is that would be helpful.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That argument makes sense. Then what if we just ignore the config if it is disabled and not return an error?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think that is still kind of not very simple and clean. Like we need to add code differentiate between different scenarios: (1) we also support update which cannot ignore disable (2) if the enabled is false and the bound is set, I don't know we still go a step further to patch our ignore rule or raise an error .

Comment thread service/frontend/workflow_handler.go
@feiyang3cat feiyang3cat force-pushed the ts/config-1 branch 5 times, most recently from 8e6b4ab to 349bc4c Compare April 13, 2026 22:40
Comment thread common/dynamicconfig/constants.go Outdated
Comment thread service/frontend/workflow_handler.go Outdated
}
// todo: validation for max target time will need to check current virtual time for updateOptions scenario
case *workflowpb.TimeSkippingConfig_MaxTargetTime:
if bound.MaxTargetTime.AsTime().Before(time.Now().Add(namespace.MinTimeSkippingDuration)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: use timeSource if possible. It's in NewWorkflowHandler but not sure if the handler struct has it or now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed

Comment thread common/namespace/const.go
Comment on lines +15 to +16
// MinTimeSkippingDuration is the minimum duration for time skipping.
MinTimeSkippingDuration = 1 * time.Minute
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: maybe if it configurable via dc as well in case someone needs to tune it. no strong opinion.

@feiyang3cat feiyang3cat force-pushed the ts/config-1 branch 2 times, most recently from 23e3d26 to 296a8f3 Compare April 14, 2026 00:37
@feiyang3cat feiyang3cat enabled auto-merge (squash) April 14, 2026 01:59
@feiyang3cat feiyang3cat force-pushed the ts/config-1 branch 2 times, most recently from 6a7d4ed to 6fdc33e Compare April 14, 2026 04:24
@feiyang3cat feiyang3cat merged commit ef19f17 into temporalio:main Apr 14, 2026
46 checks passed
switch bound := timeSkippingConfig.GetBound().(type) {
case *workflowpb.TimeSkippingConfig_MaxSkippedDuration:
if bound.MaxSkippedDuration.AsDuration() < namespace.MinTimeSkippingDuration {
return serviceerror.NewUnimplementedf(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@feiyang3cat, sorry coming late to this. This should be NewInvalidArgumentf and the same for below

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.

4 participants