Skip to content

Conversation

@typotter
Copy link
Contributor

@typotter typotter commented Jan 20, 2026

What does this PR do?

Adds comprehensive README documentation for the dd-sdk-android-flags-openfeature module.

Motivation

All code in this PR is from the approved feature/flags-ofeat branch. This PR only adds the missing README.md file for the OpenFeature provider module.

Additional Notes

The README provides:

  • Setup and configuration instructions
  • Basic usage examples
  • RUM integration details
  • Comparison with direct FlagsClient usage
  • Links to OpenFeature Kotlin SDK documentation for API details

typotter and others added 30 commits November 9, 2025 23:39
[flags] feat: scaffold openfeature provider module

Co-authored-by: typotter <tyler.potter@datadoghq.com>
Implements state observation API for FlagsClient:
- Add FlagsClientState sealed class (NotReady, Reconciling, Ready, Stale, Error)
- Add FlagsStateListener interface for state change callbacks
- Add StateObservable interface bundling getCurrentState, addListener, removeListener, and Flow
- Implement FlagsStateManager with ExecutorService for ordered state notifications
- Add synchronized blocks for defensive thread safety
- Expose state via client.state property
- Add StateFlow support for Kotlin coroutines
- Ensure Java compatibility
- Update NoOpFlagsClient with Ready state
- Add comprehensive tests

PR #3025
…tate

feat: State change notification for flags client (for OpenFeature)
Adds Map<String, Any?> overload for resolveStructureValue(), enabling cleaner
API for structured flags using Kotlin collections instead of JSON types.

API (backward compatible):
- resolveStructureValue(flagKey, JSONObject): JSONObject (existing)
- resolveStructureValue(flagKey, Map): Map (new overload)

The Map overload returns only primitives, null, nested Maps, and Lists - no
JSONObject or JSONArray types.

Implementation:
- JsonExtensions.kt: Recursive bidirectional Map↔JSON conversion
- String.toMap(): Direct JSON string → Map parsing
- FlagValueConverter: Recognizes Map::class for OBJECT type
- DatadogFlagsClient: Delegates to resolveValue with conversion
- NoOpFlagsClient: Returns default map

Benefits:
- Backward compatible - existing JSONObject API unchanged
- Type determines format - input type matches output type
- Enables OpenFeature integration without JSON conversion issues
Adds JSONObject and JSONArray method calls used in JsonExtensions.kt:
- JSONObject.constructor(String): Parse JSON strings
- JSONObject.get/put: Get and set values
- JSONArray.get/put: Get and add elements

These methods are used for recursive Map↔JSON conversion and are safe
within the context of the conversion logic.
feat: resolve map of primitives

Co-authored-by: typotter <tyler.potter@datadoghq.com>
…feature

Resolved conflicts:
- FlagValueConverter.kt: Auto-resolved via rerere
- NoOpFlagsClientTest.kt: Kept Map overload test from feature branch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
chore: rebase flagging-ofeat feature branch on latest from develop

Co-authored-by: typotter <tyler.potter@datadoghq.com>
Co-authored-by: dd-mergequeue[bot] <121105855+dd-mergequeue[bot]@users.noreply.github.com>
Co-authored-by: satween <1608994+satween@users.noreply.github.com>
Co-authored-by: 0xnm <4046447+0xnm@users.noreply.github.com>
Co-authored-by: aleksandr-gringauz <aleksandr.gringauz@datadoghq.com>
Co-authored-by: ambushwork <luyi1022@outlook.com>
Co-authored-by: jonathanmos <48201295+jonathanmos@users.noreply.github.com>
Co-authored-by: kikoveiga <francisco.veiga@datadoghq.com>
Co-authored-by: awforsythe <alex.forsythe@datadoghq.com>
Implements OpenFeature Provider for Datadog Feature Flags SDK, enabling
standardized feature flag management with vendor-neutral API.

Key components:
- DatadogFlagsProvider: Spec-compliant provider with blocking lifecycle
- FlagsClient.asOpenFeatureProvider(): Extension function for wrapping clients
- Type converters: Bidirectional JSON ↔ OpenFeature Value conversion
- Event observation: Filtered state change events via Kotlin Flow

OpenFeature spec compliance:
- Blocking initialize() and onContextSet() (spec 1.7)
- Proper event filtering (NotReady/Reconciling handled by SDK)
- Static-context paradigm implementation
- Error code mapping

NotReady state clarifications:
- Enhanced FlagsClientState.NotReady documentation
- NoOpFlagsClient returns NotReady (not Error) as appropriate state
- Aligns with OpenFeature NOT_READY semantics

Dependencies:
- dev.openfeature:kotlin-sdk-android:0.6.2 (118 Kb)
- kotlinx-coroutines-core-jvm:1.7.3 (1514 Kb)
- kotlinx-coroutines-test:1.7.3 (test only)
- Total transitive dependencies: 3 Mb

Test coverage:
- 147 unit tests covering all provider methods
- Type conversion edge cases
- Blocking behavior verification
- Event emission and filtering
- Add resolveStructureValue(Map) overload that returns pure Kotlin collections
- Implement JsonExtensions with bidirectional Map<->JSONObject conversion
- Add comprehensive test coverage for Map API
- Update FlagValueConverter to support all Map implementations
- Add detekt safe calls configuration for JSON methods

The Map API provides better Kotlin integration by returning nested Maps
and Lists instead of JSONObject/JSONArray types. Both APIs coexist for
compatibility.
dd-mergequeue bot and others added 4 commits January 19, 2026 18:49
…on-ofeat

[Flags] fix: add STATIC resolution reason

Co-authored-by: typotter <tyler.potter@datadoghq.com>
[Flags] feat: Add Openfeature Flags to test app.

Co-authored-by: typotter <tyler.potter@datadoghq.com>
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Jan 20, 2026

🎯 Code Coverage
Patch Coverage: 100.00%
Overall Coverage: 65.92% (+0.16%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 223d137 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@codecov-commenter
Copy link

codecov-commenter commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 88.19444% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.81%. Comparing base (6c11581) to head (223d137).

Files with missing lines Patch % Lines
...tadog/android/flags/internal/FlagValueConverter.kt 18.18% 2 Missing and 7 partials ⚠️
.../android/flags/openfeature/DatadogFlagsProvider.kt 88.64% 0 Missing and 5 partials ⚠️
.../flags/openfeature/internal/adapters/Converters.kt 88.89% 1 Missing and 1 partial ⚠️
...droid/flags/openfeature/internal/FlagsClientExt.kt 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3135      +/-   ##
===========================================
+ Coverage    70.73%   70.81%   +0.08%     
===========================================
  Files          893      899       +6     
  Lines        33000    33138     +138     
  Branches      5549     5592      +43     
===========================================
+ Hits         23341    23465     +124     
- Misses        8102     8109       +7     
- Partials      1557     1564       +7     
Files with missing lines Coverage Δ
...atadog/android/flags/openfeature/FlagsClientExt.kt 100.00% <100.00%> (ø)
...s/openfeature/internal/adapters/ValueConverters.kt 100.00% <100.00%> (ø)
...in/kotlin/com/datadog/android/flags/FlagsClient.kt 36.61% <ø> (+0.09%) ⬆️
...tadog/android/flags/internal/DatadogFlagsClient.kt 92.59% <100.00%> (+0.09%) ⬆️
...m/datadog/android/flags/internal/JsonExtensions.kt 100.00% <100.00%> (ø)
.../datadog/android/flags/internal/NoOpFlagsClient.kt 93.75% <100.00%> (+0.42%) ⬆️
...om/datadog/android/flags/model/ResolutionReason.kt 100.00% <100.00%> (ø)
...droid/flags/openfeature/internal/FlagsClientExt.kt 85.71% <85.71%> (ø)
.../flags/openfeature/internal/adapters/Converters.kt 88.89% <88.89%> (ø)
.../android/flags/openfeature/DatadogFlagsProvider.kt 88.64% <88.64%> (ø)
... and 1 more

... and 31 files with indirect coverage changes

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

@typotter typotter changed the title Typo/merge ofeat into main Add OpenFeature Provider README Jan 20, 2026
@typotter typotter changed the title Add OpenFeature Provider README [Flags] Merge OpenFeature (feature/flags-ofeat) into develop Jan 20, 2026
@typotter typotter marked this pull request as ready for review January 20, 2026 16:35
@typotter typotter requested review from a team as code owners January 20, 2026 16:35
Copy link
Member

@0xnm 0xnm left a comment

Choose a reason for hiding this comment

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

Should we add a new module to the Gitlab CI setup as well for it to be published? Or it will be in another PR?

Also let's wait for the @DataDog/documentation review of README and we are good to go.


**Important notes:**
- The targeting key must be consistent for the same user or entity to ensure consistent flag evaluation across requests.
- For anonymous users, use a **persistent UUID** as the targeting key (store it in `SharedPreferences`).
Copy link
Member

Choose a reason for hiding this comment

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

nit: customers may use any other persistent storage, not necessary it should be SharedPreferences

@typotter
Copy link
Contributor Author

Should we add a new module to the Gitlab CI setup as well for it to be published? Or it will be in another PR?

I thought the recent changes (#3122) to the ci pipeline included everything? @aleksandr-gringauz to confirm?

brett0000FF
brett0000FF previously approved these changes Jan 20, 2026
@0xnm
Copy link
Member

0xnm commented Jan 20, 2026

@typotter you are completely right, I forgot about this change. No need to to any changes in Gitlab CI pipeline then.

Co-authored-by: Nikita Ogorodnikov <4046447+0xnm@users.noreply.github.com>
@typotter
Copy link
Contributor Author

Thanks guys. ptal for the recent changes

0xnm
0xnm previously approved these changes Jan 21, 2026
@typotter
Copy link
Contributor Author

sorry @0xnm - just pushed a docs tweak I missed.

@typotter typotter requested a review from 0xnm January 21, 2026 07:58
@typotter
Copy link
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351
Copy link

gh-worker-devflow-routing-ef8351 bot commented Jan 21, 2026

View all feedbacks in Devflow UI.

2026-01-21 07:59:16 UTC ℹ️ Start processing command /merge
Use /merge -c to cancel this operation!


2026-01-21 07:59:21 UTC ℹ️ MergeQueue: waiting for PR to be ready

This pull 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. View in MergeQueue UI.
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.

Use /merge -c to cancel this operation!


⏳ Processing

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.

5 participants