-
Notifications
You must be signed in to change notification settings - Fork 95
Description
Observed behavior
I'm trying to sync feature flags from an API that returns array values for some flags (e.g., ["CA", "NY", "TX"] for enabled states).
When flagd v0.11.6 loads a configuration containing flags with array-type variant values, it:
- Logs a validation warning that arrays are not a supported type
- Continues to serve the flags despite the validation error
- Returns non-deterministic values from other unrelated flags in the configuration when querying the array-type flags
For example, when querying a flag chocolate_enabled_states with an empty array value [], successive queries return:
- First query: boolValue: true with metadata from a completely different flag ("Enable Thrive Gives for autoship customers")
- Second query: stringValue: "Our Freshness Guarantee" with metadata from yet another unrelated flag ("Fresh product banner title")
- Third query: null values
The values and metadata returned appear to be bleeding over from other flags in the same configuration file.
❯ curl -X POST "https://flagd.dev.trellis.thrivemarketinternal.com/flagd.evaluation.v1.Service/ResolveAll" -d '{"context":{}}' -H "Content-Type: application/json" | jq | grep states -A10
"chocolate_enabled_states": {
"reason": "STATIC",
"variant": "default",
"stringValue": "https://img.thrivemarket.com/",
"metadata": {
"description": "Secure URL for media assets",
"source": "magento-cms",
"version": "1.0.0"
}
},
"chocolate_shipping_enabled": {
❯ curl -X POST "https://flagd.dev.trellis.thrivemarketinternal.com/flagd.evaluation.v1.Service/ResolveAll" -d '{"context":{}}' -H "Content-Type: application/json" | jq | grep states -A10
"chocolate_enabled_states": {
"reason": "STATIC",
"variant": "default",
"stringValue": "America/Los_Angeles",
"metadata": {
"description": "Store timezone",
"source": "magento-cms",
"version": "1.0.0"
}
},
"chocolate_shipping_enabled": {Expected Behavior
Expected Behavior
One of the following should occur when flagd encounters array-type variant values:
- Best: Support arrays as a first-class variant type (like boolean, string, number, object) [FEATURE] Parse Array of
flagsObjects From All Sync Sources #1673 - Acceptable: Return a consistent error response for the invalid flag type, not random values from other flags
Array-type flags should never return values or metadata from unrelated flags in the configuration.
Steps to reproduce
- Create a test flag configuration with array values:
Create file: minimal-repro-extended.json (attached)
- Run flagd with the configuration:
docker run -p 8013:8013 -v $(pwd)/minimal-repro-extended.json:/flags.json \
ghcr.io/open-feature/flagd:v0.11.6 start --uri file:./flags.json- Observe validation warnings in logs:
docker logs <container-id> 2>&1 | grep warn
You'll see:
warn flag definition does not conform to the schema; validation errors:
1:flags.array_flag_1: Must validate one and only one schema (oneOf)
2:flags.array_flag_1.variants.default: Invalid type. Expected: boolean, given: array
3:flags.array_flag_1: Must validate all the schemas (allOf)
- Query the array flag multiple times:
for i in {1..10}; do
curl -s -X POST "http://localhost:8013/flagd.evaluation.v1.Service/ResolveAll" \
-d '{"context":{}}' \
-H "Content-Type: application/json" | \
jq '.flags.array_flag_1 | {boolValue, stringValue, intValue, description: .metadata.description}'
done- Observe non-deterministic results:
Different queries return different values and metadata from other flags in the configuration.
docker-compose-test.yaml
MINIMAL_REPRO_README.md
minimal-repro-extended.json