FAILURE MAP
← Case archive

FA-74086 / Feature flag rollout bucketing / Open access

Mutually exclusive layer allocation: Layer hash drops the separator · case 01

Layer salts and user ids run together, so ("ab", "c") and ("a", "bc") share a bucket and SDKs disagree.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The hash input is layer_salt + user without the ":" separator.

THE FAILURE

The hash input is layer_salt + user without the ":" separator.

Unsuccessful approach: Putting the user before the salt keeps the separator but changes the hashed text.

Case contract

bucket = int(md5(layer_salt + ":" + user) hex, 16) % 1000. experiments is an ordered list of {name, start, end, paused?} with start/end in percent (one decimal) converted to permille by round(x * 10); ranges are half-open [start, end). The first listed range containing the bucket decides: a paused experiment reserves its range (user gets None). Return [bucket, name or None].

Why this case matters

Layers keep concurrent experiments from overlapping on the same users.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import hashlib
N = 1
observations = []
def solve(layer_salt, user, experiments):
    bucket = int(hashlib.md5((layer_salt + user).encode()).hexdigest(), 16) % 1000
    for exp in experiments:
        lo = round(exp['start'] * 10)
        hi = round(exp['end'] * 10)
        if lo <= bucket < hi:
            if exp.get('paused'):
                return [bucket, None]
            return [bucket, exp['name']]
    return [bucket, None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('bucket at range end belongs to next range',
   ['layer-a', 'alice', [{'name': 'x', 'start': 0, 'end': 98.8}, {'name': 'y', 'start': 98.8, 'end': 100}]],
   [988, 'y']),
  ('bucket at range start is included',
   ['layer-b', 'bob', [{'name': 'x', 'start': 30.9, 'end': 100}]],
   [309, 'x']),
  ('paused range reserves its users',
   ['layer-a',
    'alice',
    [{'name': 'x', 'start': 0, 'end': 100, 'paused': True}, {'name': 'y', 'start': 0, 'end': 100}]],
   [988, None]),
  ('first listed overlapping range wins',
   ['layer-b',
    'bob',
    [{'name': 'wide', 'start': 0, 'end': 100}, {'name': 'narrow', 'start': 30.9, 'end': 31.0}]],
   [309, 'wide']),
  ('percent bounds convert to permille',
   ['layer-a', 'alice', [{'name': 'x', 'start': 98.3, 'end': 99.3}]],
   [988, 'x']),
  ('empty experiment list', ['layer-a', 'carol', []], [970, None]),
  ('layer sample 1',
   ['layer-a',
    'u295',
    [{'name': 'exp0', 'start': 50, 'end': 57.7, 'paused': False},
     {'name': 'exp1', 'start': 0, 'end': 57.7, 'paused': False}]],
   [576, 'exp0']),
  ('layer sample 2',
   ['layer-b',
    'u4435',
    [{'name': 'exp0', 'start': 0, 'end': 75.0, 'paused': True},
     {'name': 'exp1', 'start': 0, 'end': 74.9, 'paused': False}]],
   [750, None])],
 [('bucket at range start is included',
   ['layer-b', 'bob', [{'name': 'x', 'start': 30.9, 'end': 100}]],
   [309, 'x']),
  ('paused range reserves its users',
   ['layer-a',
    'alice',
    [{'name': 'x', 'start': 0, 'end': 100, 'paused': True}, {'name': 'y', 'start': 0, 'end': 100}]],
   [988, None]),
  ('first listed overlapping range wins',
   ['layer-b',
    'bob',
    [{'name': 'wide', 'start': 0, 'end': 100}, {'name': 'narrow', 'start': 30.9, 'end': 31.0}]],
   [309, 'wide']),
  ('percent bounds convert to permille',
   ['layer-a', 'alice', [{'name': 'x', 'start': 98.3, 'end': 99.3}]],
   [988, 'x']),
  ('no range matches', ['layer-b', 'bob', [{'name': 'x', 'start': 0, 'end': 0}]], [309, None]),
  ('empty experiment list', ['layer-a', 'carol', []], [970, None]),
  ('layer sample 1',
   ['layer-a',
    'u295',
    [{'name': 'exp0', 'start': 50, 'end': 57.7, 'paused': False},
     {'name': 'exp1', 'start': 0, 'end': 57.7, 'paused': False}]],
   [576, 'exp0']),
  ('layer sample 6',
   ['layer-a', 'u2869', [{'name': 'exp0', 'start': 28.1, 'end': 50, 'paused': False}]],
   [282, 'exp0'])],
 [('paused range reserves its users',
   ['layer-a',
    'alice',
    [{'name': 'x', 'start': 0, 'end': 100, 'paused': True}, {'name': 'y', 'start': 0, 'end': 100}]],
   [988, None]),
  ('first listed overlapping range wins',
   ['layer-b',
    'bob',
    [{'name': 'wide', 'start': 0, 'end': 100}, {'name': 'narrow', 'start': 30.9, 'end': 31.0}]],
   [309, 'wide']),
  ('percent bounds convert to permille',
   ['layer-a', 'alice', [{'name': 'x', 'start': 98.3, 'end': 99.3}]],
   [988, 'x']),
  ('no range matches', ['layer-b', 'bob', [{'name': 'x', 'start': 0, 'end': 0}]], [309, None]),
  ('empty experiment list', ['layer-a', 'carol', []], [970, None]),
  ('layer sample 8',
   ['layer-a', 'u2719', [{'name': 'exp0', 'start': 3.74, 'end': 37.5, 'paused': False}]],
   [374, 'exp0']),
  ('layer sample 11',
   ['layer-b',
    'u3995',
    [{'name': 'exp0', 'start': 50, 'end': 84.5, 'paused': True},
     {'name': 'exp1', 'start': 8.45, 'end': 84.5, 'paused': True}]],
   [845, None]),
  ('layer sample 12',
   ['layer-a', 'u3185', [{'name': 'exp0', 'start': 50, 'end': 98.8, 'paused': False}]],
   [344, None])],
 [('bucket at range end belongs to next range',
   ['layer-a', 'alice', [{'name': 'x', 'start': 0, 'end': 98.8}, {'name': 'y', 'start': 98.8, 'end': 100}]],
   [988, 'y']),
  ('first listed overlapping range wins',
   ['layer-b',
    'bob',
    [{'name': 'wide', 'start': 0, 'end': 100}, {'name': 'narrow', 'start': 30.9, 'end': 31.0}]],
   [309, 'wide']),
  ('percent bounds convert to permille',
   ['layer-a', 'alice', [{'name': 'x', 'start': 98.3, 'end': 99.3}]],
   [988, 'x']),
  ('no range matches', ['layer-b', 'bob', [{'name': 'x', 'start': 0, 'end': 0}]], [309, None]),
  ('empty experiment list', ['layer-a', 'carol', []], [970, None]),
  ('layer sample 15',
   ['layer-a',
    'u2371',
    [{'name': 'exp0', 'start': 74.2, 'end': 74.3, 'paused': False},
     {'name': 'exp1', 'start': 56.3, 'end': 74.4, 'paused': False}]],
   [743, 'exp1']),
  ('layer sample 16',
   ['layer-a',
    'u4745',
    [{'name': 'exp0', 'start': 81.9, 'end': 100, 'paused': True},
     {'name': 'exp1', 'start': 8.19, 'end': 82.0, 'paused': True},
     {'name': 'exp2', 'start': 50, 'end': 82.0, 'paused': False}]],
   [819, None]),
  ('layer sample 17',
   ['layer-a',
    'u1058',
    [{'name': 'exp0', 'start': 39.5, 'end': 100, 'paused': False},
     {'name': 'exp1', 'start': 39.3, 'end': 39.4, 'paused': False}]],
   [394, None])],
 [('bucket at range end belongs to next range',
   ['layer-a', 'alice', [{'name': 'x', 'start': 0, 'end': 98.8}, {'name': 'y', 'start': 98.8, 'end': 100}]],
   [988, 'y']),
  ('bucket at range start is included',
   ['layer-b', 'bob', [{'name': 'x', 'start': 30.9, 'end': 100}]],
   [309, 'x']),
  ('percent bounds convert to permille',
   ['layer-a', 'alice', [{'name': 'x', 'start': 98.3, 'end': 99.3}]],
   [988, 'x']),
  ('no range matches', ['layer-b', 'bob', [{'name': 'x', 'start': 0, 'end': 0}]], [309, None]),
  ('empty experiment list', ['layer-a', 'carol', []], [970, None]),
  ('layer sample 21',
   ['layer-a',
    'u505',
    [{'name': 'exp0', 'start': 0, 'end': 100, 'paused': False},
     {'name': 'exp1', 'start': 54.1, 'end': 100, 'paused': False}]],
   [540, 'exp0']),
  ('layer sample 22',
   ['layer-b',
    'u3057',
    [{'name': 'exp0', 'start': 0, 'end': 22.2, 'paused': False},
     {'name': 'exp1', 'start': 0, 'end': 100, 'paused': False},
     {'name': 'exp2', 'start': 3.76, 'end': 37.5, 'paused': False}]],
   [376, 'exp1']),
  ('layer sample 23',
   ['layer-b',
    'u3183',
    [{'name': 'exp0', 'start': 0, 'end': 50, 'paused': True},
     {'name': 'exp1', 'start': 23.6, 'end': 100, 'paused': False},
     {'name': 'exp2', 'start': 23.7, 'end': 50, 'paused': False}]],
   [236, None])]]
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 fixtureActualExpectedOutcome
bucket at range end belongs to next range[20, 'x'][988, 'y']Failed
bucket at range start is included[456, 'x'][309, 'x']Failed
paused range reserves its users[20, None][988, None]Failed
first listed overlapping range wins[456, 'wide'][309, 'wide']Failed
percent bounds convert to permille[20, None][988, 'x']Failed
empty experiment list[679, None][970, None]Failed
layer sample 1[323, 'exp1'][576, 'exp0']Failed
layer sample 2[900, None][750, None]Failed

