Commit 89d00a7
committed
Fix holdout variation lookup in impression event creation
CRITICAL FIX: Holdout impression events were sending empty variation_key
and variation_id in event payloads, causing fullstack compatibility suite
failures.
Root Cause:
- user_event_factory.create_impression_event was using get_flag_variation()
for all events when both flag_key and variation_id were present
- get_flag_variation() only searches flag_variations_map (experiments/rollouts)
- Holdout variations aren't in flag_variations_map, so lookup returned None
- This caused impression events to have empty variation_key and variation_id
The Fix:
- Added rule_type check: exclude HOLDOUT from get_flag_variation() path
- For holdouts: use get_variation_from_id_by_experiment_id() instead
- This works because holdout variations are properly mapped in
variation_id_map_by_experiment_id and variation_key_map_by_experiment_id
Impact:
- Holdout impression events now include correct variation_key and variation_id
- Event metadata properly populated: rule_key, rule_type: holdout, variation_key
- Fixes fullstack compatibility suite decide_holdouts.feature event validation
- All 237 tests passing (194 optimizely + 8 event_factory + 35 holdout)
Aligned with Swift SDK event creation behavior.1 parent 3d68a24 commit 89d00a7
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
0 commit comments