feat(openfeature): add explicit RUM context enrichment - #1363
Open
btthomas wants to merge 5 commits into
Open
Conversation
1 task
btthomas
marked this pull request as ready for review
August 7, 2026 15:32
btthomas
requested review from
pavlokhrebto and
vjfridge
and removed request for
a team
August 7, 2026 15:32
There was a problem hiding this comment.
Pull request overview
This PR enriches the online Datadog OpenFeature provider’s evaluation context with the current RUM user (id/name/email + flat primitive extraInfo), aligning React Native behavior with the browser SDK and ensuring the same effective context is used for both assignment fetching and evaluation tracking.
Changes:
- Add a core helper to enrich OpenFeature-shaped contexts with the current RUM user (and expose it for the OpenFeature package while keeping compatibility with older core versions).
- Update the online OpenFeature provider to apply RUM enrichment during
initializeandonContextChange(context reconciliation). - Add unit + integration coverage and document RUM-user context behavior and reconciliation guidance.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/react-native-openfeature/src/provider.ts | Applies optional core-provided RUM context enrichment before mapping to Datadog evaluation context. |
| packages/react-native-openfeature/src/tests/provider.test.ts | Adds unit tests verifying enrichment is applied on initialize and on context change. |
| packages/react-native-openfeature/src/tests/provider.integration.test.ts | Adds integration tests validating enriched context is used for fetch + tracking and respects rumIntegrationEnabled: false. |
| packages/react-native-openfeature/src/tests/provider.compatibility.test.ts | Ensures behavior is preserved when running against older core versions without the enrichment helper. |
| packages/react-native-openfeature/README.md | Documents how RUM user defaults affect OpenFeature context and how to reconcile after user changes. |
| packages/core/src/index.tsx | Exposes the enrichment helper via an internal __ddEnrichEvaluationContextWithRumUser export. |
| packages/core/src/flags/types.ts | Updates rumIntegrationEnabled documentation to include OpenFeature context enrichment behavior. |
| packages/core/src/flags/rumIntegration.ts | Implements RUM-user-to-context enrichment logic (id → targetingKey; name/email/flat primitive extraInfo → attributes). |
| packages/core/src/flags/DdFlags.ts | Wires rumIntegrationEnabled configuration into the enrichment helper’s runtime behavior. |
| packages/core/src/flags/tests/rumIntegration.test.ts | Adds unit tests for enrichment semantics and opt-out behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+59
to
+62
| return { | ||
| ...Object.fromEntries(rumContextEntries), | ||
| ...context | ||
| } as T; |
janine-c
approved these changes
Aug 7, 2026
btthomas
force-pushed
the
blake.thomas/rum-user-evaluation-context
branch
from
August 11, 2026 20:51
b46ce00 to
b3e773f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add an explicit
enrichRumContext(applicationContext)helper for applications that want to use the current RUM user in their OpenFeature evaluation context.targetingKeyname,email, and flat primitiveextraInfovalues to evaluation attributesundefinedapplication fields as tombstones that remove corresponding RUM valuesrumIntegrationEnabledscoped to RUM evaluation tracking; it does not control the helperThe helper is point-in-time rather than a live binding. After login, logout, or an account switch, applications update the RUM user and call
OpenFeature.setContext(enrichRumContext(applicationContext))again. They should retain the original application-owned context instead of enrichingOpenFeature.getContext(), which may contain values inherited from the previous RUM user.This is implemented entirely in JavaScript/TypeScript; no Android or iOS SDK changes are needed. The provider remains usable with older compatible core package versions. Calling the new helper with an older core version produces a clear package-version error.
Acceptance plan
enrichRumContext().undefinedapplication fields remove inherited RUM values.Validation
yarn exec jest --watchman=false --runInBand --projects packages/core packages/react-native-openfeatureyarn bob buildpassed for both affected packages, including TypeScript declaration generation.git diff --checkpassed.