FAILURE MAP
← Case archive

FA-46951 / Bounded deques / Open access

Deque reservation commit returns initialized entries as unused · case 01

Deque reservation commit returns initialized entries as unused.

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

ROOT CAUSE

Deque reservation commit returns initialized entries as unused.

VERIFIED REPAIR

Restore the documented uninitialized return invariant in write-reservation-commit.

Unsuccessful approach: The partial repair still applies the incorrect transition to an admitted boundary or multi-element case.

Case contract

A bounded deque write reservation publishes exactly its initialized prefix. Reject negative, uninitialized, over-reserved or over-capacity commit counts atomically. Successful commit releases the entire reservation and advances structure epoch only for nonempty publication.

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,reserved,values,written,cap,epoch=x
    if written<0 or written>len(values) or written>reserved:return [a,reserved,epoch,False,[]]
    if len(a)+written>cap:return [a,reserved,epoch,False,[]]
    published=values[:written]
    state=a+published
    remaining=0
    version=epoch+(written>0)
    unused=values[:written]
    return [state,remaining,version,True,unused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N],3,[N+1,N+2,N+3],2,5,4]), {1: [[1, 2, 3], 0, 5, True, [4]], 2: [[2, 3, 4], 0, 5, True, [5]], 3: [[3, 4, 5], 0, 5, True, [6]], 4: [[4, 5, 6], 0, 5, True, [7]], 5: [[5, 6, 7], 0, 5, True, [8]]}[N])
check('1', solve([[N],1,[N+1,N+2],2,4,2]), {1: [[1], 1, 2, False, []], 2: [[2], 1, 2, False, []], 3: [[3], 1, 2, False, []], 4: [[4], 1, 2, False, []], 5: [[5], 1, 2, False, []]}[N])
check('2', solve([[N],3,[N+1],2,5,1]), {1: [[1], 3, 1, False, []], 2: [[2], 3, 1, False, []], 3: [[3], 3, 1, False, []], 4: [[4], 3, 1, False, []], 5: [[5], 3, 1, False, []]}[N])
check('3', solve([[N,N+1],2,[N+2,N+3],2,3,5]), {1: [[1, 2], 2, 5, False, []], 2: [[2, 3], 2, 5, False, []], 3: [[3, 4], 2, 5, False, []], 4: [[4, 5], 2, 5, False, []], 5: [[5, 6], 2, 5, False, []]}[N])
check('4', solve([[N],2,[N+1,N+2],0,4,7]), {1: [[1], 0, 7, True, [2, 3]], 2: [[2], 0, 7, True, [3, 4]], 3: [[3], 0, 7, True, [4, 5]], 4: [[4], 0, 7, True, [5, 6]], 5: [[5], 0, 7, True, [6, 7]]}[N])
check('5', solve([[],2,[N,N+1],2,2,0]), {1: [[1, 2], 0, 1, True, []], 2: [[2, 3], 0, 1, True, []], 3: [[3, 4], 0, 1, True, []], 4: [[4, 5], 0, 1, True, []], 5: [[5, 6], 0, 1, True, []]}[N])
check('6', solve([[N],2,[N+1],-1,4,1]), {1: [[1], 2, 1, False, []], 2: [[2], 2, 1, False, []], 3: [[3], 2, 1, False, []], 4: [[4], 2, 1, False, []], 5: [[5], 2, 1, False, []]}[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 fixtureActualExpectedOutcome
0[[1, 2, 3], 0, 5, True, [2, 3]][[1, 2, 3], 0, 5, True, [4]]Failed
1[[1], 1, 2, False, []][[1], 1, 2, False, []]Passed
2[[1], 3, 1, False, []][[1], 3, 1, False, []]Passed
3[[1, 2], 2, 5, False, []][[1, 2], 2, 5, False, []]Passed
4[[1], 0, 7, True, []][[1], 0, 7, True, [2, 3]]Failed
5[[1, 2], 0, 1, True, [1, 2]][[1, 2], 0, 1, True, []]Failed
6[[1], 2, 1, False, []][[1], 2, 1, False, []]Passed

SHA-256 / 72efb3b0348129834a20fffcbf1a729f0c77dd9f3192d50ecd166364b5907893

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    a,reserved,values,written,cap,epoch=x
    if written<0 or written>len(values) or written>reserved:return [a,reserved,epoch,False,[]]
    if len(a)+written>cap:return [a,reserved,epoch,False,[]]
    published=values[:written]
    state=a+published
    remaining=0
    version=epoch+(written>0)
    unused=values[written:] if written==0 else values[:written]
    return [state,remaining,version,True,unused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N],3,[N+1,N+2,N+3],2,5,4]), {1: [[1, 2, 3], 0, 5, True, [4]], 2: [[2, 3, 4], 0, 5, True, [5]], 3: [[3, 4, 5], 0, 5, True, [6]], 4: [[4, 5, 6], 0, 5, True, [7]], 5: [[5, 6, 7], 0, 5, True, [8]]}[N])
