Skip to content

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

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

FFL-2510: Thread extraLogging into FlagDetails and OpenFeature flagMetadata#1303
typotter wants to merge 2 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 extraLogging primitive values from the flag assignment into FlagDetails.extraLogging and then into OpenFeature flagMetadata, consistent with Android and iOS.

FlagDetails<T> already had allocationKey; this PR adds extraLogging and ensures both are surfaced in flagMetadata. The internal FlagCacheEntry already parsed extraLogging from the wire format — this PR just propagates it to the public surface.

Threading flow

Wire JSON → FlagCacheEntry.extraLogging (already parsed) → buildExtraLogging() filters to primitives, skips "allocationKey" key → FlagDetails.extraLoggingtoFlagResolution() spreads into flagMetadataallocationKey written last (wins on collision)

Changes

  • packages/core/src/flags/types.ts: Added extraLogging?: Record<string, PrimitiveValue> to FlagDetails<T>
  • packages/core/src/flags/FlagsClient.ts: getDetails populates extraLogging via buildExtraLogging helper (primitive filter + allocationKey skip)
  • packages/react-native-openfeature/src/provider.ts: toFlagResolution spreads extraLogging into flagMetadata, then sets allocationKey last

Tests

14 new tests across FlagsClient.test.ts and provider.test.ts. 1099/1100 tests pass — the 1 skip is a pre-existing skipped test unrelated to this change.

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!

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