FA-271 / Runtime and resources / Open access
A busy batch never reaches its flush deadline · case 01
Each arrival postpones a batch timer, so sustained low-rate traffic starves publication.
ROOT CAUSE
The deadline is based on the latest arrival instead of the oldest buffered item.
VERIFIED REPAIR
Set one deadline when an empty batch receives its first item and flush at or before the next arrival at that deadline.
Unsuccessful approach: Anchoring the timer correctly but using a strict greater-than comparison leaves an exactly due batch pending.
Case contract
Arrivals have nondecreasing integer timestamps and latency is nonnegative. Before admitting an arrival, flush an existing batch if its first-item deadline <= arrival time. At finish_time (>= last arrival), flush if due. Record the scheduled deadline as flush time. Return [flushed [time,values] batches,remaining values]; actual event-loop delay is outside this model.
Why this case matters
Models latency-bounded batching and the difference between a debounce timer and a maximum age guarantee for the oldest queued item.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(latency, arrivals, finish_time):
pending, deadline, flushed = [], None, []
for timestamp, value in arrivals:
if pending and deadline <= timestamp:
flushed.append([deadline, pending])
pending, deadline = [], None
if True:
deadline = timestamp + latency
pending.append(value)
if pending and deadline <= finish_time:
flushed.append([deadline, pending])
pending = []
return [flushed, pending]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('steady arrivals cannot postpone oldest', solve(3*N, [[0, 'a'], [N, 'b'], [2*N, 'c']], 3*N), [[[3*N, ['a', 'b', 'c']]], []])
check('arrival at deadline starts new batch', solve(3*N, [[0, 'a'], [3*N, 'b']], 3*N), [[[3*N, ['a']]], ['b']])
check('sparse arrivals create distinct batches', solve(3*N, [[0, 'a'], [4*N, 'b']], 8*N), [[[3*N, ['a']], [7*N, ['b']]], []])
check('not yet due remains buffered', solve(3*N, [[0, 'a']], N), [[], ['a']])
check('same-tick values share batch', solve(N, [[0, 'a'], [0, 'b']], N), [[[N, ['a', 'b']]], []])
check('zero-latency each item flushes', solve(0, [[N, 'a'], [N, 'b']], N), [[[N, ['a']], [N, ['b']]], []])
check('empty buffer never flushes', solve(N, [], 10*N), [[], []])
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 |
|---|---|---|---|
| steady arrivals cannot postpone oldest | [[], ['a', 'b', 'c']] | [[[3, ['a', 'b', 'c']]], []] | Failed |
| arrival at deadline starts new batch | [[[3, ['a']]], ['b']] | [[[3, ['a']]], ['b']] | Passed |
| sparse arrivals create distinct batches | [[[3, ['a']], [7, ['b']]], []] | [[[3, ['a']], [7, ['b']]], []] | Passed |
| not yet due remains buffered | [[], ['a']] | [[], ['a']] | Passed |
| same-tick values share batch | [[[1, ['a', 'b']]], []] | [[[1, ['a', 'b']]], []] | Passed |
| zero-latency each item flushes | [[[1, ['a']], [1, ['b']]], []] | [[[1, ['a']], [1, ['b']]], []] | Passed |
| empty buffer never flushes | [[], []] | [[], []] | Passed |
SHA-256 / 6c4669b463e91e3003d858431be34521d22ed3c8aa055f336d63115b904ca8a9
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(latency, arrivals, finish_time):
pending, deadline, flushed = [], None, []
for timestamp, value in arrivals:
if pending and deadline < timestamp:
flushed.append([deadline, pending])
pending, deadline = [], None
if not pending:
deadline = timestamp + latency
pending.append(value)
if pending and deadline < finish_time:
flushed.append([deadline, pending])
pending = []
return [flushed, pending]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('steady arrivals cannot postpone oldest', solve(3*N, [[0, 'a'], [N, 'b'], [2*N, 'c']], 3*N), [[[3*N, ['a', 'b', 'c']]], []])
check('arrival at deadline starts new batch', solve(3*N, [[0, 'a'], [3*N, 'b']], 3*N), [[[3*N, ['a']]], ['b']])
check('sparse arrivals create distinct batches', solve(3*N, [[0, 'a'], [4*N, 'b']], 8*N), [[[3*N, ['a']], [7*N, ['b']]], []])
check('not yet due remains buffered', solve(3*N, [[0, 'a']], N), [[], ['a']])
check('same-tick values share batch', solve(N, [[0, 'a'], [0, 'b']], N), [[[N, ['a', 'b']]], []])
check('zero-latency each item flushes', solve(0, [[N, 'a'], [N, 'b']], N), [[[N, ['a']], [N, ['b']]], []])
check('empty buffer never flushes', solve(N, [], 10*N), [[], []])
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 |
|---|---|---|---|
| steady arrivals cannot postpone oldest | [[], ['a', 'b', 'c']] | [[[3, ['a', 'b', 'c']]], []] | Failed |
| arrival at deadline starts new batch | [[], ['a', 'b']] | [[[3, ['a']]], ['b']] | Failed |
| sparse arrivals create distinct batches | [[[3, ['a']], [7, ['b']]], []] | [[[3, ['a']], [7, ['b']]], []] | Passed |
| not yet due remains buffered | [[], ['a']] | [[], ['a']] | Passed |
| same-tick values share batch | [[], ['a', 'b']] | [[[1, ['a', 'b']]], []] | Failed |
| zero-latency each item flushes | [[], ['a', 'b']] | [[[1, ['a']], [1, ['b']]], []] | Failed |
| empty buffer never flushes | [[], []] | [[], []] | Passed |
SHA-256 / 8e2abca6ea08d7c3ddea5fded4764155dda14d6c19b649e5afdebbd1f1d4ebbc
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(latency, arrivals, finish_time):
pending, deadline, flushed = [], None, []
for timestamp, value in arrivals:
if pending and deadline <= timestamp:
flushed.append([deadline, pending])
pending, deadline = [], None
if not pending:
deadline = timestamp + latency
pending.append(value)
if pending and deadline <= finish_time:
flushed.append([deadline, pending])
pending = []
return [flushed, pending]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('steady arrivals cannot postpone oldest', solve(3*N, [[0, 'a'], [N, 'b'], [2*N, 'c']], 3*N), [[[3*N, ['a', 'b', 'c']]], []])
check('arrival at deadline starts new batch', solve(3*N, [[0, 'a'], [3*N, 'b']], 3*N), [[[3*N, ['a']]], ['b']])
check('sparse arrivals create distinct batches', solve(3*N, [[0, 'a'], [4*N, 'b']], 8*N), [[[3*N, ['a']], [7*N, ['b']]], []])
check('not yet due remains buffered', solve(3*N, [[0, 'a']], N), [[], ['a']])
check('same-tick values share batch', solve(N, [[0, 'a'], [0, 'b']], N), [[[N, ['a', 'b']]], []])
check('zero-latency each item flushes', solve(0, [[N, 'a'], [N, 'b']], N), [[[N, ['a']], [N, ['b']]], []])
check('empty buffer never flushes', solve(N, [], 10*N), [[], []])
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 |
|---|---|---|---|
| steady arrivals cannot postpone oldest | [[[3, ['a', 'b', 'c']]], []] | [[[3, ['a', 'b', 'c']]], []] | Passed |
| arrival at deadline starts new batch | [[[3, ['a']]], ['b']] | [[[3, ['a']]], ['b']] | Passed |
| sparse arrivals create distinct batches | [[[3, ['a']], [7, ['b']]], []] | [[[3, ['a']], [7, ['b']]], []] | Passed |
| not yet due remains buffered | [[], ['a']] | [[], ['a']] | Passed |
| same-tick values share batch | [[[1, ['a', 'b']]], []] | [[[1, ['a', 'b']]], []] | Passed |
| zero-latency each item flushes | [[[1, ['a']], [1, ['b']]], []] | [[[1, ['a']], [1, ['b']]], []] | Passed |
| empty buffer never flushes | [[], []] | [[], []] | Passed |
SHA-256 / 2815aa62be18dc006f7ed5171a7396a9662a7b8bd1d0e77868707d269d315529
Verification & scope
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:36:51.568611+00:00.
Case digest / 935217eb3b10607dd71ec8feeb5ec2981191b802f0404e5e3e369b61616e1f06