Skip to content

[Flags] feat: PROVIDER_NOT_READY state#2967

Merged
dd-mergequeue[bot] merged 5 commits into
feature/feature-flaggingfrom
typo/FFL-1188-api-spec-verification
Oct 24, 2025
Merged

[Flags] feat: PROVIDER_NOT_READY state#2967
dd-mergequeue[bot] merged 5 commits into
feature/feature-flaggingfrom
typo/FFL-1188-api-spec-verification

Conversation

@typotter

@typotter typotter commented Oct 24, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

Implements provider readiness state tracking for the Flags SDK by adding the PROVIDER_NOT_READY error code and enforcing that flag resolution cannot occur until setEvaluationContext() has been called at least once.

Motivation

The mobile API spec requires proper error handling when flags are evaluated before the provider is ready. This ensures:

  1. Clear developer feedback: Developers get explicit error messages when attempting to use flags before initialization
  2. OpenFeature alignment: Follows the OpenFeature error code standards for multi-provider compatibility
  3. Graceful degradation: Returns default values with error details rather than crashing or silently failing
  4. API spec compliance: Implements requirements from lines 101-133 of the mobile API spec

Before this change, attempting to resolve flags before setEvaluationContext() would return FLAG_NOT_FOUND errors, which was misleading since the real issue was that the client wasn't ready yet.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@typotter
typotter marked this pull request as ready for review October 24, 2025 05:42
@typotter
typotter requested review from a team as code owners October 24, 2025 05:42
@codecov-commenter

codecov-commenter commented Oct 24, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.83%. Comparing base (38bd253) to head (719eea9).

Additional details and impacted files
@@                     Coverage Diff                      @@
##           feature/feature-flagging    #2967      +/-   ##
============================================================
+ Coverage                     70.81%   70.83%   +0.02%     
============================================================
  Files                           840      840              
  Lines                         30547    30559      +12     
  Branches                       5167     5169       +2     
============================================================
+ Hits                          21629    21644      +15     
  Misses                         7451     7451              
+ Partials                       1467     1464       -3     
Files with missing lines Coverage Δ
...tadog/android/flags/internal/DatadogFlagsClient.kt 91.55% <100.00%> (+3.49%) ⬆️
.../datadog/android/flags/internal/NoOpFlagsClient.kt 95.83% <100.00%> (+19.64%) ⬆️
...otlin/com/datadog/android/flags/model/ErrorCode.kt 100.00% <100.00%> (ø)

... and 44 files with indirect coverage changes

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

0xnm
0xnm previously approved these changes Oct 24, 2025
verify(mockInternalLogger).log(
eq(InternalLogger.Level.ERROR),
eq(InternalLogger.Target.USER),
any(),

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.

nit: it is better to verify the message, otherwise assertion is too wide.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

verified message.

@typotter
typotter force-pushed the typo/FFL-1188-api-spec-verification branch from 82cee14 to 719eea9 Compare October 24, 2025 07:49

@typotter typotter left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks @0xnm . PTAL

@typotter
typotter requested a review from 0xnm October 24, 2025 07:50
@typotter

Copy link
Copy Markdown
Contributor Author

/merge

@dd-devflow-routing-codex

dd-devflow-routing-codex Bot commented Oct 24, 2025

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2025-10-24 08:01:14 UTC ℹ️ Start processing command /merge


2025-10-24 08:01:20 UTC ℹ️ MergeQueue: waiting for PR to be ready

This merge request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2025-10-24 08:37:16 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in feature/feature-flagging is approximately 1h (p90).


2025-10-24 09:31:03 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue
dd-mergequeue Bot merged commit 412d3f3 into feature/feature-flagging Oct 24, 2025
26 checks passed
@dd-mergequeue
dd-mergequeue Bot deleted the typo/FFL-1188-api-spec-verification branch October 24, 2025 09:31
This was referenced Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants