FA-82606 / Chess move legality / Open access
Ranks 0 and 9 accepted in UCI squares · case 01
"e2e9" passes syntax validation.
ROOT CAUSE
Any digit is accepted as a rank.
VERIFIED REPAIR
Ranks must be the characters 1 through 8.
Unsuccessful approach: An upper bound alone still accepts rank 0.
Case contract
Input: {"board", "uci": move string}. Return "ok" or a reason: "syntax" (length not 4-5, squares outside a1-h8, or from equals to), "no piece" (origin empty), "promotion required" (a white pawn reaching rank 8 or black pawn reaching rank 1 without a suffix), "unexpected promotion" (suffix on any other move), "bad promotion" (suffix not one of q, r, b, n).
Why this case matters
Engines and servers exchange moves in this long algebraic format.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
u=x['uci']; b=x['board']
if len(u) not in (4,5): return 'syntax'
fr,to,promo=u[:2],u[2:4],u[4:]
for s in (fr,to):
if s[0] not in 'abcdefgh' or not s[1].isdigit(): return 'syntax'
if fr==to: return 'syntax'
p=b.get(fr)
if p is None: return 'no piece'
last=(p=='P' and to[1]=='8') or (p=='p' and to[1]=='1')
if last and not promo: return 'promotion required'
if promo and not last: return 'unexpected promotion'
if promo and promo not in 'qrbn': return 'bad promotion'
return 'ok'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok')],
[('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion')],
[('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece')],
[('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece'),
('too long', {'board': {'e7': 'P'}, 'uci': 'e7e8qq'}, 'syntax'),
('too short', {'board': {'e2': 'P'}, 'uci': 'e2e'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('too long', {'board': {'e7': 'P'}, 'uci': 'e7e8qq'}, 'syntax'),
('too short', {'board': {'e2': 'P'}, 'uci': 'e2e'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')]]
for label, args, expected in fixtures[N-1]:
try:
actual = solve(args)
except Exception as exc:
actual = 'error:' + type(exc).__name__
check(label, actual, expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| simple move | ok | ok | Passed |
| rank nine | ok | syntax | Failed |
| rank zero | ok | syntax | Failed |
| white promotion | ok | ok | Passed |
| white needs promotion | promotion required | promotion required | Passed |
| black needs promotion | promotion required | promotion required | Passed |
| black promotes knight | ok | ok | Passed |
| rook reaches last rank | ok | ok | Passed |
SHA-256 / 087389f9f4f962bdb7b548a3a036b2aa3df7d157bf064be21857a9112c14e566
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
u=x['uci']; b=x['board']
if len(u) not in (4,5): return 'syntax'
fr,to,promo=u[:2],u[2:4],u[4:]
for s in (fr,to):
if s[0] not in 'abcdefgh' or int(s[1])>8: return 'syntax'
if fr==to: return 'syntax'
p=b.get(fr)
if p is None: return 'no piece'
last=(p=='P' and to[1]=='8') or (p=='p' and to[1]=='1')
if last and not promo: return 'promotion required'
if promo and not last: return 'unexpected promotion'
if promo and promo not in 'qrbn': return 'bad promotion'
return 'ok'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok')],
[('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion')],
[('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece')],
[('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece'),
('too long', {'board': {'e7': 'P'}, 'uci': 'e7e8qq'}, 'syntax'),
('too short', {'board': {'e2': 'P'}, 'uci': 'e2e'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('too long', {'board': {'e7': 'P'}, 'uci': 'e7e8qq'}, 'syntax'),
('too short', {'board': {'e2': 'P'}, 'uci': 'e2e'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')]]
for label, args, expected in fixtures[N-1]:
try:
actual = solve(args)
except Exception as exc:
actual = 'error:' + type(exc).__name__
check(label, actual, expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| simple move | ok | ok | Passed |
| rank nine | syntax | syntax | Passed |
| rank zero | ok | syntax | Failed |
| white promotion | ok | ok | Passed |
| white needs promotion | promotion required | promotion required | Passed |
| black needs promotion | promotion required | promotion required | Passed |
| black promotes knight | ok | ok | Passed |
| rook reaches last rank | ok | ok | Passed |
SHA-256 / 388a150b3bd739cf76652f27172780ca2e90586418c3e58f70cef6701fcb1928
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
u=x['uci']; b=x['board']
if len(u) not in (4,5): return 'syntax'
fr,to,promo=u[:2],u[2:4],u[4:]
for s in (fr,to):
if s[0] not in 'abcdefgh' or s[1] not in '12345678': return 'syntax'
if fr==to: return 'syntax'
p=b.get(fr)
if p is None: return 'no piece'
last=(p=='P' and to[1]=='8') or (p=='p' and to[1]=='1')
if last and not promo: return 'promotion required'
if promo and not last: return 'unexpected promotion'
if promo and promo not in 'qrbn': return 'bad promotion'
return 'ok'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok')],
[('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('black needs promotion', {'board': {'b2': 'p'}, 'uci': 'b2b1'}, 'promotion required'),
('black promotes knight', {'board': {'b2': 'p'}, 'uci': 'b2a1n'}, 'ok'),
('rook reaches last rank', {'board': {'a1': 'R'}, 'uci': 'a1a8'}, 'ok'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion')],
[('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('king promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8k'}, 'bad promotion'),
('pawn promotion letter', {'board': {'c7': 'P'}, 'uci': 'c7c8p'}, 'bad promotion'),
('suffix on quiet move', {'board': {'g1': 'N'}, 'uci': 'g1f3q'}, 'unexpected promotion'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece')],
[('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('null move', {'board': {'e2': 'P'}, 'uci': 'e2e2'}, 'syntax'),
('vertical rook move', {'board': {'h1': 'R'}, 'uci': 'h1h5'}, 'ok'),
('empty origin', {'board': {'e2': 'P'}, 'uci': 'd2d4'}, 'no piece'),
('too long', {'board': {'e7': 'P'}, 'uci': 'e7e8qq'}, 'syntax'),
('too short', {'board': {'e2': 'P'}, 'uci': 'e2e'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')],
[('simple move', {'board': {'e2': 'P'}, 'uci': 'e2e4'}, 'ok'),
('rank nine', {'board': {'e2': 'P'}, 'uci': 'e2e9'}, 'syntax'),
('rank zero', {'board': {'e2': 'P'}, 'uci': 'e2e0'}, 'syntax'),
('white promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8q'}, 'ok'),
('white needs promotion', {'board': {'e7': 'P'}, 'uci': 'e7e8'}, 'promotion required'),
('too long', {'board': {'e7': 'P'}, 'uci': 'e7e8qq'}, 'syntax'),
('too short', {'board': {'e2': 'P'}, 'uci': 'e2e'}, 'syntax'),
('castling encoding', {'board': {'e1': 'K', 'h1': 'R'}, 'uci': 'e1g1'}, 'ok')]]
for label, args, expected in fixtures[N-1]:
try:
actual = solve(args)
except Exception as exc:
actual = 'error:' + type(exc).__name__
check(label, actual, expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| simple move | ok | ok | Passed |
| rank nine | syntax | syntax | Passed |
| rank zero | syntax | syntax | Passed |
| white promotion | ok | ok | Passed |
| white needs promotion | promotion required | promotion required | Passed |
| black needs promotion | promotion required | promotion required | Passed |
| black promotes knight | ok | ok | Passed |
| rook reaches last rank | ok | ok | Passed |
SHA-256 / c89afbdb6e094ad116a575d9f90b8d7b0ab2a57b0b1f3c895b85c8c08dd8ea03
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:50:13.694347+00:00.
Case digest / c37e958cae1f379012879a42da8042b0e1dfb18f7e93cba8ec42a18bb3d2fba6