FAILURE MAP
← Case archive

FA-74191 / Feature flag rollout bucketing / Open access

Exposure event deduplication: Events are processed in arrival order · case 01

Late-arriving older events are emitted after newer ones and suppress the wrong exposures.

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

ROOT CAUSE

The loop walks events by list index instead of timestamp.

VERIFIED REPAIR

Process events in timestamp order, stable for ties.

Unsuccessful approach: Grouping by user before time emits the right events in a non-chronological order.

Case contract

events are [t, user, flag, variant] processed in timestamp order (stable for ties). An exposure is emitted unless the same (user, flag, variant) was emitted less than window seconds earlier; suppressed events do not move the window. Return emitted indices in processing order.

Why this case matters

Exposure logs define who entered an experiment; duplicates and gaps both bias analysis.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events, window):
    last = {}
    out = []
    for i in range(len(events)):
        t, user, flag, variant = events[i]
        k = (user, flag, variant)
        if k in last and t - last[k] < window:
            continue
        last[k] = t
        out.append(i)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('variant change emits immediately', [[[0, 'a', 'f', 'on'], [1, 'a', 'f', 'off']], 10], [0, 1]),
  ('different flags are tracked separately', [[[0, 'a', 'f', 'on'], [1, 'a', 'g', 'on']], 10], [0, 1]),
  ('suppressed events do not extend the window',
   [[[0, 'a', 'f', 'on'], [8, 'a', 'f', 'on'], [12, 'a', 'f', 'on']], 10],
   [0, 2]),
  ('duplicate inside a re-anchored window is suppressed',
   [[[0, 'a', 'f', 'on'], [12, 'a', 'f', 'on'], [15, 'a', 'f', 'on'], [25, 'a', 'f', 'on']], 10],
   [0, 1, 3]),
  ('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('exposure stream sample 1',
   [[[2, 'a', 'f', 'on'],
     [2, 'b', 'g', 'on'],
     [9, 'a', 'g', 'on'],
     [14, 'b', 'g', 'off'],
     [18, 'a', 'g', 'off'],
     [21, 'b', 'f', 'off'],
     [21, 'b', 'f', 'on'],
     [24, 'a', 'f', 'off']],
    5],
   [0, 1, 2, 3, 4, 5, 6, 7]),
  ('exposure stream sample 2',
   [[[21, 'a', 'f', 'off'],
     [8, 'a', 'g', 'off'],
     [3, 'a', 'f', 'off'],
     [9, 'b', 'f', 'on'],
     [21, 'a', 'g', 'on'],
     [24, 'b', 'g', 'off'],
     [20, 'b', 'f', 'on']],
    0],
   [2, 1, 3, 6, 0, 4, 5])],
 [('different flags are tracked separately', [[[0, 'a', 'f', 'on'], [1, 'a', 'g', 'on']], 10], [0, 1]),
  ('suppressed events do not extend the window',
   [[[0, 'a', 'f', 'on'], [8, 'a', 'f', 'on'], [12, 'a', 'f', 'on']], 10],
   [0, 2]),
  ('duplicate inside a re-anchored window is suppressed',
   [[[0, 'a', 'f', 'on'], [12, 'a', 'f', 'on'], [15, 'a', 'f', 'on'], [25, 'a', 'f', 'on']], 10],
   [0, 1, 3]),
  ('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('exactly one window later emits again', [[[0, 'a', 'f', 'on'], [10, 'a', 'f', 'on']], 10], [0, 1]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('exposure stream sample 10',
   [[[20, 'a', 'f', 'off'], [12, 'b', 'g', 'off'], [11, 'a', 'g', 'off']], 0],
   [2, 1, 0]),
  ('exposure stream sample 16',
   [[[4, 'a', 'g', 'off'],
     [21, 'a', 'g', 'off'],
     [20, 'a', 'g', 'off'],
     [23, 'b', 'g', 'on'],
     [19, 'b', 'f', 'on'],
     [22, 'b', 'f', 'on'],
     [10, 'b', 'f', 'on']],
    0],
   [0, 6, 4, 2, 1, 5, 3])],
 [('suppressed events do not extend the window',
   [[[0, 'a', 'f', 'on'], [8, 'a', 'f', 'on'], [12, 'a', 'f', 'on']], 10],
   [0, 2]),
  ('duplicate inside a re-anchored window is suppressed',
   [[[0, 'a', 'f', 'on'], [12, 'a', 'f', 'on'], [15, 'a', 'f', 'on'], [25, 'a', 'f', 'on']], 10],
   [0, 1, 3]),
  ('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('exactly one window later emits again', [[[0, 'a', 'f', 'on'], [10, 'a', 'f', 'on']], 10], [0, 1]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('exposure stream sample 11',
   [[[10, 'b', 'g', 'on'], [19, 'b', 'g', 'off'], [9, 'b', 'f', 'on'], [16, 'a', 'f', 'on']], 10],
   [2, 0, 3, 1]),
  ('exposure stream sample 19',
   [[[0, 'b', 'f', 'on'], [20, 'b', 'g', 'on'], [4, 'a', 'f', 'off']], 10],
   [0, 2, 1]),
  ('exposure stream sample 27',
   [[[23, 'b', 'g', 'on'], [16, 'b', 'f', 'on'], [18, 'a', 'g', 'off']], 0],
   [1, 2, 0])],
 [('duplicate inside a re-anchored window is suppressed',
   [[[0, 'a', 'f', 'on'], [12, 'a', 'f', 'on'], [15, 'a', 'f', 'on'], [25, 'a', 'f', 'on']], 10],
   [0, 1, 3]),
  ('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('exactly one window later emits again', [[[0, 'a', 'f', 'on'], [10, 'a', 'f', 'on']], 10], [0, 1]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('zero window never suppresses', [[[0, 'a', 'f', 'on'], [0, 'a', 'f', 'on']], 0], [0, 1]),
  ('exposure stream sample 16',
   [[[4, 'a', 'g', 'off'],
     [21, 'a', 'g', 'off'],
     [20, 'a', 'g', 'off'],
     [23, 'b', 'g', 'on'],
     [19, 'b', 'f', 'on'],
     [22, 'b', 'f', 'on'],
     [10, 'b', 'f', 'on']],
    0],
   [0, 6, 4, 2, 1, 5, 3]),
  ('exposure stream sample 27',
   [[[23, 'b', 'g', 'on'], [16, 'b', 'f', 'on'], [18, 'a', 'g', 'off']], 0],
   [1, 2, 0]),
  ('exposure stream sample 38',
   [[[5, 'b', 'g', 'on'],
     [10, 'a', 'f', 'off'],
     [1, 'b', 'g', 'off'],
     [7, 'b', 'g', 'off'],
     [11, 'b', 'f', 'off'],
     [14, 'a', 'g', 'on'],
     [21, 'b', 'g', 'off'],
     [5, 'b', 'f', 'off']],
    0],
   [2, 0, 7, 3, 1, 4, 5, 6])],
 [('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('exactly one window later emits again', [[[0, 'a', 'f', 'on'], [10, 'a', 'f', 'on']], 10], [0, 1]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('zero window never suppresses', [[[0, 'a', 'f', 'on'], [0, 'a', 'f', 'on']], 0], [0, 1]),
  ('users are tracked separately',
   [[[0, 'a', 'f', 'on'], [1, 'b', 'f', 'on'], [2, 'a', 'f', 'on']], 5],
   [0, 1]),
  ('exposure stream sample 21',
   [[[4, 'a', 'g', 'on'],
     [5, 'a', 'g', 'on'],
     [22, 'a', 'f', 'off'],
     [4, 'a', 'g', 'on'],
     [19, 'a', 'f', 'off'],
     [8, 'a', 'g', 'on'],
     [11, 'a', 'f', 'off']],
    5],
   [0, 6, 4]),
  ('exposure stream sample 35',
   [[[11, 'a', 'f', 'off'],
     [16, 'a', 'g', 'off'],
     [4, 'b', 'g', 'on'],
     [15, 'b', 'f', 'off'],
     [14, 'a', 'f', 'off'],
     [13, 'b', 'f', 'on'],
     [11, 'a', 'f', 'on'],
     [0, 'a', 'g', 'on']],
    0],
   [7, 2, 0, 6, 5, 4, 3, 1]),
  ('exposure stream sample 49',
   [[[22, 'a', 'f', 'on'], [2, 'b', 'g', 'off'], [0, 'b', 'g', 'on']], 10],
   [2, 1, 0])]]
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
variant change emits immediately[0, 1][0, 1]Passed
different flags are tracked separately[0, 1][0, 1]Passed
suppressed events do not extend the window[0, 2][0, 2]Passed
duplicate inside a re-anchored window is suppressed[0, 1, 3][0, 1, 3]Passed
one second before the window closes is suppressed[0][0]Passed
events are processed in time order[0, 2][1, 2, 0]Failed
exposure stream sample 1[0, 1, 2, 3, 4, 5, 6, 7][0, 1, 2, 3, 4, 5, 6, 7]Passed
exposure stream sample 2[0, 1, 3, 4, 5, 6][2, 1, 3, 6, 0, 4, 5]Failed

SHA-256 / fba9bafb05ba1ce1eb1d4a203028d30b667f627cac327e936b8f855977b9777f

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events, window):
    last = {}
    out = []
    for i in sorted(range(len(events)), key=lambda j: (events[j][1], events[j][0])):
        t, user, flag, variant = events[i]
        k = (user, flag, variant)
        if k in last and t - last[k] < window:
            continue
        last[k] = t
        out.append(i)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('variant change emits immediately', [[[0, 'a', 'f', 'on'], [1, 'a', 'f', 'off']], 10], [0, 1]),
  ('different flags are tracked separately', [[[0, 'a', 'f', 'on'], [1, 'a', 'g', 'on']], 10], [0, 1]),
  ('suppressed events do not extend the window',
   [[[0, 'a', 'f', 'on'], [8, 'a', 'f', 'on'], [12, 'a', 'f', 'on']], 10],
   [0, 2]),
  ('duplicate inside a re-anchored window is suppressed',
   [[[0, 'a', 'f', 'on'], [12, 'a', 'f', 'on'], [15, 'a', 'f', 'on'], [25, 'a', 'f', 'on']], 10],
   [0, 1, 3]),
  ('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('exposure stream sample 1',
   [[[2, 'a', 'f', 'on'],
     [2, 'b', 'g', 'on'],
     [9, 'a', 'g', 'on'],
     [14, 'b', 'g', 'off'],
     [18, 'a', 'g', 'off'],
     [21, 'b', 'f', 'off'],
     [21, 'b', 'f', 'on'],
     [24, 'a', 'f', 'off']],
    5],
   [0, 1, 2, 3, 4, 5, 6, 7]),
  ('exposure stream sample 2',
   [[[21, 'a', 'f', 'off'],
     [8, 'a', 'g', 'off'],
     [3, 'a', 'f', 'off'],
     [9, 'b', 'f', 'on'],
     [21, 'a', 'g', 'on'],
     [24, 'b', 'g', 'off'],
     [20, 'b', 'f', 'on']],
    0],
   [2, 1, 3, 6, 0, 4, 5])],
 [('different flags are tracked separately', [[[0, 'a', 'f', 'on'], [1, 'a', 'g', 'on']], 10], [0, 1]),
  ('suppressed events do not extend the window',
   [[[0, 'a', 'f', 'on'], [8, 'a', 'f', 'on'], [12, 'a', 'f', 'on']], 10],
   [0, 2]),
  ('duplicate inside a re-anchored window is suppressed',
   [[[0, 'a', 'f', 'on'], [12, 'a', 'f', 'on'], [15, 'a', 'f', 'on'], [25, 'a', 'f', 'on']], 10],
   [0, 1, 3]),
  ('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('exactly one window later emits again', [[[0, 'a', 'f', 'on'], [10, 'a', 'f', 'on']], 10], [0, 1]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('exposure stream sample 10',
   [[[20, 'a', 'f', 'off'], [12, 'b', 'g', 'off'], [11, 'a', 'g', 'off']], 0],
   [2, 1, 0]),
  ('exposure stream sample 16',
   [[[4, 'a', 'g', 'off'],
     [21, 'a', 'g', 'off'],
     [20, 'a', 'g', 'off'],
     [23, 'b', 'g', 'on'],
     [19, 'b', 'f', 'on'],
     [22, 'b', 'f', 'on'],
     [10, 'b', 'f', 'on']],
    0],
   [0, 6, 4, 2, 1, 5, 3])],
 [('suppressed events do not extend the window',
   [[[0, 'a', 'f', 'on'], [8, 'a', 'f', 'on'], [12, 'a', 'f', 'on']], 10],
   [0, 2]),
  ('duplicate inside a re-anchored window is suppressed',
   [[[0, 'a', 'f', 'on'], [12, 'a', 'f', 'on'], [15, 'a', 'f', 'on'], [25, 'a', 'f', 'on']], 10],
   [0, 1, 3]),
  ('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('exactly one window later emits again', [[[0, 'a', 'f', 'on'], [10, 'a', 'f', 'on']], 10], [0, 1]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('exposure stream sample 11',
   [[[10, 'b', 'g', 'on'], [19, 'b', 'g', 'off'], [9, 'b', 'f', 'on'], [16, 'a', 'f', 'on']], 10],
   [2, 0, 3, 1]),
  ('exposure stream sample 19',
   [[[0, 'b', 'f', 'on'], [20, 'b', 'g', 'on'], [4, 'a', 'f', 'off']], 10],
   [0, 2, 1]),
  ('exposure stream sample 27',
   [[[23, 'b', 'g', 'on'], [16, 'b', 'f', 'on'], [18, 'a', 'g', 'off']], 0],
   [1, 2, 0])],
 [('duplicate inside a re-anchored window is suppressed',
   [[[0, 'a', 'f', 'on'], [12, 'a', 'f', 'on'], [15, 'a', 'f', 'on'], [25, 'a', 'f', 'on']], 10],
   [0, 1, 3]),
  ('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('exactly one window later emits again', [[[0, 'a', 'f', 'on'], [10, 'a', 'f', 'on']], 10], [0, 1]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('zero window never suppresses', [[[0, 'a', 'f', 'on'], [0, 'a', 'f', 'on']], 0], [0, 1]),
  ('exposure stream sample 16',
   [[[4, 'a', 'g', 'off'],
     [21, 'a', 'g', 'off'],
     [20, 'a', 'g', 'off'],
     [23, 'b', 'g', 'on'],
     [19, 'b', 'f', 'on'],
     [22, 'b', 'f', 'on'],
     [10, 'b', 'f', 'on']],
    0],
   [0, 6, 4, 2, 1, 5, 3]),
  ('exposure stream sample 27',
   [[[23, 'b', 'g', 'on'], [16, 'b', 'f', 'on'], [18, 'a', 'g', 'off']], 0],
   [1, 2, 0]),
  ('exposure stream sample 38',
   [[[5, 'b', 'g', 'on'],
     [10, 'a', 'f', 'off'],
     [1, 'b', 'g', 'off'],
     [7, 'b', 'g', 'off'],
     [11, 'b', 'f', 'off'],
     [14, 'a', 'g', 'on'],
     [21, 'b', 'g', 'off'],
     [5, 'b', 'f', 'off']],
    0],
   [2, 0, 7, 3, 1, 4, 5, 6])],
 [('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('exactly one window later emits again', [[[0, 'a', 'f', 'on'], [10, 'a', 'f', 'on']], 10], [0, 1]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('zero window never suppresses', [[[0, 'a', 'f', 'on'], [0, 'a', 'f', 'on']], 0], [0, 1]),
  ('users are tracked separately',
   [[[0, 'a', 'f', 'on'], [1, 'b', 'f', 'on'], [2, 'a', 'f', 'on']], 5],
   [0, 1]),
  ('exposure stream sample 21',
   [[[4, 'a', 'g', 'on'],
     [5, 'a', 'g', 'on'],
     [22, 'a', 'f', 'off'],
     [4, 'a', 'g', 'on'],
     [19, 'a', 'f', 'off'],
     [8, 'a', 'g', 'on'],
     [11, 'a', 'f', 'off']],
    5],
   [0, 6, 4]),
  ('exposure stream sample 35',
   [[[11, 'a', 'f', 'off'],
     [16, 'a', 'g', 'off'],
     [4, 'b', 'g', 'on'],
     [15, 'b', 'f', 'off'],
     [14, 'a', 'f', 'off'],
     [13, 'b', 'f', 'on'],
     [11, 'a', 'f', 'on'],
     [0, 'a', 'g', 'on']],
    0],
   [7, 2, 0, 6, 5, 4, 3, 1]),
  ('exposure stream sample 49',
   [[[22, 'a', 'f', 'on'], [2, 'b', 'g', 'off'], [0, 'b', 'g', 'on']], 10],
   [2, 1, 0])]]
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
variant change emits immediately[0, 1][0, 1]Passed
different flags are tracked separately[0, 1][0, 1]Passed
suppressed events do not extend the window[0, 2][0, 2]Passed
duplicate inside a re-anchored window is suppressed[0, 1, 3][0, 1, 3]Passed
one second before the window closes is suppressed[0][0]Passed
events are processed in time order[1, 0, 2][1, 2, 0]Failed
exposure stream sample 1[0, 2, 4, 7, 1, 3, 5, 6][0, 1, 2, 3, 4, 5, 6, 7]Failed
exposure stream sample 2[2, 1, 0, 4, 3, 6, 5][2, 1, 3, 6, 0, 4, 5]Failed

SHA-256 / 552dca887472cc41c4775ec9ae7eaef3da8bd1d4b67370b4b0ac11ac3e2d77f9

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events, window):
    last = {}
    out = []
    for i in sorted(range(len(events)), key=lambda j: events[j][0]):
        t, user, flag, variant = events[i]
        k = (user, flag, variant)
        if k in last and t - last[k] < window:
            continue
        last[k] = t
        out.append(i)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('variant change emits immediately', [[[0, 'a', 'f', 'on'], [1, 'a', 'f', 'off']], 10], [0, 1]),
  ('different flags are tracked separately', [[[0, 'a', 'f', 'on'], [1, 'a', 'g', 'on']], 10], [0, 1]),
  ('suppressed events do not extend the window',
   [[[0, 'a', 'f', 'on'], [8, 'a', 'f', 'on'], [12, 'a', 'f', 'on']], 10],
   [0, 2]),
  ('duplicate inside a re-anchored window is suppressed',
   [[[0, 'a', 'f', 'on'], [12, 'a', 'f', 'on'], [15, 'a', 'f', 'on'], [25, 'a', 'f', 'on']], 10],
   [0, 1, 3]),
  ('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('exposure stream sample 1',
   [[[2, 'a', 'f', 'on'],
     [2, 'b', 'g', 'on'],
     [9, 'a', 'g', 'on'],
     [14, 'b', 'g', 'off'],
     [18, 'a', 'g', 'off'],
     [21, 'b', 'f', 'off'],
     [21, 'b', 'f', 'on'],
     [24, 'a', 'f', 'off']],
    5],
   [0, 1, 2, 3, 4, 5, 6, 7]),
  ('exposure stream sample 2',
   [[[21, 'a', 'f', 'off'],
     [8, 'a', 'g', 'off'],
     [3, 'a', 'f', 'off'],
     [9, 'b', 'f', 'on'],
     [21, 'a', 'g', 'on'],
     [24, 'b', 'g', 'off'],
     [20, 'b', 'f', 'on']],
    0],
   [2, 1, 3, 6, 0, 4, 5])],
 [('different flags are tracked separately', [[[0, 'a', 'f', 'on'], [1, 'a', 'g', 'on']], 10], [0, 1]),
  ('suppressed events do not extend the window',
   [[[0, 'a', 'f', 'on'], [8, 'a', 'f', 'on'], [12, 'a', 'f', 'on']], 10],
   [0, 2]),
  ('duplicate inside a re-anchored window is suppressed',
   [[[0, 'a', 'f', 'on'], [12, 'a', 'f', 'on'], [15, 'a', 'f', 'on'], [25, 'a', 'f', 'on']], 10],
   [0, 1, 3]),
  ('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('exactly one window later emits again', [[[0, 'a', 'f', 'on'], [10, 'a', 'f', 'on']], 10], [0, 1]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('exposure stream sample 10',
   [[[20, 'a', 'f', 'off'], [12, 'b', 'g', 'off'], [11, 'a', 'g', 'off']], 0],
   [2, 1, 0]),
  ('exposure stream sample 16',
   [[[4, 'a', 'g', 'off'],
     [21, 'a', 'g', 'off'],
     [20, 'a', 'g', 'off'],
     [23, 'b', 'g', 'on'],
     [19, 'b', 'f', 'on'],
     [22, 'b', 'f', 'on'],
     [10, 'b', 'f', 'on']],
    0],
   [0, 6, 4, 2, 1, 5, 3])],
 [('suppressed events do not extend the window',
   [[[0, 'a', 'f', 'on'], [8, 'a', 'f', 'on'], [12, 'a', 'f', 'on']], 10],
   [0, 2]),
  ('duplicate inside a re-anchored window is suppressed',
   [[[0, 'a', 'f', 'on'], [12, 'a', 'f', 'on'], [15, 'a', 'f', 'on'], [25, 'a', 'f', 'on']], 10],
   [0, 1, 3]),
  ('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('exactly one window later emits again', [[[0, 'a', 'f', 'on'], [10, 'a', 'f', 'on']], 10], [0, 1]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('exposure stream sample 11',
   [[[10, 'b', 'g', 'on'], [19, 'b', 'g', 'off'], [9, 'b', 'f', 'on'], [16, 'a', 'f', 'on']], 10],
   [2, 0, 3, 1]),
  ('exposure stream sample 19',
   [[[0, 'b', 'f', 'on'], [20, 'b', 'g', 'on'], [4, 'a', 'f', 'off']], 10],
   [0, 2, 1]),
  ('exposure stream sample 27',
   [[[23, 'b', 'g', 'on'], [16, 'b', 'f', 'on'], [18, 'a', 'g', 'off']], 0],
   [1, 2, 0])],
 [('duplicate inside a re-anchored window is suppressed',
   [[[0, 'a', 'f', 'on'], [12, 'a', 'f', 'on'], [15, 'a', 'f', 'on'], [25, 'a', 'f', 'on']], 10],
   [0, 1, 3]),
  ('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('exactly one window later emits again', [[[0, 'a', 'f', 'on'], [10, 'a', 'f', 'on']], 10], [0, 1]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('zero window never suppresses', [[[0, 'a', 'f', 'on'], [0, 'a', 'f', 'on']], 0], [0, 1]),
  ('exposure stream sample 16',
   [[[4, 'a', 'g', 'off'],
     [21, 'a', 'g', 'off'],
     [20, 'a', 'g', 'off'],
     [23, 'b', 'g', 'on'],
     [19, 'b', 'f', 'on'],
     [22, 'b', 'f', 'on'],
     [10, 'b', 'f', 'on']],
    0],
   [0, 6, 4, 2, 1, 5, 3]),
  ('exposure stream sample 27',
   [[[23, 'b', 'g', 'on'], [16, 'b', 'f', 'on'], [18, 'a', 'g', 'off']], 0],
   [1, 2, 0]),
  ('exposure stream sample 38',
   [[[5, 'b', 'g', 'on'],
     [10, 'a', 'f', 'off'],
     [1, 'b', 'g', 'off'],
     [7, 'b', 'g', 'off'],
     [11, 'b', 'f', 'off'],
     [14, 'a', 'g', 'on'],
     [21, 'b', 'g', 'off'],
     [5, 'b', 'f', 'off']],
    0],
   [2, 0, 7, 3, 1, 4, 5, 6])],
 [('one second before the window closes is suppressed',
   [[[0, 'b', 'g', 'off'], [9, 'b', 'g', 'off']], 10],
   [0]),
  ('exactly one window later emits again', [[[0, 'a', 'f', 'on'], [10, 'a', 'f', 'on']], 10], [0, 1]),
  ('events are processed in time order',
   [[[12, 'a', 'f', 'on'], [0, 'a', 'f', 'on'], [5, 'b', 'f', 'on']], 10],
   [1, 2, 0]),
  ('zero window never suppresses', [[[0, 'a', 'f', 'on'], [0, 'a', 'f', 'on']], 0], [0, 1]),
  ('users are tracked separately',
   [[[0, 'a', 'f', 'on'], [1, 'b', 'f', 'on'], [2, 'a', 'f', 'on']], 5],
   [0, 1]),
  ('exposure stream sample 21',
   [[[4, 'a', 'g', 'on'],
     [5, 'a', 'g', 'on'],
     [22, 'a', 'f', 'off'],
     [4, 'a', 'g', 'on'],
     [19, 'a', 'f', 'off'],
     [8, 'a', 'g', 'on'],
     [11, 'a', 'f', 'off']],
    5],
   [0, 6, 4]),
  ('exposure stream sample 35',
   [[[11, 'a', 'f', 'off'],
     [16, 'a', 'g', 'off'],
     [4, 'b', 'g', 'on'],
     [15, 'b', 'f', 'off'],
     [14, 'a', 'f', 'off'],
     [13, 'b', 'f', 'on'],
     [11, 'a', 'f', 'on'],
     [0, 'a', 'g', 'on']],
    0],
   [7, 2, 0, 6, 5, 4, 3, 1]),
  ('exposure stream sample 49',
   [[[22, 'a', 'f', 'on'], [2, 'b', 'g', 'off'], [0, 'b', 'g', 'on']], 10],
   [2, 1, 0])]]
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
variant change emits immediately[0, 1][0, 1]Passed
different flags are tracked separately[0, 1][0, 1]Passed
suppressed events do not extend the window[0, 2][0, 2]Passed
duplicate inside a re-anchored window is suppressed[0, 1, 3][0, 1, 3]Passed
one second before the window closes is suppressed[0][0]Passed
events are processed in time order[1, 2, 0][1, 2, 0]Passed
exposure stream sample 1[0, 1, 2, 3, 4, 5, 6, 7][0, 1, 2, 3, 4, 5, 6, 7]Passed
exposure stream sample 2[2, 1, 3, 6, 0, 4, 5][2, 1, 3, 6, 0, 4, 5]Passed

SHA-256 / 86876c368c74d5d15ad227f6321fdef12b9e0cf3de033e7bd480109e9be2a432

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

Case digest / b95bdb1161bbede8b776b0fa6a7b658ff8e8c27c0a36a6ed1afa0012143b15ac