[AI-FSSDK] [FSSDK-12813] Normalize decision event campaign_id, variation_id, and entity_id#634
Open
jaeopt wants to merge 4 commits into
Open
[AI-FSSDK] [FSSDK-12813] Normalize decision event campaign_id, variation_id, and entity_id#634jaeopt wants to merge 4 commits into
jaeopt wants to merge 4 commits into
Conversation
…ing per updated spec Per the updated FSSDK-12813 spec, decision-event campaign_id and impression entity_id only require a non-empty string (IDs may be opaque, e.g. "default-12345" or "layer_abc"). Fallback to experiment_id now fires only when the value is null or "". variation_id retains the stricter numeric-string-only contract. - EventIdNormalizer: add isNonEmptyString predicate and route normalizeCampaignId through it; isNumericString and normalizeVariationId unchanged. - EventIdNormalizerTest: add isNonEmptyString coverage; flip normalizeCampaignId tests so non-numeric/whitespace inputs assert passthrough; variation_id assertions unchanged. - EventFactoryNormalizationTest: flip whitespace and non-numeric campaign_id tests to passthrough; split the uniform-across-rule-types test into opaque-passthrough and null-fallback variants; update entity_id-mirrors-campaign_id and event-never-dropped tests to use null/empty for the campaign_id fallback path and a non-numeric value only for the variation_id null path.
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 identifier fields uniformly across every decision type (experiment, feature test, rollout, holdout) in the event-builder layer.
decisions[].campaign_idand impressionevents[].entity_idfall back toexperiment_idonly whennullor""(any non-empty string passes through unchanged, since IDs may be opaque, e.g."default-12345"or"layer_abc");decisions[].variation_idfalls back tonullwhen null, empty, whitespace, or non-numeric. The path never logs, throws, or blocks event dispatch.Changes
core-api/.../event/internal/EventIdNormalizerwith four pure helpers (isNonEmptyString,isNumericString,normalizeCampaignId,normalizeVariationId).normalizeCampaignIdaccepts any non-empty string as-is and falls back toexperiment_idonly onnull/ empty input;normalizeVariationIdkeeps the strict numeric-string-only contract and falls back tonullfor anything else.EventFactory.createVisitor(ImpressionEvent)on the single impression path so the same rules apply to all decision types. Impressionentity_idmirrors the normalizedcampaign_idbyte-for-byte; conversionentity_idis unchanged.OptimizelyTestandOptimizelyUserContextTestexpectations updated to normalized values with inlineFSSDK-12813references; added unit and integration coverage for the new helpers and the full impression payload.Jira Ticket
FSSDK-12813