FA-74306 / Feature flag rollout bucketing / Open access
Seeded weighted rollout: Seed zero is ignored · case 01
Flags configured with seed 0 bucket by flag key and salt, breaking the shared cohort.
ROOT CAUSE
The seed is tested for truthiness, so 0 counts as no seed.
THE FAILURE
The seed is tested for truthiness, so 0 counts as no seed.
Unsuccessful approach: Combining seed and flag key defeats the purpose of sharing a seed across flags.
Case contract
Hash text is (str(seed) if seed is not None else flag_key + "." + salt) + "." + ident, plus "." + secondary when secondary is not None (an empty string still counts). bucket = int(first 15 hex digits of sha1(text), 16) / 0xFFFFFFFFFFFFFFF. weights are in 1/100000 units; return the first index whose cumulative weight / 100000 exceeds the bucket, else the last index, as [index, round(bucket, 6)].
Why this case matters
Seeds let several flags share one bucketing so a cohort sees consistent variations.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import hashlib
N = 1
observations = []
def solve(flag_key, salt, ident, secondary, seed, weights):
prefix = str(seed) if seed else flag_key + '.' + salt
text = prefix + '.' + ident
if secondary is not None:
text += '.' + secondary
bucket = int(hashlib.sha1(text.encode()).hexdigest()[:15], 16) / float(0xFFFFFFFFFFFFFFF)
acc = 0
for index, w in enumerate(weights):
acc += w
if bucket < acc / 100000.0:
return [index, round(bucket, 6)]
return [len(weights) - 1, round(bucket, 6)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('seed zero is a real seed', ['flag-a', 's', 'id1', None, 0, [50000, 50000]], [0, 0.331393]),
('seed replaces flag key and salt', ['flag-b', 's', 'id2', None, 7, [30000, 70000]], [1, 0.855827]),
('empty secondary is still appended', ['flag-a', 's', 'id3', '', None, [50000, 50000]], [1, 0.891663]),
('non-empty secondary', ['flag-a', 's', 'id4', 'eu', None, [10000, 90000]], [1, 0.975219]),
('weights short of total go to last index',
['flag-b', 'salt2', 'id5', None, None, [10000, 10000]],
[1, 0.233147]),
('rollout sample 1', ['flag-b', 'salt2', 'id120', '', 0, [0, 60000, 40000]], [2, 0.88242]),
('rollout sample 2', ['flag-b', 's', 'id212', 'x', 61, [25000, 25000, 25000]], [1, 0.37423]),
('rollout sample 3', ['flag-b', 'salt2', 'id106', None, 7, [50000, 50000]], [0, 0.322784])],
[('seed zero is a real seed', ['flag-a', 's', 'id1', None, 0, [50000, 50000]], [0, 0.331393]),
('seed replaces flag key and salt', ['flag-b', 's', 'id2', None, 7, [30000, 70000]], [1, 0.855827]),
('empty secondary is still appended', ['flag-a', 's', 'id3', '', None, [50000, 50000]], [1, 0.891663]),
('non-empty secondary', ['flag-a', 's', 'id4', 'eu', None, [10000, 90000]], [1, 0.975219]),
('weights short of total go to last index',
['flag-b', 'salt2', 'id5', None, None, [10000, 10000]],
[1, 0.233147]),
('zero-weight first variation', ['flag-b', 's', 'id6', None, None, [0, 100000]], [1, 0.255084]),
('rollout sample 6', ['flag-b', 'salt2', 'id765', None, 7, [10000, 20000, 70000]], [2, 0.464498]),
('rollout sample 19', ['flag-b', 's', 'id433', 'x', 0, [0, 60000, 40000]], [1, 0.110676])],
[('seed zero is a real seed', ['flag-a', 's', 'id1', None, 0, [50000, 50000]], [0, 0.331393]),
('empty secondary is still appended', ['flag-a', 's', 'id3', '', None, [50000, 50000]], [1, 0.891663]),
('non-empty secondary', ['flag-a', 's', 'id4', 'eu', None, [10000, 90000]], [1, 0.975219]),
('weights short of total go to last index',
['flag-b', 'salt2', 'id5', None, None, [10000, 10000]],
[1, 0.233147]),
('zero-weight first variation', ['flag-b', 's', 'id6', None, None, [0, 100000]], [1, 0.255084]),
('rollout sample 11', ['flag-a', 'salt2', 'id773', '', 7, [0, 60000, 40000]], [1, 0.477906]),
('rollout sample 15', ['flag-a', 's', 'id518', None, 0, [25000, 25000, 25000]], [1, 0.304053]),
('rollout sample 48', ['flag-b', 's', 'id25', '', 0, [0, 60000, 40000]], [2, 0.8777])],
[('seed zero is a real seed', ['flag-a', 's', 'id1', None, 0, [50000, 50000]], [0, 0.331393]),
('seed replaces flag key and salt', ['flag-b', 's', 'id2', None, 7, [30000, 70000]], [1, 0.855827]),
('non-empty secondary', ['flag-a', 's', 'id4', 'eu', None, [10000, 90000]], [1, 0.975219]),
('weights short of total go to last index',
['flag-b', 'salt2', 'id5', None, None, [10000, 10000]],
[1, 0.233147]),
('zero-weight first variation', ['flag-b', 's', 'id6', None, None, [0, 100000]], [1, 0.255084]),
('rollout sample 8', ['flag-b', 's', 'id129', None, 0, [25000, 25000, 25000]], [0, 0.124835]),
('rollout sample 16', ['flag-b', 'salt2', 'id229', 'eu', 61, [10000, 20000, 70000]], [2, 0.315757]),
('rollout sample 27', ['flag-a', 'salt2', 'id732', '', 61, [50000, 50000]], [1, 0.80431])],
[('seed zero is a real seed', ['flag-a', 's', 'id1', None, 0, [50000, 50000]], [0, 0.331393]),
('seed replaces flag key and salt', ['flag-b', 's', 'id2', None, 7, [30000, 70000]], [1, 0.855827]),
('empty secondary is still appended', ['flag-a', 's', 'id3', '', None, [50000, 50000]], [1, 0.891663]),
('weights short of total go to last index',
['flag-b', 'salt2', 'id5', None, None, [10000, 10000]],
[1, 0.233147]),
('zero-weight first variation', ['flag-b', 's', 'id6', None, None, [0, 100000]], [1, 0.255084]),
('rollout sample 21', ['flag-a', 'salt2', 'id352', '', None, [99999]], [0, 0.94531]),
('rollout sample 30', ['flag-b', 'salt2', 'id599', 'eu', 0, [30000, 30000]], [1, 0.450018]),
('rollout sample 40', ['flag-b', 'salt2', 'id862', 'x', 61, [10000, 20000, 70000]], [2, 0.319084])]]
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 |
|---|---|---|---|
| seed zero is a real seed | [1, 0.703145] | [0, 0.331393] | Failed |
| seed replaces flag key and salt | [1, 0.855827] | [1, 0.855827] | Passed |
| empty secondary is still appended | [1, 0.891663] | [1, 0.891663] | Passed |
| non-empty secondary | [1, 0.975219] | [1, 0.975219] | Passed |
| weights short of total go to last index | [1, 0.233147] | [1, 0.233147] | Passed |
| rollout sample 1 | [1, 0.127778] | [2, 0.88242] | Failed |
| rollout sample 2 | [1, 0.37423] | [1, 0.37423] | Passed |
| rollout sample 3 | [0, 0.322784] | [0, 0.322784] | Passed |
SHA-256 / 466c122410545f7ef8f2b39918b9a10ebe5722e221373eda0770f5a787c2efe6
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import hashlib
N = 1
observations = []
def solve(flag_key, salt, ident, secondary, seed, weights):
prefix = str(seed) + '.' + flag_key if seed is not None else flag_key + '.' + salt
text = prefix + '.' + ident
if secondary is not None:
text += '.' + secondary
bucket = int(hashlib.sha1(text.encode()).hexdigest()[:15], 16) / float(0xFFFFFFFFFFFFFFF)
acc = 0
for index, w in enumerate(weights):
acc += w
if bucket < acc / 100000.0:
return [index, round(bucket, 6)]
return [len(weights) - 1, round(bucket, 6)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('seed zero is a real seed', ['flag-a', 's', 'id1', None, 0, [50000, 50000]], [0, 0.331393]),
('seed replaces flag key and salt', ['flag-b', 's', 'id2', None, 7, [30000, 70000]], [1, 0.855827]),
('empty secondary is still appended', ['flag-a', 's', 'id3', '', None, [50000, 50000]], [1, 0.891663]),
('non-empty secondary', ['flag-a', 's', 'id4', 'eu', None, [10000, 90000]], [1, 0.975219]),
('weights short of total go to last index',
['flag-b', 'salt2', 'id5', None, None, [10000, 10000]],
[1, 0.233147]),
('rollout sample 1', ['flag-b', 'salt2', 'id120', '', 0, [0, 60000, 40000]], [2, 0.88242]),
('rollout sample 2', ['flag-b', 's', 'id212', 'x', 61, [25000, 25000, 25000]], [1, 0.37423]),
('rollout sample 3', ['flag-b', 'salt2', 'id106', None, 7, [50000, 50000]], [0, 0.322784])],
[('seed zero is a real seed', ['flag-a', 's', 'id1', None, 0, [50000, 50000]], [0, 0.331393]),
('seed replaces flag key and salt', ['flag-b', 's', 'id2', None, 7, [30000, 70000]], [1, 0.855827]),
('empty secondary is still appended', ['flag-a', 's', 'id3', '', None, [50000, 50000]], [1, 0.891663]),
('non-empty secondary', ['flag-a', 's', 'id4', 'eu', None, [10000, 90000]], [1, 0.975219]),
('weights short of total go to last index',
['flag-b', 'salt2', 'id5', None, None, [10000, 10000]],
[1, 0.233147]),
('zero-weight first variation', ['flag-b', 's', 'id6', None, None, [0, 100000]], [1, 0.255084]),
('rollout sample 6', ['flag-b', 'salt2', 'id765', None, 7, [10000, 20000, 70000]], [2, 0.464498]),
('rollout sample 19', ['flag-b', 's', 'id433', 'x', 0, [0, 60000, 40000]], [1, 0.110676])],
[('seed zero is a real seed', ['flag-a', 's', 'id1', None, 0, [50000, 50000]], [0, 0.331393]),
('empty secondary is still appended', ['flag-a', 's', 'id3', '', None, [50000, 50000]], [1, 0.891663]),
('non-empty secondary', ['flag-a', 's', 'id4', 'eu', None, [10000, 90000]], [1, 0.975219]),
('weights short of total go to last index',
['flag-b', 'salt2', 'id5', None, None, [10000, 10000]],
[1, 0.233147]),
('zero-weight first variation', ['flag-b', 's', 'id6', None, None, [0, 100000]], [1, 0.255084]),
('rollout sample 11', ['flag-a', 'salt2', 'id773', '', 7, [0, 60000, 40000]], [1, 0.477906]),
('rollout sample 15', ['flag-a', 's', 'id518', None, 0, [25000, 25000, 25000]], [1, 0.304053]),
('rollout sample 48', ['flag-b', 's', 'id25', '', 0, [0, 60000, 40000]], [2, 0.8777])],
[('seed zero is a real seed', ['flag-a', 's', 'id1', None, 0, [50000, 50000]], [0, 0.331393]),
('seed replaces flag key and salt', ['flag-b', 's', 'id2', None, 7, [30000, 70000]], [1, 0.855827]),
('non-empty secondary', ['flag-a', 's', 'id4', 'eu', None, [10000, 90000]], [1, 0.975219]),
('weights short of total go to last index',
['flag-b', 'salt2', 'id5', None, None, [10000, 10000]],
[1, 0.233147]),
('zero-weight first variation', ['flag-b', 's', 'id6', None, None, [0, 100000]], [1, 0.255084]),
('rollout sample 8', ['flag-b', 's', 'id129', None, 0, [25000, 25000, 25000]], [0, 0.124835]),
('rollout sample 16', ['flag-b', 'salt2', 'id229', 'eu', 61, [10000, 20000, 70000]], [2, 0.315757]),
('rollout sample 27', ['flag-a', 'salt2', 'id732', '', 61, [50000, 50000]], [1, 0.80431])],
[('seed zero is a real seed', ['flag-a', 's', 'id1', None, 0, [50000, 50000]], [0, 0.331393]),
('seed replaces flag key and salt', ['flag-b', 's', 'id2', None, 7, [30000, 70000]], [1, 0.855827]),
('empty secondary is still appended', ['flag-a', 's', 'id3', '', None, [50000, 50000]], [1, 0.891663]),
('weights short of total go to last index',
['flag-b', 'salt2', 'id5', None, None, [10000, 10000]],
[1, 0.233147]),
('zero-weight first variation', ['flag-b', 's', 'id6', None, None, [0, 100000]], [1, 0.255084]),
('rollout sample 21', ['flag-a', 'salt2', 'id352', '', None, [99999]], [0, 0.94531]),
('rollout sample 30', ['flag-b', 'salt2', 'id599', 'eu', 0, [30000, 30000]], [1, 0.450018]),
('rollout sample 40', ['flag-b', 'salt2', 'id862', 'x', 61, [10000, 20000, 70000]], [2, 0.319084])]]
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 |
|---|---|---|---|
| seed zero is a real seed | [0, 0.430117] | [0, 0.331393] | Failed |
| seed replaces flag key and salt | [1, 0.759987] | [1, 0.855827] | Failed |
| empty secondary is still appended | [1, 0.891663] | [1, 0.891663] | Passed |
| non-empty secondary | [1, 0.975219] | [1, 0.975219] | Passed |
| weights short of total go to last index | [1, 0.233147] | [1, 0.233147] | Passed |
| rollout sample 1 | [2, 0.854306] | [2, 0.88242] | Failed |
| rollout sample 2 | [2, 0.901075] | [1, 0.37423] | Failed |
| rollout sample 3 | [0, 0.026223] | [0, 0.322784] | Failed |
SHA-256 / e615a3781d0c875e92c3f7b6669ce0a12a80684f8d811c427ada24afcac4cadc
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:55.427021+00:00.
Case digest / cac57d2565fe8cc4bce3eb890c66f237598ad8586da80fa171b63e7456af863a