Skip to content

fix: Correct logic for evaluation blocked for ERROR and STALE providers#96

Merged
NeaguGeorgiana23 merged 6 commits into
mainfrom
fix_provider_evaluation
Jun 23, 2026
Merged

fix: Correct logic for evaluation blocked for ERROR and STALE providers#96
NeaguGeorgiana23 merged 6 commits into
mainfrom
fix_provider_evaluation

Conversation

@NeaguGeorgiana23

Copy link
Copy Markdown
Contributor

This PR

Fixes the flag evaluation which was incorrectly blocked when the feature provider was in ERROR or STALE states.

Previously, the SDK short-circuited evaluation for any provider status other than READY. This PR updates the EvaluateFlag logic to strictly follow the OpenFeature specification by:

  • Short-circuiting and returning the PROVIDER_NOT_READY error code only when the provider is NOT_READY (Requirement 1.7.6).
  • Short-circuiting and returning the PROVIDER_FATAL error code only when the provider is in a FATAL error state (Requirement 1.7.7).
  • Allowing evaluation to proceed for READY, ERROR, and STALE states, ensuring cached values can still be returned when appropriate.

Related Issues

Fixes #69

Notes

  • Implements compliance for OpenFeature specification Requirements 1.7.6 and 1.7.7.
  • Remaining minor bugs from the tracking issue will be addressed in subsequent PRs.

Follow-up Tasks

  • Address remaining minor bugs in the compliance tracking issue

Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
@NeaguGeorgiana23 NeaguGeorgiana23 requested review from a team as code owners May 11, 2026 07:23

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the EvaluateFlag method in ClientAPI to explicitly handle different provider statuses. It replaces the generic non-ready check with specific logic for ProviderStatus::kNotReady and ProviderStatus::kFatal, ensuring that a fatal provider state returns the appropriate ErrorCode::kProviderFatal. I have no feedback to provide as there were no review comments to evaluate.

Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
@NeaguGeorgiana23 NeaguGeorgiana23 changed the title Correct logic for evaluation blocked for ERROR and STALE providers fix: Correct logic for evaluation blocked for ERROR and STALE providers May 11, 2026
@toddbaert toddbaert self-requested a review May 26, 2026 19:14

@toddbaert toddbaert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could possibly benefit from test coverage but I'll let you decide if the tradeoff is worth it.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 53eee438-45fb-4969-a618-436653821d93

📥 Commits

Reviewing files that changed from the base of the PR and between 9a98411 and a43a6e7.

📒 Files selected for processing (1)
  • test/client_api_test.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/client_api_test.cpp

📝 Walkthrough

Walkthrough

ClientAPI::EvaluateFlag replaces a single != kReady check with two explicit branches: kNotReady returns kProviderNotReady with "Provider is not ready", and kFatal returns kProviderFatal with a distinct error message. New test cases validate that evaluations are blocked for kNotReady and kFatal states, and proceed for kError and kStale states with cached results.

Changes

Provider Fatal Error Code Fix

Layer / File(s) Summary
EvaluateFlag provider status branching
openfeature/client_api.h
Splits the former single != kReady branch into kNotReadykProviderNotReady and kFatalkProviderFatal, each with its own error message.
Test coverage for provider status handling
test/client_api_test.cpp
Adds ErrorCode imports and new ClientAPITest cases validating that evaluations block for kNotReady/kFatal states and proceed for kError/kStale states with cached results.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • open-feature/cpp-sdk#97: Also modifies ClientAPI::EvaluateFlag error-handling paths in the same file, refactoring evaluation failure and exception handling via StatusOr.

Suggested reviewers

  • oxddr
  • toddbaert
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. 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 accurately summarizes the main change: fixing evaluation logic for ERROR and STALE providers, which is the primary objective of this PR.
Description check ✅ Passed The description clearly explains what was fixed, why it matters, and references the linked specification requirements.
Linked Issues check ✅ Passed The PR implements the required fixes from issue #69: distinguishing PROVIDER_NOT_READY from PROVIDER_FATAL errors and allowing evaluation for ERROR/STALE providers.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the evaluation logic for provider states as specified in the linked issue #69.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
@NeaguGeorgiana23 NeaguGeorgiana23 force-pushed the fix_provider_evaluation branch from 97527dc to 9a98411 Compare June 23, 2026 12:03
@NeaguGeorgiana23 NeaguGeorgiana23 force-pushed the fix_provider_evaluation branch from 9a98411 to a43a6e7 Compare June 23, 2026 12:08
@NeaguGeorgiana23 NeaguGeorgiana23 merged commit 9610f71 into main Jun 23, 2026
5 checks passed
NeaguGeorgiana23 pushed a commit that referenced this pull request Jun 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.1.1](v0.1.0...v0.1.1)
(2026-06-23)


### Bug Fixes

* Correct logic for evaluation blocked for ERROR and STALE providers
([#96](#96))
([9610f71](9610f71))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>
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.

Specification Compliance Review

3 participants