Skip to content

Commit de94de2

Browse files
committed
feat: adds a new feature flag for an OCR queue
1 parent 9c2ada8 commit de94de2

5 files changed

Lines changed: 33 additions & 0 deletions

File tree

pkg/settings/cresettings/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ flowchart
4747
%% TODO unused
4848
%% PerOrg.ZeroBalancePruningTimeout
4949
50+
subgraph FeatureFlags[FeatureFlags]
51+
FeatureFlags.EnableOCRQueue[/FeatureFlags.EnableOCRQueue\]:::gate
52+
end
53+
5054
subgraph Store.FetchWorkflowArtifacts
5155
PerWorkflow.WASMConfigSizeLimit{{PerWorkflow.WASMConfigSizeLimit}}:::bound
5256
PerWorkflow.WASMBinarySizeLimit{{PerWorkflow.WASMBinarySizeLimit}}:::bound

pkg/settings/cresettings/defaults.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,8 @@
110110
"CallLimit": "5"
111111
},
112112
"FeatureMultiTriggerExecutionIDsActiveAt": "2100-01-01 00:00:00 +0000 UTC"
113+
},
114+
"FeatureFlags": {
115+
"EnableOCRQueue": "false"
113116
}
114117
}

pkg/settings/cresettings/defaults.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,6 @@ ResponseSizeLimit = '100kb'
110110

111111
[PerWorkflow.Secrets]
112112
CallLimit = '5'
113+
114+
[FeatureFlags]
115+
EnableOCRQueue = 'false'

pkg/settings/cresettings/settings.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ var Default = Schema{
111111
VaultMaxPerOracleUnexpiredBlobCumulativePayloadSizeLimit: Size(31457280 * config.Byte),
112112
VaultMaxPerOracleUnexpiredBlobCount: Int(1000),
113113

114+
FeatureFlags: FeatureFlags{
115+
EnableOCRQueue: Bool(false),
116+
},
117+
114118
PerOrg: Orgs{
115119
ZeroBalancePruningTimeout: Duration(24 * time.Hour),
116120
},
@@ -239,7 +243,14 @@ type Schema struct {
239243
PerOrg Orgs `scope:"org"`
240244
PerOwner Owners `scope:"owner"`
241245
PerWorkflow Workflows `scope:"workflow"`
246+
247+
FeatureFlags FeatureFlags
242248
}
249+
250+
type FeatureFlags struct {
251+
EnableOCRQueue Setting[bool]
252+
}
253+
243254
type Orgs struct {
244255
ZeroBalancePruningTimeout Setting[time.Duration]
245256
}

pkg/settings/cresettings/settings_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ func TestSchema_Unmarshal(t *testing.T) {
7171
"GatewayUnauthenticatedRequestRateLimitPerIP": "1rps:100",
7272
"GatewayIncomingPayloadSizeLimit": "14kb",
7373
"GatewayVaultManagementEnabled": "true",
74+
"FeatureFlags": {
75+
"EnableOCRQueue": "true"
76+
},
7477
"PerOrg": {
7578
"ZeroBalancePruningTimeout": "48h"
7679
},
@@ -122,6 +125,7 @@ func TestSchema_Unmarshal(t *testing.T) {
122125
assert.Equal(t, 500, cfg.WorkflowLimit.DefaultValue)
123126
assert.Equal(t, 14*config.KByte, cfg.GatewayIncomingPayloadSizeLimit.DefaultValue)
124127
assert.Equal(t, true, cfg.GatewayVaultManagementEnabled.DefaultValue)
128+
assert.Equal(t, true, cfg.FeatureFlags.EnableOCRQueue.DefaultValue)
125129
assert.Equal(t, 48*time.Hour, cfg.PerOrg.ZeroBalancePruningTimeout.DefaultValue)
126130
assert.Equal(t, 99, cfg.PerOwner.WorkflowExecutionConcurrencyLimit.DefaultValue)
127131
assert.Equal(t, 250*config.MByte, cfg.PerWorkflow.WASMMemoryLimit.DefaultValue)
@@ -141,6 +145,14 @@ func TestSchema_Unmarshal(t *testing.T) {
141145
assert.Equal(t, config.Timestamp(time.Date(2025, 6, 15, 0, 0, 0, 0, time.UTC).Unix()), cfg.PerWorkflow.FeatureMultiTriggerExecutionIDsActiveAt.DefaultValue)
142146
}
143147

148+
func TestFeatureFlags_EnableOCRQueue(t *testing.T) {
149+
assert.False(t, Default.FeatureFlags.EnableOCRQueue.DefaultValue, "default should be false")
150+
151+
got, err := Default.FeatureFlags.EnableOCRQueue.GetOrDefault(t.Context(), nil)
152+
require.NoError(t, err)
153+
assert.False(t, got, "GetOrDefault with nil getter should return default false")
154+
}
155+
144156
func TestDefaultGetter(t *testing.T) {
145157
limit := Default.PerWorkflow.HTTPAction.CallLimit
146158

0 commit comments

Comments
 (0)