fix(flags): dedupe exposures by latest assignment#2987
Merged
leoromanovsky merged 4 commits intoJun 29, 2026
Conversation
This comment has been minimized.
This comment has been minimized.
860f556 to
fcc47a7
Compare
fcc47a7 to
0d2c045
Compare
🐑 PR Shepherd is maintaining this PRI watch your PR and automatically fix CI failures, rebase your branch, handle flaky tests, and push it to the merge queue when it's ready. More about what I do → Guide To pause me on this PR, add the |
barboraplasovska
left a comment
Contributor
There was a problem hiding this comment.
Looks great! But you should add a CHANGELOG entry.
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.
Motivation
DatadogFlags exposure deduplication stored the full exposure tuple as already seen. That suppressed a valid exposure when a subject and flag cycled back to a previous assignment, for example
A -> B -> A, because the finalAhad been seen before.The cache also needs to protect mobile devices while supporting the expected client high-water mark of two subjects across 2,500 flags.
Related Android PR: DataDog/dd-sdk-android#3526 applies the same mobile exposure-cache contract.
Changes
A -> B -> Awrites three exposure events.targetingKey + flagKeyas the key andallocationKey + variationKeyas the latest cached value.NSCachewith a 5,000-entrycountLimitfor the in-memory exposure assignment cache.Decisions
dd-trace-goandopenfeature-js-clientsemantics, where the dedupe key and assignment value are modeled separately so assignment changes re-emit exposures.Validation:
xcodebuild -workspace Datadog.xcworkspace -scheme DatadogFlags -destination "platform=iOS Simulator,id=32AE07AE-F88E-4FF4-A384-F6A347AA3B98" -only-testing:DatadogFlagsTests/ExposureTrackerTests -only-testing:DatadogFlagsTests/ExposureLoggerTests/testLogExposureAssignmentCycle testSKIP_LINT=1 xcodebuild -workspace Datadog.xcworkspace -scheme DatadogFlags -destination "platform=iOS Simulator,id=32AE07AE-F88E-4FF4-A384-F6A347AA3B98" test