[AI-FSSDK] [FSSDK-12813] Normalize decision event campaign_id, variation_id, and entity_id#455
Open
jaeopt wants to merge 1 commit into
Open
[AI-FSSDK] [FSSDK-12813] Normalize decision event campaign_id, variation_id, and entity_id#455jaeopt wants to merge 1 commit into
jaeopt wants to merge 1 commit 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 the
campaign_id,variation_id, andentity_idfields on outgoing decision events uniformly across every decision type (experiment, feature test, rollout, holdout) so the SDK emits cross-SDK byte-equivalent wire output.decisions[].campaign_idand impressionevents[].entity_idfall back toexperiment_idwhen invalid;decisions[].variation_idbecomes JSONnull. The path never logs, errors, or blocks event dispatch.Changes
pkg/event/event_id_normalizer.gowith three pure helpers (IsNumericIDString,NormalizeCampaignID,NormalizeVariationIDreturning*string).pkg/event/factory.go—createImpressionEventnormalizes fromexperiment.LayerID(falling back toexperiment.IDfor holdouts, which have no layer) and reuses the same value forEntityID.createImpressionVisitorre-applies normalization as defense-in-depth so the two fields cannot drift. Conversion path is untouched.Decision.VariationIDto*stringso non-numeric upstream values marshal to JSONnull, matching the cross-SDK contract and the existing nullable-field convention used byDecisionMetadata.CmabUUID.holdout_123,holdout_var_123) with numeric IDs, updated holdout assertions to the normalized output with inlineFSSDK-12813references, and added unit and integration coverage for the new helpers and the full wire payload.Notes
Decision.VariationIDchanging fromstringto*stringis a Go-source-level breaking change for any downstream consumer that constructsevent.Decisionliterals directly (no such usages exist in this repo outside the event package itself). The on-the-wire JSON contract is unchanged in shape and more permissive in values.Jira Ticket
FSSDK-12813