[AI-FSSDK] [FSSDK-12813] Normalize decision event campaign_id, variation_id, and entity_id#415
Open
jaeopt wants to merge 2 commits into
Open
[AI-FSSDK] [FSSDK-12813] Normalize decision event campaign_id, variation_id, and entity_id#415jaeopt wants to merge 2 commits into
jaeopt wants to merge 2 commits into
Conversation
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
Normalize three decision-event fields uniformly across every decision type (experiment, feature test, rollout, holdout) in the event-builder layer so the wire output is byte-equivalent across SDKs for the same input.
decisions[].campaign_idand impressionevents[].entity_idaccept any non-empty string (including opaque IDs like"default-12345"or"layer_abc") and fall back toexperiment_idonly when the value is null or empty string.decisions[].variation_idretains the stricter numeric-string contract and falls back tonullfor empty / whitespace / non-numeric values. Non-string types are out of scope. Conversion-evententity_idis unchanged. The path never logs, throws, or blocks dispatch.Changes
OptimizelySDK/Utils/EventIdNormalizer.csencapsulating the rules with two validators:IsNonEmptyString(forcampaign_id/entity_id) andIsNumericIdString(forvariation_id).NormalizeCampaignIdfalls back toexperiment_idonly when the input is null or"";NormalizeVariationIdfalls back tonullwhen the input is not a non-empty decimal-digit string.EventFactory.CreateVisitor(ImpressionEvent)and the obsoleteEventBuilder.GetImpressionParamsso both paths stay byte-equivalent. Impressionentity_idreuses the normalizedcampaign_id.TestCreateImpressionEventRemovesInvalidAttributesFromPayloadRolloutremains correct under the relaxed contract (nullLayerIdstill triggers fallback to emptyexperiment_id). Unit and integration tests updated for the relaxedcampaign_id/entity_idcontract: opaque non-empty strings (e.g."default-12345","layer_abc","variation_a") now pass through unchanged; only null and""trigger theexperiment_idfallback. AddedIsNonEmptyStringunit coverage, an opaque-LayerId pass-through integration test, an empty-LayerId fallback integration test, and a null-LayerId uniform-across-rule-types companion test.variation_idtests are unchanged.Jira Ticket
FSSDK-12813