{"abstract":"Reuse stops at the first differing token but reports the final sequence length.","category":"KV cache position mapping","checks":6,"contract":"Return the length of the longest shared prefix of two token sequences.","contract_signature":"cached_tokens, requested_tokens","evaluation_group":"w3-kv-map-longest-prefix-reuse","failed_approach":"Comparing membership instead of aligned token equality overestimates reuse for reordered tokens.","family":"w3-kv-cache-position-mapping-longest-prefix-reuse","id":"FA-98596","implementations":{"attempt":{"sha256":"634f6c3c16b808189b473db3a457f7c033624ff27aeb07dd13ab844706744825","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cached_tokens, requested_tokens):\n    return sum(t in requested_tokens for t in cached_tokens)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('full prefix',solve(['a']*N+['b'],['a']*N+['c']),N)\ncheck('first mismatch',solve(['x','a'],['y','a']),0)\ncheck('short request',solve(['a','b','c'],['a','b']),2)\ncheck('empty cached',solve([],['a']),0)\ncheck('empty request',solve(['a'],[]),0)\ncheck('reordered tokens',solve(['a','b'],['b','a']),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":"7133e21b105f74d510af1e056b35c25b375e54cf203db65d01d7174f888288b7","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cached_tokens, requested_tokens):\n    return min(len(cached_tokens),len(requested_tokens))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('full prefix',solve(['a']*N+['b'],['a']*N+['c']),N)\ncheck('first mismatch',solve(['x','a'],['y','a']),0)\ncheck('short request',solve(['a','b','c'],['a','b']),2)\ncheck('empty cached',solve([],['a']),0)\ncheck('empty request',solve(['a'],[]),0)\ncheck('reordered tokens',solve(['a','b'],['b','a']),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":"These toy integer maps omit tensor layout, concurrency, device memory, and model-specific cache formats. 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-kv-cache-position-mapping-longest-prefix-reuse","generated_at":"2026-09-30T16:48:14.544796+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A small in-memory model makes the cache address contract explicit for a serving component.","root_cause":"The comparison does not track the last matching boundary.","sha256":"0dd48b74e1de07e0cff18a7d0dac0cbfb86c843445008b7d86922a87344ad0e6","title":"Prefix reuse reports the common token prefix length · 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":26.707,"exit_code":1,"observations":[{"actual":1,"check":"full prefix","expected":1,"passed":true},{"actual":1,"check":"first mismatch","expected":0,"passed":false},{"actual":2,"check":"short request","expected":2,"passed":true},{"actual":0,"check":"empty cached","expected":0,"passed":true},{"actual":0,"check":"empty request","expected":0,"passed":true},{"actual":2,"check":"reordered tokens","expected":0,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"full prefix\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"first mismatch\", \"actual\": 1, \"expected\": 0, \"passed\": false}, {\"check\": \"short request\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"empty cached\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"empty request\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"reordered tokens\", \"actual\": 2, \"expected\": 0, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":25.898,"exit_code":1,"observations":[{"actual":2,"check":"full prefix","expected":1,"passed":false},{"actual":2,"check":"first mismatch","expected":0,"passed":false},{"actual":2,"check":"short request","expected":2,"passed":true},{"actual":0,"check":"empty cached","expected":0,"passed":true},{"actual":0,"check":"empty request","expected":0,"passed":true},{"actual":2,"check":"reordered tokens","expected":0,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"full prefix\", \"actual\": 2, \"expected\": 1, \"passed\": false}, {\"check\": \"first mismatch\", \"actual\": 2, \"expected\": 0, \"passed\": false}, {\"check\": \"short request\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"empty cached\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"empty request\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"reordered tokens\", \"actual\": 2, \"expected\": 0, \"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."}}