flagd icon indicating copy to clipboard operation
flagd copied to clipboard

[ENHANCEMENT] Flagd is not able to use flags with the same name for different selectors

Open aepfli opened this issue 9 months ago • 2 comments

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.

aepfli avatar Mar 18 '25 13:03 aepfli

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.

beeme1mr avatar Mar 18 '25 14:03 beeme1mr

Agreed with @beeme1mr ... while this behavior certainly should be correct, it's a known unimplemented feature.

toddbaert avatar Mar 19 '25 17:03 toddbaert

relates too https://github.com/open-feature/flagd/pull/1634

aepfli avatar Jun 02 '25 11:06 aepfli

i think we can close this one

aepfli avatar Nov 10 '25 09:11 aepfli