FAILURE MAP
← Case archive

FA-98626 / KV cache position mapping / Open access

Multi-token append reserves capacity atomically · case 01

A request that does not fit partially consumes free cache slots.

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

ROOT CAUSE

Each token is admitted independently before the full sequence capacity is known.

THE FAILURE

Each token is admitted independently before the full sequence capacity is known.

Unsuccessful approach: Comparing the request to total capacity ignores slots already occupied and can admit too many tokens.

Case contract

Return the requested count if it fits in capacity-used, else zero; never return a partial count.

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(capacity, used, requested):
    return min(requested,capacity-used)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fits exactly',solve(N+3,N,N+3-N),N+3-N)
check('one free short',solve(N+3,N+1,3),0)
check('partial would fit',solve(5,3,4),0)
check('empty append',solve(5,3,0),0)
check('empty cache',solve(N,0,N),N)
check('full cache',solve(N,N,1),0)
check('negative request',solve(5,0,-1),0)
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
fits exactly33Passed
one free short20Failed
partial would fit20Failed
empty append00Passed
empty cache11Passed
full cache00Passed
negative request-10Failed

SHA-256 / f0d709fa59ddb71be57562a4d7a7f871b1839700a6ccbef359a072b083c69be7

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(capacity, used, requested):
    return requested if requested<=capacity else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fits exactly',solve(N+3,N,N+3-N),N+3-N)
check('one free short',solve(N+3,N+1,3),0)
check('partial would fit',solve(5,3,4),0)
check('empty append',solve(5,3,0),0)
check('empty cache',solve(N,0,N),N)
check('full cache',solve(N,N,1),0)
check('negative request',solve(5,0,-1),0)
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
fits exactly33Passed
one free short30Failed
partial would fit40Failed
empty append00Passed
empty cache11Passed
full cache10Failed
negative request-10Failed

SHA-256 / a5c2b9696eb36f7c6302d0740d7a2dc55b0bf6e77e19301345381e84275301d9

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 7 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.972284+00:00.

Case digest / 4e01a54efd3e9e4a8d2d8d6392e2cb30cb3826fa2bf71bd0f4afebdc3e1ff4df