Skip to content
Closed
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
75 changes: 24 additions & 51 deletions evaluator/flags/testkit-flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -462,38 +462,29 @@
},
"semver-invalid-version-flag": {
"state": "ENABLED",
"variants": { "true": "true", "false": "false", "fallback": "fallback" },
"variants": { "match": "match", "fallback": "fallback" },
Comment thread
toddbaert marked this conversation as resolved.
"defaultVariant": "fallback",
"targeting": {
"if": [
{"sem_ver": [{"var": "version"}, "=", "1.0.0"]},
"true", "false"
]
"sem_ver": [{"var": "version"}, "=", "1.0.0"]
}
},
"semver-invalid-operator-flag": {
"state": "ENABLED",
"variants": { "true": "true", "false": "false", "fallback": "fallback" },
"variants": { "match": "match", "fallback": "fallback" },
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

For boolean-returning operators like sem_ver, the variants should remain "true" and "false" to correctly handle valid results and preserve the distinction from null errors, as intended in the PR description.

Suggested change
"variants": { "match": "match", "fallback": "fallback" },
"variants": { "true": "true", "false": "false", "fallback": "fallback" },

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are edge cases. We WANT to test for null returns.

"defaultVariant": "fallback",
"targeting": {
"if": [
{"sem_ver": [{"var": "version"}, "===", "1.0.0"]},
"true", "false"
]
"sem_ver": [{"var": "version"}, "===", "1.0.0"]
}
},
"fractional-null-bucket-key-flag": {
"state": "ENABLED",
"variants": { "true": "true", "false": "false", "fallback": "fallback" },
"variants": { "one": "one", "two": "two", "fallback": "fallback" },
"defaultVariant": "fallback",
"targeting": {
"if": [
{"fractional": [
{"var": "missing_key"},
["one", 50],
["two", 50]
]},
"true", "false"
"fractional": [
{"var": "missing_key"},
["one", 50],
["two", 50]
]
}
},
Expand Down Expand Up @@ -603,60 +594,45 @@
},
"starts-with-non-string-flag": {
"state": "ENABLED",
"variants": { "true": "true", "false": "false", "fallback": "fallback" },
"variants": { "match": "match", "fallback": "fallback" },
Comment thread
toddbaert marked this conversation as resolved.
"defaultVariant": "fallback",
"targeting": {
"if": [
{"starts_with": [{"var": "num"}, "abc"]},
"true", "false"
]
"starts_with": [{"var": "num"}, "abc"]
}
},
"ends-with-non-string-flag": {
"state": "ENABLED",
"variants": { "true": "true", "false": "false", "fallback": "fallback" },
"variants": { "match": "match", "fallback": "fallback" },
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The ends_with operator returns a boolean. The variants should be "true" and "false" to match the operator's output when it doesn't error.

Suggested change
"variants": { "match": "match", "fallback": "fallback" },
"variants": { "true": "true", "false": "false", "fallback": "fallback" },

"defaultVariant": "fallback",
"targeting": {
"if": [
{"ends_with": [{"var": "num"}, "xyz"]},
"true", "false"
]
"ends_with": [{"var": "num"}, "xyz"]
}
},
"starts-with-wrong-args-flag": {
"state": "ENABLED",
"variants": { "true": "true", "false": "false", "fallback": "fallback" },
"variants": { "match": "match", "fallback": "fallback" },
Comment thread
toddbaert marked this conversation as resolved.
"defaultVariant": "fallback",
"targeting": {
"if": [
{"starts_with": ["abc"]},
"true", "false"
]
"starts_with": ["abc"]
}
},
"ends-with-wrong-args-flag": {
"state": "ENABLED",
"variants": { "true": "true", "false": "false", "fallback": "fallback" },
"variants": { "match": "match", "fallback": "fallback" },
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The ends_with operator returns a boolean. The variants should be "true" and "false" to match the operator's output when it doesn't error.

Suggested change
"variants": { "match": "match", "fallback": "fallback" },
"variants": { "true": "true", "false": "false", "fallback": "fallback" },

"defaultVariant": "fallback",
"targeting": {
"if": [
{"ends_with": ["xyz"]},
"true", "false"
]
"ends_with": ["xyz"]
}
},
"fractional-zero-weights-flag": {
"state": "ENABLED",
"variants": { "true": "true", "false": "false", "fallback": "fallback" },
"variants": { "one": "one", "two": "two", "fallback": "fallback" },
"defaultVariant": "fallback",
"targeting": {
"if": [
{"fractional": [
{"var": "targetingKey"},
["one", 0],
["two", 0]
]},
"true", "false"
"fractional": [
{"var": "targetingKey"},
["one", 0],
["two", 0]
]
}
},
Expand All @@ -674,13 +650,10 @@
},
"semver-wrong-args-flag": {
"state": "ENABLED",
"variants": { "true": "true", "false": "false", "fallback": "fallback" },
"variants": { "match": "match", "fallback": "fallback" },
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The sem_ver operator returns a boolean. The variants should be "true" and "false" to match the operator's output when it doesn't error.

Suggested change
"variants": { "match": "match", "fallback": "fallback" },
"variants": { "true": "true", "false": "false", "fallback": "fallback" },

"defaultVariant": "fallback",
"targeting": {
"if": [
{"sem_ver": [{"var": "version"}, "="]},
"true", "false"
]
"sem_ver": [{"var": "version"}, "="]
}
}
},
Expand Down
86 changes: 26 additions & 60 deletions flags/edge-case-flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,128 +56,98 @@
"semver-invalid-version-flag": {
"state": "ENABLED",
"variants": {
"true": "true",
"false": "false",
"match": "match",
"fallback": "fallback"
Comment on lines +59 to 60
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

For boolean-returning operators like sem_ver, the variants should remain "true" and "false". This allows the evaluator to resolve a valid match/non-match and preserves the distinction from a null error which falls back to the default variant.

        "true": "true",
        "false": "false",
        "fallback": "fallback"

},
"defaultVariant": "fallback",
"targeting": {
"if": [
{"sem_ver": [{"var": "version"}, "=", "1.0.0"]},
"true", "false"
]
"sem_ver": [{"var": "version"}, "=", "1.0.0"]
}
},
"semver-invalid-operator-flag": {
"state": "ENABLED",
"variants": {
"true": "true",
"false": "false",
"match": "match",
"fallback": "fallback"
Comment on lines +70 to 71
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Same as above: variants for boolean operators should be "true" and "false".

        "true": "true",
        "false": "false",
        "fallback": "fallback"

},
"defaultVariant": "fallback",
"targeting": {
"if": [
{"sem_ver": [{"var": "version"}, "===", "1.0.0"]},
"true", "false"
]
"sem_ver": [{"var": "version"}, "===", "1.0.0"]
}
},
"fractional-null-bucket-key-flag": {
"state": "ENABLED",
"variants": {
"true": "true",
"false": "false",
"one": "one",
"two": "two",
"fallback": "fallback"
},
"defaultVariant": "fallback",
"targeting": {
"if": [
{"fractional": [
{"var": "missing_key"},
["one", 50],
["two", 50]
]},
"true", "false"
"fractional": [
{"var": "missing_key"},
["one", 50],
["two", 50]
]
}
},
"starts-with-non-string-flag": {
"state": "ENABLED",
"variants": {
"true": "true",
"false": "false",
"match": "match",
"fallback": "fallback"
Comment on lines +97 to 98
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The starts_with operator returns a boolean. The variants should be "true" and "false".

        "true": "true",
        "false": "false",
        "fallback": "fallback"

},
"defaultVariant": "fallback",
"targeting": {
"if": [
{"starts_with": [{"var": "num"}, "abc"]},
"true", "false"
]
"starts_with": [{"var": "num"}, "abc"]
}
},
"ends-with-non-string-flag": {
"state": "ENABLED",
"variants": {
"true": "true",
"false": "false",
"match": "match",
"fallback": "fallback"
Comment thread
toddbaert marked this conversation as resolved.
},
"defaultVariant": "fallback",
"targeting": {
"if": [
{"ends_with": [{"var": "num"}, "xyz"]},
"true", "false"
]
"ends_with": [{"var": "num"}, "xyz"]
}
},
"starts-with-wrong-args-flag": {
"state": "ENABLED",
"variants": {
"true": "true",
"false": "false",
"match": "match",
"fallback": "fallback"
Comment on lines +119 to 120
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The starts_with operator returns a boolean. The variants should be "true" and "false".

        "true": "true",
        "false": "false",
        "fallback": "fallback"

},
"defaultVariant": "fallback",
"targeting": {
"if": [
{"starts_with": ["abc"]},
"true", "false"
]
"starts_with": ["abc"]
}
},
"ends-with-wrong-args-flag": {
"state": "ENABLED",
"variants": {
"true": "true",
"false": "false",
"match": "match",
"fallback": "fallback"
Comment on lines +130 to 131
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The ends_with operator returns a boolean. The variants should be "true" and "false".

        "true": "true",
        "false": "false",
        "fallback": "fallback"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
"defaultVariant": "fallback",
"targeting": {
"if": [
{"ends_with": ["xyz"]},
"true", "false"
]
"ends_with": ["xyz"]
}
},
"fractional-zero-weights-flag": {
"state": "ENABLED",
"variants": {
"true": "true",
"false": "false",
"one": "one",
"two": "two",
"fallback": "fallback"
},
"defaultVariant": "fallback",
"targeting": {
"if": [
{"fractional": [
{"var": "targetingKey"},
["one", 0],
["two", 0]
]},
"true", "false"
"fractional": [
{"var": "targetingKey"},
["one", 0],
["two", 0]
]
}
},
Expand All @@ -196,16 +166,12 @@
"semver-wrong-args-flag": {
"state": "ENABLED",
"variants": {
"true": "true",
"false": "false",
"match": "match",
"fallback": "fallback"
Comment on lines +169 to 170
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The sem_ver operator returns a boolean. The variants should be "true" and "false".

        "true": "true",
        "false": "false",
        "fallback": "fallback"

},
"defaultVariant": "fallback",
"targeting": {
"if": [
{"sem_ver": [{"var": "version"}, "="]},
"true", "false"
]
"sem_ver": [{"var": "version"}, "="]
}
}
}
Expand Down
Loading