FAILURE MAP
← Case archive

FA-99566 / RAG context assembly / Open access

Whole-chunk prefix assembly slices text at a token limit · case 01

Whole-chunk prefix assembly slices text at a token limit.

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

ROOT CAUSE

The prefix builder truncates the text of an oversized chunk instead of ending before that chunk.

THE FAILURE

The prefix builder truncates the text of an oversized chunk instead of ending before that chunk.

Unsuccessful approach: Skipping an oversized chunk can include later material and break the required contiguous prefix.

Case contract

Rows are [text,cost]; return the longest input prefix of whole texts whose cumulative cost fits budget. Stop at the first non-fitting row.

Why this case matters

A small deterministic evidence assembly model makes context budgeting behavior inspectable.

1 / The failure

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

N = 1
observations = []
def solve(rows, budget):
    return [text[:budget] for text,cost in rows if cost<=budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('whole chunks', solve([['abc',3],['de',2]],4), ['abc'])
check('contiguous prefix ends', solve([['ok',1],['long',N+1],['later',1]],N+1), ['ok'])
check('empty text', solve([['',0]],0), [''])
check('empty rows', solve([],N), [])
check('exact fit', solve([['x',N]],N), ['x'])
check('prefix blocked at zero budget', solve([['x',1],['',0]],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
whole chunks['abc', 'de']['abc']Failed
contiguous prefix ends['ok', 'lo', 'la']['ok']Failed
empty text['']['']Passed
empty rows[][]Passed
exact fit['x']['x']Passed
prefix blocked at zero budget[''][]Failed

SHA-256 / a985b4cc9f706b3fa5a924cd525f28a224fc95473eb4bb6cd575e6400093641a

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(rows, budget):
    out=[]; used=0
    for text,cost in rows:
        if used+cost<=budget: out.append(text); used+=cost
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('whole chunks', solve([['abc',3],['de',2]],4), ['abc'])
check('contiguous prefix ends', solve([['ok',1],['long',N+1],['later',1]],N+1), ['ok'])
check('empty text', solve([['',0]],0), [''])
check('empty rows', solve([],N), [])
check('exact fit', solve([['x',N]],N), ['x'])
check('prefix blocked at zero budget', solve([['x',1],['',0]],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
whole chunks['abc']['abc']Passed
contiguous prefix ends['ok', 'later']['ok']Failed
empty text['']['']Passed
empty rows[][]Passed
exact fit['x']['x']Passed
prefix blocked at zero budget[''][]Failed

SHA-256 / c1f3e9d9e29bf426066c1ae78b9d99e143546f92047c0039401f5e57e4c12c28

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

Toy inputs and token counts only; this does not claim compatibility with a tokenizer, prompt format, or production retrieval system. 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:25.802449+00:00.

Case digest / 88bb4be13c65c43d3caff241cc3a0584ff9d3226744e2fd598fd37156b488a72