check('1', solve([[N],1,[N+1,N+2],2,4,2]), {1: [[1], 1, 2, False, []], 2: [[2], 1, 2, False, []], 3: [[3], 1, 2, False, []], 4: [[4], 1, 2, False, []], 5: [[5], 1, 2, False, []]}[N])
check('2', solve([[N],3,[N+1],2,5,1]), {1: [[1], 3, 1, False, []], 2: [[2], 3, 1, False, []], 3: [[3], 3, 1, False, []], 4: [[4], 3, 1, False, []], 5: [[5], 3, 1, False, []]}[N])
check('3', solve([[N,N+1],2,[N+2,N+3],2,3,5]), {1: [[1, 2], 2, 5, False, []], 2: [[2, 3], 2, 5, False, []], 3: [[3, 4], 2, 5, False, []], 4: [[4, 5], 2, 5, False, []], 5: [[5, 6], 2, 5, False, []]}[N])
check('4', solve([[N],2,[N+1,N+2],0,4,7]), {1: [[1], 0, 7, True, [2, 3]], 2: [[2], 0, 7, True, [3, 4]], 3: [[3], 0, 7, True, [4, 5]], 4: [[4], 0, 7, True, [5, 6]], 5: [[5], 0, 7, True, [6, 7]]}[N])
check('5', solve([[],2,[N,N+1],2,2,0]), {1: [[1, 2], 0, 1, True, []], 2: [[2, 3], 0, 1, True, []], 3: [[3, 4], 0, 1, True, []], 4: [[4, 5], 0, 1, True, []], 5: [[5, 6], 0, 1, True, []]}[N])
check('6', solve([[N],2,[N+1],-1,4,1]), {1: [[1], 2, 1, False, []], 2: [[2], 2, 1, False, []], 3: [[3], 2, 1, False, []], 4: [[4], 2, 1, False, []], 5: [[5], 2, 1, False, []]}[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 fixtureActualExpectedOutcome
0[[1, 2, 3], 0, 5, True, [2, 3]][[1, 2, 3], 0, 5, True, [4]]Failed
1[[1], 1, 2, False, []][[1], 1, 2, False, []]Passed
2[[1], 3, 1, False, []][[1], 3, 1, False, []]Passed
3[[1, 2], 2, 5, False, []][[1, 2], 2, 5, False, []]Passed
4[[1], 0, 7, True, [2, 3]][[1], 0, 7, True, [2, 3]]Passed
5[[1, 2], 0, 1, True, [1, 2]][[1, 2], 0, 1, True, []]Failed
6[[1], 2, 1, False, []][[1], 2, 1, False, []]Passed

SHA-256 / 3cf4cb04251e172880e90e1caf6577418cebf26f6a8a1850133e7c32923a4abf

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    a,reserved,values,written,cap,epoch=x
    if written<0 or written>len(values) or written>reserved:return [a,reserved,epoch,False,[]]
    if len(a)+written>cap:return [a,reserved,epoch,False,[]]
    published=values[:written]
    state=a+published
    remaining=0
    version=epoch+(written>0)
    unused=values[written:]
    return [state,remaining,version,True,unused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N],3,[N+1,N+2,N+3],2,5,4]), {1: [[1, 2, 3], 0, 5, True, [4]], 2: [[2, 3, 4], 0, 5, True, [5]], 3: [[3, 4, 5], 0, 5, True, [6]], 4: [[4, 5, 6], 0, 5, True, [7]], 5: [[5, 6, 7], 0, 5, True, [8]]}[N])
check('1', solve([[N],1,[N+1,N+2],2,4,2]), {1: [[1], 1, 2, False, []], 2: [[2], 1, 2, False, []], 3: [[3], 1, 2, False, []], 4: [[4], 1, 2, False, []], 5: [[5], 1, 2, False, []]}[N])
check('2', solve([[N],3,[N+1],2,5,1]), {1: [[1], 3, 1, False, []], 2: [[2], 3, 1, False, []], 3: [[3], 3, 1, False, []], 4: [[4], 3, 1, False, []], 5: [[5], 3, 1, False, []]}[N])
check('3', solve([[N,N+1],2,[N+2,N+3],2,3,5]), {1: [[1, 2], 2, 5, False, []], 2: [[2, 3], 2, 5, False, []], 3: [[3, 4], 2, 5, False, []], 4: [[4, 5], 2, 5, False, []], 5: [[5, 6], 2, 5, False, []]}[N])
check('4', solve([[N],2,[N+1,N+2],0,4,7]), {1: [[1], 0, 7, True, [2, 3]], 2: [[2], 0, 7, True, [3, 4]], 3: [[3], 0, 7, True, [4, 5]], 4: [[4], 0, 7, True, [5, 6]], 5: [[5], 0, 7, True, [6, 7]]}[N])
check('5', solve([[],2,[N,N+1],2,2,0]), {1: [[1, 2], 0, 1, True, []], 2: [[2, 3], 0, 1, True, []], 3: [[3, 4], 0, 1, True, []], 4: [[4, 5], 0, 1, True, []], 5: [[5, 6], 0, 1, True, []]}[N])
check('6', solve([[N],2,[N+1],-1,4,1]), {1: [[1], 2, 1, False, []], 2: [[2], 2, 1, False, []], 3: [[3], 2, 1, False, []], 4: [[4], 2, 1, False, []], 5: [[5], 2, 1, False, []]}[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 fixtureActualExpectedOutcome
0[[1, 2, 3], 0, 5, True, [4]][[1, 2, 3], 0, 5, True, [4]]Passed
1[[1], 1, 2, False, []][[1], 1, 2, False, []]Passed
2[[1], 3, 1, False, []][[1], 3, 1, False, []]Passed
3[[1, 2], 2, 5, False, []][[1, 2], 2, 5, False, []]Passed
4[[1], 0, 7, True, [2, 3]][[1], 0, 7, True, [2, 3]]Passed
5[[1, 2], 0, 1, True, []][[1, 2], 0, 1, True, []]Passed
6[[1], 2, 1, False, []][[1], 2, 1, False, []]Passed

SHA-256 / d04c151eab77578e5fd2f097ecd2a06e0370c1f681d5a990ccd8e09c708c8668

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

Case digest / 70873038a996509c144503d88453928d3c28f01b35bead05e76aeded8a571bdf