Skip to content

feat(flags): send the split serial ID on iOS exposure events (EX-3422) - #1410

Draft
danyal002 wants to merge 1 commit into
developfrom
danyal.khan/EX-3422-ios
Draft

feat(flags): send the split serial ID on iOS exposure events (EX-3422)#1410
danyal002 wants to merge 1 commit into
developfrom
danyal.khan/EX-3422-ios

Conversation

@danyal002

Copy link
Copy Markdown

What does this PR do?

The iOS bridge now sends the split serial ID on feature flag exposure events.

File Change
packages/core/DatadogSDKReactNative.podspec and 2 other podspecs Moves the iOS SDK to 3.17.0.
packages/core/ios/Sources/DdFlagsImplementation.swift Reads and writes serialId in both bridge directions.
packages/core/ios/Tests/DdFlagsTests.swift Adds 6 tests.

iOS SDK 3.17.0 adds serialID to FlagAssignment, reads it on the exposure event, and includes it in the exposure deduplication cache. The React Native bridge supplies the value.

The bridge converts a FlagAssignment to an NSDictionary with a fixed key list, and converts the dictionary back for exposure tracking. The key list omitted the serial ID. The value was therefore dropped in both directions, and the code still compiled.

The serial ID crosses the bridge as a string. Android does the same, because React Native converts integers to Double. An assignment with no serial ID omits the key instead of sending NSNull.

The reader accepts a string only. NSNumber and Bool bridge into each other on Apple platforms, so a numeric branch would read a boolean true as serial ID 1. Int(String) rejects a boolean, and rejects any other value that is not an integer. A malformed serial ID yields no serial ID. It never rejects the assignment, because that would drop the exposure event for the whole flag.

Serial IDs are zero-based for each org. 0 is therefore a real value, and two tests pin it.

Motivation

The UFC compiler rewrites a holdout into an ordinary allocation before any SDK reads the flag configuration. An exposure event therefore records no holdout. The split serial ID is the only link back to it. An exposure event without the serial ID cannot be resolved to a holdout.

Additional Notes

Testing. The new tests cover the string form, serial ID 0 in both directions, an absent serial ID omitting the key, four malformed values, and a round trip through both conversions.

Risks. The iOS SDK bump from 3.16.0 to 3.17.0 carries every other change in that release.

The bridge ignores a numeric serial ID, whereas the Android bridge accepts a string or a number. Both JavaScript producers send a string, so no current caller depends on the numeric shape. A test pins the numeric case as ignored, so the difference is deliberate and visible.

The offline path also needs the serial ID. PR #1409 covers that, and covers Android.

Bump the iOS SDK to 3.17.0, which adds serialID to FlagAssignment, and
send the value through the React Native bridge.

The iOS bridge converts FlagAssignment to an NSDictionary with a fixed key
list, and converts it back for exposure tracking. The key list omitted the
serial ID, so the value was dropped in both directions. The code still
compiled, so nothing reported the loss.

The serial ID crosses the bridge as a string, for parity with Android,
which sends a string because React Native converts integers to Double. An
assignment with no serial ID omits the key instead of sending NSNull.

The reader accepts a string only. NSNumber and Bool bridge into each other
on Apple platforms, so a numeric branch would read a boolean true as serial
ID 1. Int(String) rejects that. A malformed serial ID yields no serial ID
and never rejects the assignment, because that would drop the exposure
event for the whole flag.
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Sep 9, 2026

Copy link
Copy Markdown

Pipelines  Tests

Unblock PR with BitsAI

⚠️ Warnings

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 3 Pipeline jobs failed

DataDog/dd-sdk-reactnative | test:native-ios — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

DataDog/dd-sdk-reactnative | test:native-ios-newarch

View more details · View in GitLab

DataDog/dd-sdk-reactnative | test:native-ios-sr

View more details · View in GitLab

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 40d16b5 | Docs | View more details | Give us feedback!

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.

1 participant