SHA-256 / 05a7ca1432c1c23036c18b10f8cdab3d5c67cb4e9c5c066a02e3c2a5750cd01f

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import hashlib
N = 1
observations = []
def solve(layer_salt, user, experiments):
    bucket = int(hashlib.md5((user + ':' + layer_salt).encode()).hexdigest(), 16) % 1000
    for exp in experiments:
        lo = round(exp['start'] * 10)
        hi = round(exp['end'] * 10)
        if lo <= bucket < hi:
            if exp.get('paused'):
                return [bucket, None]
            return [bucket, exp['name']]
    return [bucket, None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('bucket at range end belongs to next range',
   ['layer-a', 'alice', [{'name': 'x', 'start': 0, 'end': 98.8}, {'name': 'y', 'start': 98.8, 'end': 100}]],
   [988, 'y']),
  ('bucket at range start is included',
   ['layer-b', 'bob', [{'name': 'x', 'start': 30.9, 'end': 100}]],
   [309, 'x']),
  ('paused range reserves its users',
   ['layer-a',
    'alice',
    [{'name': 'x', 'start': 0, 'end': 100, 'paused': True}, {'name': 'y', 'start': 0, 'end': 100}]],
   [988, None]),
  ('first listed overlapping range wins',
   ['layer-b',
    'bob',
    [{'name': 'wide', 'start': 0, 'end': 100}, {'name': 'narrow', 'start': 30.9, 'end': 31.0}]],
   [309, 'wide']),
  ('percent bounds convert to permille',
   ['layer-a', 'alice', [{'name': 'x', 'start': 98.3, 'end': 99.3}]],
   [988, 'x']),
  ('empty experiment list', ['layer-a', 'carol', []], [970, None]),
  ('layer sample 1',
   ['layer-a',
    'u295',
    [{'name': 'exp0', 'start': 50, 'end': 57.7, 'paused': False},
     {'name': 'exp1', 'start': 0, 'end': 57.7, 'paused': False}]],
   [576, 'exp0']),
  ('layer sample 2',
   ['layer-b',
    'u4435',
    [{'name': 'exp0', 'start': 0, 'end': 75.0, 'paused': True},
     {'name': 'exp1', 'start': 0, 'end': 74.9, 'paused': False}]],
   [750, None])],
 [('bucket at range start is included',
   ['layer-b', 'bob', [{'name': 'x', 'start': 30.9, 'end': 100}]],
   [309, 'x']),
  ('paused range reserves its users',
   ['layer-a',
    'alice',
    [{'name': 'x', 'start': 0, 'end': 100, 'paused': True}, {'name': 'y', 'start': 0, 'end': 100}]],
   [988, None]),
  ('first listed overlapping range wins',
   ['layer-b',
    'bob',
    [{'name': 'wide', 'start': 0, 'end': 100}, {'name': 'narrow', 'start': 30.9, 'end': 31.0}]],
   [309, 'wide']),
  ('percent bounds convert to permille',
   ['layer-a', 'alice', [{'name': 'x', 'start': 98.3, 'end': 99.3}]],
   [988, 'x']),
  ('no range matches', ['layer-b', 'bob', [{'name': 'x', 'start': 0, 'end': 0}]], [309, None]),
  ('empty experiment list', ['layer-a', 'carol', []], [970, None]),
  ('layer sample 1',
   ['layer-a',
    'u295',
    [{'name': 'exp0', 'start': 50, 'end': 57.7, 'paused': False},
     {'name': 'exp1', 'start': 0, 'end': 57.7, 'paused': False}]],
   [576, 'exp0']),
  ('layer sample 6',
   ['layer-a', 'u2869', [{'name': 'exp0', 'start': 28.1, 'end': 50, 'paused': False}]],
   [282, 'exp0'])],
 [('paused range reserves its users',
   ['layer-a',
    'alice',
    [{'name': 'x', 'start': 0, 'end': 100, 'paused': True}, {'name': 'y', 'start': 0, 'end': 100}]],
   [988, None]),
  ('first listed overlapping range wins',
   ['layer-b',
    'bob',
    [{'name': 'wide', 'start': 0, 'end': 100}, {'name': 'narrow', 'start': 30.9, 'end': 31.0}]],
   [309, 'wide']),
  ('percent bounds convert to permille',
   ['layer-a', 'alice', [{'name': 'x', 'start': 98.3, 'end': 99.3}]],
   [988, 'x']),
  ('no range matches', ['layer-b', 'bob', [{'name': 'x', 'start': 0, 'end': 0}]], [309, None]),
  ('empty experiment list', ['layer-a', 'carol', []], [970, None]),
  ('layer sample 8',
   ['layer-a', 'u2719', [{'name': 'exp0', 'start': 3.74, 'end': 37.5, 'paused': False}]],
   [374, 'exp0']),
  ('layer sample 11',
   ['layer-b',
    'u3995',
    [{'name': 'exp0', 'start': 50, 'end': 84.5, 'paused': True},
     {'name': 'exp1', 'start': 8.45, 'end': 84.5, 'paused': True}]],
   [845, None]),
  ('layer sample 12',
   ['layer-a', 'u3185', [{'name': 'exp0', 'start': 50, 'end': 98.8, 'paused': False}]],
   [344, None])],
 [('bucket at range end belongs to next range',
   ['layer-a', 'alice', [{'name': 'x', 'start': 0, 'end': 98.8}, {'name': 'y', 'start': 98.8, 'end': 100}]],
   [988, 'y']),
  ('first listed overlapping range wins',
   ['layer-b',
    'bob',
    [{'name': 'wide', 'start': 0, 'end': 100}, {'name': 'narrow', 'start': 30.9, 'end': 31.0}]],
   [309, 'wide']),
  ('percent bounds convert to permille',
   ['layer-a', 'alice', [{'name': 'x', 'start': 98.3, 'end': 99.3}]],
   [988, 'x']),
  ('no range matches', ['layer-b', 'bob', [{'name': 'x', 'start': 0, 'end': 0}]], [309, None]),
  ('empty experiment list', ['layer-a', 'carol', []], [970, None]),
  ('layer sample 15',
   ['layer-a',
    'u2371',
    [{'name': 'exp0', 'start': 74.2, 'end': 74.3, 'paused': False},
     {'name': 'exp1', 'start': 56.3, 'end': 74.4, 'paused': False}]],
   [743, 'exp1']),
  ('layer sample 16',
   ['layer-a',
    'u4745',
    [{'name': 'exp0', 'start': 81.9, 'end': 100, 'paused': True},
     {'name': 'exp1', 'start': 8.19, 'end': 82.0, 'paused': True},
     {'name': 'exp2', 'start': 50, 'end': 82.0, 'paused': False}]],
   [819, None]),
  ('layer sample 17',
   ['layer-a',
    'u1058',
    [{'name': 'exp0', 'start': 39.5, 'end': 100, 'paused': False},
     {'name': 'exp1', 'start': 39.3, 'end': 39.4, 'paused': False}]],
   [394, None])],
 [('bucket at range end belongs to next range',
   ['layer-a', 'alice', [{'name': 'x', 'start': 0, 'end': 98.8}, {'name': 'y', 'start': 98.8, 'end': 100}]],
   [988, 'y']),
  ('bucket at range start is included',
   ['layer-b', 'bob', [{'name': 'x', 'start': 30.9, 'end': 100}]],
   [309, 'x']),
  ('percent bounds convert to permille',
   ['layer-a', 'alice', [{'name': 'x', 'start': 98.3, 'end': 99.3}]],
   [988, 'x']),
  ('no range matches', ['layer-b', 'bob', [{'name': 'x', 'start': 0, 'end': 0}]], [309, None]),
  ('empty experiment list', ['layer-a', 'carol', []], [970, None]),
  ('layer sample 21',
   ['layer-a',
    'u505',
    [{'name': 'exp0', 'start': 0, 'end': 100, 'paused': False},
     {'name': 'exp1', 'start': 54.1, 'end': 100, 'paused': False}]],
   [540, 'exp0']),
  ('layer sample 22',
   ['layer-b',
    'u3057',
    [{'name': 'exp0', 'start': 0, 'end': 22.2, 'paused': False},
     {'name': 'exp1', 'start': 0, 'end': 100, 'paused': False},
     {'name': 'exp2', 'start': 3.76, 'end': 37.5, 'paused': False}]],
   [376, 'exp1']),
  ('layer sample 23',
   ['layer-b',
    'u3183',
    [{'name': 'exp0', 'start': 0, 'end': 50, 'paused': True},
     {'name': 'exp1', 'start': 23.6, 'end': 100, 'paused': False},
     {'name': 'exp2', 'start': 23.7, 'end': 50, 'paused': False}]],
   [236, None])]]
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 fixtureActualExpectedOutcome
bucket at range end belongs to next range[615, 'x'][988, 'y']Failed
bucket at range start is included[264, None][309, 'x']Failed
paused range reserves its users[615, None][988, None]Failed
first listed overlapping range wins[264, 'wide'][309, 'wide']Failed
percent bounds convert to permille[615, None][988, 'x']Failed
empty experiment list[12, None][970, None]Failed
layer sample 1[794, None][576, 'exp0']Failed
layer sample 2[763, None][750, None]Failed

SHA-256 / a3ad221a24e6a43f91adf8eef124bd2d32f59abd391d5887153e554af4258480

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:53.342648+00:00.

Case digest / 9ed8248b4093517ace9d250c0d7f84e6ce538ec22781a9bb876cd2a7986854e6