{"abstract":"Renaming an arm silently moves which bucket ranges it owns.","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":"Sorting by descending weight is still an order the contract never declared.","family":"w2-feature-flag-rollout-bucketing-weighted-variant-split-declaration-order","id":"FA-73881","implementations":{"attempt":{"sha256":"9ed3765c0425cb52cbbd901cf6a788ba6e26a5c40ce20da9cbd92f374ecb9ce7","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 sorted(variants, key=lambda v: -v[1]):\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  ('three way split middle arm', [[['a', 33.33], ['b', 33.33], ['c', 33.34]], 5000], 'b'),\n  ('weight table sample 1',\n   [[['green', 1.15], ['holdout', 0], ['alpha', 1.15], ['blue', 50]], 1135],\n   'blue')],\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  ('three way split middle arm', [[['a', 33.33], ['b', 33.33], ['c', 33.34]], 5000], 'b'),\n  ('weight table sample 13',\n   [[['alpha', -5], ['green', 12.5], ['treatment', 50], ['blue', 33.34]], 7194],\n   'blue'),\n  ('weight table sample 28', [[['alpha', 1.15], ['holdout', 4.35]], 1437], 'holdout')],\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 31', [[['green', 1.15], ['blue', 33.33], ['treatment', 4.35]], 3447], 'blue'),\n  ('weight table sample 46',\n   [[['control', 0], ['alpha', 4.35], ['green', 33.33], ['holdout', 33.33]], 6769],\n   'holdout')],\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 16', [[['green', 0.57], ['alpha', 12.5], ['control', 25]], 1307], 'control'),\n  ('weight table sample 17', [[['treatment', 1.15], ['control', 0.29], ['blue', 0.29]], 2597], 'blue'),\n  ('weight table sample 53',\n   [[['treatment', 33.33], ['holdout', 33.34], ['control', 4.35]], 0],\n   'treatment')],\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 3', [[['treatment', 12.5], ['control', 10], ['holdout', 0.57]], 6309], 'holdout'),\n  ('weight table sample 21', [[['green', 33.33], ['treatment', 0]], 0], 'green'),\n  ('weight table sample 31', [[['green', 1.15], ['blue', 33.33], ['treatment', 4.35]], 3447], '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":"499eafd4601363dbb05aa753fc3c96b3b4350911f0216a3d1c90861565a79ab9","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 sorted(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  ('three way split middle arm', [[['a', 33.33], ['b', 33.33], ['c', 33.34]], 5000], 'b'),\n  ('weight table sample 1',\n   [[['green', 1.15], ['holdout', 0], ['alpha', 1.15], ['blue', 50]], 1135],\n   'blue')],\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  ('three way split middle arm', [[['a', 33.33], ['b', 33.33], ['c', 33.34]], 5000], 'b'),\n  ('weight table sample 13',\n   [[['alpha', -5], ['green', 12.5], ['treatment', 50], ['blue', 33.34]], 7194],\n   'blue'),\n  ('weight table sample 28', [[['alpha', 1.15], ['holdout', 4.35]], 1437], 'holdout')],\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 31', [[['green', 1.15], ['blue', 33.33], ['treatment', 4.35]], 3447], 'blue'),\n  ('weight table sample 46',\n   [[['control', 0], ['alpha', 4.35], ['green', 33.33], ['holdout', 33.33]], 6769],\n   'holdout')],\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 16', [[['green', 0.57], ['alpha', 12.5], ['control', 25]], 1307], 'control'),\n  ('weight table sample 17', [[['treatment', 1.15], ['control', 0.29], ['blue', 0.29]], 2597], 'blue'),\n  ('weight table sample 53',\n   [[['treatment', 33.33], ['holdout', 33.34], ['control', 4.35]], 0],\n   'treatment')],\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 3', [[['treatment', 12.5], ['control', 10], ['holdout', 0.57]], 6309], 'holdout'),\n  ('weight table sample 21', [[['green', 33.33], ['treatment', 0]], 0], 'green'),\n  ('weight table sample 31', [[['green', 1.15], ['blue', 33.33], ['treatment', 4.35]], 3447], '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-declaration-order","generated_at":"2026-09-29T14:48:51.619243+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":"The loop iterates sorted(variants) instead of the declared order.","sha256":"d5103495176bb5b599fea5c96c2bb5c76a44d3e7aceeefcb34ad1e66250eb4db","title":"Weighted variant allocation: Variants are walked alphabetically · 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":41.445,"exit_code":1,"observations":[{"actual":"treatment","check":"bucket at first cumulative edge goes to second arm","expected":"treatment","passed":true},{"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":"alpha","check":"declared order beats alphabetical order","expected":"zeta","passed":false},{"actual":"rest","check":"fractional weight 0.29 covers 29 buckets","expected":"tiny","passed":false},{"actual":"a","check":"three way split middle arm","expected":"b","passed":false},{"actual":"blue","check":"weight table sample 1","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\": \"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\": \"alpha\", \"expected\": \"zeta\", \"passed\": false}, {\"check\": \"fractional weight 0.29 covers 29 buckets\", \"actual\": \"rest\", \"expected\": \"tiny\", \"passed\": false}, {\"check\": \"three way split middle arm\", \"actual\": \"a\", \"expected\": \"b\", \"passed\": false}, {\"check\": \"weight table sample 1\", \"actual\": \"blue\", \"expected\": \"blue\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.378,"exit_code":1,"observations":[{"actual":"treatment","check":"bucket at first cumulative edge goes to second arm","expected":"treatment","passed":true},{"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":"alpha","check":"declared order beats alphabetical order","expected":"zeta","passed":false},{"actual":"rest","check":"fractional weight 0.29 covers 29 buckets","expected":"tiny","passed":false},{"actual":"b","check":"three way split middle arm","expected":"b","passed":true},{"actual":"blue","check":"weight table sample 1","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\": \"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\": \"alpha\", \"expected\": \"zeta\", \"passed\": false}, {\"check\": \"fractional weight 0.29 covers 29 buckets\", \"actual\": \"rest\", \"expected\": \"tiny\", \"passed\": false}, {\"check\": \"three way split middle arm\", \"actual\": \"b\", \"expected\": \"b\", \"passed\": true}, {\"check\": \"weight table sample 1\", \"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."}}