FA-46816 / Bounded deques / Open access
Producer cancellation removes the first waiter regardless of identity · case 01
Producer cancellation removes the first waiter regardless of identity.
ROOT CAUSE
Producer cancellation removes the first waiter regardless of identity.
VERIFIED REPAIR
Restore the documented cancel id invariant in producer-waiters.
Unsuccessful approach: The partial repair still applies the incorrect transition to an admitted boundary or multi-element case.
Case contract
After cancellation by waiter identity, fill free bounded-deque slots from FIFO blocked producers. Return updated queue, remaining waiters, resumed IDs, cancelled IDs and remaining free slots.
Why this case matters
Controlled bounded deque implementation model with explicit storage and lifecycle observations.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
a,cap,waiters,cancel=x
active=waiters[1:] if cancel else waiters
cancelled=[w[0] for w in waiters if w[0]==cancel]
room=cap-len(a)
selected=active[:room]
remaining=active[room:]
result=a+[w[1] for w in selected]
resumed=[w[0] for w in selected]
return [result,remaining,resumed,cancelled,room-len(selected)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N],3,[[1,N+1],[2,N+2],[3,N+3]],2]), {1: [[1, 2, 4], [], [1, 3], [2], 0], 2: [[2, 3, 5], [], [1, 3], [2], 0], 3: [[3, 4, 6], [], [1, 3], [2], 0], 4: [[4, 5, 7], [], [1, 3], [2], 0], 5: [[5, 6, 8], [], [1, 3], [2], 0]}[N])
check('1', solve([[N,N+1],2,[[1,N+2]],9]), {1: [[1, 2], [[1, 3]], [], [], 0], 2: [[2, 3], [[1, 4]], [], [], 0], 3: [[3, 4], [[1, 5]], [], [], 0], 4: [[4, 5], [[1, 6]], [], [], 0], 5: [[5, 6], [[1, 7]], [], [], 0]}[N])
check('2', solve([[],2,[[1,N],[2,N+1],[3,N+2]],9]), {1: [[1, 2], [[3, 3]], [1, 2], [], 0], 2: [[2, 3], [[3, 4]], [1, 2], [], 0], 3: [[3, 4], [[3, 5]], [1, 2], [], 0], 4: [[4, 5], [[3, 6]], [1, 2], [], 0], 5: [[5, 6], [[3, 7]], [1, 2], [], 0]}[N])
check('3', solve([[N],4,[],8]), {1: [[1], [], [], [], 3], 2: [[2], [], [], [], 3], 3: [[3], [], [], [], 3], 4: [[4], [], [], [], 3], 5: [[5], [], [], [], 3]}[N])
check('4', solve([[],3,[[1,N],[2,N]],1]), {1: [[1], [], [2], [1], 2], 2: [[2], [], [2], [1], 2], 3: [[3], [], [2], [1], 2], 4: [[4], [], [2], [1], 2], 5: [[5], [], [2], [1], 2]}[N])
check('5', solve([[N],2,[[1,N+1],[2,N+2],[3,N+3]],1]), {1: [[1, 3], [[3, 4]], [2], [1], 0], 2: [[2, 4], [[3, 5]], [2], [1], 0], 3: [[3, 5], [[3, 6]], [2], [1], 0], 4: [[4, 6], [[3, 7]], [2], [1], 0], 5: [[5, 7], [[3, 8]], [2], [1], 0]}[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 |
|---|---|---|---|
| 0 | [[1, 3, 4], [], [2, 3], [2], 0] | [[1, 2, 4], [], [1, 3], [2], 0] | Failed |
| 1 | [[1, 2], [], [], [], 0] | [[1, 2], [[1, 3]], [], [], 0] | Failed |
| 2 | [[2, 3], [], [2, 3], [], 0] | [[1, 2], [[3, 3]], [1, 2], [], 0] | Failed |
| 3 | [[1], [], [], [], 3] | [[1], [], [], [], 3] | Passed |
| 4 | [[1], [], [2], [1], 2] | [[1], [], [2], [1], 2] | Passed |
| 5 | [[1, 3], [[3, 4]], [2], [1], 0] | [[1, 3], [[3, 4]], [2], [1], 0] | Passed |
SHA-256 / 78d1e6ec048764faba9e7363286d1647e8966e4a17fc09402cfd4fbcd3419b53
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
a,cap,waiters,cancel=x
active=waiters[1:] if any(w[0]==cancel for w in waiters) else waiters
cancelled=[w[0] for w in waiters if w[0]==cancel]
room=cap-len(a)
selected=active[:room]
remaining=active[room:]
result=a+[w[1] for w in selected]
resumed=[w[0] for w in selected]
return [result,remaining,resumed,cancelled,room-len(selected)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N],3,[[1,N+1],[2,N+2],[3,N+3]],2]), {1: [[1, 2, 4], [], [1, 3], [2], 0], 2: [[2, 3, 5], [], [1, 3], [2], 0], 3: [[3, 4, 6], [], [1, 3], [2], 0], 4: [[4, 5, 7], [], [1, 3], [2], 0], 5: [[5, 6, 8], [], [1, 3], [2], 0]}[N])
check('1', solve([[N,N+1],2,[[1,N+2]],9]), {1: [[1, 2], [[1, 3]], [], [], 0], 2: [[2, 3], [[1, 4]], [], [], 0], 3: [[3, 4], [[1, 5]], [], [], 0], 4: [[4, 5], [[1, 6]], [], [], 0], 5: [[5, 6], [[1, 7]], [], [], 0]}[N])
check('2', solve([[],2,[[1,N],[2,N+1],[3,N+2]],9]), {1: [[1, 2], [[3, 3]], [1, 2], [], 0], 2: [[2, 3], [[3, 4]], [1, 2], [], 0], 3: [[3, 4], [[3, 5]], [1, 2], [], 0], 4: [[4, 5], [[3, 6]], [1, 2], [], 0], 5: [[5, 6], [[3, 7]], [1, 2], [], 0]}[N])
check('3', solve([[N],4,[],8]), {1: [[1], [], [], [], 3], 2: [[2], [], [], [], 3], 3: [[3], [], [], [], 3], 4: [[4], [], [], [], 3], 5: [[5], [], [], [], 3]}[N])
check('4', solve([[],3,[[1,N],[2,N]],1]), {1: [[1], [], [2], [1], 2], 2: [[2], [], [2], [1], 2], 3: [[3], [], [2], [1], 2], 4: [[4], [], [2], [1], 2], 5: [[5], [], [2], [1], 2]}[N])
check('5', solve([[N],2,[[1,N+1],[2,N+2],[3,N+3]],1]), {1: [[1, 3], [[3, 4]], [2], [1], 0], 2: [[2, 4], [[3, 5]], [2], [1], 0], 3: [[3, 5], [[3, 6]], [2], [1], 0], 4: [[4, 6], [[3, 7]], [2], [1], 0], 5: [[5, 7], [[3, 8]], [2], [1], 0]}[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 |
|---|---|---|---|
| 0 | [[1, 3, 4], [], [2, 3], [2], 0] | [[1, 2, 4], [], [1, 3], [2], 0] | Failed |
| 1 | [[1, 2], [[1, 3]], [], [], 0] | [[1, 2], [[1, 3]], [], [], 0] | Passed |
| 2 | [[1, 2], [[3, 3]], [1, 2], [], 0] | [[1, 2], [[3, 3]], [1, 2], [], 0] | Passed |
| 3 | [[1], [], [], [], 3] | [[1], [], [], [], 3] | Passed |
| 4 | [[1], [], [2], [1], 2] | [[1], [], [2], [1], 2] | Passed |
| 5 | [[1, 3], [[3, 4]], [2], [1], 0] | [[1, 3], [[3, 4]], [2], [1], 0] | Passed |
SHA-256 / 05557d0c7256dedb945e03659735c1c884d55c45ae894e7931145d23a6380b82
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
a,cap,waiters,cancel=x
active=[w for w in waiters if w[0]!=cancel]
cancelled=[w[0] for w in waiters if w[0]==cancel]
room=cap-len(a)
selected=active[:room]
remaining=active[room:]
result=a+[w[1] for w in selected]
resumed=[w[0] for w in selected]
return [result,remaining,resumed,cancelled,room-len(selected)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N],3,[[1,N+1],[2,N+2],[3,N+3]],2]), {1: [[1, 2, 4], [], [1, 3], [2], 0], 2: [[2, 3, 5], [], [1, 3], [2], 0], 3: [[3, 4, 6], [], [1, 3], [2], 0], 4: [[4, 5, 7], [], [1, 3], [2], 0], 5: [[5, 6, 8], [], [1, 3], [2], 0]}[N])
check('1', solve([[N,N+1],2,[[1,N+2]],9]), {1: [[1, 2], [[1, 3]], [], [], 0], 2: [[2, 3], [[1, 4]], [], [], 0], 3: [[3, 4], [[1, 5]], [], [], 0], 4: [[4, 5], [[1, 6]], [], [], 0], 5: [[5, 6], [[1, 7]], [], [], 0]}[N])
check('2', solve([[],2,[[1,N],[2,N+1],[3,N+2]],9]), {1: [[1, 2], [[3, 3]], [1, 2], [], 0], 2: [[2, 3], [[3, 4]], [1, 2], [], 0], 3: [[3, 4], [[3, 5]], [1, 2], [], 0], 4: [[4, 5], [[3, 6]], [1, 2], [], 0], 5: [[5, 6], [[3, 7]], [1, 2], [], 0]}[N])
check('3', solve([[N],4,[],8]), {1: [[1], [], [], [], 3], 2: [[2], [], [], [], 3], 3: [[3], [], [], [], 3], 4: [[4], [], [], [], 3], 5: [[5], [], [], [], 3]}[N])
check('4', solve([[],3,[[1,N],[2,N]],1]), {1: [[1], [], [2], [1], 2], 2: [[2], [], [2], [1], 2], 3: [[3], [], [2], [1], 2], 4: [[4], [], [2], [1], 2], 5: [[5], [], [2], [1], 2]}[N])
check('5', solve([[N],2,[[1,N+1],[2,N+2],[3,N+3]],1]), {1: [[1, 3], [[3, 4]], [2], [1], 0], 2: [[2, 4], [[3, 5]], [2], [1], 0], 3: [[3, 5], [[3, 6]], [2], [1], 0], 4: [[4, 6], [[3, 7]], [2], [1], 0], 5: [[5, 7], [[3, 8]], [2], [1], 0]}[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 |
|---|---|---|---|
| 0 | [[1, 2, 4], [], [1, 3], [2], 0] | [[1, 2, 4], [], [1, 3], [2], 0] | Passed |
| 1 | [[1, 2], [[1, 3]], [], [], 0] | [[1, 2], [[1, 3]], [], [], 0] | Passed |
| 2 | [[1, 2], [[3, 3]], [1, 2], [], 0] | [[1, 2], [[3, 3]], [1, 2], [], 0] | Passed |
| 3 | [[1], [], [], [], 3] | [[1], [], [], [], 3] | Passed |
| 4 | [[1], [], [2], [1], 2] | [[1], [], [2], [1], 2] | Passed |
| 5 | [[1, 3], [[3, 4]], [2], [1], 0] | [[1, 3], [[3, 4]], [2], [1], 0] | Passed |
SHA-256 / 541bb5005675062bbde1975109dd95832353d2621e984dbf350b18742fb6d466
Verification & scope
Offline finite deterministic model; no claim of production implementation or concurrent memory-model conformance. 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:44:35.660226+00:00.
Case digest / 6cc47d789c6eb36f5ec0ee6b3cd8a405e7c2be92333bd7354bd7aa8115a8d661