Skip to content

fix(multi): preserve provider reason on successful evaluations - #632

Merged
erka merged 2 commits into
open-feature:mainfrom
Anurag-S1ngh:fix-626-preserve-success-reason
Oct 26, 2026
Merged

erka merged 2 commits into
open-feature:mainfrom
Anurag-S1ngh:fix-626-preserve-success-reason

Conversation

@Anurag-S1ngh

Copy link
Copy Markdown
Contributor

Fixes #626

When a flag is evaluated successfully through the multi provider,
toProviderResolutionDetail returned an empty Reason because it only
set reason inside the error-code switch.

Preserve evalDetails.Reason when no error code is set; ERROR is still
set only on error paths.

Tests:

  • Test_toProviderResolutionDetail_PreservesSuccessReason
  • Test_HookIsolator_PreservesSuccessReason
  • go test -tags testtools -short -race ./openfeature/... green

@Anurag-S1ngh
Anurag-S1ngh requested review from a team as code owners October 25, 2026 10:28
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ce160d92-3e0f-4d6f-96b7-a29188044134
Commits

Reviewing files that changed from the base of the PR and between 938bad5 and 37d4b84.

Files selected for processing: 1
  • openfeature/multi/isolation.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The multi-provider conversion now retains the evaluation reason when the error code is empty. Its default branch returns a general resolution error with ErrorReason. Tests cover successful resolution details and Boolean evaluation through the hook isolator.

Changes: Multi-provider reason preservation

Layer / File(s) Summary
Preserve reasons in multi-provider evaluations
openfeature/multi/isolation.go, openfeature/multi/isolation_test.go
The conversion retains the provider’s reason when no error code is set and returns a general resolution error in the default branch. Tests check successful evaluations retain reason, variant, and flag metadata without producing an error.

Priority: Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related PRs

Suggested reviewers: erka

Merge Risk: Minimal · up to 37d4b

The PR meets its stated goal without an established merge-blocking regression.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the primary change: preserving the provider reason for successful evaluations through the multi provider.
Description check Passed The description directly explains the bug, the fix, the expected error behavior, and the tests for the changeset.
Linked Issues check Passed Issue #626 requires preserving the provider Reason on successful multi-provider evaluations and returning ERROR only for error codes. toProviderResolutionDetail now copies evalDetails.Reason w…
Out of Scope Changes check Passed The pull request changes only openfeature/multi/isolation.go and its focused test file. The implementation and tests directly support issue #626. No unrelated changes are present in the reviewed dif…
Full details: Linked Issues check

Explanation

Issue #626 requires preserving the provider Reason on successful multi-provider evaluations and returning ERROR only for error codes. toProviderResolutionDetail now copies evalDetails.Reason when ErrorCode is empty and keeps the error mapping for error paths. Tests cover the conversion and HookIsolator path, including reason, variant, metadata, and no error.

Full details: Out of Scope Changes check

Explanation

The pull request changes only openfeature/multi/isolation.go and its focused test file. The implementation and tests directly support issue #626. No unrelated changes are present in the reviewed diff.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@sahidvelji
sahidvelji enabled auto-merge (squash) October 25, 2026 15:39
@codecov

codecov Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.93%. Comparing base (28127ef) to head (37d4b84).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #632   +/-   ##
=======================================
  Coverage   90.93%   90.93%           
=======================================
  Files          22       22           
  Lines        2239     2240    +1     
=======================================
+ Hits         2036     2037    +1     
  Misses        164      164           
  Partials       39       39           
Flag Coverage Δ
e2e 90.93% <100.00%> (+<0.01%) ⬆️
unit 90.93% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

toProviderResolutionDetail only set reason inside the error-code switch,
dropping the underlying provider reason (e.g. TARGETING_MATCH) on success.
Preserve evalDetails.Reason when no error code is set; ERROR is still set
only on error paths.

Fixes open-feature#626

Signed-off-by: Anurag-S1ngh <anuragsingh2313@gmail.com>
auto-merge was automatically disabled October 26, 2026 06:57

Head branch was pushed to by a user without write access

@Anurag-S1ngh
Anurag-S1ngh force-pushed the fix-626-preserve-success-reason branch from dc6a6bf to 938bad5 Compare October 26, 2026 06:57
Signed-off-by: Roman Dmytrenko <rdmytrenko@gmail.com>
@erka
erka merged commit b20d284 into open-feature:main Oct 26, 2026
7 checks passed
@erka

erka commented Oct 26, 2026

Copy link
Copy Markdown
Member

Thanks @Anurag-S1ngh!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Multi provider drops the provider's reason on successful evaluations

3 participants