FA-47336 / Bounded deques / Open access
Deque reservation commit accepts a negative initialized prefix length · case 01
Deque reservation commit accepts a negative initialized prefix length.
ROOT CAUSE
The signed commit count is passed to slicing before rejecting negative publication; negative counts expose unintended prefix data and corrupt the release receipt.
VERIFIED REPAIR
Use the corrected transition: if written<0 or written>len(values) or written>reserved:
Unsuccessful approach: The attempted transition still violates the stated contract: if written<-1 or written>len(values) or written>reserved:
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>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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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], 0, 1, True, [2]] | [[1], 2, 1, False, []] | Failed |
SHA-256 / 023958b3d24ab2ee4d8672fce036c60bb7e4e01d5694ecbce918acc2e3c32766
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<-1 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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], 0, 1, True, [2]] | [[1], 2, 1, False, []] | Failed |
SHA-256 / 6438766765d7b62bdd2063a79006bc9f6e2ec4f1ecf85bb01fce7153a45b29e2
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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:40.448254+00:00.
Case digest / 085d84a676771e9f584ae4997e57321fc3097a7f6d77fe092a2e04d3ae315977