Commit 55924e5
[AI-FSSDK] [FSSDK-12337] Add Feature Rollout support (#499)
* [AI-FSSDK] [FSSDK-12337] Add Feature Rollout support to project config parsing
* [AI-FSSDK] [FSSDK-12337] Fix test structure, mypy and ruff compliance
- Move feature rollout tests from standalone test_feature_rollout.py into
test_config.py following module-level testing convention
- Use base.BaseTest instead of unittest.TestCase for consistency
- Fix mypy strict type errors in Variation construction using cast
- All checks pass: ruff, mypy --strict, pytest (941/941)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* [AI-FSSDK] [FSSDK-12337] Simplify feature rollout config parsing
- Inline _get_everyone_else_variation logic, remove unnecessary static method
- Use get_rollout_from_id() to match TDD pseudocode
- Remove isinstance check (rollout experiments are always dicts)
- Remove 3 unit tests for deleted helper method (edge cases already
covered by integration-level tests)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* [AI-FSSDK] [FSSDK-12337] Restore _get_everyone_else_variation as method
- Restore as instance method matching TDD pseudocode structure
- Takes flag (FeatureFlag) param, calls get_rollout_from_id internally
- Caller simplified to: everyone_else_variation = self._get_everyone_else_variation(flag)
* [AI-FSSDK] [FSSDK-12337] Add ExperimentTypes constants for type field
- Add ExperimentTypes enum in helpers/enums.py with AB, MAB, CMAB, FEATURE_ROLLOUT
- Use ExperimentTypes.FEATURE_ROLLOUT constant in config parsing instead of raw string
* [AI-FSSDK] [FSSDK-12337] Type-restrict Experiment.type to ExperimentType
- Add ExperimentType Literal type in helpers/types.py: 'a/b', 'mab', 'cmab', 'feature_rollout'
- Change Experiment.type from Optional[str] to Optional[ExperimentType]
* [AI-FSSDK] [FSSDK-12337] Remove ExperimentTypes class, simplify type check
- Remove redundant ExperimentTypes class from enums.py (ExperimentType Literal suffices)
- Simplify getattr(experiment, 'type', None) to experiment.type
* [AI-FSSDK] [FSSDK-12337] Return Variation entity from _get_everyone_else_variation
- Build Variation entity once in helper, derive dict from it in caller
- Addresses PR review comment from jaeopt
* [AI-FSSDK] [FSSDK-12337] Remove redundant tests, keep 6 essential ones
Removed 7 tests that were covered by other tests:
- test_experiment_type_field_parsed (covered by injection test)
- test_feature_rollout_with_empty_rollout_experiments (similar to no_rollout)
- test_feature_rollout_multiple_experiments_mixed_types (covered by injection + unchanged)
- test_feature_rollout_flag_variations_map_includes_injected (subset of maps test)
- test_experiment_type_ab (just string assignment)
- test_feature_rollout_with_variables_on_everyone_else (edge case)
- test_existing_datafile_not_broken (covered by none_when_missing + unchanged)
* [AI-FSSDK] [FSSDK-12337] Add ExperimentTypes constant and targeted_delivery type
- Add ExperimentTypes class in enums.py with ab, mab, cmab, td, fr
- Add 'targeted_delivery' to ExperimentType Literal in types.py
- Use enums.ExperimentTypes.fr constant in injection check
- Add test for type field parsing from datafile
* [AI-FSSDK] [FSSDK-12337] Remove test not in ticket spec
Remove test_feature_rollout_everyone_else_is_last_rollout_rule
to match updated Jira ticket test requirements.
* [FSSDK-12337] Fix experiment type values to match backend
Update ExperimentTypes and ExperimentType Literal to use actual
backend values: 'multi_armed_bandit' and 'contextual_multi_armed_bandit'
instead of shorthand 'mab' and 'cmab'.
* Format ExperimentType definition for ruff check
* [AI-FSSDK] [FSSDK-12337] Update experiment type values to short-form abbreviations
* [AI-FSSDK] [FSSDK-12337] Add validation for experiment type field
* trigger CI
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent d651911 commit 55924e5
File tree
5 files changed
+461
-1
lines changed- optimizely
- helpers
- tests
5 files changed
+461
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
232 | 240 | | |
233 | 241 | | |
234 | 242 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
192 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
193 | 210 | | |
194 | 211 | | |
195 | 212 | | |
| |||
232 | 249 | | |
233 | 250 | | |
234 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
235 | 283 | | |
236 | 284 | | |
237 | 285 | | |
| |||
667 | 715 | | |
668 | 716 | | |
669 | 717 | | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
670 | 753 | | |
671 | 754 | | |
672 | 755 | | |
| |||
0 commit comments