diff --git a/pkg/settings/cresettings/README.md b/pkg/settings/cresettings/README.md index 72ea252cee..e5b8c8d665 100644 --- a/pkg/settings/cresettings/README.md +++ b/pkg/settings/cresettings/README.md @@ -100,9 +100,11 @@ flowchart subgraph CentralTriggerQueue.Put %% trigger coordinator reader → central trigger queue (pre-admission buffer) + PerWorkflow.FeatureTriggerConsensusEnabledActivePeriod[/PerWorkflow.FeatureTriggerConsensusEnabledActivePeriod\]:::gate PerWorkflow.FeatureShadowTriggerModeActivePeriod[/PerWorkflow.FeatureShadowTriggerModeActivePeriod\]:::gate CentralTriggerEventQueueLimit{{CentralTriggerEventQueueLimit}}:::bound + PerWorkflow.FeatureTriggerConsensusEnabledActivePeriod-->CentralTriggerEventQueueLimit PerWorkflow.FeatureShadowTriggerModeActivePeriod-->CentralTriggerEventQueueLimit end diff --git a/pkg/settings/cresettings/defaults.json b/pkg/settings/cresettings/defaults.json index 1f9b747893..7f09353410 100644 --- a/pkg/settings/cresettings/defaults.json +++ b/pkg/settings/cresettings/defaults.json @@ -314,6 +314,7 @@ "FeatureConsensusIncludeAllTimestampsActivePeriod": "[2100-01-01 00:00:00 +0000 UTC,2101-01-01 00:00:00 +0000 UTC]", "FeatureVaultGetSecretsDirectlyActivePeriod": "[2100-01-01 00:00:00 +0000 UTC,2101-01-01 00:00:00 +0000 UTC]", "FeatureShadowTriggerModeActivePeriod": "[2100-01-01 00:00:00 +0000 UTC,2101-01-01 00:00:00 +0000 UTC]", + "FeatureTriggerConsensusEnabledActivePeriod": "[2100-01-01 00:00:00 +0000 UTC,2101-01-01 00:00:00 +0000 UTC]", "FeatureExecutionMetadataActivePeriod": "[2100-01-01 00:00:00 +0000 UTC,2101-01-01 00:00:00 +0000 UTC]" } } \ No newline at end of file diff --git a/pkg/settings/cresettings/defaults.toml b/pkg/settings/cresettings/defaults.toml index 2d7c032831..aba1287b04 100644 --- a/pkg/settings/cresettings/defaults.toml +++ b/pkg/settings/cresettings/defaults.toml @@ -222,6 +222,7 @@ FeatureConsensusStricterMedianQuorumActivePeriod = '[2100-01-01 00:00:00 +0000 U FeatureConsensusIncludeAllTimestampsActivePeriod = '[2100-01-01 00:00:00 +0000 UTC,2101-01-01 00:00:00 +0000 UTC]' FeatureVaultGetSecretsDirectlyActivePeriod = '[2100-01-01 00:00:00 +0000 UTC,2101-01-01 00:00:00 +0000 UTC]' FeatureShadowTriggerModeActivePeriod = '[2100-01-01 00:00:00 +0000 UTC,2101-01-01 00:00:00 +0000 UTC]' +FeatureTriggerConsensusEnabledActivePeriod = '[2100-01-01 00:00:00 +0000 UTC,2101-01-01 00:00:00 +0000 UTC]' FeatureExecutionMetadataActivePeriod = '[2100-01-01 00:00:00 +0000 UTC,2101-01-01 00:00:00 +0000 UTC]' [PerWorkflow.ChainAllowed] diff --git a/pkg/settings/cresettings/featureflags_test.go b/pkg/settings/cresettings/featureflags_test.go index 704e3a9ea0..630cfe7f48 100644 --- a/pkg/settings/cresettings/featureflags_test.go +++ b/pkg/settings/cresettings/featureflags_test.go @@ -76,5 +76,6 @@ func TestFeatureFlagKeys(t *testing.T) { require.Equal(t, settings.ScopeGlobal, byKey["DonTimeSequencedTimestampsActivePeriod"]) require.Equal(t, settings.ScopeGlobal, byKey["CRONV2ActivePeriod"]) require.Equal(t, settings.ScopeWorkflow, byKey["PerWorkflow.FeatureShadowTriggerModeActivePeriod"]) + require.Equal(t, settings.ScopeWorkflow, byKey["PerWorkflow.FeatureTriggerConsensusEnabledActivePeriod"]) require.Contains(t, byKey, "ConfidentialCompute.ConfidentialHTTPVaultGetSecretsDirectlyActivePeriod") } diff --git a/pkg/settings/cresettings/settings.go b/pkg/settings/cresettings/settings.go index 540c0b7c39..c3a11b74af 100644 --- a/pkg/settings/cresettings/settings.go +++ b/pkg/settings/cresettings/settings.go @@ -376,6 +376,7 @@ var Default = Schema{ FeatureConsensusIncludeAllTimestampsActivePeriod: disabledFeatureTimeRange, FeatureVaultGetSecretsDirectlyActivePeriod: disabledFeatureTimeRange, FeatureShadowTriggerModeActivePeriod: disabledFeatureTimeRange, + FeatureTriggerConsensusEnabledActivePeriod: disabledFeatureTimeRange, FeatureExecutionMetadataActivePeriod: disabledFeatureTimeRange, }, } @@ -642,6 +643,15 @@ type Workflows struct { // copied to the central trigger queue. Each event is checked against the time it was observed, so // every node switches at the same moment. FeatureShadowTriggerModeActivePeriod Setting[Range[config.Timestamp]] `featureflag:"true"` + // FeatureTriggerConsensusEnabledActivePeriod is the window in which coordinated trigger events go + // only to the central trigger queue, and only the consensus-queue plugin starts them. Like the + // shadow window, each event is checked against the time it was observed. It takes precedence over + // FeatureShadowTriggerModeActivePeriod when both windows contain an event, so the two may overlap. + // Only move a boundary to a future time later than settings propagation plus the trigger event + // queue timeout; a boundary moved into the past can route and start in-flight events differently. + // Requires the consensus-queue plugin and the coordinated engine on every node in the workflow DON; + // without them, events in this window are never started. + FeatureTriggerConsensusEnabledActivePeriod Setting[Range[config.Timestamp]] `featureflag:"true"` // FeatureExecutionMetadataActivePeriod is the window in which the engine populates // WorkflowExecutionMetadata in the ExecuteRequest sent to the workflow module. It changes the // request bytes, which confidential workflows hash across nodes, so it is checked against the diff --git a/pkg/settings/cresettings/settings_test.go b/pkg/settings/cresettings/settings_test.go index 0ddf6197ae..93e8000832 100644 --- a/pkg/settings/cresettings/settings_test.go +++ b/pkg/settings/cresettings/settings_test.go @@ -332,6 +332,23 @@ func TestFeatureShadowTriggerModeActivePeriodKeyInit(t *testing.T) { }, s.DefaultValue) } +// TestFeatureTriggerConsensusEnabledActivePeriodKeyInit asserts the consensus window is per workflow and off by default. +func TestFeatureTriggerConsensusEnabledActivePeriodKeyInit(t *testing.T) { + s := Default.PerWorkflow.FeatureTriggerConsensusEnabledActivePeriod + + assert.Equal(t, "PerWorkflow.FeatureTriggerConsensusEnabledActivePeriod", s.GetKey()) + assert.Equal(t, settings.ScopeWorkflow, s.Scope) + assert.NotNil(t, s.Parse) + assert.Equal(t, settings.Range[config.Timestamp]{ + Lower: config.Timestamp(time.Date(2100, 1, 1, 0, 0, 0, 0, time.UTC).Unix()), + Upper: config.Timestamp(time.Date(2101, 1, 1, 0, 0, 0, 0, time.UTC).Unix()), + }, s.DefaultValue) + + got, err := s.GetOrDefault(t.Context(), DefaultGetter) + require.NoError(t, err) + assert.False(t, got.Contains(config.Timestamp(time.Now().Unix())), "consensus window must not contain now by default") +} + func TestFeatureVaultGetSecretsDirectlyActivePeriodKeyInit(t *testing.T) { s := Default.PerWorkflow.FeatureVaultGetSecretsDirectlyActivePeriod