{"abstract":"A white king on e2 still yields a castling rook.","category":"Chess move legality","checks":8,"contract":"Input: {\"board\", \"rights\"}: rights letters are K/Q (outermost own rook on the back rank on the king's h-side / a-side), file letters A-H or a-h (the own rook on that file), or \"-\". A right only counts if the king is on its back rank (rank 1 for white, 8 for black) and the rook exists. Return the sorted distinct list of rook squares that carry castling rights.","contract_signature":"x","evaluation_group":"w2-chess_move_legality-xfen-castling-rook-files","failed_approach":"Accepting either back rank lets a king on the opponent's back rank keep rights.","family":"w2-chess_move_legality-xfen-castling-rook-files-king-on-back-rank","id":"FA-82766","implementations":{"attempt":{"sha256":"7e8835a63549f9ab1caa89fe4019b39ecdfd0cfc9ece22bb962d4c1eec5dcd6a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    b=x['board']; out=[]\n    for ch in x['rights']:\n        if ch=='-': continue\n        white=ch.isupper(); rank='1' if white else '8'\n        R='R' if white else 'r'; K='K' if white else 'k'\n        kfs=[s[0] for s,v in b.items() if v==K and s[1] in '18']\n        if not kfs: continue\n        kf=kfs[0]\n        rooks=sorted(s[0] for s,v in b.items() if v==R and s[1]==rank)\n        if ch.upper()=='K':\n            side=[f for f in rooks if f>kf]\n            if side: out.append(side[-1]+rank)\n        elif ch.upper()=='Q':\n            side=[f for f in rooks if f<kf]\n            if side: out.append(side[0]+rank)\n        elif ch.lower() in 'abcdefgh' and ch.lower() in rooks:\n            out.append(ch.lower()+rank)\n    return sorted(set(out))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('standard KQkq',\n   {'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},\n   ['a1', 'a8', 'h1', 'h8']),\n  ('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},\n   ['h1']),\n  ('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},\n   ['e1']),\n  ('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},\n   ['b8', 'h8']),\n  ('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),\n  ('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),\n  ('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),\n  ('black king on white back rank',\n   {'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, [])],\n [('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},\n   ['b8', 'h8']),\n  ('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),\n  ('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),\n  ('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),\n  ('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, []),\n  ('dash', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': '-'}, []),\n  ('black kq', {'board': {'a8': 'r', 'd8': 'k', 'e1': 'K', 'f8': 'r', 'g8': 'r'}, 'rights': 'kq'},\n   ['a8', 'g8']),\n  ('black king on white back rank',\n   {'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, [])],\n [('standard KQkq',\n   {'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},\n   ['a1', 'a8', 'h1', 'h8']),\n  ('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},\n   ['h1']),\n  ('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),\n  ('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, []),\n  ('dash', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': '-'}, []),\n  ('black kq', {'board': {'a8': 'r', 'd8': 'k', 'e1': 'K', 'f8': 'r', 'g8': 'r'}, 'rights': 'kq'},\n   ['a8', 'g8']),\n  ('black king on white back rank',\n   {'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, []),\n  ('black king on rank one', {'board': {'d1': 'k', 'e8': 'K', 'h1': 'r', 'h8': 'R'}, 'rights': 'k'},\n   [])],\n [('standard KQkq',\n   {'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},\n   ['a1', 'a8', 'h1', 'h8']),\n  ('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},\n   ['h1']),\n  ('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},\n   ['e1']),\n  ('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},\n   ['b8', 'h8']),\n  ('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),\n  ('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),\n  ('black king on white back rank',\n   {'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, []),\n  ('black king on rank one', {'board': {'d1': 'k', 'e8': 'K', 'h1': 'r', 'h8': 'R'}, 'rights': 'k'},\n   [])],\n [('standard KQkq',\n   {'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},\n   ['a1', 'a8', 'h1', 'h8']),\n  ('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},\n   ['h1']),\n  ('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},\n   ['e1']),\n  ('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},\n   ['b8', 'h8']),\n  ('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),\n  ('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),\n  ('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),\n  ('black king on white back rank',\n   {'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, [])]]\nfor label, args, expected in fixtures[N-1]:\n    try:\n        actual = solve(args)\n    except Exception as exc:\n        actual = 'error:' + type(exc).__name__\n    check(label, actual, expected)\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":"b89c325624391f0b939b7fd715bf02d66f97e91e48bc16950f4f016a559014d6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    b=x['board']; out=[]\n    for ch in x['rights']:\n        if ch=='-': continue\n        white=ch.isupper(); rank='1' if white else '8'\n        R='R' if white else 'r'; K='K' if white else 'k'\n        kfs=[s[0] for s,v in b.items() if v==K]\n        if not kfs: continue\n        kf=kfs[0]\n        rooks=sorted(s[0] for s,v in b.items() if v==R and s[1]==rank)\n        if ch.upper()=='K':\n            side=[f for f in rooks if f>kf]\n            if side: out.append(side[-1]+rank)\n        elif ch.upper()=='Q':\n            side=[f for f in rooks if f<kf]\n            if side: out.append(side[0]+rank)\n        elif ch.lower() in 'abcdefgh' and ch.lower() in rooks:\n            out.append(ch.lower()+rank)\n    return sorted(set(out))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('standard KQkq',\n   {'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},\n   ['a1', 'a8', 'h1', 'h8']),\n  ('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},\n   ['h1']),\n  ('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},\n   ['e1']),\n  ('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},\n   ['b8', 'h8']),\n  ('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),\n  ('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),\n  ('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),\n  ('black king on white back rank',\n   {'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, [])],\n [('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},\n   ['b8', 'h8']),\n  ('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),\n  ('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),\n  ('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),\n  ('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, []),\n  ('dash', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': '-'}, []),\n  ('black kq', {'board': {'a8': 'r', 'd8': 'k', 'e1': 'K', 'f8': 'r', 'g8': 'r'}, 'rights': 'kq'},\n   ['a8', 'g8']),\n  ('black king on white back rank',\n   {'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, [])],\n [('standard KQkq',\n   {'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},\n   ['a1', 'a8', 'h1', 'h8']),\n  ('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},\n   ['h1']),\n  ('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),\n  ('file letter without rook', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'A'}, []),\n  ('dash', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': '-'}, []),\n  ('black kq', {'board': {'a8': 'r', 'd8': 'k', 'e1': 'K', 'f8': 'r', 'g8': 'r'}, 'rights': 'kq'},\n   ['a8', 'g8']),\n  ('black king on white back rank',\n   {'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, []),\n  ('black king on rank one', {'board': {'d1': 'k', 'e8': 'K', 'h1': 'r', 'h8': 'R'}, 'rights': 'k'},\n   [])],\n [('standard KQkq',\n   {'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},\n   ['a1', 'a8', 'h1', 'h8']),\n  ('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},\n   ['h1']),\n  ('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},\n   ['e1']),\n  ('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},\n   ['b8', 'h8']),\n  ('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),\n  ('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),\n  ('black king on white back rank',\n   {'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, []),\n  ('black king on rank one', {'board': {'d1': 'k', 'e8': 'K', 'h1': 'r', 'h8': 'R'}, 'rights': 'k'},\n   [])],\n [('standard KQkq',\n   {'board': {'a1': 'R', 'a8': 'r', 'e1': 'K', 'e8': 'k', 'h1': 'R', 'h8': 'r'}, 'rights': 'KQkq'},\n   ['a1', 'a8', 'h1', 'h8']),\n  ('two rooks on h-side', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'},\n   ['h1']),\n  ('file letter inner rook', {'board': {'c1': 'K', 'e1': 'R', 'e8': 'k', 'h1': 'R'}, 'rights': 'E'},\n   ['e1']),\n  ('black file letters', {'board': {'b8': 'r', 'e1': 'K', 'g8': 'k', 'h8': 'r'}, 'rights': 'bh'},\n   ['b8', 'h8']),\n  ('K right but only a-side rook', {'board': {'a1': 'R', 'e8': 'k', 'g1': 'K'}, 'rights': 'K'}, []),\n  ('king off back rank', {'board': {'e2': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'K'}, []),\n  ('duplicate K and H', {'board': {'e1': 'K', 'e8': 'k', 'h1': 'R'}, 'rights': 'KH'}, ['h1']),\n  ('black king on white back rank',\n   {'board': {'a1': 'R', 'b8': 'K', 'd1': 'k', 'h8': 'r'}, 'rights': 'k'}, [])]]\nfor label, args, expected in fixtures[N-1]:\n    try:\n        actual = solve(args)\n    except Exception as exc:\n        actual = 'error:' + type(exc).__name__\n    check(label, actual, expected)\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":"A deterministic toy model with an explicitly stated contract; boards are {square: piece} with white upper-case and black lower-case pieces; no claim of full FIDE Laws conformance. 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":"w2-chess_move_legality-xfen-castling-rook-files-king-on-back-rank","generated_at":"2026-09-29T14:50:15.269061+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Chess960 and X-FEN positions encode castling by rook file; a wrong mapping castles with the wrong rook.","root_cause":"The king is located anywhere on the board.","sha256":"819b2bea0903bcaa42b7209b5582145676b08dda54f5013ce674ea95b25cd0a8","title":"Castling right kept after the king left the back rank · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":41.543,"exit_code":1,"observations":[{"actual":["a1","a8","h1","h8"],"check":"standard KQkq","expected":["a1","a8","h1","h8"],"passed":true},{"actual":["h1"],"check":"two rooks on h-side","expected":["h1"],"passed":true},{"actual":["e1"],"check":"file letter inner rook","expected":["e1"],"passed":true},{"actual":["b8","h8"],"check":"black file letters","expected":["b8","h8"],"passed":true},{"actual":[],"check":"K right but only a-side rook","expected":[],"passed":true},{"actual":[],"check":"king off back rank","expected":[],"passed":true},{"actual":["h1"],"check":"duplicate K and H","expected":["h1"],"passed":true},{"actual":["h8"],"check":"black king on white back rank","expected":[],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"standard KQkq\", \"actual\": [\"a1\", \"a8\", \"h1\", \"h8\"], \"expected\": [\"a1\", \"a8\", \"h1\", \"h8\"], \"passed\": true}, {\"check\": \"two rooks on h-side\", \"actual\": [\"h1\"], \"expected\": [\"h1\"], \"passed\": true}, {\"check\": \"file letter inner rook\", \"actual\": [\"e1\"], \"expected\": [\"e1\"], \"passed\": true}, {\"check\": \"black file letters\", \"actual\": [\"b8\", \"h8\"], \"expected\": [\"b8\", \"h8\"], \"passed\": true}, {\"check\": \"K right but only a-side rook\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"king off back rank\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"duplicate K and H\", \"actual\": [\"h1\"], \"expected\": [\"h1\"], \"passed\": true}, {\"check\": \"black king on white back rank\", \"actual\": [\"h8\"], \"expected\": [], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.874,"exit_code":1,"observations":[{"actual":["a1","a8","h1","h8"],"check":"standard KQkq","expected":["a1","a8","h1","h8"],"passed":true},{"actual":["h1"],"check":"two rooks on h-side","expected":["h1"],"passed":true},{"actual":["e1"],"check":"file letter inner rook","expected":["e1"],"passed":true},{"actual":["b8","h8"],"check":"black file letters","expected":["b8","h8"],"passed":true},{"actual":[],"check":"K right but only a-side rook","expected":[],"passed":true},{"actual":["h1"],"check":"king off back rank","expected":[],"passed":false},{"actual":["h1"],"check":"duplicate K and H","expected":["h1"],"passed":true},{"actual":["h8"],"check":"black king on white back rank","expected":[],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"standard KQkq\", \"actual\": [\"a1\", \"a8\", \"h1\", \"h8\"], \"expected\": [\"a1\", \"a8\", \"h1\", \"h8\"], \"passed\": true}, {\"check\": \"two rooks on h-side\", \"actual\": [\"h1\"], \"expected\": [\"h1\"], \"passed\": true}, {\"check\": \"file letter inner rook\", \"actual\": [\"e1\"], \"expected\": [\"e1\"], \"passed\": true}, {\"check\": \"black file letters\", \"actual\": [\"b8\", \"h8\"], \"expected\": [\"b8\", \"h8\"], \"passed\": true}, {\"check\": \"K right but only a-side rook\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"king off back rank\", \"actual\": [\"h1\"], \"expected\": [], \"passed\": false}, {\"check\": \"duplicate K and H\", \"actual\": [\"h1\"], \"expected\": [\"h1\"], \"passed\": true}, {\"check\": \"black king on white back rank\", \"actual\": [\"h8\"], \"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."}}