FAILURE MAP
← Case archive

FA-99601 / RAG context assembly / Open access

Context assembly ignores boundary-specific wrapper costs · case 01

Context assembly ignores boundary-specific wrapper costs.

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

ROOT CAUSE

The budget accounts for chunk content while omitting the different wrapper cost at each join.

THE FAILURE

The budget accounts for chunk content while omitting the different wrapper cost at each join.

Unsuccessful approach: Charging boundary cost on the first item applies a wrapper where no join exists.

Case contract

Rows are [text,content_cost,boundary_cost]. Return the longest prefix fitting budget; the first row has no preceding boundary.

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=[]; used=0
    for t,c,b in chunks:
        if used+c>budget: break
        out.append(t); used+=c
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('different wrappers', solve([['a',1,4],['b',1,1]],2), ['a'])
check('cheap second join', solve([['a',1,0],['b',1,1],['c',1,0]],4), ['a','b','c'])
check('first ignores wrapper', solve([['a',N,9]],N), ['a'])
check('empty', solve([],N), [])
check('zero wrapper', solve([['a',1,0],['b',1,0]],2), ['a','b'])
check('first fits only', solve([['a',1,0],['b',1,N]],N), ['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
different wrappers['a', 'b']['a']Failed
cheap second join['a', 'b', 'c']['a', 'b', 'c']Passed
first ignores wrapper['a']['a']Passed
empty[][]Passed
zero wrapper['a', 'b']['a', 'b']Passed
first fits only['a']['a']Passed

SHA-256 / 6b4ecda47e84e1c0598d7f30209466fcef71c0d81c48ebb75fed90b2e7810f15

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(chunks, budget):
    out=[]; used=0
    for t,c,b in chunks:
        extra=c+(b if out else 0)
        if used+extra+b>budget: break
        out.append(t); used+=extra+b
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('different wrappers', solve([['a',1,4],['b',1,1]],2), ['a'])
check('cheap second join', solve([['a',1,0],['b',1,1],['c',1,0]],4), ['a','b','c'])
check('first ignores wrapper', solve([['a',N,9]],N), ['a'])
check('empty', solve([],N), [])
check('zero wrapper', solve([['a',1,0],['b',1,0]],2), ['a','b'])
check('first fits only', solve([['a',1,0],['b',1,N]],N), ['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
different wrappers[]['a']Failed
cheap second join['a', 'b']['a', 'b', 'c']Failed
first ignores wrapper[]['a']Failed
empty[][]Passed
zero wrapper['a', 'b']['a', 'b']Passed
first fits only['a']['a']Passed

SHA-256 / 9ab9a59a5baa10df539b61651bf731757832052527219d2d08135cc40541dc3b

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

Case digest / d50d75ed8377bf211a2cbdece51300ea3682aa7c09c62da79b83a7dca5b1d89e