Skip to content

[AI-FSSDK] [FSSDK-12839] Normalize impression event campaign_id, variation_id, entity_id#519

Closed
jaeopt wants to merge 2 commits into
masterfrom
ai/jaeopt/FSSDK-12839-test-1
Closed

[AI-FSSDK] [FSSDK-12839] Normalize impression event campaign_id, variation_id, entity_id#519
jaeopt wants to merge 2 commits into
masterfrom
ai/jaeopt/FSSDK-12839-test-1

Conversation

@jaeopt

@jaeopt jaeopt commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Impression-event payloads emitted by the Python SDK can carry empty, null, or non-numeric values for decisions[].campaign_id, decisions[].variation_id, and events[].entity_id — most visibly on holdout decisions, which legitimately lack a layerId. Downstream event processing requires these fields to be numeric strings (or explicit null for variation_id), so malformed values are silently dropped or misattributed. This change normalizes those fields at the event-builder layer so every impression event conforms to the wire contract.

Changes

  • Added a is_numeric_string_id helper that recognises a non-empty ASCII decimal-digit string as the only valid form for these IDs.
  • In both the legacy event builder and the modern event factory, normalize decisions[].campaign_id to fall back to the decision's experiment_id when the source value is invalid, and normalize decisions[].variation_id to None when invalid.
  • Derive events[].entity_id from the same normalized value as campaign_id so the two fields are guaranteed byte-equal on every impression payload.
  • Limited the change to impression events; conversion events continue to derive entity_id from the conversion event's own id.

Jira Ticket

FSSDK-12839

@jaeopt

jaeopt commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

redundant

@jaeopt jaeopt closed this Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant