FA-73866 / Feature flag rollout bucketing / Open access
Weighted variant allocation: Cumulative edges are treated as inclusive · case 01
A bucket equal to an arm boundary is assigned to the earlier arm, over-weighting it by one bucket.
ROOT CAUSE
Selection uses bucket <= acc instead of the half-open bucket < acc.
THE FAILURE
Selection uses bucket <= acc instead of the half-open bucket < acc.
Unsuccessful approach: Comparing against acc - 1 moves the edge the other way and steals the last bucket of each arm.
Case contract
variants is an ordered list of [name, weight percent with at most two decimals]; bucket is an integer in [0, 10000). Walk variants in declared order, skipping non-positive weights, adding round(weight * 100) to a running total, and return the first variant whose total exceeds the bucket. Buckets beyond the total go to the last positively weighted variant; with none, None.
Why this case matters
Variant splits decide which arm of a flag a user receives and must honour declared weights exactly.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(variants, bucket):
acc = 0
last = None
for name, weight in variants:
if weight <= 0:
continue
last = name
acc += round(weight * 100)
if bucket <= acc:
return name
return last
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('bucket at first cumulative edge goes to second arm',
[[['control', 50], ['treatment', 50]], 5000],
'treatment'),
('bucket just below first edge stays in first arm',
[[['control', 50], ['treatment', 50]], 4999],
'control'),
('zero weight arm is never selected', [[['control', 0], ['treatment', 100]], 0], 'treatment'),
('trailing zero weight arm does not absorb remainder',
[[['control', 40], ['treatment', 40], ['off', 0]], 9000],
'treatment'),
('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),
('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),
('weight table sample 1', [[['green', 1.15], ['holdout', 0], ['alpha', 1.15], ['blue', 50]], 1135], 'blue'),
('weight table sample 2', [[['blue', 50], ['treatment', 10]], 2986], 'blue')],
[('bucket at first cumulative edge goes to second arm',
[[['control', 50], ['treatment', 50]], 5000],
'treatment'),
('bucket just below first edge stays in first arm',
[[['control', 50], ['treatment', 50]], 4999],
'control'),
('zero weight arm is never selected', [[['control', 0], ['treatment', 100]], 0], 'treatment'),
('trailing zero weight arm does not absorb remainder',
[[['control', 40], ['treatment', 40], ['off', 0]], 9000],
'treatment'),
('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),
('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),
('weight table sample 37', [[['holdout', 10], ['green', 1.15]], 1000], 'green'),
('weight table sample 58',
[[['treatment', 50], ['control', 25], ['green', 25], ['holdout', 33.33]], 4999],
'treatment')],
[('zero weight arm is never selected', [[['control', 0], ['treatment', 100]], 0], 'treatment'),
('trailing zero weight arm does not absorb remainder',
[[['control', 40], ['treatment', 40], ['off', 0]], 9000],
'treatment'),
('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),
('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),
('no positive weights yields None', [[['a', 0], ['b', 0]], 10], None),
('weight table sample 11', [[['holdout', 12.5], ['blue', 12.5], ['alpha', 0.57]], 2500], 'alpha'),
('weight table sample 19', [[['holdout', 0.57], ['treatment', 50], ['green', 50]], 5057], 'green'),
('weight table sample 55',
[[['control', 1.15], ['green', -5], ['blue', 4.35], ['treatment', 25]], 549],
'blue')],
[('trailing zero weight arm does not absorb remainder',
[[['control', 40], ['treatment', 40], ['off', 0]], 9000],
'treatment'),
('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),
('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),
('no positive weights yields None', [[['a', 0], ['b', 0]], 10], None),
('three way split middle arm', [[['a', 33.33], ['b', 33.33], ['c', 33.34]], 5000], 'b'),
('weight table sample 11', [[['holdout', 12.5], ['blue', 12.5], ['alpha', 0.57]], 2500], 'alpha'),
('weight table sample 16', [[['green', 0.57], ['alpha', 12.5], ['control', 25]], 1307], 'control'),
('weight table sample 50',
[[['blue', 12.5], ['control', 0.57], ['green', 4.35], ['holdout', 0.29]], 1741],
'green')],
[('bucket at first cumulative edge goes to second arm',
[[['control', 50], ['treatment', 50]], 5000],
'treatment'),
('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),
('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),
('no positive weights yields None', [[['a', 0], ['b', 0]], 10], None),
('three way split middle arm', [[['a', 33.33], ['b', 33.33], ['c', 33.34]], 5000], 'b'),
('weight table sample 21', [[['green', 33.33], ['treatment', 0]], 0], 'green'),
('weight table sample 39', [[['treatment', 1.15], ['control', 25], ['green', 4.35]], 115], 'control'),
('weight table sample 45',
[[['control', 4.35], ['blue', 50], ['treatment', 50], ['alpha', 50]], 5434],
'blue')]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| bucket at first cumulative edge goes to second arm | control | treatment | Failed |
| bucket just below first edge stays in first arm | control | control | Passed |
| zero weight arm is never selected | treatment | treatment | Passed |
| trailing zero weight arm does not absorb remainder | treatment | treatment | Passed |
| declared order beats alphabetical order | zeta | zeta | Passed |
| fractional weight 0.29 covers 29 buckets | tiny | tiny | Passed |
| weight table sample 1 | blue | blue | Passed |
| weight table sample 2 | blue | blue | Passed |
SHA-256 / 887faf5cec782570785b67f507da4cd43ccd1dd92b82401ee05b2a70e61c6b7c
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(variants, bucket):
acc = 0
last = None
for name, weight in variants:
if weight <= 0:
continue
last = name
acc += round(weight * 100)
if bucket < acc - 1:
return name
return last
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('bucket at first cumulative edge goes to second arm',
[[['control', 50], ['treatment', 50]], 5000],
'treatment'),
('bucket just below first edge stays in first arm',
[[['control', 50], ['treatment', 50]], 4999],
'control'),
('zero weight arm is never selected', [[['control', 0], ['treatment', 100]], 0], 'treatment'),
('trailing zero weight arm does not absorb remainder',
[[['control', 40], ['treatment', 40], ['off', 0]], 9000],
'treatment'),
('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),
('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),
('weight table sample 1', [[['green', 1.15], ['holdout', 0], ['alpha', 1.15], ['blue', 50]], 1135], 'blue'),
('weight table sample 2', [[['blue', 50], ['treatment', 10]], 2986], 'blue')],
[('bucket at first cumulative edge goes to second arm',
[[['control', 50], ['treatment', 50]], 5000],
'treatment'),
('bucket just below first edge stays in first arm',
[[['control', 50], ['treatment', 50]], 4999],
'control'),
('zero weight arm is never selected', [[['control', 0], ['treatment', 100]], 0], 'treatment'),
('trailing zero weight arm does not absorb remainder',
[[['control', 40], ['treatment', 40], ['off', 0]], 9000],
'treatment'),
('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),
('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),
('weight table sample 37', [[['holdout', 10], ['green', 1.15]], 1000], 'green'),
('weight table sample 58',
[[['treatment', 50], ['control', 25], ['green', 25], ['holdout', 33.33]], 4999],
'treatment')],
[('zero weight arm is never selected', [[['control', 0], ['treatment', 100]], 0], 'treatment'),
('trailing zero weight arm does not absorb remainder',
[[['control', 40], ['treatment', 40], ['off', 0]], 9000],
'treatment'),
('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),
('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),
('no positive weights yields None', [[['a', 0], ['b', 0]], 10], None),
('weight table sample 11', [[['holdout', 12.5], ['blue', 12.5], ['alpha', 0.57]], 2500], 'alpha'),
('weight table sample 19', [[['holdout', 0.57], ['treatment', 50], ['green', 50]], 5057], 'green'),
('weight table sample 55',
[[['control', 1.15], ['green', -5], ['blue', 4.35], ['treatment', 25]], 549],
'blue')],
[('trailing zero weight arm does not absorb remainder',
[[['control', 40], ['treatment', 40], ['off', 0]], 9000],
'treatment'),
('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),
('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),
('no positive weights yields None', [[['a', 0], ['b', 0]], 10], None),
('three way split middle arm', [[['a', 33.33], ['b', 33.33], ['c', 33.34]], 5000], 'b'),
('weight table sample 11', [[['holdout', 12.5], ['blue', 12.5], ['alpha', 0.57]], 2500], 'alpha'),
('weight table sample 16', [[['green', 0.57], ['alpha', 12.5], ['control', 25]], 1307], 'control'),
('weight table sample 50',
[[['blue', 12.5], ['control', 0.57], ['green', 4.35], ['holdout', 0.29]], 1741],
'green')],
[('bucket at first cumulative edge goes to second arm',
[[['control', 50], ['treatment', 50]], 5000],
'treatment'),
('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),
('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),
('no positive weights yields None', [[['a', 0], ['b', 0]], 10], None),
('three way split middle arm', [[['a', 33.33], ['b', 33.33], ['c', 33.34]], 5000], 'b'),
('weight table sample 21', [[['green', 33.33], ['treatment', 0]], 0], 'green'),
('weight table sample 39', [[['treatment', 1.15], ['control', 25], ['green', 4.35]], 115], 'control'),
('weight table sample 45',
[[['control', 4.35], ['blue', 50], ['treatment', 50], ['alpha', 50]], 5434],
'blue')]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| bucket at first cumulative edge goes to second arm | treatment | treatment | Passed |
| bucket just below first edge stays in first arm | treatment | control | Failed |
| zero weight arm is never selected | treatment | treatment | Passed |
| trailing zero weight arm does not absorb remainder | treatment | treatment | Passed |
| declared order beats alphabetical order | zeta | zeta | Passed |
| fractional weight 0.29 covers 29 buckets | rest | tiny | Failed |
| weight table sample 1 | blue | blue | Passed |
| weight table sample 2 | blue | blue | Passed |
SHA-256 / 6576b02707f662e0fa8a87ce94ee7385c11b444abbe79624b0b94c92a7889231
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
A deterministic toy flag-evaluation model with a stipulated contract; it does not reproduce any vendor SDK byte for byte. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:48:51.337086+00:00.
Case digest / 1e999de253ea462b144e29936da597ffda56356a1347124c98b7ff6356f63bf3