FAILURE MAP
← Case archive

FA-45991 / Bounded deques / Open access

Directory subtracts the current block end from its logical index · case 01

Directory subtracts the current block end from its logical index.

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

ROOT CAUSE

Local indexing uses the wrong cumulative boundary.

VERIFIED REPAIR

Restore the documented block start 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] 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, -3, 3, 5, 2, 4][1, 0, 3, 5, 2, 4]Failed
second block interior[1, -2, 3, 5, 2, 4][1, 1, 3, 5, 2, 4]Failed
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]Failed
single value[0, 0, 1, 1, None, None][0, 0, 1, 1, None, None]Passed
third block head[2, -2, 4, 5, 3, 5][2, 0, 4, 5, 3, 5]Failed

SHA-256 / 96efa2c851dc5b21b5ec604e092a4c39b2aef80a7cb584d93eae89e3bbdf5f4b

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 < 2 else ends[b]
    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, -3, 'invalid offset', 3, None, 2][0, 0, 1, 3, None, 2]Failed
last element[2, -1, 4, 4, 3, None][2, 1, 4, 4, 3, None]Failed
single value[0, -1, 1, 1, None, None][0, 0, 1, 1, None, None]Failed
third block head[2, -2, 4, 5, 3, 5][2, 0, 4, 5, 3, 5]Failed

SHA-256 / 12ddc5e611b983a3dd006e1c0b00812b83e2f9aa6277b1d5e5fbaf333c010731

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

Case digest / 3e2ade980d5e28c617aefa6ceb9964678be6d606267f6adc31eeb731591d4f59