Whole file
microsoft/FeatureManagement-Python
The author described this change as “Assignment Fix (#42)”. It counts as a record because the check below fails on the code as it stood at d26463d32 and passes on 577987cf7, with nothing else changed between the two runs.
Fix saved2024-09-27
Sharing licenceMIT · LICENSE
Change size+2 −2
What the code was meant to do, written into the code itself as a save note
Assignment Fix (#42)
The change
| 168 | 168 | if targeting_context.user_id in user_allocation.users: | |
| 169 | 169 | evaluation_event.reason = VariantAssignmentReason.USER | |
| 170 | 170 | variant_name = user_allocation.variant | |
| 171 | - | elif feature.allocation.group and len(targeting_context.groups) > 0: | |
| 171 | + | if not variant_name and feature.allocation.group and len(targeting_context.groups) > 0: | |
| 172 | 172 | for group_allocation in feature.allocation.group: | |
| 173 | 173 | for group in targeting_context.groups: | |
| 174 | 174 | if group in group_allocation.groups: | |
| 175 | 175 | evaluation_event.reason = VariantAssignmentReason.GROUP | |
| 176 | 176 | variant_name = group_allocation.variant | |
| 177 | - | elif feature.allocation.percentile: | |
| 177 | + | if not variant_name and feature.allocation.percentile: | |
| 178 | 178 | context_id = targeting_context.user_id + "\n" + feature.allocation.seed | |
| 179 | 179 | box: float = self._is_targeted(context_id) | |
| 180 | 180 | for percentile_allocation in feature.allocation.percentile: |
The check that tells the two apart
fail→pass·tests/test_feature_variants.py::TestFeatureVariants::test_user_and_group_allocation
Check file tests/test_feature_variants.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itd26463d3221498e03c24e7eff984d6d65b4be665
Broken version dated2024-09-10
Modulefeaturemanagement._featuremanagerbase
Units changedFeatureManagerBase
Fingerprintb91c935bd1f32328
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.