Skip to content

FFL-2510: Thread allocationKey into FlagDetails and OpenFeature flagMetadata#1303

Open
typotter wants to merge 4 commits into
developfrom
typo/thread-allocation-key-to-flag-details-metadata
Open

FFL-2510: Thread allocationKey into FlagDetails and OpenFeature flagMetadata#1303
typotter wants to merge 4 commits into
developfrom
typo/thread-allocation-key-to-flag-details-metadata

Conversation

@typotter

@typotter typotter commented Jun 11, 2026

Copy link
Copy Markdown

What

FFL-2510 — threads `allocationKey` from the flag assignment into OpenFeature `flagMetadata`, consistent with Android (dd-sdk-android#3534) and iOS (dd-sdk-ios#2989).

Threading flow

Wire JSON → `FlagCacheEntry.allocationKey` → `FlagDetails.allocationKey` (already present) → `toFlagResolution()` sets `flagMetadata: { allocationKey }`

Changes

  • `packages/react-native-openfeature/src/provider.ts`: `toFlagResolution` now sets `flagMetadata: allocationKey ? { allocationKey } : undefined`

Tests

Tests cover `allocationKey` appearing in `flagMetadata` and `undefined` when absent.

FFL-2510

…tadata

- Add extraLogging field to FlagDetails<T> typed as Record<string, PrimitiveValue>
- Add buildExtraLogging helper in FlagsClient that filters to primitives and drops allocationKey key
- Populate extraLogging in getDetails from flag cache entry
- Update toFlagResolution in provider.ts to spread extraLogging into flagMetadata, with allocationKey winning on collision
- Add __mocks__/react-native.ts to openfeature package for test infrastructure
- Add provider.test.ts covering extraLogging threading and allocationKey collision semantics
Copilot AI review requested due to automatic review settings June 11, 2026 22:05
@typotter typotter requested review from a team as code owners June 11, 2026 22:05

Copilot AI 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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

…ation

- Fix prettier formatting on multi-line import in FlagsClient.ts
- Add curly braces to if/continue statements in buildExtraLogging (curly rule)
- Fix import ordering and remove blank line between same-section imports in provider.test.ts (arca rules)
- Narrow flagMetadata type to Record<string, string | number | boolean> in provider.ts to match OpenFeature FlagMetadata; filter null values when building flagMetadata
@typotter typotter changed the base branch from main to develop June 12, 2026 04:35
@typotter typotter requested a review from Copilot June 12, 2026 04:56

Copilot AI 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.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment on lines +171 to +188
// Build flagMetadata: extraLogging primitives first, allocationKey last (wins on collision).
// OpenFeature FlagMetadata does not support null values, so null entries are omitted.
let flagMetadata: Record<string, string | number | boolean> | undefined;
const hasExtraLogging =
extraLogging && Object.keys(extraLogging).length > 0;
if (allocationKey || hasExtraLogging) {
flagMetadata = {};
if (extraLogging) {
for (const [k, v] of Object.entries(extraLogging)) {
if (v !== null) {
flagMetadata[k] = v;
}
}
}
if (allocationKey) {
flagMetadata.allocationKey = allocationKey;
}
}
@evazorro evazorro removed the request for review from a team June 12, 2026 16:24
@evazorro

Copy link
Copy Markdown

It looks like this PR didn't actually touch any docs files, so I've dismissed documentation as a reviewer. Let me know if I missed something, though!

typotter added 2 commits June 15, 2026 08:51
hasExtraLogging now checks for at least one non-null value rather than
any key at all, so extraLogging with only null entries no longer
produces an empty {} flagMetadata when allocationKey is absent.
Only allocationKey is surfaced in flagMetadata; extraLogging is no
longer built or stored on FlagDetails. Remove buildExtraLogging(),
FlagDetails.extraLogging, and related provider logic and tests.
Copilot AI review requested due to automatic review settings June 18, 2026 20:14
@typotter typotter closed this Jun 18, 2026

Copilot AI 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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment on lines 8 to 13
import type {
FlagDetails,
FlagsClient,
EvaluationContext as DdEvaluationContext
EvaluationContext as DdEvaluationContext,
PrimitiveValue
} from '@datadog/mobile-react-native';
Comment on lines +63 to +66
expect(result.flagMetadata).toEqual({
allocationKey: 'alloc-xyz'
});
});
@typotter typotter reopened this Jun 18, 2026
@sbarrio sbarrio requested review from marco-saia-datadog and removed request for marco-saia-datadog June 19, 2026 10:45
@typotter typotter changed the title FFL-2510: Thread extraLogging into FlagDetails and OpenFeature flagMetadata FFL-2510: Thread allocationKey into FlagDetails and OpenFeature flagMetadata Jun 19, 2026
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.

3 participants