Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ require (
github.com/fatih/color v1.19.0
github.com/google/uuid v1.6.0
github.com/mattn/go-isatty v0.0.23
github.com/nexus-rpc/sdk-go v0.7.0
github.com/nexus-rpc/sdk-go v0.8.0
github.com/olekukonko/tablewriter v0.0.5
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.10
github.com/stretchr/testify v1.12.1
github.com/temporalio/cli/cliext v0.0.0
github.com/temporalio/ui-server/v2 v2.56.4
go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9
go.temporal.io/sdk v1.49.0
go.temporal.io/api v1.64.4
go.temporal.io/sdk v1.52.1-0.20261202231524-20e9cbc2994f
go.temporal.io/sdk/contrib/envconfig v1.1.0
go.temporal.io/server v1.33.0-166.3
go.temporal.io/server v1.33.0-168.3
golang.org/x/exp v0.0.0-20260611194520-c48552f49976
golang.org/x/mod v0.41.0
golang.org/x/term v0.47.0
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOF
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/nexus-rpc/nexus-proto-annotations v0.1.0 h1:2fELd+9sqUtNu6Fg//pw8YFsxOvp8vZ8hfP0nHhNI80=
github.com/nexus-rpc/nexus-proto-annotations v0.1.0/go.mod h1:n3UjF1bPCW8llR8tHvbxJ+27yPWrhpo8w/Yg1IOuY0Y=
github.com/nexus-rpc/sdk-go v0.7.0 h1:38NrfY5rLnZAiMMs2ZfCKI/CSDzdfJG+27iAgfA8bUI=
github.com/nexus-rpc/sdk-go v0.7.0/go.mod h1:FHdPfVQwRuJFZFTF0Y2GOAxCrbIBNrcPna9slkGKPYk=
github.com/nexus-rpc/sdk-go v0.8.0 h1:xQbsF3KHlCwbIt7fMkAk6gx2iE/NYsg9pHRTZgq95VQ=
github.com/nexus-rpc/sdk-go v0.8.0/go.mod h1:FHdPfVQwRuJFZFTF0Y2GOAxCrbIBNrcPna9slkGKPYk=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
Expand Down Expand Up @@ -479,18 +479,18 @@ go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOy
go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc=
go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk=
go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E=
go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9 h1:ZJb+HC/3UhzBBnvzKhGOVNf6WSDpNPBDn94vhEBfZVo=
go.temporal.io/api v1.64.1-0.20261030195137-01272cbd37c9/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM=
go.temporal.io/api v1.64.4 h1:SHiPMuT9j/txHwk9QAsFE4/KNMcXtgD9z9f5L4ERBLU=
go.temporal.io/api v1.64.4/go.mod h1:acM0I9WPuYg8W3Pd9jOZvEgi7mRUttUQ4+e7fowKVnM=
go.temporal.io/auto-scaled-workers v0.0.0-20261030203857-75274b664c29 h1:wr2yPeTpZAvovJ1tQviQFfcZQRuqvdhU1T+6yvZ23S0=
go.temporal.io/auto-scaled-workers v0.0.0-20261030203857-75274b664c29/go.mod h1:Wcxj1DAGbC/tQwcfX8VjGhVKM9+/idGDQIvYx/gf13Y=
go.temporal.io/sdk v1.49.0 h1:CtGI0BUe/SCo3eoqTwuWWtXKueii9GBVus7KrKKH1Vo=
go.temporal.io/sdk v1.49.0/go.mod h1:xP0FulN5JJSfisESUP60LlWsrKz2tLSStGjVdk8r5cc=
go.temporal.io/sdk v1.52.1-0.20261202231524-20e9cbc2994f h1:Ze3hiwLZiFF4ifH0btrOV7UI63TFJHA2fH9+hyDzA+k=
go.temporal.io/sdk v1.52.1-0.20261202231524-20e9cbc2994f/go.mod h1:H0KRRzQ/L5EZwtVOIsOyqq16Gm/1meYGJhzwBCZ+lkk=
go.temporal.io/sdk/contrib/envconfig v1.1.0 h1:9HGsyrZytjdcZeWJwQlczqYulMhmHS2PRcarcFRjMRE=
go.temporal.io/sdk/contrib/envconfig v1.1.0/go.mod h1:th96Zl21YH2mHEe3uZ5Dw0KwZFSF4I2oSwTcUxGA19Y=
go.temporal.io/server v1.33.0-166.3 h1:y3tLzHag7F6Pv5EieBUJk2+RlTkUhKT1TaC7k5k2HcQ=
go.temporal.io/server v1.33.0-166.3/go.mod h1:SP/bukdhfHYhAlaz7oghgdNZvJtEaBmPjzvSbvkS2jk=
go.temporal.io/testx v0.0.0-20261029001555-ddcb0739798d h1:SK9slpVz38T0H1ldMpsh/GFWrVTZw7gWC3i2An0rviI=
go.temporal.io/testx v0.0.0-20261029001555-ddcb0739798d/go.mod h1:nL3IFIKnioDnUxNaqKLyzR2tZUK6THrXsaQuVjNYVX8=
go.temporal.io/server v1.33.0-168.3 h1:CSzVO6eM/qgd3jbLLh6IKBXe05DIWcv3RPeHViLfOIc=
go.temporal.io/server v1.33.0-168.3/go.mod h1:VZr6mUoqAe1bPiJeINuggEOZgqUfR3o7059vGuvEsh4=
go.temporal.io/testx v0.0.0-20261112171501-c4cea589f218 h1:ZUWWvMMda6gW5w+w2CjbZpM18wdXUQ3kM0bB5jADu0A=
go.temporal.io/testx v0.0.0-20261112171501-c4cea589f218/go.mod h1:nL3IFIKnioDnUxNaqKLyzR2tZUK6THrXsaQuVjNYVX8=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
Expand Down
4 changes: 4 additions & 0 deletions internal/devserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ type StartOptions struct {
SqlitePragmas map[string]string
FrontendHTTPPort int
EnableGlobalNamespace bool
EnableTimeSkipping bool
DynamicConfigValues map[string]any
SearchAttributes map[string]enums.IndexedValueType
LogConfig func([]byte)
Expand Down Expand Up @@ -254,6 +255,9 @@ func (s *StartOptions) buildServerOptions() ([]temporal.ServerOption, *slog.Leve
for k, v := range s.DynamicConfigValues {
dynConf[dynamicconfig.MakeKey(k)] = v
}
if s.EnableTimeSkipping {
applyTimeSkippingDynamicConfig(dynConf)
}
opts = append(opts, temporal.WithDynamicConfigClient(dynConf))

// gRPC interceptors if set
Expand Down
103 changes: 103 additions & 0 deletions internal/devserver/server_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package devserver

import (
"testing"

"github.com/stretchr/testify/require"
"go.temporal.io/server/common/dynamicconfig"
"go.temporal.io/server/common/log"
)

func timeSkippingConfigForTest(values map[string]any, enabled bool) dynamicconfig.StaticClient {
config := make(dynamicconfig.StaticClient)
for key, value := range values {
config[dynamicconfig.MakeKey(key)] = value
}
if enabled {
applyTimeSkippingDynamicConfig(config)
}
return config
}

func TestDevServerTimeSkippingDynamicConfigPrecedence(t *testing.T) {
type wantConfig struct {
workflow, schedule, creation, routing bool
rollout, maxSkip int
}
serverDefaults := wantConfig{routing: true, maxSkip: 200}
allEnabled := wantConfig{workflow: true, schedule: true, creation: true, routing: true, rollout: 100, maxSkip: 200}

for _, tc := range []struct {
name string
enabled bool
explicit map[string]any
want wantConfig
}{
{name: "flag off uses server defaults", want: serverDefaults},
{name: "flag on without explicit config", enabled: true, want: allEnabled},
{
name: "explicit global config overrides all time-skipping defaults",
enabled: true,
explicit: map[string]any{
dynamicconfig.WorkflowTimeSkippingEnabled.Key().String(): false,
dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Key().String(): false,
dynamicconfig.EnableCHASMSchedulerCreation.Key().String(): false,
dynamicconfig.CHASMSchedulerCreationRolloutPercent.Key().String(): 0,
dynamicconfig.EnableCHASMSchedulerRouting.Key().String(): false,
},
want: wantConfig{maxSkip: 200},
},
{
name: "partial global override preserves other defaults",
enabled: true,
explicit: map[string]any{
dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Key().String(): false,
},
want: wantConfig{workflow: true, creation: true, routing: true, rollout: 100, maxSkip: 200},
},
{
name: "explicit global max skip overrides server default",
enabled: true,
explicit: map[string]any{
dynamicconfig.TimeSkippingMaxSkipPerSession.Key().String(): 50,
},
want: wantConfig{workflow: true, schedule: true, creation: true, routing: true, rollout: 100, maxSkip: 50},
},
{
name: "flag off preserves explicit global config",
explicit: map[string]any{
dynamicconfig.WorkflowTimeSkippingEnabled.Key().String(): true,
},
want: wantConfig{workflow: true, routing: true, maxSkip: 200},
},
} {
t.Run(tc.name, func(t *testing.T) {
raw := timeSkippingConfigForTest(tc.explicit, tc.enabled)
for key, value := range tc.explicit {
require.Equal(t, value, raw[dynamicconfig.MakeKey(key)], "explicit key %s was replaced", key)
}
for key, fallback := range timeSkippingDynamicConfigDefaults {
if _, explicit := tc.explicit[key.String()]; explicit {
continue
}
if tc.enabled {
require.Equal(t, fallback, raw[key], "key %s", key)
} else {
_, present := raw[key]
require.False(t, present, "unexpected override for %s", key)
}
}
config := dynamicconfig.NewCollection(raw, log.NewNoopLogger())
for _, namespace := range []string{"timeskipping-test", "another-namespace"} {
t.Run(namespace, func(t *testing.T) {
require.Equal(t, tc.want.workflow, dynamicconfig.WorkflowTimeSkippingEnabled.Get(config)(namespace))
require.Equal(t, tc.want.schedule, dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Get(config)(namespace))
require.Equal(t, tc.want.creation, dynamicconfig.EnableCHASMSchedulerCreation.Get(config)(namespace))
require.Equal(t, tc.want.rollout, dynamicconfig.CHASMSchedulerCreationRolloutPercent.Get(config)(namespace))
require.Equal(t, tc.want.routing, dynamicconfig.EnableCHASMSchedulerRouting.Get(config)(namespace))
require.Equal(t, tc.want.maxSkip, dynamicconfig.TimeSkippingMaxSkipPerSession.Get(config)(namespace))
})
}
})
}
}
20 changes: 20 additions & 0 deletions internal/devserver/time_skipping_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package devserver

import "go.temporal.io/server/common/dynamicconfig"

var timeSkippingDynamicConfigDefaults = map[dynamicconfig.Key]any{
dynamicconfig.WorkflowTimeSkippingEnabled.Key(): true,
dynamicconfig.CHASMSchedulerTimeSkippingEnabled.Key(): true,
dynamicconfig.EnableCHASMSchedulerCreation.Key(): true,
dynamicconfig.CHASMSchedulerCreationRolloutPercent.Key(): 100,
dynamicconfig.EnableCHASMSchedulerRouting.Key(): true,
}

func applyTimeSkippingDynamicConfig(dynConf dynamicconfig.StaticClient) {
for key, fallback := range timeSkippingDynamicConfigDefaults {
// Explicit dynamic config values take precedence over these defaults.
if _, exists := dynConf[key]; !exists {
dynConf[key] = fallback
}
}
}
Loading
Loading