From f03337486b3a3f633f13bf2ed083fdc1b86d6867 Mon Sep 17 00:00:00 2001 From: lea konvalinka Date: Fri, 17 Apr 2026 11:12:15 +0200 Subject: [PATCH 1/4] fix: accept uppercase V version prefix Signed-off-by: Lea Konvalinka --- core/pkg/evaluator/fractional.go | 2 +- core/pkg/evaluator/semver.go | 2 ++ core/pkg/evaluator/semver_test.go | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/pkg/evaluator/fractional.go b/core/pkg/evaluator/fractional.go index 0163e0929..b72ece20f 100644 --- a/core/pkg/evaluator/fractional.go +++ b/core/pkg/evaluator/fractional.go @@ -61,7 +61,7 @@ func parseFractionalEvaluationData(values, data any, logger *logger.Logger) (str if !ok { return "", nil, errors.New("fractional evaluation data is not an array") } -if len(valuesArray) < 1 { + if len(valuesArray) < 1 { return "", nil, errors.New("fractional evaluation data must contain at least one distribution") } diff --git a/core/pkg/evaluator/semver.go b/core/pkg/evaluator/semver.go index 9d338a359..4157a6122 100644 --- a/core/pkg/evaluator/semver.go +++ b/core/pkg/evaluator/semver.go @@ -135,7 +135,9 @@ func parseSemanticVersion(v interface{}) (string, error) { version := ensureString(v) // version strings are only valid in the semver package if they start with a 'v' // if it's not present in the given value, we prepend it + // 'V' is normalized to 'v' if !strings.HasPrefix(version, "v") { + version = strings.TrimPrefix(version, "V") version = "v" + version } diff --git a/core/pkg/evaluator/semver_test.go b/core/pkg/evaluator/semver_test.go index 0d25af9cc..0a636e10f 100644 --- a/core/pkg/evaluator/semver_test.go +++ b/core/pkg/evaluator/semver_test.go @@ -83,6 +83,16 @@ func TestSemVerOperator_Compare(t *testing.T) { want: true, wantErr: false, }, + { + name: "uppercase V prefix equals lowercase or no prefix", + svo: Equals, + args: args{ + v1: "V1.0.0", + v2: "1.0.0", + }, + want: true, + wantErr: false, + }, { name: "no prefixed v both", svo: Greater, From a5329712be7b2bff8a369b28c4afec8bfa6085e4 Mon Sep 17 00:00:00 2001 From: lea konvalinka Date: Thu, 23 Apr 2026 13:52:10 +0200 Subject: [PATCH 2/4] fix: further custom-ops inconsistencies Signed-off-by: Lea Konvalinka --- core/pkg/evaluator/fractional.go | 4 +- core/pkg/evaluator/fractional_test.go | 54 ++++++++++++++++ core/pkg/evaluator/semver.go | 4 +- core/pkg/evaluator/semver_test.go | 50 ++++++++++++++ core/pkg/evaluator/string_comparison.go | 2 +- core/pkg/evaluator/string_comparison_test.go | 68 +++++++++++++++++--- test-harness | 2 +- 7 files changed, 168 insertions(+), 16 deletions(-) diff --git a/core/pkg/evaluator/fractional.go b/core/pkg/evaluator/fractional.go index b72ece20f..5d3973789 100644 --- a/core/pkg/evaluator/fractional.go +++ b/core/pkg/evaluator/fractional.go @@ -195,7 +195,7 @@ func parseFractionalEvaluationDistributions(values []any, data any, logger *logg // It maps a 32-bit hash to the range [0, totalWeight) and finds the variant bucket that contains that value. func distributeValue(hashValue uint32, feDistribution *fractionalEvaluationDistribution) any { if feDistribution.totalWeight == 0 { - return "" + return nil } bucket := (uint64(hashValue) * uint64(feDistribution.totalWeight)) >> 32 @@ -209,5 +209,5 @@ func distributeValue(hashValue uint32, feDistribution *fractionalEvaluationDistr } // unreachable given validation - return "" + return nil } diff --git a/core/pkg/evaluator/fractional_test.go b/core/pkg/evaluator/fractional_test.go index 6fcfa7ffb..789a626d4 100644 --- a/core/pkg/evaluator/fractional_test.go +++ b/core/pkg/evaluator/fractional_test.go @@ -1073,3 +1073,57 @@ func TestFractionalVariantBoolNumericAndOperators(t *testing.T) { }) } } + +func TestFractionalEvaluation_ErrorFallbackWhenUsedDirectly(t *testing.T) { + const source = "testSource" + ctx := context.Background() + + tests := map[string]struct { + targeting string + context map[string]any + }{ + "missing bucket key falls back": { + targeting: `{ + "fractional": [ + {"var": "missing_key"}, + ["one", 50], + ["two", 50] + ] + }`, + context: map[string]any{}, + }, + "all zero weights fall back": { + targeting: `{ + "fractional": [ + {"var": "targetingKey"}, + ["one", 0], + ["two", 0] + ] + }`, + context: map[string]any{"targetingKey": "any-user"}, + }, + } + + for name, tt := range tests { + t.Run(name, func(t *testing.T) { + je, err := setupEvaluator(source, []model.Flag{{ + Key: "fractional-op-error-fallback", + State: "ENABLED", + DefaultVariant: "fallback", + Variants: map[string]any{ + "one": "one", + "two": "two", + "fallback": "fallback", + }, + Targeting: []byte(tt.targeting), + }}) + assert.NoError(t, err) + + value, variant, reason, _, err := resolve[string](ctx, "default", "fractional-op-error-fallback", tt.context, je.evaluateVariant) + assert.NoError(t, err) + assert.Equal(t, "fallback", value) + assert.Equal(t, "fallback", variant) + assert.Equal(t, model.DefaultReason, reason) + }) + } +} diff --git a/core/pkg/evaluator/semver.go b/core/pkg/evaluator/semver.go index 4157a6122..683b0a287 100644 --- a/core/pkg/evaluator/semver.go +++ b/core/pkg/evaluator/semver.go @@ -85,12 +85,12 @@ func (je *SemVerComparison) SemVerEvaluation(values, _ interface{}) interface{} actualVersion, targetVersion, operator, err := parseSemverEvaluationData(values) if err != nil { je.Logger.Error(fmt.Sprintf("parse sem_ver evaluation data: %v", err)) - return false + return nil } res, err := operator.compare(actualVersion, targetVersion) if err != nil { je.Logger.Error(fmt.Sprintf("sem_ver evaluation: %v", err)) - return false + return nil } return res } diff --git a/core/pkg/evaluator/semver_test.go b/core/pkg/evaluator/semver_test.go index 0a636e10f..a2bf3a8f9 100644 --- a/core/pkg/evaluator/semver_test.go +++ b/core/pkg/evaluator/semver_test.go @@ -830,3 +830,53 @@ func TestJSONEvaluator_semVerEvaluation(t *testing.T) { }) } } + +func TestSemVerEvaluation_ErrorFallbackWhenUsedDirectly(t *testing.T) { + const source = "testSource" + ctx := context.Background() + + tests := map[string]struct { + targeting string + context map[string]any + }{ + "invalid context version falls back": { + targeting: `{"sem_ver": [{"var": "version"}, "=", "1.0.0"]}`, + context: map[string]any{"version": "not-a-version"}, + }, + "invalid operator falls back": { + targeting: `{"sem_ver": [{"var": "version"}, "===", "1.0.0"]}`, + context: map[string]any{"version": "1.0.0"}, + }, + "wrong arg count falls back": { + targeting: `{"sem_ver": [{"var": "version"}, "="]}`, + context: map[string]any{"version": "1.0.0"}, + }, + } + + for name, tt := range tests { + t.Run(name, func(t *testing.T) { + log := logger.NewLogger(nil, false) + s, err := store.NewStore(log, []string{source}) + require.NoError(t, err) + + je := NewJSON(log, s) + je.store.Update(source, []model.Flag{{ + Key: "semver-op-error-fallback", + State: "ENABLED", + DefaultVariant: "fallback", + Variants: map[string]any{ + "true": "true", + "false": "false", + "fallback": "fallback", + }, + Targeting: []byte(tt.targeting), + }}, model.Metadata{}, false) + + value, variant, reason, _, err := resolve[string](ctx, "default", "semver-op-error-fallback", tt.context, je.evaluateVariant) + require.NoError(t, err) + require.Equal(t, "fallback", value) + require.Equal(t, "fallback", variant) + require.Equal(t, model.DefaultReason, reason) + }) + } +} diff --git a/core/pkg/evaluator/string_comparison.go b/core/pkg/evaluator/string_comparison.go index d4a0d6b7c..9449b9430 100644 --- a/core/pkg/evaluator/string_comparison.go +++ b/core/pkg/evaluator/string_comparison.go @@ -72,7 +72,7 @@ func (sce *StringComparisonEvaluator) EndsWithEvaluation(values, _ interface{}) propertyValue, target, err := parseStringComparisonEvaluationData(values) if err != nil { sce.Logger.Error(fmt.Sprintf("parse ends_with evaluation data: %v", err)) - return false + return nil } return strings.HasSuffix(propertyValue, target) } diff --git a/core/pkg/evaluator/string_comparison_test.go b/core/pkg/evaluator/string_comparison_test.go index 01905a446..d91f4349f 100644 --- a/core/pkg/evaluator/string_comparison_test.go +++ b/core/pkg/evaluator/string_comparison_test.go @@ -31,7 +31,7 @@ func TestJSONEvaluator_startsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -55,7 +55,7 @@ func TestJSONEvaluator_startsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -79,7 +79,7 @@ func TestJSONEvaluator_startsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -103,7 +103,7 @@ func TestJSONEvaluator_startsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -127,7 +127,7 @@ func TestJSONEvaluator_startsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -199,7 +199,7 @@ func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -223,7 +223,7 @@ func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -247,7 +247,7 @@ func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -271,7 +271,7 @@ func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -295,7 +295,7 @@ func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { Key: "headerColor", State: "ENABLED", DefaultVariant: "red", - Variants: colorVariants, + Variants: colorVariants, Targeting: []byte(`{ "if": [ { @@ -431,3 +431,51 @@ func Test_parseStringComparisonEvaluationData(t *testing.T) { }) } } + +func TestStringComparisonEvaluation_ErrorFallbackWhenUsedDirectly(t *testing.T) { + const source = "testSource" + ctx := context.Background() + + tests := map[string]struct { + targeting string + context map[string]any + }{ + "starts_with invalid input falls back": { + targeting: `{"starts_with": [{"var": "num"}, "abc"]}`, + context: map[string]any{"num": 123.0}, + }, + "ends_with invalid input falls back": { + targeting: `{"ends_with": [{"var": "num"}, "xyz"]}`, + context: map[string]any{"num": 123.0}, + }, + } + + for name, tt := range tests { + t.Run(name, func(t *testing.T) { + log := logger.NewLogger(nil, false) + s, err := store.NewStore(log, []string{source}) + if err != nil { + t.Fatalf("NewStore failed: %v", err) + } + + je := NewJSON(log, s) + je.store.Update(source, []model.Flag{{ + Key: "string-op-error-fallback", + State: "ENABLED", + DefaultVariant: "fallback", + Variants: map[string]any{ + "true": "true", + "false": "false", + "fallback": "fallback", + }, + Targeting: []byte(tt.targeting), + }}, model.Metadata{}, false) + + value, variant, reason, _, err := resolve[string](ctx, "default", "string-op-error-fallback", tt.context, je.evaluateVariant) + assert.NoError(t, err) + assert.Equal(t, "fallback", value) + assert.Equal(t, "fallback", variant) + assert.Equal(t, model.DefaultReason, reason) + }) + } +} diff --git a/test-harness b/test-harness index 2684a3ecf..190307b3b 160000 --- a/test-harness +++ b/test-harness @@ -1 +1 @@ -Subproject commit 2684a3ecf061002221a8be7d09e9c8f915c7b193 +Subproject commit 190307b3b1982773976f05464942f69bb23528a4 From 7a844e084042b4c9617f84725a4bb15b4121791b Mon Sep 17 00:00:00 2001 From: lea konvalinka Date: Thu, 23 Apr 2026 15:11:26 +0200 Subject: [PATCH 3/4] fix: duplication and in-process exclusion tags Signed-off-by: Lea Konvalinka --- core/pkg/evaluator/semver_test.go | 76 +----------- core/pkg/evaluator/string_comparison_test.go | 119 +------------------ core/pkg/evaluator/utils_test.go | 76 ++++++++++++ test/integration/integration_test.go | 3 +- 4 files changed, 88 insertions(+), 186 deletions(-) diff --git a/core/pkg/evaluator/semver_test.go b/core/pkg/evaluator/semver_test.go index a2bf3a8f9..47b61b371 100644 --- a/core/pkg/evaluator/semver_test.go +++ b/core/pkg/evaluator/semver_test.go @@ -2,12 +2,9 @@ package evaluator import ( "context" - "errors" "testing" - "github.com/open-feature/flagd/core/pkg/logger" "github.com/open-feature/flagd/core/pkg/model" - "github.com/open-feature/flagd/core/pkg/store" "github.com/stretchr/testify/require" ) @@ -330,15 +327,7 @@ func TestJSONEvaluator_semVerEvaluation(t *testing.T) { var sources = []string{source} ctx := context.Background() - tests := map[string]struct { - flags []model.Flag - flagKey string - context map[string]any - expectedValue string - expectedVariant string - expectedReason string - expectedError error - }{ + tests := map[string]stringFlagEvalTestCase{ "versions and operator provided - match": { flags: []model.Flag{{ Key: "headerColor", @@ -799,46 +788,14 @@ func TestJSONEvaluator_semVerEvaluation(t *testing.T) { }, } - const reqID = "default" - for name, tt := range tests { - t.Run(name, func(t *testing.T) { - log := logger.NewLogger(nil, false) - s, err := store.NewStore(log, sources) - if err != nil { - t.Fatalf("NewStore failed: %v", err) - } - je := NewJSON(log, s) - je.store.Update(source, tt.flags, model.Metadata{}, false) - - value, variant, reason, _, err := resolve[string](ctx, reqID, tt.flagKey, tt.context, je.evaluateVariant) - - if value != tt.expectedValue { - t.Errorf("expected value '%s', got '%s'", tt.expectedValue, value) - } - - if variant != tt.expectedVariant { - t.Errorf("expected variant '%s', got '%s'", tt.expectedVariant, variant) - } - - if reason != tt.expectedReason { - t.Errorf("expected reason '%s', got '%s'", tt.expectedReason, reason) - } - - if !errors.Is(err, tt.expectedError) { - t.Errorf("expected err '%v', got '%v'", tt.expectedError, err) - } - }) - } + runStringFlagEvalTests(t, ctx, source, sources, tests) } func TestSemVerEvaluation_ErrorFallbackWhenUsedDirectly(t *testing.T) { const source = "testSource" ctx := context.Background() - tests := map[string]struct { - targeting string - context map[string]any - }{ + tests := map[string]errorFallbackTestCase{ "invalid context version falls back": { targeting: `{"sem_ver": [{"var": "version"}, "=", "1.0.0"]}`, context: map[string]any{"version": "not-a-version"}, @@ -853,30 +810,5 @@ func TestSemVerEvaluation_ErrorFallbackWhenUsedDirectly(t *testing.T) { }, } - for name, tt := range tests { - t.Run(name, func(t *testing.T) { - log := logger.NewLogger(nil, false) - s, err := store.NewStore(log, []string{source}) - require.NoError(t, err) - - je := NewJSON(log, s) - je.store.Update(source, []model.Flag{{ - Key: "semver-op-error-fallback", - State: "ENABLED", - DefaultVariant: "fallback", - Variants: map[string]any{ - "true": "true", - "false": "false", - "fallback": "fallback", - }, - Targeting: []byte(tt.targeting), - }}, model.Metadata{}, false) - - value, variant, reason, _, err := resolve[string](ctx, "default", "semver-op-error-fallback", tt.context, je.evaluateVariant) - require.NoError(t, err) - require.Equal(t, "fallback", value) - require.Equal(t, "fallback", variant) - require.Equal(t, model.DefaultReason, reason) - }) - } + runErrorFallbackTests(t, ctx, source, "semver-op-error-fallback", tests) } diff --git a/core/pkg/evaluator/string_comparison_test.go b/core/pkg/evaluator/string_comparison_test.go index d91f4349f..9049caf15 100644 --- a/core/pkg/evaluator/string_comparison_test.go +++ b/core/pkg/evaluator/string_comparison_test.go @@ -2,13 +2,10 @@ package evaluator import ( "context" - "errors" "fmt" "testing" - "github.com/open-feature/flagd/core/pkg/logger" "github.com/open-feature/flagd/core/pkg/model" - "github.com/open-feature/flagd/core/pkg/store" "github.com/stretchr/testify/assert" ) @@ -17,15 +14,7 @@ func TestJSONEvaluator_startsWithEvaluation(t *testing.T) { var sources = []string{source} ctx := context.Background() - tests := map[string]struct { - flags []model.Flag - flagKey string - context map[string]any - expectedValue string - expectedVariant string - expectedReason string - expectedError error - }{ + tests := map[string]stringFlagEvalTestCase{ "two strings provided - match": { flags: []model.Flag{{ Key: "headerColor", @@ -148,36 +137,7 @@ func TestJSONEvaluator_startsWithEvaluation(t *testing.T) { }, } - const reqID = "default" - for name, tt := range tests { - t.Run(name, func(t *testing.T) { - log := logger.NewLogger(nil, false) - s, err := store.NewStore(log, sources) - if err != nil { - t.Fatalf("NewStore failed: %v", err) - } - je := NewJSON(log, s) - je.store.Update(source, tt.flags, model.Metadata{}, false) - - value, variant, reason, _, err := resolve[string](ctx, reqID, tt.flagKey, tt.context, je.evaluateVariant) - - if value != tt.expectedValue { - t.Errorf("expected value '%s', got '%s'", tt.expectedValue, value) - } - - if variant != tt.expectedVariant { - t.Errorf("expected variant '%s', got '%s'", tt.expectedVariant, variant) - } - - if reason != tt.expectedReason { - t.Errorf("expected reason '%s', got '%s'", tt.expectedReason, reason) - } - - if !errors.Is(err, tt.expectedError) { - t.Errorf("expected err '%v', got '%v'", tt.expectedError, err) - } - }) - } + runStringFlagEvalTests(t, ctx, source, sources, tests) } func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { @@ -185,15 +145,7 @@ func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { var sources = []string{source} ctx := context.Background() - tests := map[string]struct { - flags []model.Flag - flagKey string - context map[string]any - expectedValue string - expectedVariant string - expectedReason string - expectedError error - }{ + tests := map[string]stringFlagEvalTestCase{ "two strings provided - match": { flags: []model.Flag{{ Key: "headerColor", @@ -316,36 +268,7 @@ func TestJSONEvaluator_endsWithEvaluation(t *testing.T) { }, } - const reqID = "default" - for name, tt := range tests { - t.Run(name, func(t *testing.T) { - log := logger.NewLogger(nil, false) - s, err := store.NewStore(log, sources) - if err != nil { - t.Fatalf("NewStore failed: %v", err) - } - je := NewJSON(log, s) - je.store.Update(source, tt.flags, model.Metadata{}, false) - - value, variant, reason, _, err := resolve[string](ctx, reqID, tt.flagKey, tt.context, je.evaluateVariant) - - if value != tt.expectedValue { - t.Errorf("expected value '%s', got '%s'", tt.expectedValue, value) - } - - if variant != tt.expectedVariant { - t.Errorf("expected variant '%s', got '%s'", tt.expectedVariant, variant) - } - - if reason != tt.expectedReason { - t.Errorf("expected reason '%s', got '%s'", tt.expectedReason, reason) - } - - if err != tt.expectedError { - t.Errorf("expected err '%v', got '%v'", tt.expectedError, err) - } - }) - } + runStringFlagEvalTests(t, ctx, source, sources, tests) } func Test_parseStringComparisonEvaluationData(t *testing.T) { @@ -436,10 +359,7 @@ func TestStringComparisonEvaluation_ErrorFallbackWhenUsedDirectly(t *testing.T) const source = "testSource" ctx := context.Background() - tests := map[string]struct { - targeting string - context map[string]any - }{ + tests := map[string]errorFallbackTestCase{ "starts_with invalid input falls back": { targeting: `{"starts_with": [{"var": "num"}, "abc"]}`, context: map[string]any{"num": 123.0}, @@ -450,32 +370,5 @@ func TestStringComparisonEvaluation_ErrorFallbackWhenUsedDirectly(t *testing.T) }, } - for name, tt := range tests { - t.Run(name, func(t *testing.T) { - log := logger.NewLogger(nil, false) - s, err := store.NewStore(log, []string{source}) - if err != nil { - t.Fatalf("NewStore failed: %v", err) - } - - je := NewJSON(log, s) - je.store.Update(source, []model.Flag{{ - Key: "string-op-error-fallback", - State: "ENABLED", - DefaultVariant: "fallback", - Variants: map[string]any{ - "true": "true", - "false": "false", - "fallback": "fallback", - }, - Targeting: []byte(tt.targeting), - }}, model.Metadata{}, false) - - value, variant, reason, _, err := resolve[string](ctx, "default", "string-op-error-fallback", tt.context, je.evaluateVariant) - assert.NoError(t, err) - assert.Equal(t, "fallback", value) - assert.Equal(t, "fallback", variant) - assert.Equal(t, model.DefaultReason, reason) - }) - } + runErrorFallbackTests(t, ctx, source, "string-op-error-fallback", tests) } diff --git a/core/pkg/evaluator/utils_test.go b/core/pkg/evaluator/utils_test.go index 3a9cde66d..d466d364a 100644 --- a/core/pkg/evaluator/utils_test.go +++ b/core/pkg/evaluator/utils_test.go @@ -1,8 +1,84 @@ package evaluator +import ( + "context" + "testing" + + "github.com/open-feature/flagd/core/pkg/logger" + "github.com/open-feature/flagd/core/pkg/model" + "github.com/open-feature/flagd/core/pkg/store" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + var colorVariants = map[string]any{ "red": "#FF0000", "blue": "#0000FF", "green": "#00FF00", "yellow": "#FFFF00", } + +type stringFlagEvalTestCase struct { + flags []model.Flag + flagKey string + context map[string]any + expectedValue string + expectedVariant string + expectedReason string + expectedError error +} + +func runStringFlagEvalTests(t *testing.T, ctx context.Context, source string, sources []string, tests map[string]stringFlagEvalTestCase) { + t.Helper() + const reqID = "default" + for name, tt := range tests { + t.Run(name, func(t *testing.T) { + log := logger.NewLogger(nil, false) + s, err := store.NewStore(log, sources) + require.NoError(t, err) + je := NewJSON(log, s) + je.store.Update(source, tt.flags, model.Metadata{}, false) + + value, variant, reason, _, err := resolve[string](ctx, reqID, tt.flagKey, tt.context, je.evaluateVariant) + + assert.Equal(t, tt.expectedValue, value) + assert.Equal(t, tt.expectedVariant, variant) + assert.Equal(t, tt.expectedReason, reason) + assert.ErrorIs(t, err, tt.expectedError) + }) + } +} + +type errorFallbackTestCase struct { + targeting string + context map[string]any +} + +func runErrorFallbackTests(t *testing.T, ctx context.Context, source, flagKey string, tests map[string]errorFallbackTestCase) { + t.Helper() + for name, tt := range tests { + t.Run(name, func(t *testing.T) { + log := logger.NewLogger(nil, false) + s, err := store.NewStore(log, []string{source}) + require.NoError(t, err) + je := NewJSON(log, s) + je.store.Update(source, []model.Flag{{ + Key: flagKey, + State: "ENABLED", + DefaultVariant: "fallback", + Variants: map[string]any{ + "true": "true", + "false": "false", + "fallback": "fallback", + }, + Targeting: []byte(tt.targeting), + }}, model.Metadata{}, false) + + value, variant, reason, _, err := resolve[string](ctx, "default", flagKey, tt.context, je.evaluateVariant) + assert.NoError(t, err) + assert.Equal(t, "fallback", value) + assert.Equal(t, "fallback", variant) + assert.Equal(t, model.DefaultReason, reason) + }) + } +} diff --git a/test/integration/integration_test.go b/test/integration/integration_test.go index 48742626b..7fdf78a40 100644 --- a/test/integration/integration_test.go +++ b/test/integration/integration_test.go @@ -200,7 +200,8 @@ func TestInProcess(t *testing.T) { } // Run tests with InProcess-specific tags - tags := "@in-process && ~@unixsocket&& ~@metadata && ~@contextEnrichment && ~@customCert && ~@forbidden && ~@sync-port && ~@sync-payload && ~@fractional-v2 && ~@fractional-nested && ~@deprecated" + // TODO: remove ~@operator-errors and ~@semver-v-prefix once the edge-case fixes are released + tags := "@in-process && ~@unixsocket&& ~@metadata && ~@contextEnrichment && ~@customCert && ~@forbidden && ~@sync-port && ~@sync-payload && ~@fractional-v2 && ~@fractional-nested && ~@deprecated && ~@operator-errors && ~@semver-v-prefix" if err := runner.RunGherkinTestsWithSubtests(t, featurePaths, tags); err != nil { t.Fatalf("Gherkin tests failed: %v", err) From 39c482034d6a626910a6f04adf4121f433dd364d Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Thu, 23 Apr 2026 14:18:36 -0400 Subject: [PATCH 4/4] fixup: update go.mod, update use JSON round trip to make $ref regex simpler, method rename, tweak excludes Signed-off-by: Todd Baert --- core/pkg/evaluator/json.go | 31 ++++++------ core/pkg/evaluator/json_test.go | 73 +++++++++++++++++---------- core/pkg/evaluator/semver.go | 6 +-- test/integration/go.mod | 32 ++++++------ test/integration/go.sum | 75 ++++++++++++++-------------- test/integration/integration_test.go | 10 ++-- 6 files changed, 125 insertions(+), 102 deletions(-) diff --git a/core/pkg/evaluator/json.go b/core/pkg/evaluator/json.go index 428ff35c8..bb3cdc223 100644 --- a/core/pkg/evaluator/json.go +++ b/core/pkg/evaluator/json.go @@ -6,7 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "regexp" "strings" "time" @@ -35,12 +34,6 @@ const ( ProtoVersionKey = "__flagd.protoVersion__" // used to mark if the request is coming from an older proto source, which has different fallback behavior ) -var regBrace *regexp.Regexp - -func init() { - regBrace = regexp.MustCompile("^[^{]*{|}[^}]*$") -} - func addSchemaResource(compiler *jsonschema.Compiler, url string, schemaData string) error { unmarshalJSON, err := jsonschema.UnmarshalJSON(strings.NewReader(schemaData)) if err != nil { @@ -548,13 +541,18 @@ func transposeEvaluators(state string) (string, error) { return "", fmt.Errorf("unmarshal: %w", err) } - for evalName, evalRaw := range evaluators.Evaluators { - // replace any occurrences of "evaluator": "evalName" - regex, err := regexp.Compile(fmt.Sprintf(`"\$ref":(\s)*"%s"`, evalName)) - if err != nil { - return "", fmt.Errorf("compile regex: %w", err) - } + // round-trip to normalize whitespace so we can use plain string matching + var raw interface{} + if err := json.Unmarshal([]byte(state), &raw); err != nil { + return "", fmt.Errorf("normalize: %w", err) + } + normalizedBytes, err := json.Marshal(raw) + if err != nil { + return "", fmt.Errorf("normalize marshal: %w", err) + } + result := string(normalizedBytes) + for evalName, evalRaw := range evaluators.Evaluators { marshalledEval, err := evalRaw.MarshalJSON() if err != nil { return "", fmt.Errorf("marshal evaluator: %w", err) @@ -564,9 +562,10 @@ func transposeEvaluators(state string) (string, error) { if len(evalValue) < 3 { return "", errors.New("evaluator object is empty") } - evalValue = regBrace.ReplaceAllString(evalValue, "") - state = regex.ReplaceAllString(state, evalValue) + + refPattern := `{"$ref":"` + evalName + `"}` + result = strings.ReplaceAll(result, refPattern, evalValue) } - return state, nil + return result, nil } diff --git a/core/pkg/evaluator/json_test.go b/core/pkg/evaluator/json_test.go index d9b988692..14993f0e0 100644 --- a/core/pkg/evaluator/json_test.go +++ b/core/pkg/evaluator/json_test.go @@ -1145,37 +1145,56 @@ func TestState_Evaluator(t *testing.T) { }, }, }, - "invalid evaluator json": { + "string-valued evaluator": { + // string-valued evaluators are valid; the string is substituted as-is (with quotes) inputState: ` { "flags": { - "fibAlgo": { - "variants": { - "recursive": "recursive", - "memo": "memo", - "loop": "loop", - "binet": "binet" - }, - "defaultVariant": "recursive", - "state": "ENABLED", - "metadata": { - "flagSetId": "flagSetId" - }, - "targeting": { - "if": [ - { - "$ref": "emailWithFaas" - }, "binet", null - ] - } - } + "fibAlgo": { + "variants": { + "recursive": "recursive", + "memo": "memo", + "loop": "loop", + "binet": "binet" + }, + "defaultVariant": "recursive", + "state": "ENABLED", + "metadata": { + "flagSetId": "flagSetId" + }, + "targeting": { + "if": [ + { + "$ref": "emailWithFaas" + }, "binet", null + ] + } + } + }, + "$evaluators": { + "emailWithFaas": "foo" + } + } + `, + expectedOutputState: map[string]model.Flag{ + "fibAlgo": { + Key: "fibAlgo", + Variants: map[string]any{ + "recursive": "recursive", + "memo": "memo", + "loop": "loop", + "binet": "binet", }, - "$evaluators": { - "emailWithFaas": "foo" - } - } - `, - expectedError: true, + DefaultVariant: "recursive", + State: "ENABLED", + Source: "testSource", + Targeting: json.RawMessage(`{"if":["foo","binet",null]}`), + Metadata: map[string]interface{}{ + "flagSetId": "flagSetId", + }, + FlagSetId: "flagSetId", + }, + }, }, "invalid targeting": { inputState: ` diff --git a/core/pkg/evaluator/semver.go b/core/pkg/evaluator/semver.go index 683b0a287..56327780d 100644 --- a/core/pkg/evaluator/semver.go +++ b/core/pkg/evaluator/semver.go @@ -105,7 +105,7 @@ func parseSemverEvaluationData(values interface{}) (string, string, SemVerOperat return "", "", "", errors.New("sem_ver evaluation must contain a value, an operator, and a comparison target") } - actualVersion, err := parseSemanticVersion(parsed[0]) + actualVersion, err := normalizeVersion(parsed[0]) if err != nil { return "", "", "", fmt.Errorf("sem_ver evaluation: could not parse target property value: %w", err) } @@ -115,7 +115,7 @@ func parseSemverEvaluationData(values interface{}) (string, string, SemVerOperat return "", "", "", fmt.Errorf("sem_ver evaluation: could not parse operator: %w", err) } - targetVersion, err := parseSemanticVersion(parsed[2]) + targetVersion, err := normalizeVersion(parsed[2]) if err != nil { return "", "", "", fmt.Errorf("sem_ver evaluation: could not parse target value: %w", err) } @@ -131,7 +131,7 @@ func ensureString(v interface{}) string { return fmt.Sprintf("%v", v) } -func parseSemanticVersion(v interface{}) (string, error) { +func normalizeVersion(v interface{}) (string, error) { version := ensureString(v) // version strings are only valid in the semver package if they start with a 'v' // if it's not present in the given value, we prepend it diff --git a/test/integration/go.mod b/test/integration/go.mod index 247d359d4..83703c501 100644 --- a/test/integration/go.mod +++ b/test/integration/go.mod @@ -5,7 +5,7 @@ go 1.25.5 require ( github.com/go-git/go-git/v5 v5.16.2 - github.com/open-feature/go-sdk-contrib/providers/flagd v0.4.0 + github.com/open-feature/go-sdk-contrib/providers/flagd v0.5.0 github.com/open-feature/go-sdk-contrib/tests/flagd/v2 v2.0.2 github.com/testcontainers/testcontainers-go v0.41.0 ) @@ -114,7 +114,7 @@ require ( github.com/morikuni/aec v1.1.0 // indirect github.com/onsi/gomega v1.35.1 // indirect github.com/open-feature/flagd-schemas v0.2.13 // indirect - github.com/open-feature/flagd/core v0.14.0 // indirect + github.com/open-feature/flagd/core v0.15.0 // indirect github.com/open-feature/go-sdk v1.17.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.1 // indirect @@ -155,20 +155,20 @@ require ( go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect - go.opentelemetry.io/otel v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0 // indirect - go.opentelemetry.io/otel/metric v1.41.0 // indirect - go.opentelemetry.io/otel/sdk v1.41.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.41.0 // indirect - go.opentelemetry.io/otel/trace v1.41.0 // indirect + go.opentelemetry.io/otel v1.42.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.42.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 // indirect + go.opentelemetry.io/otel/metric v1.42.0 // indirect + go.opentelemetry.io/otel/sdk v1.42.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.42.0 // indirect + go.opentelemetry.io/otel/trace v1.42.0 // indirect go.opentelemetry.io/proto/otlp v1.9.0 // indirect go.uber.org/mock v0.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.27.0 // indirect + go.uber.org/zap v1.27.1 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect go.yaml.in/yaml/v4 v4.0.0-rc.4 // indirect golang.org/x/crypto v0.48.0 // indirect @@ -180,9 +180,9 @@ require ( golang.org/x/term v0.40.0 // indirect golang.org/x/text v0.34.0 // indirect golang.org/x/time v0.14.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 // indirect - google.golang.org/grpc v1.79.1 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 // indirect + google.golang.org/grpc v1.79.3 // indirect google.golang.org/protobuf v1.36.11 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/test/integration/go.sum b/test/integration/go.sum index c8f56fd4e..975dd70eb 100644 --- a/test/integration/go.sum +++ b/test/integration/go.sum @@ -253,8 +253,9 @@ github.com/hashicorp/go-memdb v1.3.5/go.mod h1:8IVKKBkVe+fxFgdFOYxzQQNjz+sWCyHCd github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.8.0 h1:KAkNb1HAiZd1ukkxDFGmokVZe1Xy9HG6NUp+bPle2i4= github.com/hashicorp/go-version v1.8.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -341,12 +342,12 @@ github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4= github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/open-feature/flagd-schemas v0.2.13 h1:LzoyQfirfpR8cxI4PKnoFRtpwPjpC/cOO8N0n8dpbRc= github.com/open-feature/flagd-schemas v0.2.13/go.mod h1:C0jnJ4C3j2LzGuqKgLDdTsdfKEWQp6sOHZyxu3QohFU= -github.com/open-feature/flagd/core v0.14.0 h1:eGjPKONDjGa0+Pkxi6XiTdusFUCN3EuF7b1aebcDPvM= -github.com/open-feature/flagd/core v0.14.0/go.mod h1:G1KZQoSD0gi6JMVwcZxHhzOhs/WnhoyPjZneqej1neI= +github.com/open-feature/flagd/core v0.15.0 h1:y8ZEj1Ia8xHQiSugoRpWW4t1kvc+l5bLqWwPzO5avr0= +github.com/open-feature/flagd/core v0.15.0/go.mod h1:J+Hz06ZMPymRiXR9WGA/nMYjtVKzuHC9LSrz81GxJIE= github.com/open-feature/go-sdk v1.17.0 h1:/OUBBw5d9D61JaNZZxb2Nnr5/EJrEpjtKCTY3rspJQk= github.com/open-feature/go-sdk v1.17.0/go.mod h1:lPxPSu1UnZ4E3dCxZi5gV3et2ACi8O8P+zsTGVsDZUw= -github.com/open-feature/go-sdk-contrib/providers/flagd v0.4.0 h1:FHcz/EQ+WtPrbrtB9XBbrOKnpXk2sHyIwLo7pFt2wm4= -github.com/open-feature/go-sdk-contrib/providers/flagd v0.4.0/go.mod h1:HcsGB/b695L9PZX9fZwpWU72tFQaj0wADbthStDaajE= +github.com/open-feature/go-sdk-contrib/providers/flagd v0.5.0 h1:+zYgmk5JOhfaco0gnQ2gqAlGC6MTlIS0RN0ishPun6c= +github.com/open-feature/go-sdk-contrib/providers/flagd v0.5.0/go.mod h1:bzGZZSSFPOkvptyFUOhZPUtjK0thkgNDOvQ4UcgUi/g= github.com/open-feature/go-sdk-contrib/tests/flagd/v2 v2.0.2 h1:deCtDKh3QKh6WXKDe6HzF6Gm01ZltVSF0JV5GhZbuRI= github.com/open-feature/go-sdk-contrib/tests/flagd/v2 v2.0.2/go.mod h1:oRuJpK7H5Alg8D3xGU2f/xJK/UqUqODIwhLMol6yo1Q= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -374,10 +375,10 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= -github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= -github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= -github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= +github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= +github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= +github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= +github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= @@ -488,26 +489,26 @@ go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0. go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0/go.mod h1:rjbQTDEPQymPE0YnRQp9/NuPwwtL0sesz/fnqRW/v84= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg= -go.opentelemetry.io/otel v1.41.0 h1:YlEwVsGAlCvczDILpUXpIpPSL/VPugt7zHThEMLce1c= -go.opentelemetry.io/otel v1.41.0/go.mod h1:Yt4UwgEKeT05QbLwbyHXEwhnjxNO6D8L5PQP51/46dE= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 h1:vl9obrcoWVKp/lwl8tRE33853I8Xru9HFbw/skNeLs8= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0/go.mod h1:GAXRxmLJcVM3u22IjTg74zWBrRCKq8BnOqUVLodpcpw= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0 h1:Oe2z/BCg5q7k4iXC3cqJxKYg0ieRiOqF0cecFYdPTwk= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0/go.mod h1:ZQM5lAJpOsKnYagGg/zV2krVqTtaVdYdDkhMoX6Oalg= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.41.0 h1:ao6Oe+wSebTlQ1OEht7jlYTzQKE+pnx/iNywFvTbuuI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.41.0/go.mod h1:u3T6vz0gh/NVzgDgiwkgLxpsSF6PaPmo2il0apGJbls= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 h1:lwI4Dc5leUqENgGuQImwLo4WnuXFPetmPpkLi2IrX54= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0/go.mod h1:Kz/oCE7z5wuyhPxsXDuaPteSWqjSBD5YaSdbxZYGbGk= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0 h1:inYW9ZhgqiDqh6BioM7DVHHzEGVq76Db5897WLGZ5Go= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.41.0/go.mod h1:Izur+Wt8gClgMJqO/cZ8wdeeMryJ/xxiOVgFSSfpDTY= -go.opentelemetry.io/otel/metric v1.41.0 h1:rFnDcs4gRzBcsO9tS8LCpgR0dxg4aaxWlJxCno7JlTQ= -go.opentelemetry.io/otel/metric v1.41.0/go.mod h1:xPvCwd9pU0VN8tPZYzDZV/BMj9CM9vs00GuBjeKhJps= -go.opentelemetry.io/otel/sdk v1.41.0 h1:YPIEXKmiAwkGl3Gu1huk1aYWwtpRLeskpV+wPisxBp8= -go.opentelemetry.io/otel/sdk v1.41.0/go.mod h1:ahFdU0G5y8IxglBf0QBJXgSe7agzjE4GiTJ6HT9ud90= -go.opentelemetry.io/otel/sdk/metric v1.41.0 h1:siZQIYBAUd1rlIWQT2uCxWJxcCO7q3TriaMlf08rXw8= -go.opentelemetry.io/otel/sdk/metric v1.41.0/go.mod h1:HNBuSvT7ROaGtGI50ArdRLUnvRTRGniSUZbxiWxSO8Y= -go.opentelemetry.io/otel/trace v1.41.0 h1:Vbk2co6bhj8L59ZJ6/xFTskY+tGAbOnCtQGVVa9TIN0= -go.opentelemetry.io/otel/trace v1.41.0/go.mod h1:U1NU4ULCoxeDKc09yCWdWe+3QoyweJcISEVa1RBzOis= +go.opentelemetry.io/otel v1.42.0 h1:lSQGzTgVR3+sgJDAU/7/ZMjN9Z+vUip7leaqBKy4sho= +go.opentelemetry.io/otel v1.42.0/go.mod h1:lJNsdRMxCUIWuMlVJWzecSMuNjE7dOYyWlqOXWkdqCc= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0 h1:MdKucPl/HbzckWWEisiNqMPhRrAOQX8r4jTuGr636gk= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0/go.mod h1:RolT8tWtfHcjajEH5wFIZ4Dgh5jpPdFXYV9pTAk/qjc= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.42.0 h1:H7O6RlGOMTizyl3R08Kn5pdM06bnH8oscSj7o11tmLA= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.42.0/go.mod h1:mBFWu/WOVDkWWsR7Tx7h6EpQB8wsv7P0Yrh0Pb7othc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 h1:THuZiwpQZuHPul65w4WcwEnkX2QIuMT+UFoOrygtoJw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0/go.mod h1:J2pvYM5NGHofZ2/Ru6zw/TNWnEQp5crgyDeSrYpXkAw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 h1:zWWrB1U6nqhS/k6zYB74CjRpuiitRtLLi68VcgmOEto= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0/go.mod h1:2qXPNBX1OVRC0IwOnfo1ljoid+RD0QK3443EaqVlsOU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 h1:uLXP+3mghfMf7XmV4PkGfFhFKuNWoCvvx5wP/wOXo0o= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0/go.mod h1:v0Tj04armyT59mnURNUJf7RCKcKzq+lgJs6QSjHjaTc= +go.opentelemetry.io/otel/metric v1.42.0 h1:2jXG+3oZLNXEPfNmnpxKDeZsFI5o4J+nz6xUlaFdF/4= +go.opentelemetry.io/otel/metric v1.42.0/go.mod h1:RlUN/7vTU7Ao/diDkEpQpnz3/92J9ko05BIwxYa2SSI= +go.opentelemetry.io/otel/sdk v1.42.0 h1:LyC8+jqk6UJwdrI/8VydAq/hvkFKNHZVIWuslJXYsDo= +go.opentelemetry.io/otel/sdk v1.42.0/go.mod h1:rGHCAxd9DAph0joO4W6OPwxjNTYWghRWmkHuGbayMts= +go.opentelemetry.io/otel/sdk/metric v1.42.0 h1:D/1QR46Clz6ajyZ3G8SgNlTJKBdGp84q9RKCAZ3YGuA= +go.opentelemetry.io/otel/sdk/metric v1.42.0/go.mod h1:Ua6AAlDKdZ7tdvaQKfSmnFTdHx37+J4ba8MwVCYM5hc= +go.opentelemetry.io/otel/trace v1.42.0 h1:OUCgIPt+mzOnaUTpOQcBiM/PLQ/Op7oq6g4LenLmOYY= +go.opentelemetry.io/otel/trace v1.42.0/go.mod h1:f3K9S+IFqnumBkKhRJMeaZeNk9epyhnCmQh/EysQCdc= go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -516,8 +517,8 @@ go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= -go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= +go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= @@ -585,12 +586,12 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= -google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 h1:JLQynH/LBHfCTSbDWl+py8C+Rg/k1OVH3xfcaiANuF0= -google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57/go.mod h1:kSJwQxqmFXeo79zOmbrALdflXQeAYcUbgS7PbpMknCY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 h1:mWPCjDEyshlQYzBpMNHaEof6UX1PmHcaUODUywQ0uac= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= -google.golang.org/grpc v1.79.1 h1:zGhSi45ODB9/p3VAawt9a+O/MULLl9dpizzNNpq7flY= -google.golang.org/grpc v1.79.1/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= +google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171 h1:tu/dtnW1o3wfaxCOjSLn5IRX4YDcJrtlpzYkhHhGaC4= +google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171/go.mod h1:M5krXqk4GhBKvB596udGL3UyjL4I1+cTbK0orROM9ng= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 h1:ggcbiqK8WWh6l1dnltU4BgWGIGo+EVYxCaAPih/zQXQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= +google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/test/integration/integration_test.go b/test/integration/integration_test.go index 7fdf78a40..d286293e7 100644 --- a/test/integration/integration_test.go +++ b/test/integration/integration_test.go @@ -199,9 +199,13 @@ func TestInProcess(t *testing.T) { "./", } - // Run tests with InProcess-specific tags - // TODO: remove ~@operator-errors and ~@semver-v-prefix once the edge-case fixes are released - tags := "@in-process && ~@unixsocket&& ~@metadata && ~@contextEnrichment && ~@customCert && ~@forbidden && ~@sync-port && ~@sync-payload && ~@fractional-v2 && ~@fractional-nested && ~@deprecated && ~@operator-errors && ~@semver-v-prefix" + // Run tests with InProcess-specific tags. + // These tests use the published go-sdk-contrib in-process provider (see sibling go.mod), + // not the local flagd evaluator code. The goal is to verify the sync.proto interface, + // not to fully test the go in-process provider (that happens in go-sdk-contrib). + // Many tags are excluded because they require a more complex testbed than what's built here. + // TODO: remove ~@operator-errors and ~@semver-v-prefix once go-sdk-contrib picks up the fixes + tags := "@in-process && ~@unixsocket && ~@metadata && ~@contextEnrichment && ~@customCert && ~@forbidden && ~@sync-port && ~@sync-payload && ~@fractional-v1 && ~@fractional-single-entry && ~@deprecated && ~@operator-errors && ~@semver-v-prefix" if err := runner.RunGherkinTestsWithSubtests(t, featurePaths, tags); err != nil { t.Fatalf("Gherkin tests failed: %v", err)