From 4181b65535337734011dabe5a28e861788957be5 Mon Sep 17 00:00:00 2001 From: Marka Date: Mon, 20 Jan 2025 11:00:01 +0200 Subject: [PATCH 01/14] added test cases for flags with empty string value --- assignment-v2/test-case-7.json | 37 +++++ ufc/flags-v1.json | 28 ++++ .../test-case-flag-with-empty-string.json | 143 ++++++++++++++++++ 3 files changed, 208 insertions(+) create mode 100644 assignment-v2/test-case-7.json create mode 100644 ufc/tests/test-case-flag-with-empty-string.json diff --git a/assignment-v2/test-case-7.json b/assignment-v2/test-case-7.json new file mode 100644 index 00000000..33b59e41 --- /dev/null +++ b/assignment-v2/test-case-7.json @@ -0,0 +1,37 @@ +{ + "experiment": "empty_string_variations_test", + "valueType": "string", + "subjectsWithAttributes": [ + { + "subjectKey": "subject-1", + "subjectAttributes": { + "email": "test@geteppo.com" + } + }, + { + "subjectKey": "subject-2", + "subjectAttributes": { + "email": "test@example.com" + } + }, + { + "subjectKey": "subject-3", + "subjectAttributes": { + "device": "android", + "version": "1.0.0" + } + }, + { + "subjectKey": "subject-4", + "subjectAttributes": { + "country": "US" + } + } + ], + "expectedAssignments": [ + "test-value", + "", + "another-value", + "" + ] +} \ No newline at end of file diff --git a/ufc/flags-v1.json b/ufc/flags-v1.json index 060d378c..ecb65ef1 100644 --- a/ufc/flags-v1.json +++ b/ufc/flags-v1.json @@ -410,6 +410,34 @@ ], "totalShards": 10000 }, + "empty_string_flag": { + "key": "empty_string_flag", + "enabled": true, + "variationType": "STRING", + "variations": { + "empty": { + "key": "empty_string", + "value": "" + }, + "random": { + "key": "random_string", + "value": "dfdfd" + } + }, + "allocations": [ + { + "key": "rollout", + "splits": [ + { + "variationKey": "empty", + "shards": [] + } + ], + "doLog": true + } + ], + "totalShards": 10000 + }, "kill-switch": { "key": "kill-switch", "enabled": true, diff --git a/ufc/tests/test-case-flag-with-empty-string.json b/ufc/tests/test-case-flag-with-empty-string.json new file mode 100644 index 00000000..5fd70217 --- /dev/null +++ b/ufc/tests/test-case-flag-with-empty-string.json @@ -0,0 +1,143 @@ +{ + "flag": "string-variations", + "variationType": "STRING", + "defaultValue": {}, + "subjects": [ + { + "subjectKey": "alice", + "subjectAttributes": {}, + "assignment": { + "a": "", + "b": "non-empty" + }, + "evaluationDetails": { + "environmentName": "Test", + "flagEvaluationCode": "MATCH", + "flagEvaluationDescription": "alice belongs to the range of traffic assigned to \"empty_a\" defined in allocation \"allocation-test\".", + "banditKey": null, + "banditAction": null, + "variationKey": "empty_a", + "variationValue": { + "a": "", + "b": "non-empty" + }, + "matchedRule": null, + "matchedAllocation": { + "key": "allocation-test", + "allocationEvaluationCode": "MATCH", + "orderPosition": 1 + }, + "unmatchedAllocations": [], + "unevaluatedAllocations": [ + { + "key": "allocation-default", + "allocationEvaluationCode": "UNEVALUATED", + "orderPosition": 2 + } + ] + } + }, + { + "subjectKey": "bob", + "subjectAttributes": {}, + "assignment": { + "a": "non-empty", + "b": "" + }, + "evaluationDetails": { + "environmentName": "Test", + "flagEvaluationCode": "MATCH", + "flagEvaluationDescription": "bob belongs to the range of traffic assigned to \"empty_b\" defined in allocation \"allocation-test\".", + "banditKey": null, + "banditAction": null, + "variationKey": "empty_b", + "variationValue": { + "a": "non-empty", + "b": "" + }, + "matchedRule": null, + "matchedAllocation": { + "key": "allocation-test", + "allocationEvaluationCode": "MATCH", + "orderPosition": 1 + }, + "unmatchedAllocations": [], + "unevaluatedAllocations": [ + { + "key": "allocation-default", + "allocationEvaluationCode": "UNEVALUATED", + "orderPosition": 2 + } + ] + } + }, + { + "subjectKey": "charlie", + "subjectAttributes": {}, + "assignment": { + "a": "", + "b": "" + }, + "evaluationDetails": { + "environmentName": "Test", + "flagEvaluationCode": "MATCH", + "flagEvaluationDescription": "charlie belongs to the range of traffic assigned to \"empty_both\" defined in allocation \"allocation-test\".", + "banditKey": null, + "banditAction": null, + "variationKey": "empty_both", + "variationValue": { + "a": "", + "b": "" + }, + "matchedRule": null, + "matchedAllocation": { + "key": "allocation-test", + "allocationEvaluationCode": "MATCH", + "orderPosition": 1 + }, + "unmatchedAllocations": [], + "unevaluatedAllocations": [ + { + "key": "allocation-default", + "allocationEvaluationCode": "UNEVALUATED", + "orderPosition": 2 + } + ] + } + }, + { + "subjectKey": "david", + "subjectAttributes": {}, + "assignment": { + "a": "value1", + "b": "value2" + }, + "evaluationDetails": { + "environmentName": "Test", + "flagEvaluationCode": "MATCH", + "flagEvaluationDescription": "david belongs to the range of traffic assigned to \"non_empty\" defined in allocation \"allocation-test\".", + "banditKey": null, + "banditAction": null, + "variationKey": "non_empty", + "variationValue": { + "a": "value1", + "b": "value2" + }, + "matchedRule": null, + "matchedAllocation": { + "key": "allocation-test", + "allocationEvaluationCode": "MATCH", + "orderPosition": 1 + }, + "unmatchedAllocations": [], + "unevaluatedAllocations": [ + { + "key": "allocation-default", + "allocationEvaluationCode": "UNEVALUATED", + "orderPosition": 2 + } + ] + } + } + ] +} \ No newline at end of file From 5c7f9b2d5e396154ac55961a75e699342d3d9ae3 Mon Sep 17 00:00:00 2001 From: Marka Date: Thu, 23 Jan 2025 14:53:59 +0200 Subject: [PATCH 02/14] fixed test data --- ufc/flags-v1.json | 20 +++++++++++-------- .../test-case-flag-with-empty-string.json | 7 ++----- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ufc/flags-v1.json b/ufc/flags-v1.json index ecb65ef1..599a6224 100644 --- a/ufc/flags-v1.json +++ b/ufc/flags-v1.json @@ -415,21 +415,25 @@ "enabled": true, "variationType": "STRING", "variations": { - "empty": { - "key": "empty_string", - "value": "" + "empty_a": { + "key": "empty_a", + "value": {"a": "", "b": "non-empty"} }, - "random": { - "key": "random_string", - "value": "dfdfd" + "empty_b": { + "key": "empty_b", + "value": {"a": "non-empty", "b": ""} + }, + "non_empty": { + "key": "non_empty", + "value": {"a": "value1", "b": "value2"} } }, "allocations": [ { - "key": "rollout", + "key": "allocation-test", "splits": [ { - "variationKey": "empty", + "variationKey": "empty_a", "shards": [] } ], diff --git a/ufc/tests/test-case-flag-with-empty-string.json b/ufc/tests/test-case-flag-with-empty-string.json index 5fd70217..8bc157b3 100644 --- a/ufc/tests/test-case-flag-with-empty-string.json +++ b/ufc/tests/test-case-flag-with-empty-string.json @@ -1,15 +1,12 @@ { "flag": "string-variations", "variationType": "STRING", - "defaultValue": {}, + "defaultValue": "default", "subjects": [ { "subjectKey": "alice", "subjectAttributes": {}, - "assignment": { - "a": "", - "b": "non-empty" - }, + "assignment": {"a": "", "b": "non-empty"}, "evaluationDetails": { "environmentName": "Test", "flagEvaluationCode": "MATCH", From 96d90e70de4d466093022e09f12ccae58bd66c6c Mon Sep 17 00:00:00 2001 From: Marka Date: Thu, 23 Jan 2025 15:01:56 +0200 Subject: [PATCH 03/14] fixed test data --- ufc/tests/test-case-flag-with-empty-string.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ufc/tests/test-case-flag-with-empty-string.json b/ufc/tests/test-case-flag-with-empty-string.json index 8bc157b3..b8fab09e 100644 --- a/ufc/tests/test-case-flag-with-empty-string.json +++ b/ufc/tests/test-case-flag-with-empty-string.json @@ -1,7 +1,7 @@ { "flag": "string-variations", "variationType": "STRING", - "defaultValue": "default", + "defaultValue": "non_empty", "subjects": [ { "subjectKey": "alice", From 03cf9aee94982a279af07da4110cc426ec37f450 Mon Sep 17 00:00:00 2001 From: Marka Date: Thu, 23 Jan 2025 15:15:41 +0200 Subject: [PATCH 04/14] fixed test data --- ufc/flags-v1.json | 10 +++++----- ufc/tests/test-case-flag-with-empty-string.json | 16 +++++----------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/ufc/flags-v1.json b/ufc/flags-v1.json index 599a6224..636b934c 100644 --- a/ufc/flags-v1.json +++ b/ufc/flags-v1.json @@ -415,22 +415,22 @@ "enabled": true, "variationType": "STRING", "variations": { - "empty_a": { + "empty_string": { "key": "empty_a", - "value": {"a": "", "b": "non-empty"} + "value": "" }, "empty_b": { "key": "empty_b", - "value": {"a": "non-empty", "b": ""} + "value": "" }, "non_empty": { "key": "non_empty", - "value": {"a": "value1", "b": "value2"} + "value": "value2" } }, "allocations": [ { - "key": "allocation-test", + "key": "allocation-empty", "splits": [ { "variationKey": "empty_a", diff --git a/ufc/tests/test-case-flag-with-empty-string.json b/ufc/tests/test-case-flag-with-empty-string.json index b8fab09e..f9b6f26f 100644 --- a/ufc/tests/test-case-flag-with-empty-string.json +++ b/ufc/tests/test-case-flag-with-empty-string.json @@ -1,7 +1,7 @@ { "flag": "string-variations", "variationType": "STRING", - "defaultValue": "non_empty", + "defaultValue": "default", "subjects": [ { "subjectKey": "alice", @@ -14,13 +14,10 @@ "banditKey": null, "banditAction": null, "variationKey": "empty_a", - "variationValue": { - "a": "", - "b": "non-empty" - }, + "variationValue": "", "matchedRule": null, "matchedAllocation": { - "key": "allocation-test", + "key": "allocation-empty", "allocationEvaluationCode": "MATCH", "orderPosition": 1 }, @@ -47,11 +44,8 @@ "flagEvaluationDescription": "bob belongs to the range of traffic assigned to \"empty_b\" defined in allocation \"allocation-test\".", "banditKey": null, "banditAction": null, - "variationKey": "empty_b", - "variationValue": { - "a": "non-empty", - "b": "" - }, + "variationKey": "non_empty_b", + "variationValue": "non_empty_b", "matchedRule": null, "matchedAllocation": { "key": "allocation-test", From 4688dc237d5e58460f507351c54ddf7e293a0e6f Mon Sep 17 00:00:00 2001 From: Marka Date: Thu, 23 Jan 2025 15:36:13 +0200 Subject: [PATCH 05/14] fixed test data --- ufc/flags-v1.json | 10 +++------- ufc/tests/test-case-flag-with-empty-string.json | 15 ++++++--------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/ufc/flags-v1.json b/ufc/flags-v1.json index 636b934c..3f8bc9fd 100644 --- a/ufc/flags-v1.json +++ b/ufc/flags-v1.json @@ -416,16 +416,12 @@ "variationType": "STRING", "variations": { "empty_string": { - "key": "empty_a", - "value": "" - }, - "empty_b": { - "key": "empty_b", + "key": "empty_string", "value": "" }, "non_empty": { "key": "non_empty", - "value": "value2" + "value": "non_empty" } }, "allocations": [ @@ -433,7 +429,7 @@ "key": "allocation-empty", "splits": [ { - "variationKey": "empty_a", + "variationKey": "empty_string", "shards": [] } ], diff --git a/ufc/tests/test-case-flag-with-empty-string.json b/ufc/tests/test-case-flag-with-empty-string.json index f9b6f26f..d6c89619 100644 --- a/ufc/tests/test-case-flag-with-empty-string.json +++ b/ufc/tests/test-case-flag-with-empty-string.json @@ -6,14 +6,14 @@ { "subjectKey": "alice", "subjectAttributes": {}, - "assignment": {"a": "", "b": "non-empty"}, + "assignment": "", "evaluationDetails": { "environmentName": "Test", "flagEvaluationCode": "MATCH", - "flagEvaluationDescription": "alice belongs to the range of traffic assigned to \"empty_a\" defined in allocation \"allocation-test\".", + "flagEvaluationDescription": "alice belongs to the range of traffic assigned to \"empty_string\" defined in allocation \"allocation-empty\".", "banditKey": null, "banditAction": null, - "variationKey": "empty_a", + "variationKey": "empty_string", "variationValue": "", "matchedRule": null, "matchedAllocation": { @@ -34,18 +34,15 @@ { "subjectKey": "bob", "subjectAttributes": {}, - "assignment": { - "a": "non-empty", - "b": "" - }, + "assignment": "non_empty", "evaluationDetails": { "environmentName": "Test", "flagEvaluationCode": "MATCH", "flagEvaluationDescription": "bob belongs to the range of traffic assigned to \"empty_b\" defined in allocation \"allocation-test\".", "banditKey": null, "banditAction": null, - "variationKey": "non_empty_b", - "variationValue": "non_empty_b", + "variationKey": "non_empty", + "variationValue": "non_empty", "matchedRule": null, "matchedAllocation": { "key": "allocation-test", From 6ed4ec87d69e7da7aad3a388246e9c3c46e90128 Mon Sep 17 00:00:00 2001 From: Marka Date: Thu, 23 Jan 2025 17:39:06 +0200 Subject: [PATCH 06/14] fixed test data --- .../test-case-flag-with-empty-string.json | 34 +++---------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/ufc/tests/test-case-flag-with-empty-string.json b/ufc/tests/test-case-flag-with-empty-string.json index d6c89619..5ac6a405 100644 --- a/ufc/tests/test-case-flag-with-empty-string.json +++ b/ufc/tests/test-case-flag-with-empty-string.json @@ -22,13 +22,7 @@ "orderPosition": 1 }, "unmatchedAllocations": [], - "unevaluatedAllocations": [ - { - "key": "allocation-default", - "allocationEvaluationCode": "UNEVALUATED", - "orderPosition": 2 - } - ] + "unevaluatedAllocations": [] } }, { @@ -38,7 +32,7 @@ "evaluationDetails": { "environmentName": "Test", "flagEvaluationCode": "MATCH", - "flagEvaluationDescription": "bob belongs to the range of traffic assigned to \"empty_b\" defined in allocation \"allocation-test\".", + "flagEvaluationDescription": "bob belongs to the range of traffic assigned to \"non_empty\" defined in allocation \"allocation-test\".", "banditKey": null, "banditAction": null, "variationKey": "non_empty", @@ -50,13 +44,7 @@ "orderPosition": 1 }, "unmatchedAllocations": [], - "unevaluatedAllocations": [ - { - "key": "allocation-default", - "allocationEvaluationCode": "UNEVALUATED", - "orderPosition": 2 - } - ] + "unevaluatedAllocations": [] } }, { @@ -84,13 +72,7 @@ "orderPosition": 1 }, "unmatchedAllocations": [], - "unevaluatedAllocations": [ - { - "key": "allocation-default", - "allocationEvaluationCode": "UNEVALUATED", - "orderPosition": 2 - } - ] + "unevaluatedAllocations": [] } }, { @@ -118,13 +100,7 @@ "orderPosition": 1 }, "unmatchedAllocations": [], - "unevaluatedAllocations": [ - { - "key": "allocation-default", - "allocationEvaluationCode": "UNEVALUATED", - "orderPosition": 2 - } - ] + "unevaluatedAllocations": [] } } ] From ae4b53795c8e022ca37660eef39afe090785fec6 Mon Sep 17 00:00:00 2001 From: Marka Date: Thu, 23 Jan 2025 20:16:12 +0200 Subject: [PATCH 07/14] updated test data --- ufc/flags-v1.json | 46 ++++++++++++- .../test-case-flag-with-empty-string.json | 68 +++---------------- 2 files changed, 53 insertions(+), 61 deletions(-) diff --git a/ufc/flags-v1.json b/ufc/flags-v1.json index 3f8bc9fd..167b5a31 100644 --- a/ufc/flags-v1.json +++ b/ufc/flags-v1.json @@ -421,16 +421,58 @@ }, "non_empty": { "key": "non_empty", - "value": "non_empty" + "value": "non_empty" } }, "allocations": [ { "key": "allocation-empty", + "rules": [ + { + "conditions": [ + { + "attribute": "country", + "operator": "MATCHES", + "value": "US" + } + ] + } + ], "splits": [ { "variationKey": "empty_string", - "shards": [] + "shards": [ + { + "salt": "allocation-empty-shards", + "ranges": [ + { + "start": 0, + "end": 10000 + } + ] + } + ] + } + ], + "doLog": true + }, + { + "key": "allocation-test", + "rules": [], + "splits": [ + { + "variationKey": "non_empty", + "shards": [ + { + "salt": "allocation-empty-shards", + "ranges": [ + { + "start": 0, + "end": 10000 + } + ] + } + ] } ], "doLog": true diff --git a/ufc/tests/test-case-flag-with-empty-string.json b/ufc/tests/test-case-flag-with-empty-string.json index 5ac6a405..a61b09e3 100644 --- a/ufc/tests/test-case-flag-with-empty-string.json +++ b/ufc/tests/test-case-flag-with-empty-string.json @@ -1,11 +1,13 @@ { - "flag": "string-variations", + "flag": "empty_string_flag", "variationType": "STRING", "defaultValue": "default", "subjects": [ { "subjectKey": "alice", - "subjectAttributes": {}, + "subjectAttributes": { + "country": "US" + }, "assignment": "", "evaluationDetails": { "environmentName": "Test", @@ -15,7 +17,11 @@ "banditAction": null, "variationKey": "empty_string", "variationValue": "", - "matchedRule": null, + "matchedRule": { + "attribute": "country", + "operator": "MATCHES", + "value": "US" + }, "matchedAllocation": { "key": "allocation-empty", "allocationEvaluationCode": "MATCH", @@ -46,62 +52,6 @@ "unmatchedAllocations": [], "unevaluatedAllocations": [] } - }, - { - "subjectKey": "charlie", - "subjectAttributes": {}, - "assignment": { - "a": "", - "b": "" - }, - "evaluationDetails": { - "environmentName": "Test", - "flagEvaluationCode": "MATCH", - "flagEvaluationDescription": "charlie belongs to the range of traffic assigned to \"empty_both\" defined in allocation \"allocation-test\".", - "banditKey": null, - "banditAction": null, - "variationKey": "empty_both", - "variationValue": { - "a": "", - "b": "" - }, - "matchedRule": null, - "matchedAllocation": { - "key": "allocation-test", - "allocationEvaluationCode": "MATCH", - "orderPosition": 1 - }, - "unmatchedAllocations": [], - "unevaluatedAllocations": [] - } - }, - { - "subjectKey": "david", - "subjectAttributes": {}, - "assignment": { - "a": "value1", - "b": "value2" - }, - "evaluationDetails": { - "environmentName": "Test", - "flagEvaluationCode": "MATCH", - "flagEvaluationDescription": "david belongs to the range of traffic assigned to \"non_empty\" defined in allocation \"allocation-test\".", - "banditKey": null, - "banditAction": null, - "variationKey": "non_empty", - "variationValue": { - "a": "value1", - "b": "value2" - }, - "matchedRule": null, - "matchedAllocation": { - "key": "allocation-test", - "allocationEvaluationCode": "MATCH", - "orderPosition": 1 - }, - "unmatchedAllocations": [], - "unevaluatedAllocations": [] - } } ] } \ No newline at end of file From d7e594b51250a625284dc4e1a7fa6d1dc6fb1543 Mon Sep 17 00:00:00 2001 From: Marka Date: Thu, 23 Jan 2025 20:47:26 +0200 Subject: [PATCH 08/14] added obfuscated --- ufc/flags-v1-obfuscated.json | 70 +++++++++++++++++++ .../test-case-flag-with-empty-string.json | 2 +- 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/ufc/flags-v1-obfuscated.json b/ufc/flags-v1-obfuscated.json index bb844ba9..733cd509 100644 --- a/ufc/flags-v1-obfuscated.json +++ b/ufc/flags-v1-obfuscated.json @@ -1284,6 +1284,76 @@ "value": "eyJhIjogIueFp+mhviIsICJiIjogIua8guS6riJ9" } } + }, + "96e89a298e0c2716130c12b0056b3651": { + "key": "96e89a298e0c2716130c12b0056b3651", + "enabled": true, + "variationType": "STRING", + "variations": { + "ZW1wdHlfc3RyaW5n": { + "key": "ZW1wdHlfc3RyaW5n", + "value": "" + }, + "bm9uX2VtcHR5": { + "key": "bm9uX2VtcHR5", + "value": "bm9uX2VtcHR5" + } + }, + "allocations": [ + { + "key": "YWxsb2NhdGlvbi1lbXB0eQ==", + "rules": [ + { + "conditions": [ + { + "attribute": "Y291bnRyeQ==", + "operator": "MATCHES", + "value": "VVM=" + } + ] + } + ], + "splits": [ + { + "variationKey": "ZW1wdHlfc3RyaW5n", + "shards": [ + { + "salt": "YWxsb2NhdGlvbi1lbXB0eS1zaGFyZHM=", + "ranges": [ + { + "start": 0, + "end": 10000 + } + ] + } + ] + } + ], + "doLog": true + }, + { + "key": "YWxsb2NhdGlvbi10ZXN0", + "rules": [], + "splits": [ + { + "variationKey": "bm9uX2VtcHR5", + "shards": [ + { + "salt": "YWxsb2NhdGlvbi1lbXB0eS1zaGFyZHM=", + "ranges": [ + { + "start": 0, + "end": 10000 + } + ] + } + ] + } + ], + "doLog": true + } + ], + "totalShards": 10000 } } } diff --git a/ufc/tests/test-case-flag-with-empty-string.json b/ufc/tests/test-case-flag-with-empty-string.json index a61b09e3..d01ea42b 100644 --- a/ufc/tests/test-case-flag-with-empty-string.json +++ b/ufc/tests/test-case-flag-with-empty-string.json @@ -47,7 +47,7 @@ "matchedAllocation": { "key": "allocation-test", "allocationEvaluationCode": "MATCH", - "orderPosition": 1 + "orderPosition": 2 }, "unmatchedAllocations": [], "unevaluatedAllocations": [] From 5d796c334b67bcacbae23b1537a755ff292c6284 Mon Sep 17 00:00:00 2001 From: Marka Date: Thu, 23 Jan 2025 20:49:59 +0200 Subject: [PATCH 09/14] updated test data --- ufc/flags-v1.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ufc/flags-v1.json b/ufc/flags-v1.json index 167b5a31..1017b28f 100644 --- a/ufc/flags-v1.json +++ b/ufc/flags-v1.json @@ -464,7 +464,7 @@ "variationKey": "non_empty", "shards": [ { - "salt": "allocation-empty-shards", + "salt": "allocation-test-shards", "ranges": [ { "start": 0, From 80a41d5f76eb88332e542657146a3d3f106a9715 Mon Sep 17 00:00:00 2001 From: Tyler Potter Date: Fri, 24 Jan 2025 01:09:53 -0700 Subject: [PATCH 10/14] hash the fields I told Marka to base64encode (#111) --- ufc/flags-v1-obfuscated.json | 9 +++++---- ufc/flags-v1.json | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ufc/flags-v1-obfuscated.json b/ufc/flags-v1-obfuscated.json index 733cd509..8ea2d6f2 100644 --- a/ufc/flags-v1-obfuscated.json +++ b/ufc/flags-v1-obfuscated.json @@ -1285,8 +1285,9 @@ } } }, - "96e89a298e0c2716130c12b0056b3651": { - "key": "96e89a298e0c2716130c12b0056b3651", + "1d23cbd300895799fda462f81ec4e135": { + "key": "1d23cbd300895799fda462f81ec4e135", + "comment": "Testing the empty string as a variation values", "enabled": true, "variationType": "STRING", "variations": { @@ -1306,8 +1307,8 @@ { "conditions": [ { - "attribute": "Y291bnRyeQ==", - "operator": "MATCHES", + "attribute": "e909c2d7067ea37437cf97fe11d91bd0", + "operator": "05015086bdd8402218f6aad6528bef08", "value": "VVM=" } ] diff --git a/ufc/flags-v1.json b/ufc/flags-v1.json index 1017b28f..1675b05d 100644 --- a/ufc/flags-v1.json +++ b/ufc/flags-v1.json @@ -413,6 +413,7 @@ "empty_string_flag": { "key": "empty_string_flag", "enabled": true, + "comment": "Testing the empty string as a variation values", "variationType": "STRING", "variations": { "empty_string": { @@ -464,7 +465,7 @@ "variationKey": "non_empty", "shards": [ { - "salt": "allocation-test-shards", + "salt": "allocation-empty-shards", "ranges": [ { "start": 0, From a5a3951df128c588eec680c8d4da389d5b287ceb Mon Sep 17 00:00:00 2001 From: Marka Date: Tue, 28 Jan 2025 10:36:16 +0100 Subject: [PATCH 11/14] fixed typo --- ufc/flags-v1-obfuscated.json | 2 +- ufc/flags-v1.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ufc/flags-v1-obfuscated.json b/ufc/flags-v1-obfuscated.json index 8ea2d6f2..7f3739a7 100644 --- a/ufc/flags-v1-obfuscated.json +++ b/ufc/flags-v1-obfuscated.json @@ -1287,7 +1287,7 @@ }, "1d23cbd300895799fda462f81ec4e135": { "key": "1d23cbd300895799fda462f81ec4e135", - "comment": "Testing the empty string as a variation values", + "comment": "Testing the empty string as a variation value", "enabled": true, "variationType": "STRING", "variations": { diff --git a/ufc/flags-v1.json b/ufc/flags-v1.json index 1675b05d..d2fa8d6b 100644 --- a/ufc/flags-v1.json +++ b/ufc/flags-v1.json @@ -413,7 +413,7 @@ "empty_string_flag": { "key": "empty_string_flag", "enabled": true, - "comment": "Testing the empty string as a variation values", + "comment": "Testing the empty string as a variation value", "variationType": "STRING", "variations": { "empty_string": { From 00cb0146fd26cd6950b578d7b3e3e6ea1fc1e0a3 Mon Sep 17 00:00:00 2001 From: Marka Date: Tue, 28 Jan 2025 10:36:49 +0100 Subject: [PATCH 12/14] Update ufc/tests/test-case-flag-with-empty-string.json Co-authored-by: Tyler Potter --- ufc/tests/test-case-flag-with-empty-string.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ufc/tests/test-case-flag-with-empty-string.json b/ufc/tests/test-case-flag-with-empty-string.json index d01ea42b..0d2adfb2 100644 --- a/ufc/tests/test-case-flag-with-empty-string.json +++ b/ufc/tests/test-case-flag-with-empty-string.json @@ -18,9 +18,11 @@ "variationKey": "empty_string", "variationValue": "", "matchedRule": { - "attribute": "country", - "operator": "MATCHES", - "value": "US" + "conditions": [ + "attribute": "country", + "operator": "MATCHES", + "value": "US" + ] }, "matchedAllocation": { "key": "allocation-empty", From ffe160f36cb1c67f8abe2596396fae8a4f42317a Mon Sep 17 00:00:00 2001 From: Marka Date: Tue, 28 Jan 2025 10:42:39 +0100 Subject: [PATCH 13/14] fixed conditions --- ufc/tests/test-case-flag-with-empty-string.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ufc/tests/test-case-flag-with-empty-string.json b/ufc/tests/test-case-flag-with-empty-string.json index 0d2adfb2..a3f7a15a 100644 --- a/ufc/tests/test-case-flag-with-empty-string.json +++ b/ufc/tests/test-case-flag-with-empty-string.json @@ -19,9 +19,11 @@ "variationValue": "", "matchedRule": { "conditions": [ + { "attribute": "country", "operator": "MATCHES", "value": "US" + } ] }, "matchedAllocation": { @@ -56,4 +58,5 @@ } } ] -} \ No newline at end of file +} + From c3bffa8cfb0b2da14dc7373811b921fbde31cf53 Mon Sep 17 00:00:00 2001 From: Ty Potter Date: Tue, 28 Jan 2025 12:33:25 -0700 Subject: [PATCH 14/14] fixed expected evaluation details --- .../test-case-flag-with-empty-string.json | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/ufc/tests/test-case-flag-with-empty-string.json b/ufc/tests/test-case-flag-with-empty-string.json index a3f7a15a..37e103d0 100644 --- a/ufc/tests/test-case-flag-with-empty-string.json +++ b/ufc/tests/test-case-flag-with-empty-string.json @@ -12,7 +12,7 @@ "evaluationDetails": { "environmentName": "Test", "flagEvaluationCode": "MATCH", - "flagEvaluationDescription": "alice belongs to the range of traffic assigned to \"empty_string\" defined in allocation \"allocation-empty\".", + "flagEvaluationDescription": "Supplied attributes match rules defined in allocation \"allocation-empty\".", "banditKey": null, "banditAction": null, "variationKey": "empty_string", @@ -20,9 +20,9 @@ "matchedRule": { "conditions": [ { - "attribute": "country", - "operator": "MATCHES", - "value": "US" + "attribute": "country", + "operator": "MATCHES", + "value": "US" } ] }, @@ -32,7 +32,13 @@ "orderPosition": 1 }, "unmatchedAllocations": [], - "unevaluatedAllocations": [] + "unevaluatedAllocations": [ + { + "allocationEvaluationCode": "UNEVALUATED", + "key": "allocation-test", + "orderPosition": 2 + } + ] } }, { @@ -53,10 +59,15 @@ "allocationEvaluationCode": "MATCH", "orderPosition": 2 }, - "unmatchedAllocations": [], + "unmatchedAllocations": [ + { + "allocationEvaluationCode": "FAILING_RULE", + "key": "allocation-empty", + "orderPosition": 1 + } + ], "unevaluatedAllocations": [] } } ] } -