FAILURE MAP
← Case archive

FA-46006 / Bounded deques / Open access

Block lookup omits the final valid successor · case 01

Block lookup omits the final valid successor.

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

ROOT CAUSE

A strict bound is applied to one beyond the actual successor.

VERIFIED REPAIR

Restore the documented successor boundary 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+2 < 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 fixtureActualExpectedOutcome
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, None][2, 0, 4, 5, 3, 5]Failed

SHA-256 / 88a56b3c9f0fa281714a3db2d7e55a2850f3f1250a90fc010135d6e02f00171a

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)
        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 == 0 and index+1 < total else (flat[index+1] if index+2 < 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 fixtureActualExpectedOutcome
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, None][2, 0, 4, 5, 3, 5]Failed

SHA-256 / c3f0ee33fa1ad07c14cc4ca103c97a5e70bbd3428bf654b5cdd0651b65bfe552

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

Case digest / 561aa031c4b52efd3684f0e8586bc0bb35d49f36fcb7ba1c87c637be27c9753f