FAILURE MAP
← Case archive

FA-98546 / KV cache position mapping / Open access

Ring writes wrap at capacity · case 01

A cache write past the final slot escapes the circular buffer.

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

ROOT CAUSE

The mapper computes a linear address and never wraps it.

THE FAILURE

The mapper computes a linear address and never wraps it.

Unsuccessful approach: Wrapping the absolute position ignores the ring’s logical origin.

Case contract

Map each inclusive logical position to (position, (slot_origin + position - logical_origin) modulo capacity). Capacity is positive.

Why this case matters

A small in-memory model makes the cache address contract explicit for a serving component.

1 / The failure

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

N = 1
observations = []
def solve(logical_origin, slot_origin, capacity, end):
    return [(p, slot_origin+p-logical_origin) for p in range(logical_origin,end+1)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('wrap once',solve(10,2,4,12),[(10,2),(11,3),(12,0)])
check('wrap twice',solve(0,1,3,6),[(0,1),(1,2),(2,0),(3,1),(4,2),(5,0),(6,1)])
check('capacity one',solve(N,0,1,N+2),[(N,0),(N+1,0),(N+2,0)])
check('no wrap',solve(5,3,8,7),[(5,3),(6,4),(7,5)])
check('empty append',solve(4,2,5,3),[])
check('nonzero slot origin wrap',solve(20,7,5,24),[(20,2),(21,3),(22,4),(23,0),(24,1)])
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
wrap once[[10, 2], [11, 3], [12, 4]][[10, 2], [11, 3], [12, 0]]Failed
wrap twice[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7]][[0, 1], [1, 2], [2, 0], [3, 1], [4, 2], [5, 0], [6, 1]]Failed
capacity one[[1, 0], [2, 1], [3, 2]][[1, 0], [2, 0], [3, 0]]Failed
no wrap[[5, 3], [6, 4], [7, 5]][[5, 3], [6, 4], [7, 5]]Passed
empty append[][]Passed
nonzero slot origin wrap[[20, 7], [21, 8], [22, 9], [23, 10], [24, 11]][[20, 2], [21, 3], [22, 4], [23, 0], [24, 1]]Failed

SHA-256 / 546bceec60c4e594aa8b4867f13d395c7739de749da3627429c1ee2eb2fcc5cb

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(logical_origin, slot_origin, capacity, end):
    return [(p, p%capacity) for p in range(logical_origin,end+1)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('wrap once',solve(10,2,4,12),[(10,2),(11,3),(12,0)])
check('wrap twice',solve(0,1,3,6),[(0,1),(1,2),(2,0),(3,1),(4,2),(5,0),(6,1)])
check('capacity one',solve(N,0,1,N+2),[(N,0),(N+1,0),(N+2,0)])
check('no wrap',solve(5,3,8,7),[(5,3),(6,4),(7,5)])
check('empty append',solve(4,2,5,3),[])
check('nonzero slot origin wrap',solve(20,7,5,24),[(20,2),(21,3),(22,4),(23,0),(24,1)])
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
wrap once[[10, 2], [11, 3], [12, 0]][[10, 2], [11, 3], [12, 0]]Passed
wrap twice[[0, 0], [1, 1], [2, 2], [3, 0], [4, 1], [5, 2], [6, 0]][[0, 1], [1, 2], [2, 0], [3, 1], [4, 2], [5, 0], [6, 1]]Failed
capacity one[[1, 0], [2, 0], [3, 0]][[1, 0], [2, 0], [3, 0]]Passed
no wrap[[5, 5], [6, 6], [7, 7]][[5, 3], [6, 4], [7, 5]]Failed
empty append[][]Passed
nonzero slot origin wrap[[20, 0], [21, 1], [22, 2], [23, 3], [24, 4]][[20, 2], [21, 3], [22, 4], [23, 0], [24, 1]]Failed

SHA-256 / 0afc78bec9ab04052815d718ac030534de33a2a78f1cca0fe221513cf3e45cc4

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 6 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

These toy integer maps omit tensor layout, concurrency, device memory, and model-specific cache formats. 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-30T16:48:14.105442+00:00.

Case digest / 3bd92de0fc83706af073702c939918b4f914ede3d898b583012ca36f4ad223a3