{"abstract":"Nearest L2 candidate is ranked last.","category":"Vector retrieval ranking","checks":6,"contract":"Rows are [id,squared_distance]; return IDs nearest first, lexical ties.","contract_signature":"rows","evaluation_group":"vector-retrieval-distance-direction","failed_approach":"Descending identifier order still misorders equal-distance rows.","family":"w3-vector-retrieval-ranking-distance-direction","id":"FA-99441","implementations":{"attempt":{"sha256":"f3f7a02026df9cee9616b05142e04ba111ab91ecff9f4cbda75a6515416804f7","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows):\n    return [x[0] for x in sorted(rows,key=lambda x:(x[1],tuple(-ord(c) for c in x[0])))]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('near/far',solve([['far',N+4],['near',N]]),['near','far'])\ncheck('ties lexical',solve([['z',N],['a',N]]),['a','z'])\ncheck('three distances',solve([['m',N+2],['b',N+1],['a',N]]),['a','b','m'])\ncheck('zero tie',solve([['q',0],['p',0]]),['p','q'])\ncheck('equal offset',solve([['b',N+1],['a',N+1]]),['a','b'])\ncheck('reversed input',solve([['c',N+3],['b',N+2],['a',N+1]]),['a','b','c'])\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":"e2b97409304666e59bea53a9205ed343d8555019816a572174a36bff8790b0ab","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows):\n    return [x[0] for x in sorted(rows,key=lambda x:x[1],reverse=True)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('near/far',solve([['far',N+4],['near',N]]),['near','far'])\ncheck('ties lexical',solve([['z',N],['a',N]]),['a','z'])\ncheck('three distances',solve([['m',N+2],['b',N+1],['a',N]]),['a','b','m'])\ncheck('zero tie',solve([['q',0],['p',0]]),['p','q'])\ncheck('equal offset',solve([['b',N+1],['a',N+1]]),['a','b'])\ncheck('reversed input',solve([['c',N+3],['b',N+2],['a',N+1]]),['a','b','c'])\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 small exact toy vectors and scores. No production index, ANN recall, embedding quality, or latency claim is implied. 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-vector-retrieval-ranking-distance-direction","generated_at":"2026-09-30T16:48:24.474420+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"An offline vector retrieval toy model isolates one ranking contract from embedding generation, storage, and serving.","root_cause":"The distance key is sorted in descending order.","sha256":"48ab222b6dfdaf6ce17fe4c875f900fe39cfa8c5e6b758a7d46ec7c2b8c8742f","title":"Vector retrieval: Nearest L2 candidate is ranked last · 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":28.076,"exit_code":1,"observations":[{"actual":["near","far"],"check":"near/far","expected":["near","far"],"passed":true},{"actual":["z","a"],"check":"ties lexical","expected":["a","z"],"passed":false},{"actual":["a","b","m"],"check":"three distances","expected":["a","b","m"],"passed":true},{"actual":["q","p"],"check":"zero tie","expected":["p","q"],"passed":false},{"actual":["b","a"],"check":"equal offset","expected":["a","b"],"passed":false},{"actual":["a","b","c"],"check":"reversed input","expected":["a","b","c"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"near/far\", \"actual\": [\"near\", \"far\"], \"expected\": [\"near\", \"far\"], \"passed\": true}, {\"check\": \"ties lexical\", \"actual\": [\"z\", \"a\"], \"expected\": [\"a\", \"z\"], \"passed\": false}, {\"check\": \"three distances\", \"actual\": [\"a\", \"b\", \"m\"], \"expected\": [\"a\", \"b\", \"m\"], \"passed\": true}, {\"check\": \"zero tie\", \"actual\": [\"q\", \"p\"], \"expected\": [\"p\", \"q\"], \"passed\": false}, {\"check\": \"equal offset\", \"actual\": [\"b\", \"a\"], \"expected\": [\"a\", \"b\"], \"passed\": false}, {\"check\": \"reversed input\", \"actual\": [\"a\", \"b\", \"c\"], \"expected\": [\"a\", \"b\", \"c\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":28.057,"exit_code":1,"observations":[{"actual":["far","near"],"check":"near/far","expected":["near","far"],"passed":false},{"actual":["z","a"],"check":"ties lexical","expected":["a","z"],"passed":false},{"actual":["m","b","a"],"check":"three distances","expected":["a","b","m"],"passed":false},{"actual":["q","p"],"check":"zero tie","expected":["p","q"],"passed":false},{"actual":["b","a"],"check":"equal offset","expected":["a","b"],"passed":false},{"actual":["c","b","a"],"check":"reversed input","expected":["a","b","c"],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"near/far\", \"actual\": [\"far\", \"near\"], \"expected\": [\"near\", \"far\"], \"passed\": false}, {\"check\": \"ties lexical\", \"actual\": [\"z\", \"a\"], \"expected\": [\"a\", \"z\"], \"passed\": false}, {\"check\": \"three distances\", \"actual\": [\"m\", \"b\", \"a\"], \"expected\": [\"a\", \"b\", \"m\"], \"passed\": false}, {\"check\": \"zero tie\", \"actual\": [\"q\", \"p\"], \"expected\": [\"p\", \"q\"], \"passed\": false}, {\"check\": \"equal offset\", \"actual\": [\"b\", \"a\"], \"expected\": [\"a\", \"b\"], \"passed\": false}, {\"check\": \"reversed input\", \"actual\": [\"c\", \"b\", \"a\"], \"expected\": [\"a\", \"b\", \"c\"], \"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."}}