FAILURE MAP
← Case archive

FA-231 / Runtime and resources / Open access

A bounded queue admits only part of a logical batch · case 01

A queue exceeds capacity or silently drops a suffix after accepting a batch.

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

ROOT CAUSE

Admission checks a single item or truncates work instead of reserving capacity for the complete batch.

VERIFIED REPAIR

Admit the complete batch only when its full size fits; otherwise preserve the existing queue unchanged.

Unsuccessful approach: Truncating the resulting queue enforces a size bound but violates all-or-nothing admission.

Case contract

Capacity is nonnegative and the initial queue fits. Return [new queue,accepted]. A batch is atomic: all items append in order or none do. An empty batch succeeds even at zero capacity. The check and append are one serialized state transition in this model.

Why this case matters

Models bounded work admission for a logically indivisible request, isolating capacity reservation from the separate problem of locking a concurrent implementation.

1 / The failure

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

N = 1
observations = []
def solve(capacity, queue, batch):
    allowed = len(queue) < capacity
    return [list(queue)+list(batch), True] if allowed else [list(queue), False]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
queue = list(range(N))
check('oversize batch is rejected intact', solve(N+1, queue, ['a', 'b']), [queue, False])
check('exact fit admitted', solve(N+2, queue, ['a', 'b']), [queue+['a', 'b'], True])
check('empty batch on full queue', solve(N, queue, []), [queue, True])
check('zero capacity empty batch', solve(0, [], []), [[], True])
check('zero capacity nonempty batch', solve(0, [], [N]), [[], False])
check('oversize from empty', solve(N, [], list(range(N+1))), [[], False])
check('room for small batch', solve(3*N, queue, [N]), [queue+[N], True])
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
oversize batch is rejected intact[[0, 'a', 'b'], True][[0], False]Failed
exact fit admitted[[0, 'a', 'b'], True][[0, 'a', 'b'], True]Passed
empty batch on full queue[[0], False][[0], True]Failed
zero capacity empty batch[[], False][[], True]Failed
zero capacity nonempty batch[[], False][[], False]Passed
oversize from empty[[0, 1], True][[], False]Failed
room for small batch[[0, 1], True][[0, 1], True]Passed

SHA-256 / db9dcd1f8250c598cbc3620002ca710e050422c1fa0338874b7cfdf639fb0530

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(capacity, queue, batch):
    return [(list(queue)+list(batch))[:capacity], len(queue) < capacity]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
queue = list(range(N))
check('oversize batch is rejected intact', solve(N+1, queue, ['a', 'b']), [queue, False])
check('exact fit admitted', solve(N+2, queue, ['a', 'b']), [queue+['a', 'b'], True])
check('empty batch on full queue', solve(N, queue, []), [queue, True])
check('zero capacity empty batch', solve(0, [], []), [[], True])
check('zero capacity nonempty batch', solve(0, [], [N]), [[], False])
check('oversize from empty', solve(N, [], list(range(N+1))), [[], False])
check('room for small batch', solve(3*N, queue, [N]), [queue+[N], True])
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
oversize batch is rejected intact[[0, 'a'], True][[0], False]Failed
exact fit admitted[[0, 'a', 'b'], True][[0, 'a', 'b'], True]Passed
empty batch on full queue[[0], False][[0], True]Failed
zero capacity empty batch[[], False][[], True]Failed
zero capacity nonempty batch[[], False][[], False]Passed
oversize from empty[[0], True][[], False]Failed
room for small batch[[0, 1], True][[0, 1], True]Passed

SHA-256 / 8aacaf2519b78db462dc45f7b0c038c97404be88ff0cacb3401df75fd67d1fbb

3 / The verified repair

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

N = 1
observations = []
def solve(capacity, queue, batch):
    allowed = len(queue)+len(batch) <= capacity
    return [list(queue)+list(batch), True] if allowed else [list(queue), False]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
queue = list(range(N))
check('oversize batch is rejected intact', solve(N+1, queue, ['a', 'b']), [queue, False])
check('exact fit admitted', solve(N+2, queue, ['a', 'b']), [queue+['a', 'b'], True])
check('empty batch on full queue', solve(N, queue, []), [queue, True])
check('zero capacity empty batch', solve(0, [], []), [[], True])
check('zero capacity nonempty batch', solve(0, [], [N]), [[], False])
check('oversize from empty', solve(N, [], list(range(N+1))), [[], False])
check('room for small batch', solve(3*N, queue, [N]), [queue+[N], True])
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
oversize batch is rejected intact[[0], False][[0], False]Passed
exact fit admitted[[0, 'a', 'b'], True][[0, 'a', 'b'], True]Passed
empty batch on full queue[[0], True][[0], True]Passed
zero capacity empty batch[[], True][[], True]Passed
zero capacity nonempty batch[[], False][[], False]Passed
oversize from empty[[], False][[], False]Passed
room for small batch[[0, 1], True][[0, 1], True]Passed

SHA-256 / 4d00dc0b66bb0bfce854cf6097284955f5a8b2c5e4bf4d00230992e32c229a9b

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

Case digest / 4f6f61999399feaa472ee8c35febc3de42c1f0fb5355be178771558870043f85