[ENHANCEMENT] Flagd is not able to use flags with the same name for different selectors
Observed behavior
Flagd supports selectors, so separate flags into different buckets, eg. each file source is an own selector.
But flagd can not handle flags with the same name in different buckets/selectors. There will be only one flag in the last selector with this name, and it will be removed from other selectors
Expected Behavior
Each selector can have a a flag with the same name, not influenced by other selectors
Steps to reproduce
create a two flag configurations with the following content and name them "a.json" and "b.json":
{
"flags": {
"flag": {
"state": "ENABLED",
"variants": {
"foo": "foo",
"bar": "bar"
},
"defaultVariant": "foo"
}
}
}
start flagd with those two files as sources:
docker run \
--rm -it \
--name flagd \
-p 8015:8015 \
-v $(pwd):/flags \
ghcr.io/open-feature/flagd:latest start \
--uri file:./flags/a.json \
--uri file:./flags/b.json
verify the flag changes:
grpcurl -import-path <path-to-sync-proto-dir> -proto sync.proto -plaintext -d '{"selector":"./flags/a.json"}' localhost:8015 flagd.sync.v1.FlagSyncService/FetchAllFlags
and
grpcurl -import-path <path-to-sync-proto-dir> -proto sync.proto -plaintext -d '{"selector":"./flags/b.json"}' localhost:8015 flagd.sync.v1.FlagSyncService/FetchAllFlags
the flag will be only returned by one of them.
This isn't a bug but more of a limitation of flagd. You can read more about the merging strategy here. However, I do believe we should make flag sets an out-of-the-box feature.
Agreed with @beeme1mr ... while this behavior certainly should be correct, it's a known unimplemented feature.
relates too https://github.com/open-feature/flagd/pull/1634
i think we can close this one