-
Notifications
You must be signed in to change notification settings - Fork 35
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
[BUG] Awkward usage when trying to evaluate a boolean flag in a complex conditional #262
Comments
If this is acceptable to the maintainers, I'm willing to contribute a PR for it 😉 |
@hairyhenderson thank you for bringing this up. Given that this concern is raised again in a short time shows the need for a common agreement. @toddbaert @thomaspoignant tagging you as I think a decision is needed from the TC level.
Thank you. If we are to support non-error evaluations, then I would go with a set of facade methods for existing error methods. But let's first wait for TC decision on this. note - CNCF openfeature-go discussion https://cloud-native.slack.com/archives/C06HAN9KP9Q/p1712248379124169 |
Adding in the issue some of the research I've made on different SDKs available (as mentioned in slack):
That being said I am not opposed to having a sugar syntax to make things easier for the developer adoption. I am not a fan of the I like the |
Somebody brought this up and KubeCon, and the way they put it was very astute... The spec says (in 1.4.10):
In Java, .NET, JS... this means these should never throw. The Go equivalent of throwing is returning an error... for that reason, on some level, our Go evaluation API is non-conforming... The fact that we return an error means these functions, as far as Go idioms are concerned, can in fact abnormally terminate. This issue illustrates exactly why this is a problem. I don't know, practically, what path we want to take, but I think this is a pretty serious problem and we need to find a way to fix it (breaking or not). |
@toddbaert I think this was discussed here #259. It was resolved as the author got their concern resolved with hook usage. |
Yeah, that's fair. Often when I see functions with that prefix in the wild, it means "panic where you'd normally error", but that isn't really what we want here. Naming-wise, how about just |
I've issued #263 to demonstrate how this could work... |
@hairyhenderson thank you for your contribution :) |
Observed behavior
(Related to #259, but that one was closed, so filing this instead)
I just ran into a papercut when working on an experiment to move from an in-house feature management system to OpenFeature. The previous system allowed calling a simple
IsEnabled(flag string) bool
method, which I'd like to replace with a call toclient.BooleanValue
. Mostly this works fine, but I just ran into an awkward case for some code with a fairly convoluted conditional:In this case it's impossible to simply replace the
features.IsEnabled
call withclient.BooleanValue
due to theerr
return value. And I'd rather avoid evaluating the flag altogether ifcond1
is false.This isn't insurmountable, but it does make it more awkward to use OpenFeature in this case, and will cause adoption friction.
Expected Behavior
The package should be less awkward to integrate with an existing project.
Could an additional set of methods be considered like these?
Steps to reproduce
(See above)
The text was updated successfully, but these errors were encountered: