Repository navigation
fix(memprovider): return TYPE_MISMATCH for scalar object evaluations - #667
kripa-sindhu-007 wants to merge 1 commit into
Conversation
Closes open-feature#666 Signed-off-by: Kripa Sindhu <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #667 +/- ##
==========================================
+ Coverage 91.31% 91.51% +0.20%
==========================================
Files 22 22
Lines 2256 2264 +8
==========================================
+ Hits 2060 2072 +12
+ Misses 160 157 -3
+ Partials 36 35 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
We need to make sure that the Grafana test suite won't be affected by this change. I see this as a potentially breaking change, so it would be great to minimize its impact. |
|
@erka I checked this against Grafana. They pin go-sdk v1.17.2, so I ran every Grafana package that imports go-sdk (63 in the root module plus That matches the code: featuremgmt picks the typed evaluation from the variant's Go type, and config values come from One catch: Grafana's tests already don't compile against our current main, with or without this PR. |
|
Thanks for the Grafana check @kripa-sindhu-007. I agree with @erka that this needs care. Even if it's more compliant, it changes results for anyone serving scalar variants through On compliance: the spec defines structure as a type separate from boolean, string and number, so IMO this PR's reading is right. But the definition is loose ("such as JSON or YAML"), and 1.3.4 is a client SHOULD that says nothing about providers. As a result, SDKs disagree: Java and .NET's in-memory providers reject scalars, JS compares with the default's @erka @kripa-sindhu-007 what are your opinions on this? What's the best path forward in terms of stability/breakage? |
|
@toddbaert Quick correction first: the I'd ship this as +1 on the spec issue, happy to open it. cc- @erka |
|
I’ve opened PR #139146 to bump to 1.20 in the Grafana repo. I wonder how it will go and how Dave will react on it. The spec improvements are always nice to have. I think someone could argue that InterfaceEvaluationDetails means the value could be of any type, but I think aligning it with other languages is the right way to go. @kripa-sindhu-007 Please don't do |
|
Noted @erka. I'll keep it as fix:. The behaviour change is already called out in the PR description, so it can go into the release notes from there. I'll open the spec issue for the structure type / 1.3.4 wording. Do we have anyplace to note this so it can't get missed from release notes? |
InMemoryProvider.ObjectEvaluationreturned any non-nil variant as an object, so a boolean, string or number came back as a valid value. SinceObjectValuereturnsany, the client can't catch that either. It now returns the default withTYPE_MISMATCHfor scalar values, as spec 1.3.4 requires. Maps, slices, structs and pointers resolve as before, and a disabled flag still returns the caller's default.This is a behavior change for anyone serving scalar variants through
ObjectValuewith memprovider orTestProvider: those calls now get the default. Two existing tests relied on that and are updated.With this change, the spec's
evaluation_v2.featurepasses 73/73 locally (#665).Closes #666