{"abstract":"The last chunk is dropped instead of truncated at the remaining budget.","category":"RAG context assembly","checks":6,"contract":"Chunks are token lists. Concatenate in order up to budget tokens, truncating only the final included chunk.","contract_signature":"chunks, budget","evaluation_group":"ragctx-final-truncate","failed_approach":"Truncating every chunk to the total budget can exceed the remaining space.","family":"w3-rag-context-assembly-final-chunk-truncation","id":"FA-99611","implementations":{"attempt":{"sha256":"789811a8a47c739d678badd52069dc8405cd558e7e1d3d344a1dfe9848f2851e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(chunks, budget):\n    out=[]\n    for c in chunks:\n        if len(out)+len(c)>budget: out.extend(c[:budget]); break\n        out.extend(c)\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\na='a'+str(N); b='b'+str(N)\ncheck('truncate final', solve([[a,a],[b,b,b]],4), [a,a,b,b])\ncheck('all fit', solve([[a],[b]],2), [a,b])\ncheck('zero budget', solve([[a]],0), [])\ncheck('empty chunks', solve([[],[a]],1), [a])\ncheck('exact boundary', solve([[a,a]],2), [a,a])\ncheck('first partial', solve([[a,a,a]],2), [a,a])\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":"ccdd1ac9faea151ffef8ba505bcb3e07409ba318fa125473f5b914f0a72fdca1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(chunks, budget):\n    out=[]\n    for c in chunks:\n        if len(out)+len(c)>budget: break\n        out.extend(c)\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\na='a'+str(N); b='b'+str(N)\ncheck('truncate final', solve([[a,a],[b,b,b]],4), [a,a,b,b])\ncheck('all fit', solve([[a],[b]],2), [a,b])\ncheck('zero budget', solve([[a]],0), [])\ncheck('empty chunks', solve([[],[a]],1), [a])\ncheck('exact boundary', solve([[a,a]],2), [a,a])\ncheck('first partial', solve([[a,a,a]],2), [a,a])\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-final-chunk-truncation","generated_at":"2026-09-30T16:48:26.270092+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 builder only accepts chunks that fit whole, despite a contract allowing the final chunk to be shortened.","sha256":"16d611f59789f93298a487cc7934b4dabd3cae6ec3ec54719772e5ad0efcd80b","title":"The last chunk is dropped instead of truncated at the remaining budget · 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":29.191,"exit_code":1,"observations":[{"actual":["a1","a1","b1","b1","b1"],"check":"truncate final","expected":["a1","a1","b1","b1"],"passed":false},{"actual":["a1","b1"],"check":"all fit","expected":["a1","b1"],"passed":true},{"actual":[],"check":"zero budget","expected":[],"passed":true},{"actual":["a1"],"check":"empty chunks","expected":["a1"],"passed":true},{"actual":["a1","a1"],"check":"exact boundary","expected":["a1","a1"],"passed":true},{"actual":["a1","a1"],"check":"first partial","expected":["a1","a1"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"truncate final\", \"actual\": [\"a1\", \"a1\", \"b1\", \"b1\", \"b1\"], \"expected\": [\"a1\", \"a1\", \"b1\", \"b1\"], \"passed\": false}, {\"check\": \"all fit\", \"actual\": [\"a1\", \"b1\"], \"expected\": [\"a1\", \"b1\"], \"passed\": true}, {\"check\": \"zero budget\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"empty chunks\", \"actual\": [\"a1\"], \"expected\": [\"a1\"], \"passed\": true}, {\"check\": \"exact boundary\", \"actual\": [\"a1\", \"a1\"], \"expected\": [\"a1\", \"a1\"], \"passed\": true}, {\"check\": \"first partial\", \"actual\": [\"a1\", \"a1\"], \"expected\": [\"a1\", \"a1\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":33.152,"exit_code":1,"observations":[{"actual":["a1","a1"],"check":"truncate final","expected":["a1","a1","b1","b1"],"passed":false},{"actual":["a1","b1"],"check":"all fit","expected":["a1","b1"],"passed":true},{"actual":[],"check":"zero budget","expected":[],"passed":true},{"actual":["a1"],"check":"empty chunks","expected":["a1"],"passed":true},{"actual":["a1","a1"],"check":"exact boundary","expected":["a1","a1"],"passed":true},{"actual":[],"check":"first partial","expected":["a1","a1"],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"truncate final\", \"actual\": [\"a1\", \"a1\"], \"expected\": [\"a1\", \"a1\", \"b1\", \"b1\"], \"passed\": false}, {\"check\": \"all fit\", \"actual\": [\"a1\", \"b1\"], \"expected\": [\"a1\", \"b1\"], \"passed\": true}, {\"check\": \"zero budget\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"empty chunks\", \"actual\": [\"a1\"], \"expected\": [\"a1\"], \"passed\": true}, {\"check\": \"exact boundary\", \"actual\": [\"a1\", \"a1\"], \"expected\": [\"a1\", \"a1\"], \"passed\": true}, {\"check\": \"first partial\", \"actual\": [], \"expected\": [\"a1\", \"a1\"], \"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."}}