Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] make flag not found a reason #2950

Open
1 task done
piclemx opened this issue Apr 5, 2024 · 2 comments
Open
1 task done

[Feature Request] make flag not found a reason #2950

piclemx opened this issue Apr 5, 2024 · 2 comments
Labels
enhancement Created by Linear-GitHub Sync

Comments

@piclemx
Copy link

piclemx commented Apr 5, 2024

Problem

When looking at the output of an evaluation of a boolean flag that doesn't exist, I think it would be preferable that the Flipt API returns that the Flag is false. IMO boolean flag should always consider false by default if nothing is provided.

Ideal Solution

curl --location 'http://localhost:8080/evaluate/v1/boolean' \
--header 'Content-Type: text/plain' \
--data '{
    "flagKey": "patate"
}'
< HTTP/1.1 404 Not Found
< Date: Fri, 05 Apr 2024 18:25:41 GMT
< Content-Type: application/json
< Content-Length: 80
< Connection: keep-alive
< Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src * data:; frame-ancestors 'none'; connect-src 'self' https://app.formbricks.com; script-src-elem 'self' https://unpkg.com;
< X-Content-Type-Options: nosniff
{
	"code": 5,
	"message": "flag \"default/patate\" not found",
	"details": []
}

Would like more something like

< HTTP/1.1 200 Ok
< Date: Fri, 05 Apr 2024 18:25:41 GMT
< Content-Type: application/json
< Content-Length: 80
< Connection: keep-alive
< Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src * data:; frame-ancestors 'none'; connect-src 'self' https://app.formbricks.com; script-src-elem 'self' https://unpkg.com;
< X-Content-Type-Options: nosniff
{
	result: false
        reason: "flag not found"
}

Search

  • I searched for other open and closed issues before opening this

Additional Context

No response

@piclemx piclemx added the enhancement Created by Linear-GitHub Sync label Apr 5, 2024
@GeorgeMac
Copy link
Member

Thanks for the suggestion @piclemx !

My main concern here is that this can lead to confusion if you e.g. miss-spell or miss-reference a flag by mistake.
This could easily mislead folks into thinking a flag is present, but disabled/returning false. Then be confused when constraints and targeting rules have no effect on the result of the flag when its in production.

This is at-least the main motivation for flag not found being a fail-fast error. I think this is pretty common in the FF space and e.g. how OpenFeature also handles these evaluation semantics (FLAG_NOT_FOUND is an error code not a reason):

@GeorgeMac GeorgeMac changed the title [Feature Request] [Feature Request] make flag not found a reason Apr 8, 2024
@Chris-Greaves
Copy link

I can see where both of you are coming from. I guess it's the job of the Client to handle the FLAG_NOT_FOUND error gracefully.

OpenFeature has a requirement on providers that when 'Resolving' a flag, you have to have a defaultvalue parameter.
https://openfeature.dev/specification/sections/providers#requirement-221

I do think this is missing from of the flipt specific client libraries, so I'd stick to the OpenFeature ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Created by Linear-GitHub Sync
Projects
Status: No status
Development

No branches or pull requests

3 participants