{"abstract":"A bucket equal to an arm boundary is assigned to the earlier arm, over-weighting it by one bucket.","category":"Feature flag rollout bucketing","checks":8,"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.","contract_signature":"variants, bucket","evaluation_group":"w2-feature-flag-rollout-bucketing-weighted-variant-split","failed_approach":"Comparing against acc - 1 moves the edge the other way and steals the last bucket of each arm.","family":"w2-feature-flag-rollout-bucketing-weighted-variant-split-cumulative-boundary","id":"FA-73866","implementations":{"attempt":{"sha256":"6576b02707f662e0fa8a87ce94ee7385c11b444abbe79624b0b94c92a7889231","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(variants, bucket):\n    acc = 0\n    last = None\n    for name, weight in variants:\n        if weight <= 0:\n            continue\n        last = name\n        acc += round(weight * 100)\n        if bucket < acc - 1:\n            return name\n    return last\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('bucket at first cumulative edge goes to second arm',\n   [[['control', 50], ['treatment', 50]], 5000],\n   'treatment'),\n  ('bucket just below first edge stays in first arm',\n   [[['control', 50], ['treatment', 50]], 4999],\n   'control'),\n  ('zero weight arm is never selected', [[['control', 0], ['treatment', 100]], 0], 'treatment'),\n  ('trailing zero weight arm does not absorb remainder',\n   [[['control', 40], ['treatment', 40], ['off', 0]], 9000],\n   'treatment'),\n  ('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),\n  ('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),\n  ('weight table sample 1', [[['green', 1.15], ['holdout', 0], ['alpha', 1.15], ['blue', 50]], 1135], 'blue'),\n  ('weight table sample 2', [[['blue', 50], ['treatment', 10]], 2986], 'blue')],\n [('bucket at first cumulative edge goes to second arm',\n   [[['control', 50], ['treatment', 50]], 5000],\n   'treatment'),\n  ('bucket just below first edge stays in first arm',\n   [[['control', 50], ['treatment', 50]], 4999],\n   'control'),\n  ('zero weight arm is never selected', [[['control', 0], ['treatment', 100]], 0], 'treatment'),\n  ('trailing zero weight arm does not absorb remainder',\n   [[['control', 40], ['treatment', 40], ['off', 0]], 9000],\n   'treatment'),\n  ('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),\n  ('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),\n  ('weight table sample 37', [[['holdout', 10], ['green', 1.15]], 1000], 'green'),\n  ('weight table sample 58',\n   [[['treatment', 50], ['control', 25], ['green', 25], ['holdout', 33.33]], 4999],\n   'treatment')],\n [('zero weight arm is never selected', [[['control', 0], ['treatment', 100]], 0], 'treatment'),\n  ('trailing zero weight arm does not absorb remainder',\n   [[['control', 40], ['treatment', 40], ['off', 0]], 9000],\n   'treatment'),\n  ('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),\n  ('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),\n  ('no positive weights yields None', [[['a', 0], ['b', 0]], 10], None),\n  ('weight table sample 11', [[['holdout', 12.5], ['blue', 12.5], ['alpha', 0.57]], 2500], 'alpha'),\n  ('weight table sample 19', [[['holdout', 0.57], ['treatment', 50], ['green', 50]], 5057], 'green'),\n  ('weight table sample 55',\n   [[['control', 1.15], ['green', -5], ['blue', 4.35], ['treatment', 25]], 549],\n   'blue')],\n [('trailing zero weight arm does not absorb remainder',\n   [[['control', 40], ['treatment', 40], ['off', 0]], 9000],\n   'treatment'),\n  ('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),\n  ('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),\n  ('no positive weights yields None', [[['a', 0], ['b', 0]], 10], None),\n  ('three way split middle arm', [[['a', 33.33], ['b', 33.33], ['c', 33.34]], 5000], 'b'),\n  ('weight table sample 11', [[['holdout', 12.5], ['blue', 12.5], ['alpha', 0.57]], 2500], 'alpha'),\n  ('weight table sample 16', [[['green', 0.57], ['alpha', 12.5], ['control', 25]], 1307], 'control'),\n  ('weight table sample 50',\n   [[['blue', 12.5], ['control', 0.57], ['green', 4.35], ['holdout', 0.29]], 1741],\n   'green')],\n [('bucket at first cumulative edge goes to second arm',\n   [[['control', 50], ['treatment', 50]], 5000],\n   'treatment'),\n  ('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),\n  ('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),\n  ('no positive weights yields None', [[['a', 0], ['b', 0]], 10], None),\n  ('three way split middle arm', [[['a', 33.33], ['b', 33.33], ['c', 33.34]], 5000], 'b'),\n  ('weight table sample 21', [[['green', 33.33], ['treatment', 0]], 0], 'green'),\n  ('weight table sample 39', [[['treatment', 1.15], ['control', 25], ['green', 4.35]], 115], 'control'),\n  ('weight table sample 45',\n   [[['control', 4.35], ['blue', 50], ['treatment', 50], ['alpha', 50]], 5434],\n   'blue')]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"887faf5cec782570785b67f507da4cd43ccd1dd92b82401ee05b2a70e61c6b7c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(variants, bucket):\n    acc = 0\n    last = None\n    for name, weight in variants:\n        if weight <= 0:\n            continue\n        last = name\n        acc += round(weight * 100)\n        if bucket <= acc:\n            return name\n    return last\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('bucket at first cumulative edge goes to second arm',\n   [[['control', 50], ['treatment', 50]], 5000],\n   'treatment'),\n  ('bucket just below first edge stays in first arm',\n   [[['control', 50], ['treatment', 50]], 4999],\n   'control'),\n  ('zero weight arm is never selected', [[['control', 0], ['treatment', 100]], 0], 'treatment'),\n  ('trailing zero weight arm does not absorb remainder',\n   [[['control', 40], ['treatment', 40], ['off', 0]], 9000],\n   'treatment'),\n  ('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),\n  ('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),\n  ('weight table sample 1', [[['green', 1.15], ['holdout', 0], ['alpha', 1.15], ['blue', 50]], 1135], 'blue'),\n  ('weight table sample 2', [[['blue', 50], ['treatment', 10]], 2986], 'blue')],\n [('bucket at first cumulative edge goes to second arm',\n   [[['control', 50], ['treatment', 50]], 5000],\n   'treatment'),\n  ('bucket just below first edge stays in first arm',\n   [[['control', 50], ['treatment', 50]], 4999],\n   'control'),\n  ('zero weight arm is never selected', [[['control', 0], ['treatment', 100]], 0], 'treatment'),\n  ('trailing zero weight arm does not absorb remainder',\n   [[['control', 40], ['treatment', 40], ['off', 0]], 9000],\n   'treatment'),\n  ('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),\n  ('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),\n  ('weight table sample 37', [[['holdout', 10], ['green', 1.15]], 1000], 'green'),\n  ('weight table sample 58',\n   [[['treatment', 50], ['control', 25], ['green', 25], ['holdout', 33.33]], 4999],\n   'treatment')],\n [('zero weight arm is never selected', [[['control', 0], ['treatment', 100]], 0], 'treatment'),\n  ('trailing zero weight arm does not absorb remainder',\n   [[['control', 40], ['treatment', 40], ['off', 0]], 9000],\n   'treatment'),\n  ('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),\n  ('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),\n  ('no positive weights yields None', [[['a', 0], ['b', 0]], 10], None),\n  ('weight table sample 11', [[['holdout', 12.5], ['blue', 12.5], ['alpha', 0.57]], 2500], 'alpha'),\n  ('weight table sample 19', [[['holdout', 0.57], ['treatment', 50], ['green', 50]], 5057], 'green'),\n  ('weight table sample 55',\n   [[['control', 1.15], ['green', -5], ['blue', 4.35], ['treatment', 25]], 549],\n   'blue')],\n [('trailing zero weight arm does not absorb remainder',\n   [[['control', 40], ['treatment', 40], ['off', 0]], 9000],\n   'treatment'),\n  ('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),\n  ('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),\n  ('no positive weights yields None', [[['a', 0], ['b', 0]], 10], None),\n  ('three way split middle arm', [[['a', 33.33], ['b', 33.33], ['c', 33.34]], 5000], 'b'),\n  ('weight table sample 11', [[['holdout', 12.5], ['blue', 12.5], ['alpha', 0.57]], 2500], 'alpha'),\n  ('weight table sample 16', [[['green', 0.57], ['alpha', 12.5], ['control', 25]], 1307], 'control'),\n  ('weight table sample 50',\n   [[['blue', 12.5], ['control', 0.57], ['green', 4.35], ['holdout', 0.29]], 1741],\n   'green')],\n [('bucket at first cumulative edge goes to second arm',\n   [[['control', 50], ['treatment', 50]], 5000],\n   'treatment'),\n  ('declared order beats alphabetical order', [[['zeta', 10], ['alpha', 90]], 500], 'zeta'),\n  ('fractional weight 0.29 covers 29 buckets', [[['tiny', 0.29], ['rest', 99.71]], 28], 'tiny'),\n  ('no positive weights yields None', [[['a', 0], ['b', 0]], 10], None),\n  ('three way split middle arm', [[['a', 33.33], ['b', 33.33], ['c', 33.34]], 5000], 'b'),\n  ('weight table sample 21', [[['green', 33.33], ['treatment', 0]], 0], 'green'),\n  ('weight table sample 39', [[['treatment', 1.15], ['control', 25], ['green', 4.35]], 115], 'control'),\n  ('weight table sample 45',\n   [[['control', 4.35], ['blue', 50], ['treatment', 50], ['alpha', 50]], 5434],\n   'blue')]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-feature-flag-rollout-bucketing-weighted-variant-split-cumulative-boundary","generated_at":"2026-09-29T14:48:51.337086+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Variant splits decide which arm of a flag a user receives and must honour declared weights exactly.","root_cause":"Selection uses bucket <= acc instead of the half-open bucket < acc.","sha256":"1e999de253ea462b144e29936da597ffda56356a1347124c98b7ff6356f63bf3","title":"Weighted variant allocation: Cumulative edges are treated as inclusive · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":39.53,"exit_code":1,"observations":[{"actual":"treatment","check":"bucket at first cumulative edge goes to second arm","expected":"treatment","passed":true},{"actual":"treatment","check":"bucket just below first edge stays in first arm","expected":"control","passed":false},{"actual":"treatment","check":"zero weight arm is never selected","expected":"treatment","passed":true},{"actual":"treatment","check":"trailing zero weight arm does not absorb remainder","expected":"treatment","passed":true},{"actual":"zeta","check":"declared order beats alphabetical order","expected":"zeta","passed":true},{"actual":"rest","check":"fractional weight 0.29 covers 29 buckets","expected":"tiny","passed":false},{"actual":"blue","check":"weight table sample 1","expected":"blue","passed":true},{"actual":"blue","check":"weight table sample 2","expected":"blue","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"bucket at first cumulative edge goes to second arm\", \"actual\": \"treatment\", \"expected\": \"treatment\", \"passed\": true}, {\"check\": \"bucket just below first edge stays in first arm\", \"actual\": \"treatment\", \"expected\": \"control\", \"passed\": false}, {\"check\": \"zero weight arm is never selected\", \"actual\": \"treatment\", \"expected\": \"treatment\", \"passed\": true}, {\"check\": \"trailing zero weight arm does not absorb remainder\", \"actual\": \"treatment\", \"expected\": \"treatment\", \"passed\": true}, {\"check\": \"declared order beats alphabetical order\", \"actual\": \"zeta\", \"expected\": \"zeta\", \"passed\": true}, {\"check\": \"fractional weight 0.29 covers 29 buckets\", \"actual\": \"rest\", \"expected\": \"tiny\", \"passed\": false}, {\"check\": \"weight table sample 1\", \"actual\": \"blue\", \"expected\": \"blue\", \"passed\": true}, {\"check\": \"weight table sample 2\", \"actual\": \"blue\", \"expected\": \"blue\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":37.931,"exit_code":1,"observations":[{"actual":"control","check":"bucket at first cumulative edge goes to second arm","expected":"treatment","passed":false},{"actual":"control","check":"bucket just below first edge stays in first arm","expected":"control","passed":true},{"actual":"treatment","check":"zero weight arm is never selected","expected":"treatment","passed":true},{"actual":"treatment","check":"trailing zero weight arm does not absorb remainder","expected":"treatment","passed":true},{"actual":"zeta","check":"declared order beats alphabetical order","expected":"zeta","passed":true},{"actual":"tiny","check":"fractional weight 0.29 covers 29 buckets","expected":"tiny","passed":true},{"actual":"blue","check":"weight table sample 1","expected":"blue","passed":true},{"actual":"blue","check":"weight table sample 2","expected":"blue","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"bucket at first cumulative edge goes to second arm\", \"actual\": \"control\", \"expected\": \"treatment\", \"passed\": false}, {\"check\": \"bucket just below first edge stays in first arm\", \"actual\": \"control\", \"expected\": \"control\", \"passed\": true}, {\"check\": \"zero weight arm is never selected\", \"actual\": \"treatment\", \"expected\": \"treatment\", \"passed\": true}, {\"check\": \"trailing zero weight arm does not absorb remainder\", \"actual\": \"treatment\", \"expected\": \"treatment\", \"passed\": true}, {\"check\": \"declared order beats alphabetical order\", \"actual\": \"zeta\", \"expected\": \"zeta\", \"passed\": true}, {\"check\": \"fractional weight 0.29 covers 29 buckets\", \"actual\": \"tiny\", \"expected\": \"tiny\", \"passed\": true}, {\"check\": \"weight table sample 1\", \"actual\": \"blue\", \"expected\": \"blue\", \"passed\": true}, {\"check\": \"weight table sample 2\", \"actual\": \"blue\", \"expected\": \"blue\", \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}