FA-45986 / Bounded deques / Open access
Deque directory uses each block length as an absolute end · case 01
Deque directory uses each block length as an absolute end.
ROOT CAUSE
The directory lacks cumulative counts after the first block.
VERIFIED REPAIR
Restore the documented prefix sum invariant in block-directory.
Unsuccessful approach: The partial repair still applies the incorrect transition to an admitted boundary or multi-element case.
Case contract
For nonempty, variable-size deque blocks, resolve a logical index into [block index, local offset, value, total size, predecessor value, successor value]. Null neighbors mark sequence endpoints. Directory is built from cumulative block lengths.
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):
blocks, index = x
ends = []
total = 0
for block in blocks:
total = len(block)
ends.append(total)
b = next((i for i,end in enumerate(ends) if index < end), None)
if b is None: return 'invalid directory'
start = ends[b-1] if b else 0
local = index - start
value = blocks[b][local] if -len(blocks[b]) <= local < len(blocks[b]) else 'invalid offset'
flat = [v for block in blocks for v in block]
previous = flat[index-1] if index else None
following = flat[index+1] if index+1 < total else None
return [b,local,value,total,previous,following]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second block first', solve([[[N,N+1],[N+2,N+3,N+4]],2]), [1,0,N+2,5,N+1,N+3])
check('second block interior', solve([[[N],[N+1,N+2,N+3],[N+4]],2]), [1,1,N+2,5,N+1,N+3])
check('first element', solve([[[N,N+1],[N+2]],0]), [0,0,N,3,None,N+1])
check('last element', solve([[[N],[N+1],[N+2,N+3]],3]), [2,1,N+3,4,N+2,None])
check('single value', solve([[[N]],0]), [0,0,N,1,None,None])
check('third block head', solve([[[N,N+1],[N+2],[N+3,N+4]],3]), [2,0,N+3,5,N+2,N+4])
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 |
|---|---|---|---|
| second block first | [1, 0, 3, 3, 2, None] | [1, 0, 3, 5, 2, 4] | Failed |
| second block interior | [1, 1, 3, 1, 2, None] | [1, 1, 3, 5, 2, 4] | Failed |
| first element | [0, 0, 1, 1, None, None] | [0, 0, 1, 3, None, 2] | Failed |
| last element | invalid directory | [2, 1, 4, 4, 3, None] | Failed |
| single value | [0, 0, 1, 1, None, None] | [0, 0, 1, 1, None, None] | Passed |
| third block head | invalid directory | [2, 0, 4, 5, 3, 5] | Failed |
SHA-256 / f8f5bb955b412e1a314bddc882c2c4eafad56c1fe76c5f10196d1b1ad0e7780b
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
blocks, index = x
ends = []
total = 0
for block in blocks:
total += len(block) if len(ends) < 1 else 0
ends.append(total)
b = next((i for i,end in enumerate(ends) if index < end), None)
if b is None: return 'invalid directory'
start = ends[b-1] if b else 0
local = index - start
value = blocks[b][local] if -len(blocks[b]) <= local < len(blocks[b]) else 'invalid offset'
flat = [v for block in blocks for v in block]
previous = flat[index-1] if index else None
following = flat[index+1] if index+1 < total else None
return [b,local,value,total,previous,following]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second block first', solve([[[N,N+1],[N+2,N+3,N+4]],2]), [1,0,N+2,5,N+1,N+3])
check('second block interior', solve([[[N],[N+1,N+2,N+3],[N+4]],2]), [1,1,N+2,5,N+1,N+3])
check('first element', solve([[[N,N+1],[N+2]],0]), [0,0,N,3,None,N+1])
check('last element', solve([[[N],[N+1],[N+2,N+3]],3]), [2,1,N+3,4,N+2,None])
check('single value', solve([[[N]],0]), [0,0,N,1,None,None])
check('third block head', solve([[[N,N+1],[N+2],[N+3,N+4]],3]), [2,0,N+3,5,N+2,N+4])
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 |
|---|---|---|---|
| second block first | invalid directory | [1, 0, 3, 5, 2, 4] | Failed |
| second block interior | invalid directory | [1, 1, 3, 5, 2, 4] | Failed |
| first element | [0, 0, 1, 2, None, 2] | [0, 0, 1, 3, None, 2] | Failed |
| last element | invalid directory | [2, 1, 4, 4, 3, None] | Failed |
| single value | [0, 0, 1, 1, None, None] | [0, 0, 1, 1, None, None] | Passed |
| third block head | invalid directory | [2, 0, 4, 5, 3, 5] | Failed |
SHA-256 / 0e00857506a322077e1d23f337a12d60aff61ce5ce12822cc0fa475cd16a566a
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
blocks, index = x
ends = []
total = 0
for block in blocks:
total += len(block)
ends.append(total)
b = next((i for i,end in enumerate(ends) if index < end), None)
if b is None: return 'invalid directory'
start = ends[b-1] if b else 0
local = index - start
value = blocks[b][local] if -len(blocks[b]) <= local < len(blocks[b]) else 'invalid offset'
flat = [v for block in blocks for v in block]
previous = flat[index-1] if index else None
following = flat[index+1] if index+1 < total else None
return [b,local,value,total,previous,following]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second block first', solve([[[N,N+1],[N+2,N+3,N+4]],2]), [1,0,N+2,5,N+1,N+3])
check('second block interior', solve([[[N],[N+1,N+2,N+3],[N+4]],2]), [1,1,N+2,5,N+1,N+3])
check('first element', solve([[[N,N+1],[N+2]],0]), [0,0,N,3,None,N+1])
check('last element', solve([[[N],[N+1],[N+2,N+3]],3]), [2,1,N+3,4,N+2,None])
check('single value', solve([[[N]],0]), [0,0,N,1,None,None])
check('third block head', solve([[[N,N+1],[N+2],[N+3,N+4]],3]), [2,0,N+3,5,N+2,N+4])
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 |
|---|---|---|---|
| second block first | [1, 0, 3, 5, 2, 4] | [1, 0, 3, 5, 2, 4] | Passed |
| second block interior | [1, 1, 3, 5, 2, 4] | [1, 1, 3, 5, 2, 4] | Passed |
| first element | [0, 0, 1, 3, None, 2] | [0, 0, 1, 3, None, 2] | Passed |
| last element | [2, 1, 4, 4, 3, None] | [2, 1, 4, 4, 3, None] | Passed |
| single value | [0, 0, 1, 1, None, None] | [0, 0, 1, 1, None, None] | Passed |
| third block head | [2, 0, 4, 5, 3, 5] | [2, 0, 4, 5, 3, 5] | Passed |
SHA-256 / 73d490a7aa291918a8fbc006c1725286face25151d2f8a2d3a7d5fe9a7ec6e20
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:27.793679+00:00.
Case digest / 5b7dd17773f6f9ed9ae5d455cbe7f726efa525febd7126a52eed691cb1056a78