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

168168 if targeting_context.user_id in user_allocation.users:
169169 evaluation_event.reason = VariantAssignmentReason.USER
170170 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:
172172 for group_allocation in feature.allocation.group:
173173 for group in targeting_context.groups:
174174 if group in group_allocation.groups:
175175 evaluation_event.reason = VariantAssignmentReason.GROUP
176176 variant_name = group_allocation.variant
177- elif feature.allocation.percentile:
177+ if not variant_name and feature.allocation.percentile:
178178 context_id = targeting_context.user_id + "\n" + feature.allocation.seed
179179 box: float = self._is_targeted(context_id)
180180 for percentile_allocation in feature.allocation.percentile:

The check that tells the two apart

failpass·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.