FAILURE MAP
← Case archive

FA-99631 / RAG context assembly / Open access

Context misses metadata overhead for selected evidence · case 01

Context misses metadata overhead for selected evidence.

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

ROOT CAUSE

The budget charges evidence text but ignores a fixed per-item metadata wrapper.

THE FAILURE

The budget charges evidence text but ignores a fixed per-item metadata wrapper.

Unsuccessful approach: Charging wrapper overhead only after selection can leave the returned context over budget.

Case contract

Rows are [id,text_cost]. Greedily select in order when text_cost plus wrapper fits remaining budget; return IDs.

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, wrapper):
    out=[]; used=0
    for i,c in rows:
        if used+c<=budget: out.append(i); used+=c
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('wrapper excludes second', solve([['a',2],['b',1]],4,1), ['a'])
check('exact overhead', solve([['a',2]],3,1), ['a'])
check('zero wrapper', solve([['a',1],['b',1]],2,0), ['a','b'])
check('empty', solve([],N,1), [])
check('oversized first skip', solve([['a',N+1],['b',1]],N,0), ['b'])
check('zero cost item', solve([['a',0]],1,1), ['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
wrapper excludes second['a', 'b']['a']Failed
exact overhead['a']['a']Passed
zero wrapper['a', 'b']['a', 'b']Passed
empty[][]Passed
oversized first skip['b']['b']Passed
zero cost item['a']['a']Passed

SHA-256 / 3c58fcff3f380da5b099240b27219a2921abf3a14808004830ffd22cad151d95

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(rows, budget, wrapper):
    out=[]; used=0
    for i,c in rows:
        if used+c+wrapper<=budget: out.append(i); used+=c
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('wrapper excludes second', solve([['a',2],['b',1]],4,1), ['a'])
check('exact overhead', solve([['a',2]],3,1), ['a'])
check('zero wrapper', solve([['a',1],['b',1]],2,0), ['a','b'])
check('empty', solve([],N,1), [])
check('oversized first skip', solve([['a',N+1],['b',1]],N,0), ['b'])
check('zero cost item', solve([['a',0]],1,1), ['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
wrapper excludes second['a', 'b']['a']Failed
exact overhead['a']['a']Passed
zero wrapper['a', 'b']['a', 'b']Passed
empty[][]Passed
oversized first skip['b']['b']Passed
zero cost item['a']['a']Passed

SHA-256 / af46815cfe6944652b94eac4cb9de0a03125929a8529d462bb8f417c88053dec

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

Case digest / c3f30596aa7396a637b733c486527fec011f7f2952b13db693750517b736740d