FAILURE MAP
← Case archive

FA-99611 / RAG context assembly / Open access

The last chunk is dropped instead of truncated at the remaining budget · case 01

The last chunk is dropped instead of truncated at the remaining budget.

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

ROOT CAUSE

The builder only accepts chunks that fit whole, despite a contract allowing the final chunk to be shortened.

THE FAILURE

The builder only accepts chunks that fit whole, despite a contract allowing the final chunk to be shortened.

Unsuccessful approach: Truncating every chunk to the total budget can exceed the remaining space.

Case contract

Chunks are token lists. Concatenate in order up to budget tokens, truncating only the final included chunk.

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(chunks, budget):
    out=[]
    for c in chunks:
        if len(out)+len(c)>budget: break
        out.extend(c)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='a'+str(N); b='b'+str(N)
check('truncate final', solve([[a,a],[b,b,b]],4), [a,a,b,b])
check('all fit', solve([[a],[b]],2), [a,b])
check('zero budget', solve([[a]],0), [])
check('empty chunks', solve([[],[a]],1), [a])
check('exact boundary', solve([[a,a]],2), [a,a])
check('first partial', solve([[a,a,a]],2), [a,a])
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
truncate final['a1', 'a1']['a1', 'a1', 'b1', 'b1']Failed
all fit['a1', 'b1']['a1', 'b1']Passed
zero budget[][]Passed
empty chunks['a1']['a1']Passed
exact boundary['a1', 'a1']['a1', 'a1']Passed
first partial[]['a1', 'a1']Failed

SHA-256 / ccdd1ac9faea151ffef8ba505bcb3e07409ba318fa125473f5b914f0a72fdca1

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(chunks, budget):
    out=[]
    for c in chunks:
        if len(out)+len(c)>budget: out.extend(c[:budget]); break
        out.extend(c)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='a'+str(N); b='b'+str(N)
check('truncate final', solve([[a,a],[b,b,b]],4), [a,a,b,b])
check('all fit', solve([[a],[b]],2), [a,b])
check('zero budget', solve([[a]],0), [])
check('empty chunks', solve([[],[a]],1), [a])
check('exact boundary', solve([[a,a]],2), [a,a])
check('first partial', solve([[a,a,a]],2), [a,a])
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
truncate final['a1', 'a1', 'b1', 'b1', 'b1']['a1', 'a1', 'b1', 'b1']Failed
all fit['a1', 'b1']['a1', 'b1']Passed
zero budget[][]Passed
empty chunks['a1']['a1']Passed
exact boundary['a1', 'a1']['a1', 'a1']Passed
first partial['a1', 'a1']['a1', 'a1']Passed

SHA-256 / 789811a8a47c739d678badd52069dc8405cd558e7e1d3d344a1dfe9848f2851e

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

Case digest / 16d611f59789f93298a487cc7934b4dabd3cae6ec3ec54719772e5ad0efcd80b