Repository navigation
fix: resolve disabled flags without an error - #574
sahidvelji merged 2 commits into
Conversation
InMemoryFlag.Resolve attached a general resolution error to the disabled branch. ProviderResolutionDetail.Error() is non-nil whenever a code is set, so Client.evaluate treated a disabled flag as abnormal execution, overwrote DisabledReason with ErrorReason and returned a GENERAL error. Dropping the ResolutionError is the whole fix: Resolve already returns defaultValue on that branch, and genericResolve asserts it against itself, so the value and reason come out right on their own. Extends TestInMemoryProvider_Disabled to assert no error, and adds a client-level subtest, since the provider-level assertions cannot observe the reason being overwritten. The subtest uses an isolated API instance so the global singleton is untouched. Fixes open-feature#552 Signed-off-by: Kripa Sindhu <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe disabled in-memory provider path no longer returns a general resolution error. Tests now verify the disabled reason and nil error through both direct provider evaluation and client evaluation. ChangesDisabled flag resolution
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Disabled in-memory flags now return their configured default with a DISABLED reason rather than an error, and the behavior is covered at both provider and client levels. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #574 +/- ##
==========================================
+ Coverage 86.55% 86.64% +0.08%
==========================================
Files 22 22
Lines 2135 2134 -1
==========================================
+ Hits 1848 1849 +1
+ Misses 242 241 -1
+ Partials 45 44 -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:
|
This PR
ProviderResolutionDetail.Error() is non-nil whenever a code is set, so Client.evaluate treated a disabled flag as abnormal execution, overwrote DisabledReason with ErrorReason and returned a GENERAL error to the caller:
value=false reason="ERROR" errorCode="GENERAL" errorMessage="flag is disabled"
err=error code: GENERAL: flag is disabled
After the fix, reason DISABLED, the default value, and no error.
Related Issues
Fixes #552
Notes
How to test
go test -tags testtools -race -count=1 -run 'TestInMemoryProvider_Disabled' ./openfeature/memprovider/