[AI-FSSDK] [FSSDK-12813] Normalize decision event campaign_id, variation_id, and entity_id#518
Open
jaeopt wants to merge 5 commits into
Open
[AI-FSSDK] [FSSDK-12813] Normalize decision event campaign_id, variation_id, and entity_id#518jaeopt wants to merge 5 commits into
jaeopt wants to merge 5 commits into
Conversation
…ing per updated spec
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 ID fields uniformly across every decision type (experiment, feature test, rollout, holdout) in the event-builder layer so the wire payload is byte-equivalent across SDKs for the same input.
decisions[].campaign_idand impressionevents[].entity_idfall back toexperiment_idonly when the value is empty string orNone— any non-empty string (numeric like"12345"or opaque like"default-12345","layer_abc") passes through unchanged.decisions[].variation_idretains the strict numeric-string contract and falls back toNonefor empty/whitespace/non-numeric input. The path never logs, raises, or drops dispatch.Changes
optimizely/event/event_id_normalizer.pywith pure helpers (is_non_empty_string,is_numeric_id_string,normalize_campaign_id,normalize_variation_id).normalize_campaign_idaccepts any non-empty string and falls back toexperiment_idonly on empty/None;normalize_variation_idkeeps the strict decimal-digit contract and returnsNoneotherwise.event_factory.py(current) andevent_builder.py(legacy) on the single impression path so both producers emit identical output.campaign_idforevents[].entity_idso the two fields are byte-equivalent by construction. TypedDecision.variation_idasOptional[str]so invalid inputs serialize as JSONnull.campaign_id/entity_idand null normalization forvariation_id.Jira Ticket
FSSDK-12813