Commit c3cb6ef
Fix: Always evaluate holdouts for every feature (align with Swift SDK)
This commit fixes a critical architectural difference where Python
conditionally entered the holdout evaluation path, while Swift always
evaluates holdouts for every feature.
## Problem
Python had two different code paths:
1. WITH holdouts: get_variation_for_feature → get_decision_for_flag
2. WITHOUT holdouts: get_variation_for_feature → get_variations_for_feature_list
This created inconsistency and potential bugs.
## Solution
Now Python ALWAYS goes through get_decision_for_flag:
- get_variation_for_feature → get_decision_for_flag (always)
- get_decision_for_flag checks holdouts → experiments → rollouts
## Changes
optimizely/decision_service.py:
- Removed conditional branching in get_variation_for_feature()
- Always call get_decision_for_flag() regardless of holdout existence
- Updated docstring to reflect Swift SDK alignment
## Alignment with Swift SDK
Swift flow:
getVariationForFeature → getVariationForFeatureList → getDecisionForFlag
Python flow (now):
get_variation_for_feature → get_decision_for_flag
Both now:
- Always evaluate holdouts first (even if empty list)
- Use single unified code path
- No conditional branching
## Testing
✓ Features without holdouts work correctly
✓ Features with holdouts work correctly
✓ Features with experiments work correctly
✓ Unified code path verified
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 2650196 commit c3cb6ef
1 file changed
+8
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
662 | 665 | | |
663 | 666 | | |
664 | 667 | | |
| |||
671 | 674 | | |
672 | 675 | | |
673 | 676 | | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
681 | 682 | | |
682 | 683 | | |
683 | 684 | | |
| |||
0 commit comments