{"abstract":"Old document versions remain searchable after replacement.","category":"Search retrieval semantics","checks":7,"contract":"Records are [id,revision,tokens], with unique id/revision pairs. Return sorted IDs whose greatest-revision record contains the term. Record order is arbitrary.","evaluation_group":"model-cbe5ec154f043f2e","failed_approach":"Selecting the newest matching revision still ignores a newer nonmatching replacement.","family":"z-search-latest-document-postings","id":"FA-11876","implementations":{"attempt":{"sha256":"bb9fccac9265d19ce2daafb2498448ad9c0b3cc906f14b88b393689fb740b43f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(records, term):\n    latest={}\n    for ident,revision,tokens in records:\n        if term in tokens and (ident not in latest or revision>latest[ident]): latest[ident]=revision\n    return sorted(latest)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('replacement removes term', solve([['a',N,['x']],['a',N+1,[]]],'x'),[])\ncheck('replacement adds term', solve([['a',N,[]],['a',N+1,['x']]],'x'),['a'])\ncheck('out of order revisions', solve([['a',N+1,[]],['a',N,['x']]],'x'),[])\ncheck('separate documents', solve([['b',N,['x']],['a',N,['x']]],'x'),['a','b'])\ncheck('unrelated term', solve([['a',N,['y']]],'x'),[])\ncheck('empty index', solve([],'x'),[])\ncheck('unchanged term', solve([['a',N,['x']],['a',N+1,['x']]],'x'),['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":"fb03e5f5046409f7c7813d5046965132248735d61f4ff116291f29bc04c95847","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(records, term):\n    return sorted({ident for ident,revision,tokens in records if term in tokens})\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('replacement removes term', solve([['a',N,['x']],['a',N+1,[]]],'x'),[])\ncheck('replacement adds term', solve([['a',N,[]],['a',N+1,['x']]],'x'),['a'])\ncheck('out of order revisions', solve([['a',N+1,[]],['a',N,['x']]],'x'),[])\ncheck('separate documents', solve([['b',N,['x']],['a',N,['x']]],'x'),['a','b'])\ncheck('unrelated term', solve([['a',N,['y']]],'x'),[])\ncheck('empty index', solve([],'x'),[])\ncheck('unchanged term', solve([['a',N,['x']],['a',N+1,['x']]],'x'),['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"},"fixed":{"sha256":"3387e05a55bd2f79572025692141a6fd04f20979ccb0c58965132937b733bedf","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(records, term):\n    latest={}\n    for ident,revision,tokens in records:\n        if ident not in latest or revision>latest[ident][0]: latest[ident]=(revision,tokens)\n    return sorted(ident for ident,(revision,tokens) in latest.items() if term in tokens)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('replacement removes term', solve([['a',N,['x']],['a',N+1,[]]],'x'),[])\ncheck('replacement adds term', solve([['a',N,[]],['a',N+1,['x']]],'x'),['a'])\ncheck('out of order revisions', solve([['a',N+1,[]],['a',N,['x']]],'x'),[])\ncheck('separate documents', solve([['b',N,['x']],['a',N,['x']]],'x'),['a','b'])\ncheck('unrelated term', solve([['a',N,['y']]],'x'),[])\ncheck('empty index', solve([],'x'),[])\ncheck('unchanged term', solve([['a',N,['x']],['a',N+1,['x']]],'x'),['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":"Inputs are already tokenized or scored; this model makes no claim about production engine performance or linguistic analysis. 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":"z-search-latest-document-postings","generated_at":"2026-09-29T14:38:51.750796+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"An offline deterministic retrieval model isolates this search contract from tokenization, storage, and network behavior.","repair":"Select the highest revision of each document before checking its term membership.","root_cause":"A term posting from any historical version is treated as a live match.","sha256":"5a9b55aceb9dcfbc790158ce3bf034db78ae1ddf5230d32716f7b131a1430f18","title":"Old document versions remain searchable after replacement · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":39.66,"exit_code":1,"observations":[{"actual":["a"],"check":"replacement removes term","expected":[],"passed":false},{"actual":["a"],"check":"replacement adds term","expected":["a"],"passed":true},{"actual":["a"],"check":"out of order revisions","expected":[],"passed":false},{"actual":["a","b"],"check":"separate documents","expected":["a","b"],"passed":true},{"actual":[],"check":"unrelated term","expected":[],"passed":true},{"actual":[],"check":"empty index","expected":[],"passed":true},{"actual":["a"],"check":"unchanged term","expected":["a"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"replacement removes term\", \"actual\": [\"a\"], \"expected\": [], \"passed\": false}, {\"check\": \"replacement adds term\", \"actual\": [\"a\"], \"expected\": [\"a\"], \"passed\": true}, {\"check\": \"out of order revisions\", \"actual\": [\"a\"], \"expected\": [], \"passed\": false}, {\"check\": \"separate documents\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\", \"b\"], \"passed\": true}, {\"check\": \"unrelated term\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"empty index\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"unchanged term\", \"actual\": [\"a\"], \"expected\": [\"a\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.643,"exit_code":1,"observations":[{"actual":["a"],"check":"replacement removes term","expected":[],"passed":false},{"actual":["a"],"check":"replacement adds term","expected":["a"],"passed":true},{"actual":["a"],"check":"out of order revisions","expected":[],"passed":false},{"actual":["a","b"],"check":"separate documents","expected":["a","b"],"passed":true},{"actual":[],"check":"unrelated term","expected":[],"passed":true},{"actual":[],"check":"empty index","expected":[],"passed":true},{"actual":["a"],"check":"unchanged term","expected":["a"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"replacement removes term\", \"actual\": [\"a\"], \"expected\": [], \"passed\": false}, {\"check\": \"replacement adds term\", \"actual\": [\"a\"], \"expected\": [\"a\"], \"passed\": true}, {\"check\": \"out of order revisions\", \"actual\": [\"a\"], \"expected\": [], \"passed\": false}, {\"check\": \"separate documents\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\", \"b\"], \"passed\": true}, {\"check\": \"unrelated term\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"empty index\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"unchanged term\", \"actual\": [\"a\"], \"expected\": [\"a\"], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":37.827,"exit_code":0,"observations":[{"actual":[],"check":"replacement removes term","expected":[],"passed":true},{"actual":["a"],"check":"replacement adds term","expected":["a"],"passed":true},{"actual":[],"check":"out of order revisions","expected":[],"passed":true},{"actual":["a","b"],"check":"separate documents","expected":["a","b"],"passed":true},{"actual":[],"check":"unrelated term","expected":[],"passed":true},{"actual":[],"check":"empty index","expected":[],"passed":true},{"actual":["a"],"check":"unchanged term","expected":["a"],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"replacement removes term\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"replacement adds term\", \"actual\": [\"a\"], \"expected\": [\"a\"], \"passed\": true}, {\"check\": \"out of order revisions\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"separate documents\", \"actual\": [\"a\", \"b\"], \"expected\": [\"a\", \"b\"], \"passed\": true}, {\"check\": \"unrelated term\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"empty index\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"unchanged term\", \"actual\": [\"a\"], \"expected\": [\"a\"], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}