{"abstract":"Whole-chunk prefix assembly slices text at a token limit.","category":"RAG context assembly","checks":6,"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.","contract_signature":"rows, budget","evaluation_group":"ragctx-whole-chunk","failed_approach":"Skipping an oversized chunk can include later material and break the required contiguous prefix.","family":"w3-rag-context-assembly-whole-chunk-budget","id":"FA-99566","implementations":{"attempt":{"sha256":"c1f3e9d9e29bf426066c1ae78b9d99e143546f92047c0039401f5e57e4c12c28","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows, budget):\n    out=[]; used=0\n    for text,cost in rows:\n        if used+cost<=budget: out.append(text); used+=cost\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('whole chunks', solve([['abc',3],['de',2]],4), ['abc'])\ncheck('contiguous prefix ends', solve([['ok',1],['long',N+1],['later',1]],N+1), ['ok'])\ncheck('empty text', solve([['',0]],0), [''])\ncheck('empty rows', solve([],N), [])\ncheck('exact fit', solve([['x',N]],N), ['x'])\ncheck('prefix blocked at zero budget', solve([['x',1],['',0]],0), [])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"a985b4cc9f706b3fa5a924cd525f28a224fc95473eb4bb6cd575e6400093641a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows, budget):\n    return [text[:budget] for text,cost in rows if cost<=budget]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('whole chunks', solve([['abc',3],['de',2]],4), ['abc'])\ncheck('contiguous prefix ends', solve([['ok',1],['long',N+1],['later',1]],N+1), ['ok'])\ncheck('empty text', solve([['',0]],0), [''])\ncheck('empty rows', solve([],N), [])\ncheck('exact fit', solve([['x',N]],N), ['x'])\ncheck('prefix blocked at zero budget', solve([['x',1],['',0]],0), [])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w3-rag-context-assembly-whole-chunk-budget","generated_at":"2026-09-30T16:48:25.802449+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A small deterministic evidence assembly model makes context budgeting behavior inspectable.","root_cause":"The prefix builder truncates the text of an oversized chunk instead of ending before that chunk.","sha256":"88bb4be13c65c43d3caff241cc3a0584ff9d3226744e2fd598fd37156b488a72","title":"Whole-chunk prefix assembly slices text at a token limit · case 01","variant":1,"variant_policy":"The fixture code references N, supplied as 1 through 5. Fixed boundary checks may repeat. These records share one mechanism and must remain together in evaluation splits.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":30.43,"exit_code":1,"observations":[{"actual":["abc"],"check":"whole chunks","expected":["abc"],"passed":true},{"actual":["ok","later"],"check":"contiguous prefix ends","expected":["ok"],"passed":false},{"actual":[""],"check":"empty text","expected":[""],"passed":true},{"actual":[],"check":"empty rows","expected":[],"passed":true},{"actual":["x"],"check":"exact fit","expected":["x"],"passed":true},{"actual":[""],"check":"prefix blocked at zero budget","expected":[],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"whole chunks\", \"actual\": [\"abc\"], \"expected\": [\"abc\"], \"passed\": true}, {\"check\": \"contiguous prefix ends\", \"actual\": [\"ok\", \"later\"], \"expected\": [\"ok\"], \"passed\": false}, {\"check\": \"empty text\", \"actual\": [\"\"], \"expected\": [\"\"], \"passed\": true}, {\"check\": \"empty rows\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"exact fit\", \"actual\": [\"x\"], \"expected\": [\"x\"], \"passed\": true}, {\"check\": \"prefix blocked at zero budget\", \"actual\": [\"\"], \"expected\": [], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":28.802,"exit_code":1,"observations":[{"actual":["abc","de"],"check":"whole chunks","expected":["abc"],"passed":false},{"actual":["ok","lo","la"],"check":"contiguous prefix ends","expected":["ok"],"passed":false},{"actual":[""],"check":"empty text","expected":[""],"passed":true},{"actual":[],"check":"empty rows","expected":[],"passed":true},{"actual":["x"],"check":"exact fit","expected":["x"],"passed":true},{"actual":[""],"check":"prefix blocked at zero budget","expected":[],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"whole chunks\", \"actual\": [\"abc\", \"de\"], \"expected\": [\"abc\"], \"passed\": false}, {\"check\": \"contiguous prefix ends\", \"actual\": [\"ok\", \"lo\", \"la\"], \"expected\": [\"ok\"], \"passed\": false}, {\"check\": \"empty text\", \"actual\": [\"\"], \"expected\": [\"\"], \"passed\": true}, {\"check\": \"empty rows\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"exact fit\", \"actual\": [\"x\"], \"expected\": [\"x\"], \"passed\": true}, {\"check\": \"prefix blocked at zero budget\", \"actual\": [\"\"], \"expected\": [], \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}