Skip to content

fix(multi): map FLAG_NOT_FOUND and TARGETING_KEY_MISSING to ErrorReason - #593

Open
chiliec wants to merge 1 commit into
open-feature:mainfrom
chiliec:fix-multiprovider-error-reasons
Open

chiliec wants to merge 1 commit into
open-feature:mainfrom
chiliec:fix-multiprovider-error-reasons

Conversation

@chiliec

@chiliec chiliec commented Sep 17, 2026

Copy link
Copy Markdown

Closes #560.

Problem

In openfeature/multi/isolation.go, toProviderResolutionDetail maps two error codes to reasons that assert success:

  • FlagNotFoundCodeof.DefaultReason
  • TargetingKeyMissingCodeof.TargetingMatchReason (a targeting match reported as the reason for a missing targeting key)

Every other error code in the switch maps to of.ErrorReason.

Fix

Map both to of.ErrorReason. Per spec requirement 1.4.9, in cases of abnormal execution the reason field SHOULD indicate an error.

Tests

Added Test_toProviderResolutionDetail_ErrorCodesMapToErrorReason — a table test asserting every error code produces ErrorReason and a non-nil Error().

Validation:

make mockgen
go test -tags testtools -race ./openfeature/multi/
ok  	github.com/open-feature/go-sdk/openfeature/multi	1.297s
go vet -tags testtools ./openfeature/multi/   # clean

Confirmed RED before the fix (the flag not found and targeting key missing subtests failed with expected: "ERROR") and GREEN after.

toProviderResolutionDetail mapped FlagNotFoundCode to DefaultReason and
TargetingKeyMissingCode to TargetingMatchReason, reporting success reasons
for error codes. Per spec requirement 1.4.9, abnormal execution SHOULD set
reason to indicate an error. Map both to ErrorReason, consistent with the
other error codes in the switch.

Closes open-feature#560

Signed-off-by: Vladimir Babin <vovababin@gmail.com>
@chiliec
chiliec requested review from a team as code owners September 17, 2026 02:32
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: b4d64ab7-4928-4916-a960-3167f86fbf6f

📥 Commits

Reviewing files that changed from the base of the PR and between 8f9f17d and 62b392d.

📒 Files selected for processing (2)
  • openfeature/multi/isolation.go
  • openfeature/multi/isolation_test.go

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The change maps FlagNotFoundCode and TargetingKeyMissingCode to of.ErrorReason. Table-driven tests cover six error codes and verify that each produces an error.

Changes

Resolution error reason mapping

Layer / File(s) Summary
Error reason mapping and validation
openfeature/multi/isolation.go, openfeature/multi/isolation_test.go
FlagNotFoundCode and TargetingKeyMissingCode now use of.ErrorReason. Tests cover six error codes and verify error results.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: toddbaert

Merge Risk: ⚪ Minimal · up to 62b39

The targeted error-reason mappings and regression coverage align with the intended behavior, so the change is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: mapping FLAG_NOT_FOUND and TARGETING_KEY_MISSING to ErrorReason.
Description check ✅ Passed The description directly explains the incorrect mappings, the fix, the specification basis, and the added validation for the changeset.
Linked Issues check ✅ Passed Issue #560 requires FlagNotFoundCode and TargetingKeyMissingCode to map to of.ErrorReason. The PR summary states that openfeature/multi/isolation.go applies of.ErrorReason to both cases. The…
Out of Scope Changes check ✅ Passed The reported changes are limited to the two reason mappings in openfeature/multi/isolation.go and focused table-driven tests in openfeature/multi/isolation_test.go. These changes directly support …
  • Fix all pre-merge checks with AI

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

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] multiprovider: toProviderResolutionDetail maps FLAG_NOT_FOUND and TARGETING_KEY_MISSING to non-error reasons

1 participant