broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(data, would_block, written):
    return data[written:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('abc', True, 2), 'abc')", "check('fixture 2', solve('abc', False, 2), 'c')", "check('fixture 3', solve('', True, 0), '')", "check('fixture 4', solve('abc', False, 0), 'abc')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(data, would_block, written):
    return data
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('abc', True, 2), 'abc')", "check('fixture 2', solve('abc', False, 2), 'c')", "check('fixture 3', solve('', True, 0), '')", "check('fixture 4', solve('abc', False, 0), 'abc')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

prompt:
Would block preserves entire unsent write buffer.

Bounded offline decision model: would block preserves entire unsent write buffer. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(buffered, eof):
    return 'closed' if eof else ('deliver' if buffered else 'wait')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(3, True), 'deliver')", "check('fixture 2', solve(0, True), 'closed')", "check('fixture 3', solve(0, False), 'wait')", "check('fixture 4', solve(1, False), 'deliver')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(buffered, eof):
    return 'deliver' if buffered else 'wait'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(3, True), 'deliver')", "check('fixture 2', solve(0, True), 'closed')", "check('fixture 3', solve(0, False), 'wait')", "check('fixture 4', solve(1, False), 'deliver')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

prompt:
Stream eof is terminal only after buffered input is delivered.

Bounded offline decision model: stream eof is terminal only after buffered input is delivered. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(expected, received, eof):
    return 'complete' if eof or received >= expected else 'wait'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(10, 5, True), 'truncated')", "check('fixture 2', solve(10, 10, False), 'complete')", "check('fixture 3', solve(10, 5, False), 'wait')", "check('fixture 4', solve(0, 0, True), 'complete')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(expected, received, eof):
    return 'complete' if received >= expected else 'wait'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(10, 5, True), 'truncated')", "check('fixture 2', solve(10, 10, False), 'complete')", "check('fixture 3', solve(10, 5, False), 'wait')", "check('fixture 4', solve(0, 0, True), 'complete')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

prompt:
Response boundary for fixed length body detects short eof.

Bounded offline decision model: response boundary for fixed length body detects short eof. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(covered, same_address, h2):
    return covered and h2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(True, False, True), False)", "check('fixture 2', solve(False, True, True), False)", "check('fixture 3', solve(True, True, True), True)", "check('fixture 4', solve(True, True, False), False)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(covered, same_address, h2):
    return same_address and h2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(True, False, True), False)", "check('fixture 2', solve(False, True, True), False)", "check('fixture 3', solve(True, True, True), True)", "check('fixture 4', solve(True, True, False), False)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

prompt:
Connection coalescing requires origin coverage and address match.

Bounded offline decision model: connection coalescing requires origin coverage and address match. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(expiry, now, lifetime, success):
    return now+lifetime
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(10, 8, 20, False), 10)", "check('fixture 2', solve(10, 8, 20, True), 28)", "check('fixture 3', solve(0, 0, 0, True), 0)", "check('fixture 4', solve(5, 7, 1, False), 5)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(expiry, now, lifetime, success):
    return expiry
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(10, 8, 20, False), 10)", "check('fixture 2', solve(10, 8, 20, True), 28)", "check('fixture 3', solve(0, 0, 0, True), 0)", "check('fixture 4', solve(5, 7, 1, False), 5)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

prompt:
Alt service expiration does not extend on unsuccessful use.

Bounded offline decision model: alt service expiration does not extend on unsuccessful use. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(alternatives, clear):
    return alternatives
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(['a', 'b'], True), [])", "check('fixture 2', solve(['a'], False), ['a'])", "check('fixture 3', solve([], True), [])", "check('fixture 4', solve([], False), [])"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(alternatives, clear):
    return []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(['a', 'b'], True), [])", "check('fixture 2', solve(['a'], False), ['a'])", "check('fixture 3', solve([], True), [])", "check('fixture 4', solve([], False), [])"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

prompt:
Alt service clear removes all alternatives.

Bounded offline decision model: alt service clear removes all alternatives. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(queued, ready):
    return (queued[-1],queued[:-1]) if ready and queued else (None,queued)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(['a', 'b'], True), ('a', ['b']))", "check('fixture 2', solve(['a'], False), (None, ['a']))", "check('fixture 3', solve([], True), (None, []))", "check('fixture 4', solve(['a'], True), ('a', []))"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(queued, ready):
    return (queued[0],queued[1:]) if queued else (None,queued)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(['a', 'b'], True), ('a', ['b']))", "check('fixture 2', solve(['a'], False), (None, ['a']))", "check('fixture 3', solve([], True), (None, []))", "check('fixture 4', solve(['a'], True), ('a', []))"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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)

prompt:
Connection backpressure does not drop queued request order.

Bounded offline decision model: connection backpressure does not drop queued request order. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(items, current, direction):
    eligible = [i for i, item in enumerate(items) if  not item['disabled'] and item['tab'] >= 0]
    eligible.sort(key=lambda i: (items[i]['tab'] == 0, items[i]['tab'] if items[i]['tab'] > 0 else 0, i))
    if not eligible: return None
    if current not in eligible: return eligible[0] if direction > 0 else eligible[-1]
    return eligible[(eligible.index(current) + direction) % len(eligible)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hidden', solve([dict(visible=False, disabled=False, tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('disabled', solve([dict(visible=True,disabled=True,tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('negative', solve([dict(visible=True,disabled=False,tab=-1),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('priority', solve([dict(visible=True,disabled=False,tab=0),dict(visible=True,disabled=False,tab=2)], None, 1), 1)
check('reverse', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, -1), 0)
check('forward', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, 1), 2)
check('empty', solve([], None, 1), None)
check('parameterized focus sequence', solve([dict(visible=True, disabled=False, tab=0)]*(N+2), N, 1), N+1)
for repetition in range(N):
    check('repeat empty', solve([], None, 1), None)
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)

evaluation_group: xi-tab-stop

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(items, current, direction):
    eligible = [i for i, item in enumerate(items) if not item['visible'] and not item['disabled'] and item['tab'] >= 0]
    eligible.sort(key=lambda i: (items[i]['tab'] == 0, items[i]['tab'] if items[i]['tab'] > 0 else 0, i))
    if not eligible: return None
    if current not in eligible: return eligible[0] if direction > 0 else eligible[-1]
    return eligible[(eligible.index(current) + direction) % len(eligible)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hidden', solve([dict(visible=False, disabled=False, tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('disabled', solve([dict(visible=True,disabled=True,tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('negative', solve([dict(visible=True,disabled=False,tab=-1),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('priority', solve([dict(visible=True,disabled=False,tab=0),dict(visible=True,disabled=False,tab=2)], None, 1), 1)
check('reverse', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, -1), 0)
check('forward', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, 1), 2)
check('empty', solve([], None, 1), None)
check('parameterized focus sequence', solve([dict(visible=True, disabled=False, tab=0)]*(N+2), N, 1), N+1)
for repetition in range(N):
    check('repeat empty', solve([], None, 1), None)
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)

prompt:
Hidden controls enter the focus sequence.

Visit visible enabled nonnegative tabindex controls; positive tabindex precedes zero; ties retain document order and navigation wraps.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(items, current, direction):
    eligible = [i for i, item in enumerate(items) if item['visible'] and True and item['tab'] >= 0]
    eligible.sort(key=lambda i: (items[i]['tab'] == 0, items[i]['tab'] if items[i]['tab'] > 0 else 0, i))
    if not eligible: return None
    if current not in eligible: return eligible[0] if direction > 0 else eligible[-1]
    return eligible[(eligible.index(current) + direction) % len(eligible)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hidden', solve([dict(visible=False, disabled=False, tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('disabled', solve([dict(visible=True,disabled=True,tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('negative', solve([dict(visible=True,disabled=False,tab=-1),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('priority', solve([dict(visible=True,disabled=False,tab=0),dict(visible=True,disabled=False,tab=2)], None, 1), 1)
check('reverse', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, -1), 0)
check('forward', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, 1), 2)
check('empty', solve([], None, 1), None)
check('parameterized focus sequence', solve([dict(visible=True, disabled=False, tab=0)]*(N+2), N, 1), N+1)
for repetition in range(N):
    check('repeat empty', solve([], None, 1), None)
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)

evaluation_group: xi-tab-stop

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(items, current, direction):
    eligible = [i for i, item in enumerate(items) if item['visible'] and item['disabled'] and item['tab'] >= 0]
    eligible.sort(key=lambda i: (items[i]['tab'] == 0, items[i]['tab'] if items[i]['tab'] > 0 else 0, i))
    if not eligible: return None
    if current not in eligible: return eligible[0] if direction > 0 else eligible[-1]
    return eligible[(eligible.index(current) + direction) % len(eligible)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hidden', solve([dict(visible=False, disabled=False, tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('disabled', solve([dict(visible=True,disabled=True,tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('negative', solve([dict(visible=True,disabled=False,tab=-1),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('priority', solve([dict(visible=True,disabled=False,tab=0),dict(visible=True,disabled=False,tab=2)], None, 1), 1)
check('reverse', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, -1), 0)
check('forward', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, 1), 2)
check('empty', solve([], None, 1), None)
check('parameterized focus sequence', solve([dict(visible=True, disabled=False, tab=0)]*(N+2), N, 1), N+1)
for repetition in range(N):
    check('repeat empty', solve([], None, 1), None)
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)

prompt:
Disabled controls become keyboard targets.

Visit visible enabled nonnegative tabindex controls; positive tabindex precedes zero; ties retain document order and navigation wraps.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(items, current, direction):
    eligible = [i for i, item in enumerate(items) if item['visible'] and not item['disabled'] and True]
    eligible.sort(key=lambda i: (items[i]['tab'] == 0, items[i]['tab'] if items[i]['tab'] > 0 else 0, i))
    if not eligible: return None
    if current not in eligible: return eligible[0] if direction > 0 else eligible[-1]
    return eligible[(eligible.index(current) + direction) % len(eligible)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hidden', solve([dict(visible=False, disabled=False, tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('disabled', solve([dict(visible=True,disabled=True,tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('negative', solve([dict(visible=True,disabled=False,tab=-1),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('priority', solve([dict(visible=True,disabled=False,tab=0),dict(visible=True,disabled=False,tab=2)], None, 1), 1)
check('reverse', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, -1), 0)
check('forward', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, 1), 2)
check('empty', solve([], None, 1), None)
check('parameterized focus sequence', solve([dict(visible=True, disabled=False, tab=0)]*(N+2), N, 1), N+1)
for repetition in range(N):
    check('repeat empty', solve([], None, 1), None)
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)

evaluation_group: xi-tab-stop

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(items, current, direction):
    eligible = [i for i, item in enumerate(items) if item['visible'] and not item['disabled'] and item['tab'] > 0]
    eligible.sort(key=lambda i: (items[i]['tab'] == 0, items[i]['tab'] if items[i]['tab'] > 0 else 0, i))
    if not eligible: return None
    if current not in eligible: return eligible[0] if direction > 0 else eligible[-1]
    return eligible[(eligible.index(current) + direction) % len(eligible)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hidden', solve([dict(visible=False, disabled=False, tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('disabled', solve([dict(visible=True,disabled=True,tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('negative', solve([dict(visible=True,disabled=False,tab=-1),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('priority', solve([dict(visible=True,disabled=False,tab=0),dict(visible=True,disabled=False,tab=2)], None, 1), 1)
check('reverse', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, -1), 0)
check('forward', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, 1), 2)
check('empty', solve([], None, 1), None)
check('parameterized focus sequence', solve([dict(visible=True, disabled=False, tab=0)]*(N+2), N, 1), N+1)
for repetition in range(N):
    check('repeat empty', solve([], None, 1), None)
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)

prompt:
Programmatic-only targets join sequential navigation.

Visit visible enabled nonnegative tabindex controls; positive tabindex precedes zero; ties retain document order and navigation wraps.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(items, current, direction):
    eligible = [i for i, item in enumerate(items) if item['visible'] and not item['disabled'] and item['tab'] >= 0]
    eligible.sort(key=lambda i: (False, items[i]['tab'] if items[i]['tab'] > 0 else 0, i))
    if not eligible: return None
    if current not in eligible: return eligible[0] if direction > 0 else eligible[-1]
    return eligible[(eligible.index(current) + direction) % len(eligible)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hidden', solve([dict(visible=False, disabled=False, tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('disabled', solve([dict(visible=True,disabled=True,tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('negative', solve([dict(visible=True,disabled=False,tab=-1),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('priority', solve([dict(visible=True,disabled=False,tab=0),dict(visible=True,disabled=False,tab=2)], None, 1), 1)
check('reverse', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, -1), 0)
check('forward', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, 1), 2)
check('empty', solve([], None, 1), None)
check('parameterized focus sequence', solve([dict(visible=True, disabled=False, tab=0)]*(N+2), N, 1), N+1)
for repetition in range(N):
    check('repeat empty', solve([], None, 1), None)
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)

evaluation_group: xi-tab-stop

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(items, current, direction):
    eligible = [i for i, item in enumerate(items) if item['visible'] and not item['disabled'] and item['tab'] >= 0]
    eligible.sort(key=lambda i: (items[i]['tab'] > 0, items[i]['tab'] if items[i]['tab'] > 0 else 0, i))
    if not eligible: return None
    if current not in eligible: return eligible[0] if direction > 0 else eligible[-1]
    return eligible[(eligible.index(current) + direction) % len(eligible)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hidden', solve([dict(visible=False, disabled=False, tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('disabled', solve([dict(visible=True,disabled=True,tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('negative', solve([dict(visible=True,disabled=False,tab=-1),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('priority', solve([dict(visible=True,disabled=False,tab=0),dict(visible=True,disabled=False,tab=2)], None, 1), 1)
check('reverse', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, -1), 0)
check('forward', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, 1), 2)
check('empty', solve([], None, 1), None)
check('parameterized focus sequence', solve([dict(visible=True, disabled=False, tab=0)]*(N+2), N, 1), N+1)
for repetition in range(N):
    check('repeat empty', solve([], None, 1), None)
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)

prompt:
Ordinary controls precede positive tabindex controls.

Visit visible enabled nonnegative tabindex controls; positive tabindex precedes zero; ties retain document order and navigation wraps.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(items, current, direction):
    eligible = [i for i, item in enumerate(items) if item['visible'] and not item['disabled'] and item['tab'] >= 0]
    eligible.sort(key=lambda i: (items[i]['tab'] == 0, items[i]['tab'] if items[i]['tab'] > 0 else 0, i))
    if not eligible: return None
    if current not in eligible: return eligible[0] if direction > 0 else eligible[-1]
    return eligible[(eligible.index(current) + 1) % len(eligible)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hidden', solve([dict(visible=False, disabled=False, tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('disabled', solve([dict(visible=True,disabled=True,tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('negative', solve([dict(visible=True,disabled=False,tab=-1),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('priority', solve([dict(visible=True,disabled=False,tab=0),dict(visible=True,disabled=False,tab=2)], None, 1), 1)
check('reverse', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, -1), 0)
check('forward', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, 1), 2)
check('empty', solve([], None, 1), None)
check('parameterized focus sequence', solve([dict(visible=True, disabled=False, tab=0)]*(N+2), N, 1), N+1)
for repetition in range(N):
    check('repeat empty', solve([], None, 1), None)
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)

evaluation_group: xi-tab-stop

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(items, current, direction):
    eligible = [i for i, item in enumerate(items) if item['visible'] and not item['disabled'] and item['tab'] >= 0]
    eligible.sort(key=lambda i: (items[i]['tab'] == 0, items[i]['tab'] if items[i]['tab'] > 0 else 0, i))
    if not eligible: return None
    if current not in eligible: return eligible[0] if direction > 0 else eligible[-1]
    return eligible[(eligible.index(current) - direction) % len(eligible)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hidden', solve([dict(visible=False, disabled=False, tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('disabled', solve([dict(visible=True,disabled=True,tab=0),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('negative', solve([dict(visible=True,disabled=False,tab=-1),dict(visible=True,disabled=False,tab=0)], None, 1), 1)
check('priority', solve([dict(visible=True,disabled=False,tab=0),dict(visible=True,disabled=False,tab=2)], None, 1), 1)
check('reverse', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, -1), 0)
check('forward', solve([dict(visible=True,disabled=False,tab=0)]*3, 1, 1), 2)
check('empty', solve([], None, 1), None)
check('parameterized focus sequence', solve([dict(visible=True, disabled=False, tab=0)]*(N+2), N, 1), N+1)
for repetition in range(N):
    check('repeat empty', solve([], None, 1), None)
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)

prompt:
Shift-tab advances in the wrong direction.

Visit visible enabled nonnegative tabindex controls; positive tabindex precedes zero; ties retain document order and navigation wraps.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(stack, event, target, connected):
    stack = list(stack)
    if event == 'open': return [target]
    if event == 'close': return stack[:-1]
    if event == 'restore': return next((x for x in reversed(stack) if x in connected), None)
    if event == 'escape': return stack[:-1] if stack else []
    if event == 'clear': return []
    return stack
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested open', solve(['outer'], 'open', 'inner', []), ['outer', 'inner'])
check('nested close', solve(['outer','inner'], 'close', None, []), ['outer'])
check('newest live', solve(['z','a'], 'restore', None, ['z','a']), 'a')
check('ordered newest', solve(['a','z'], 'restore', None, ['a','z']), 'z')
check('detached', solve(['outer','gone'], 'restore', None, ['outer']), 'outer')
check('escape one', solve(['outer','inner'], 'escape', None, []), ['outer'])
check('clear', solve(['outer'], 'clear', None, []), [])
check('parameterized opener', solve(['outer'], 'open', 'dialog'+str(N), []), ['outer', 'dialog'+str(N)])
for repetition in range(N):
    check('repeat clear', solve(['outer'], 'clear', None, []), [])
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)

evaluation_group: xi-focus-scope

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(stack, event, target, connected):
    stack = list(stack)
    if event == 'open': return [target] + stack
    if event == 'close': return stack[:-1]
    if event == 'restore': return next((x for x in reversed(stack) if x in connected), None)
    if event == 'escape': return stack[:-1] if stack else []
    if event == 'clear': return []
    return stack
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested open', solve(['outer'], 'open', 'inner', []), ['outer', 'inner'])
check('nested close', solve(['outer','inner'], 'close', None, []), ['outer'])
check('newest live', solve(['z','a'], 'restore', None, ['z','a']), 'a')
check('ordered newest', solve(['a','z'], 'restore', None, ['a','z']), 'z')
check('detached', solve(['outer','gone'], 'restore', None, ['outer']), 'outer')
check('escape one', solve(['outer','inner'], 'escape', None, []), ['outer'])
check('clear', solve(['outer'], 'clear', None, []), [])
check('parameterized opener', solve(['outer'], 'open', 'dialog'+str(N), []), ['outer', 'dialog'+str(N)])
for repetition in range(N):
    check('repeat clear', solve(['outer'], 'clear', None, []), [])
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)

prompt:
Nested dialogs erase the outer return target.

Opening pushes one return target; closing or Escape pops one scope; restoration chooses the newest connected target; clear empties the stack.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(stack, event, target, connected):
    stack = list(stack)
    if event == 'open': return stack + [target]
    if event == 'close': return []
    if event == 'restore': return next((x for x in reversed(stack) if x in connected), None)
    if event == 'escape': return stack[:-1] if stack else []
    if event == 'clear': return []
    return stack
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested open', solve(['outer'], 'open', 'inner', []), ['outer', 'inner'])
check('nested close', solve(['outer','inner'], 'close', None, []), ['outer'])
check('newest live', solve(['z','a'], 'restore', None, ['z','a']), 'a')
check('ordered newest', solve(['a','z'], 'restore', None, ['a','z']), 'z')
check('detached', solve(['outer','gone'], 'restore', None, ['outer']), 'outer')
check('escape one', solve(['outer','inner'], 'escape', None, []), ['outer'])
check('clear', solve(['outer'], 'clear', None, []), [])
check('parameterized opener', solve(['outer'], 'open', 'dialog'+str(N), []), ['outer', 'dialog'+str(N)])
for repetition in range(N):
    check('repeat clear', solve(['outer'], 'clear', None, []), [])
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)

evaluation_group: xi-focus-scope

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(stack, event, target, connected):
    stack = list(stack)
    if event == 'open': return stack + [target]
    if event == 'close': return stack[1:]
    if event == 'restore': return next((x for x in reversed(stack) if x in connected), None)
    if event == 'escape': return stack[:-1] if stack else []
    if event == 'clear': return []
    return stack
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested open', solve(['outer'], 'open', 'inner', []), ['outer', 'inner'])
check('nested close', solve(['outer','inner'], 'close', None, []), ['outer'])
check('newest live', solve(['z','a'], 'restore', None, ['z','a']), 'a')
check('ordered newest', solve(['a','z'], 'restore', None, ['a','z']), 'z')
check('detached', solve(['outer','gone'], 'restore', None, ['outer']), 'outer')
check('escape one', solve(['outer','inner'], 'escape', None, []), ['outer'])
check('clear', solve(['outer'], 'clear', None, []), [])
check('parameterized opener', solve(['outer'], 'open', 'dialog'+str(N), []), ['outer', 'dialog'+str(N)])
for repetition in range(N):
    check('repeat clear', solve(['outer'], 'clear', None, []), [])
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)

prompt:
Closing a nested dialog discards the outer scope.

Opening pushes one return target; closing or Escape pops one scope; restoration chooses the newest connected target; clear empties the stack.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(stack, event, target, connected):
    stack = list(stack)
    if event == 'open': return stack + [target]
    if event == 'close': return stack[:-1]
    if event == 'restore': return next((x for x in stack if x in connected), None)
    if event == 'escape': return stack[:-1] if stack else []
    if event == 'clear': return []
    return stack
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested open', solve(['outer'], 'open', 'inner', []), ['outer', 'inner'])
check('nested close', solve(['outer','inner'], 'close', None, []), ['outer'])
check('newest live', solve(['z','a'], 'restore', None, ['z','a']), 'a')
check('ordered newest', solve(['a','z'], 'restore', None, ['a','z']), 'z')
check('detached', solve(['outer','gone'], 'restore', None, ['outer']), 'outer')
check('escape one', solve(['outer','inner'], 'escape', None, []), ['outer'])
check('clear', solve(['outer'], 'clear', None, []), [])
check('parameterized opener', solve(['outer'], 'open', 'dialog'+str(N), []), ['outer', 'dialog'+str(N)])
for repetition in range(N):
    check('repeat clear', solve(['outer'], 'clear', None, []), [])
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)

evaluation_group: xi-focus-scope

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(stack, event, target, connected):
    stack = list(stack)
    if event == 'open': return stack + [target]
    if event == 'close': return stack[:-1]
    if event == 'restore': return next((x for x in sorted(stack) if x in connected), None)
    if event == 'escape': return stack[:-1] if stack else []
    if event == 'clear': return []
    return stack
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested open', solve(['outer'], 'open', 'inner', []), ['outer', 'inner'])
check('nested close', solve(['outer','inner'], 'close', None, []), ['outer'])
check('newest live', solve(['z','a'], 'restore', None, ['z','a']), 'a')
check('ordered newest', solve(['a','z'], 'restore', None, ['a','z']), 'z')
check('detached', solve(['outer','gone'], 'restore', None, ['outer']), 'outer')
check('escape one', solve(['outer','inner'], 'escape', None, []), ['outer'])
check('clear', solve(['outer'], 'clear', None, []), [])
check('parameterized opener', solve(['outer'], 'open', 'dialog'+str(N), []), ['outer', 'dialog'+str(N)])
for repetition in range(N):
    check('repeat clear', solve(['outer'], 'clear', None, []), [])
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)

prompt:
Restoration selects an outer rather than the newest live target.

Opening pushes one return target; closing or Escape pops one scope; restoration chooses the newest connected target; clear empties the stack.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(stack, event, target, connected):
    stack = list(stack)
    if event == 'open': return stack + [target]
    if event == 'close': return stack[:-1]
    if event == 'restore': return next((x for x in reversed(stack) if True), None)
    if event == 'escape': return stack[:-1] if stack else []
    if event == 'clear': return []
    return stack
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested open', solve(['outer'], 'open', 'inner', []), ['outer', 'inner'])
check('nested close', solve(['outer','inner'], 'close', None, []), ['outer'])
check('newest live', solve(['z','a'], 'restore', None, ['z','a']), 'a')
check('ordered newest', solve(['a','z'], 'restore', None, ['a','z']), 'z')
check('detached', solve(['outer','gone'], 'restore', None, ['outer']), 'outer')
check('escape one', solve(['outer','inner'], 'escape', None, []), ['outer'])
check('clear', solve(['outer'], 'clear', None, []), [])
check('parameterized opener', solve(['outer'], 'open', 'dialog'+str(N), []), ['outer', 'dialog'+str(N)])
for repetition in range(N):
    check('repeat clear', solve(['outer'], 'clear', None, []), [])
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)

evaluation_group: xi-focus-scope

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(stack, event, target, connected):
    stack = list(stack)
    if event == 'open': return stack + [target]
    if event == 'close': return stack[:-1]
    if event == 'restore': return next((x for x in reversed(stack) if x not in connected), None)
    if event == 'escape': return stack[:-1] if stack else []
    if event == 'clear': return []
    return stack
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested open', solve(['outer'], 'open', 'inner', []), ['outer', 'inner'])
check('nested close', solve(['outer','inner'], 'close', None, []), ['outer'])
check('newest live', solve(['z','a'], 'restore', None, ['z','a']), 'a')
check('ordered newest', solve(['a','z'], 'restore', None, ['a','z']), 'z')
check('detached', solve(['outer','gone'], 'restore', None, ['outer']), 'outer')
check('escape one', solve(['outer','inner'], 'escape', None, []), ['outer'])
check('clear', solve(['outer'], 'clear', None, []), [])
check('parameterized opener', solve(['outer'], 'open', 'dialog'+str(N), []), ['outer', 'dialog'+str(N)])
for repetition in range(N):
    check('repeat clear', solve(['outer'], 'clear', None, []), [])
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)

prompt:
Restoration targets a detached opener.

Opening pushes one return target; closing or Escape pops one scope; restoration chooses the newest connected target; clear empties the stack.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(stack, event, target, connected):
    stack = list(stack)
    if event == 'open': return stack + [target]
    if event == 'close': return stack[:-1]
    if event == 'restore': return next((x for x in reversed(stack) if x in connected), None)
    if event == 'escape': return stack
    if event == 'clear': return []
    return stack
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested open', solve(['outer'], 'open', 'inner', []), ['outer', 'inner'])
check('nested close', solve(['outer','inner'], 'close', None, []), ['outer'])
check('newest live', solve(['z','a'], 'restore', None, ['z','a']), 'a')
check('ordered newest', solve(['a','z'], 'restore', None, ['a','z']), 'z')
check('detached', solve(['outer','gone'], 'restore', None, ['outer']), 'outer')
check('escape one', solve(['outer','inner'], 'escape', None, []), ['outer'])
check('clear', solve(['outer'], 'clear', None, []), [])
check('parameterized opener', solve(['outer'], 'open', 'dialog'+str(N), []), ['outer', 'dialog'+str(N)])
for repetition in range(N):
    check('repeat clear', solve(['outer'], 'clear', None, []), [])
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)

evaluation_group: xi-focus-scope

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(stack, event, target, connected):
    stack = list(stack)
    if event == 'open': return stack + [target]
    if event == 'close': return stack[:-1]
    if event == 'restore': return next((x for x in reversed(stack) if x in connected), None)
    if event == 'escape': return []
    if event == 'clear': return []
    return stack
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested open', solve(['outer'], 'open', 'inner', []), ['outer', 'inner'])
check('nested close', solve(['outer','inner'], 'close', None, []), ['outer'])
check('newest live', solve(['z','a'], 'restore', None, ['z','a']), 'a')
check('ordered newest', solve(['a','z'], 'restore', None, ['a','z']), 'z')
check('detached', solve(['outer','gone'], 'restore', None, ['outer']), 'outer')
check('escape one', solve(['outer','inner'], 'escape', None, []), ['outer'])
check('clear', solve(['outer'], 'clear', None, []), [])
check('parameterized opener', solve(['outer'], 'open', 'dialog'+str(N), []), ['outer', 'dialog'+str(N)])
for repetition in range(N):
    check('repeat clear', solve(['outer'], 'clear', None, []), [])
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)

prompt:
Escape leaves the active focus scope installed.

Opening pushes one return target; closing or Escape pops one scope; restoration chooses the newest connected target; clear empties the stack.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(enabled, current, key, rtl):
    if not enabled: return None
    if key == 'Home': return current
    if key == 'End': return enabled[-1]
    step = (-1 if key == 'Left' else 1) * (-1 if rtl else 1)
    if current not in enabled: return enabled[0]
    return enabled[(enabled.index(current) + step) % len(enabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('home', solve([1,3,7], 3, 'Home', False), 1)
check('end', solve([1,3,7], 3, 'End', False), 7)
check('rtl right', solve([1,3,7], 3, 'Right', True), 1)
check('ltr right', solve([1,3,7], 3, 'Right', False), 7)
check('removed', solve([1,3,7], 8, 'Right', False), 1)
check('wrap', solve([1,3,7], 7, 'Right', False), 1)
check('empty', solve([], 0, 'Home', False), None)
check('parameterized arrow', solve(list(range(N+3)), N, 'Right', False), N+1)
for repetition in range(N):
    check('repeat empty', solve([], 0, 'Home', False), None)
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)

evaluation_group: xi-roving

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(enabled, current, key, rtl):
    if not enabled: return None
    if key == 'Home': return enabled[-1]
    if key == 'End': return enabled[-1]
    step = (-1 if key == 'Left' else 1) * (-1 if rtl else 1)
    if current not in enabled: return enabled[0]
    return enabled[(enabled.index(current) + step) % len(enabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('home', solve([1,3,7], 3, 'Home', False), 1)
check('end', solve([1,3,7], 3, 'End', False), 7)
check('rtl right', solve([1,3,7], 3, 'Right', True), 1)
check('ltr right', solve([1,3,7], 3, 'Right', False), 7)
check('removed', solve([1,3,7], 8, 'Right', False), 1)
check('wrap', solve([1,3,7], 7, 'Right', False), 1)
check('empty', solve([], 0, 'Home', False), None)
check('parameterized arrow', solve(list(range(N+3)), N, 'Right', False), N+1)
for repetition in range(N):
    check('repeat empty', solve([], 0, 'Home', False), None)
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)

prompt:
Home fails to reach the first enabled item.

Home and End select enabled endpoints; horizontal arrows honor directionality and wrap; a removed current item resets to the first enabled item.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(enabled, current, key, rtl):
    if not enabled: return None
    if key == 'Home': return enabled[0]
    if key == 'End': return current
    step = (-1 if key == 'Left' else 1) * (-1 if rtl else 1)
    if current not in enabled: return enabled[0]
    return enabled[(enabled.index(current) + step) % len(enabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('home', solve([1,3,7], 3, 'Home', False), 1)
check('end', solve([1,3,7], 3, 'End', False), 7)
check('rtl right', solve([1,3,7], 3, 'Right', True), 1)
check('ltr right', solve([1,3,7], 3, 'Right', False), 7)
check('removed', solve([1,3,7], 8, 'Right', False), 1)
check('wrap', solve([1,3,7], 7, 'Right', False), 1)
check('empty', solve([], 0, 'Home', False), None)
check('parameterized arrow', solve(list(range(N+3)), N, 'Right', False), N+1)
for repetition in range(N):
    check('repeat empty', solve([], 0, 'Home', False), None)
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)

evaluation_group: xi-roving

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(enabled, current, key, rtl):
    if not enabled: return None
    if key == 'Home': return enabled[0]
    if key == 'End': return enabled[0]
    step = (-1 if key == 'Left' else 1) * (-1 if rtl else 1)
    if current not in enabled: return enabled[0]
    return enabled[(enabled.index(current) + step) % len(enabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('home', solve([1,3,7], 3, 'Home', False), 1)
check('end', solve([1,3,7], 3, 'End', False), 7)
check('rtl right', solve([1,3,7], 3, 'Right', True), 1)
check('ltr right', solve([1,3,7], 3, 'Right', False), 7)
check('removed', solve([1,3,7], 8, 'Right', False), 1)
check('wrap', solve([1,3,7], 7, 'Right', False), 1)
check('empty', solve([], 0, 'Home', False), None)
check('parameterized arrow', solve(list(range(N+3)), N, 'Right', False), N+1)
for repetition in range(N):
    check('repeat empty', solve([], 0, 'Home', False), None)
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)

prompt:
End fails to reach the last enabled item.

Home and End select enabled endpoints; horizontal arrows honor directionality and wrap; a removed current item resets to the first enabled item.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(enabled, current, key, rtl):
    if not enabled: return None
    if key == 'Home': return enabled[0]
    if key == 'End': return enabled[-1]
    step = (-1 if key == 'Left' else 1) * 1
    if current not in enabled: return enabled[0]
    return enabled[(enabled.index(current) + step) % len(enabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('home', solve([1,3,7], 3, 'Home', False), 1)
check('end', solve([1,3,7], 3, 'End', False), 7)
check('rtl right', solve([1,3,7], 3, 'Right', True), 1)
check('ltr right', solve([1,3,7], 3, 'Right', False), 7)
check('removed', solve([1,3,7], 8, 'Right', False), 1)
check('wrap', solve([1,3,7], 7, 'Right', False), 1)
check('empty', solve([], 0, 'Home', False), None)
check('parameterized arrow', solve(list(range(N+3)), N, 'Right', False), N+1)
for repetition in range(N):
    check('repeat empty', solve([], 0, 'Home', False), None)
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)

evaluation_group: xi-roving

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(enabled, current, key, rtl):
    if not enabled: return None
    if key == 'Home': return enabled[0]
    if key == 'End': return enabled[-1]
    step = (-1 if key == 'Left' else 1) * -1
    if current not in enabled: return enabled[0]
    return enabled[(enabled.index(current) + step) % len(enabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('home', solve([1,3,7], 3, 'Home', False), 1)
check('end', solve([1,3,7], 3, 'End', False), 7)
check('rtl right', solve([1,3,7], 3, 'Right', True), 1)
check('ltr right', solve([1,3,7], 3, 'Right', False), 7)
check('removed', solve([1,3,7], 8, 'Right', False), 1)
check('wrap', solve([1,3,7], 7, 'Right', False), 1)
check('empty', solve([], 0, 'Home', False), None)
check('parameterized arrow', solve(list(range(N+3)), N, 'Right', False), N+1)
for repetition in range(N):
    check('repeat empty', solve([], 0, 'Home', False), None)
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)

prompt:
Horizontal arrow direction ignores right-to-left layout.

Home and End select enabled endpoints; horizontal arrows honor directionality and wrap; a removed current item resets to the first enabled item.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(enabled, current, key, rtl):
    if not enabled: return None
    if key == 'Home': return enabled[0]
    if key == 'End': return enabled[-1]
    step = (-1 if key == 'Left' else 1) * (-1 if rtl else 1)
    if current not in enabled: return current
    return enabled[(enabled.index(current) + step) % len(enabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('home', solve([1,3,7], 3, 'Home', False), 1)
check('end', solve([1,3,7], 3, 'End', False), 7)
check('rtl right', solve([1,3,7], 3, 'Right', True), 1)
check('ltr right', solve([1,3,7], 3, 'Right', False), 7)
check('removed', solve([1,3,7], 8, 'Right', False), 1)
check('wrap', solve([1,3,7], 7, 'Right', False), 1)
check('empty', solve([], 0, 'Home', False), None)
check('parameterized arrow', solve(list(range(N+3)), N, 'Right', False), N+1)
for repetition in range(N):
    check('repeat empty', solve([], 0, 'Home', False), None)
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)

evaluation_group: xi-roving

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(enabled, current, key, rtl):
    if not enabled: return None
    if key == 'Home': return enabled[0]
    if key == 'End': return enabled[-1]
    step = (-1 if key == 'Left' else 1) * (-1 if rtl else 1)
    if current not in enabled: return enabled[-1]
    return enabled[(enabled.index(current) + step) % len(enabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('home', solve([1,3,7], 3, 'Home', False), 1)
check('end', solve([1,3,7], 3, 'End', False), 7)
check('rtl right', solve([1,3,7], 3, 'Right', True), 1)
check('ltr right', solve([1,3,7], 3, 'Right', False), 7)
check('removed', solve([1,3,7], 8, 'Right', False), 1)
check('wrap', solve([1,3,7], 7, 'Right', False), 1)
check('empty', solve([], 0, 'Home', False), None)
check('parameterized arrow', solve(list(range(N+3)), N, 'Right', False), N+1)
for repetition in range(N):
    check('repeat empty', solve([], 0, 'Home', False), None)
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)

prompt:
Removed active items remain the navigation target.

Home and End select enabled endpoints; horizontal arrows honor directionality and wrap; a removed current item resets to the first enabled item.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(enabled, current, key, rtl):
    if not enabled: return None
    if key == 'Home': return enabled[0]
    if key == 'End': return enabled[-1]
    step = (-1 if key == 'Left' else 1) * (-1 if rtl else 1)
    if current not in enabled: return enabled[0]
    return enabled[min(len(enabled)-1, max(0, enabled.index(current) + step))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('home', solve([1,3,7], 3, 'Home', False), 1)
check('end', solve([1,3,7], 3, 'End', False), 7)
check('rtl right', solve([1,3,7], 3, 'Right', True), 1)
check('ltr right', solve([1,3,7], 3, 'Right', False), 7)
check('removed', solve([1,3,7], 8, 'Right', False), 1)
check('wrap', solve([1,3,7], 7, 'Right', False), 1)
check('empty', solve([], 0, 'Home', False), None)
check('parameterized arrow', solve(list(range(N+3)), N, 'Right', False), N+1)
for repetition in range(N):
    check('repeat empty', solve([], 0, 'Home', False), None)
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)

evaluation_group: xi-roving

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(enabled, current, key, rtl):
    if not enabled: return None
    if key == 'Home': return enabled[0]
    if key == 'End': return enabled[-1]
    step = (-1 if key == 'Left' else 1) * (-1 if rtl else 1)
    if current not in enabled: return enabled[0]
    return enabled[(enabled.index(current) - step) % len(enabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('home', solve([1,3,7], 3, 'Home', False), 1)
check('end', solve([1,3,7], 3, 'End', False), 7)
check('rtl right', solve([1,3,7], 3, 'Right', True), 1)
check('ltr right', solve([1,3,7], 3, 'Right', False), 7)
check('removed', solve([1,3,7], 8, 'Right', False), 1)
check('wrap', solve([1,3,7], 7, 'Right', False), 1)
check('empty', solve([], 0, 'Home', False), None)
check('parameterized arrow', solve(list(range(N+3)), N, 'Right', False), N+1)
for repetition in range(N):
    check('repeat empty', solve([], 0, 'Home', False), None)
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)

prompt:
Arrow navigation stops at an endpoint instead of wrapping.

Home and End select enabled endpoints; horizontal arrows honor directionality and wrap; a removed current item resets to the first enabled item.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(text, anchor, focus, replacement, composing):
    if False: return (text, anchor, focus)
    lo = min(anchor, focus)
    hi = max(anchor, focus)
    result = text[:lo] + replacement + text[hi:]
    caret = lo + len(replacement)
    return (result, caret, caret)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('abcdef', 1, 4, 'XY', True), ('abcdef', 1, 4))
check('forward', solve('abcdef', 1, 4, 'XY', False), ('aXYef', 3, 3))
check('backward', solve('abcdef', 4, 1, 'XY', False), ('aXYef', 3, 3))
check('insertion', solve('ab', 1, 1, 'XYZ', False), ('aXYZb', 4, 4))
check('delete', solve('abc', 0, 3, '', False), ('', 0, 0))
check('no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
check('parameterized selected length', solve('a'*N, 0, N, 'X', False), ('X', 1, 1))
for repetition in range(N):
    check('repeat no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
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)

evaluation_group: xi-text-selection

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(text, anchor, focus, replacement, composing):
    if not composing: return (text, anchor, focus)
    lo = min(anchor, focus)
    hi = max(anchor, focus)
    result = text[:lo] + replacement + text[hi:]
    caret = lo + len(replacement)
    return (result, caret, caret)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('abcdef', 1, 4, 'XY', True), ('abcdef', 1, 4))
check('forward', solve('abcdef', 1, 4, 'XY', False), ('aXYef', 3, 3))
check('backward', solve('abcdef', 4, 1, 'XY', False), ('aXYef', 3, 3))
check('insertion', solve('ab', 1, 1, 'XYZ', False), ('aXYZb', 4, 4))
check('delete', solve('abc', 0, 3, '', False), ('', 0, 0))
check('no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
check('parameterized selected length', solve('a'*N, 0, N, 'X', False), ('X', 1, 1))
for repetition in range(N):
    check('repeat no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
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)

prompt:
An IME composition is overwritten before commitment.

Composition is preserved; replace the normalized half-open selection and collapse both endpoints immediately after inserted text.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(text, anchor, focus, replacement, composing):
    if composing: return (text, anchor, focus)
    lo = anchor
    hi = max(anchor, focus)
    result = text[:lo] + replacement + text[hi:]
    caret = lo + len(replacement)
    return (result, caret, caret)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('abcdef', 1, 4, 'XY', True), ('abcdef', 1, 4))
check('forward', solve('abcdef', 1, 4, 'XY', False), ('aXYef', 3, 3))
check('backward', solve('abcdef', 4, 1, 'XY', False), ('aXYef', 3, 3))
check('insertion', solve('ab', 1, 1, 'XYZ', False), ('aXYZb', 4, 4))
check('delete', solve('abc', 0, 3, '', False), ('', 0, 0))
check('no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
check('parameterized selected length', solve('a'*N, 0, N, 'X', False), ('X', 1, 1))
for repetition in range(N):
    check('repeat no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
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)

evaluation_group: xi-text-selection

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(text, anchor, focus, replacement, composing):
    if composing: return (text, anchor, focus)
    lo = max(anchor, focus)
    hi = max(anchor, focus)
    result = text[:lo] + replacement + text[hi:]
    caret = lo + len(replacement)
    return (result, caret, caret)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('abcdef', 1, 4, 'XY', True), ('abcdef', 1, 4))
check('forward', solve('abcdef', 1, 4, 'XY', False), ('aXYef', 3, 3))
check('backward', solve('abcdef', 4, 1, 'XY', False), ('aXYef', 3, 3))
check('insertion', solve('ab', 1, 1, 'XYZ', False), ('aXYZb', 4, 4))
check('delete', solve('abc', 0, 3, '', False), ('', 0, 0))
check('no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
check('parameterized selected length', solve('a'*N, 0, N, 'X', False), ('X', 1, 1))
for repetition in range(N):
    check('repeat no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
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)

prompt:
Backward selections start replacement at the anchor.

Composition is preserved; replace the normalized half-open selection and collapse both endpoints immediately after inserted text.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(text, anchor, focus, replacement, composing):
    if composing: return (text, anchor, focus)
    lo = min(anchor, focus)
    hi = focus
    result = text[:lo] + replacement + text[hi:]
    caret = lo + len(replacement)
    return (result, caret, caret)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('abcdef', 1, 4, 'XY', True), ('abcdef', 1, 4))
check('forward', solve('abcdef', 1, 4, 'XY', False), ('aXYef', 3, 3))
check('backward', solve('abcdef', 4, 1, 'XY', False), ('aXYef', 3, 3))
check('insertion', solve('ab', 1, 1, 'XYZ', False), ('aXYZb', 4, 4))
check('delete', solve('abc', 0, 3, '', False), ('', 0, 0))
check('no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
check('parameterized selected length', solve('a'*N, 0, N, 'X', False), ('X', 1, 1))
for repetition in range(N):
    check('repeat no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
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)

evaluation_group: xi-text-selection

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(text, anchor, focus, replacement, composing):
    if composing: return (text, anchor, focus)
    lo = min(anchor, focus)
    hi = min(anchor, focus)
    result = text[:lo] + replacement + text[hi:]
    caret = lo + len(replacement)
    return (result, caret, caret)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('abcdef', 1, 4, 'XY', True), ('abcdef', 1, 4))
check('forward', solve('abcdef', 1, 4, 'XY', False), ('aXYef', 3, 3))
check('backward', solve('abcdef', 4, 1, 'XY', False), ('aXYef', 3, 3))
check('insertion', solve('ab', 1, 1, 'XYZ', False), ('aXYZb', 4, 4))
check('delete', solve('abc', 0, 3, '', False), ('', 0, 0))
check('no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
check('parameterized selected length', solve('a'*N, 0, N, 'X', False), ('X', 1, 1))
for repetition in range(N):
    check('repeat no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
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)

prompt:
Backward selections retain selected suffix text.

Composition is preserved; replace the normalized half-open selection and collapse both endpoints immediately after inserted text.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(text, anchor, focus, replacement, composing):
    if composing: return (text, anchor, focus)
    lo = min(anchor, focus)
    hi = max(anchor, focus)
    result = text[:lo] + replacement + text[lo:]
    caret = lo + len(replacement)
    return (result, caret, caret)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('abcdef', 1, 4, 'XY', True), ('abcdef', 1, 4))
check('forward', solve('abcdef', 1, 4, 'XY', False), ('aXYef', 3, 3))
check('backward', solve('abcdef', 4, 1, 'XY', False), ('aXYef', 3, 3))
check('insertion', solve('ab', 1, 1, 'XYZ', False), ('aXYZb', 4, 4))
check('delete', solve('abc', 0, 3, '', False), ('', 0, 0))
check('no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
check('parameterized selected length', solve('a'*N, 0, N, 'X', False), ('X', 1, 1))
for repetition in range(N):
    check('repeat no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
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)

evaluation_group: xi-text-selection

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(text, anchor, focus, replacement, composing):
    if composing: return (text, anchor, focus)
    lo = min(anchor, focus)
    hi = max(anchor, focus)
    result = text[:lo] + replacement + ''
    caret = lo + len(replacement)
    return (result, caret, caret)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('abcdef', 1, 4, 'XY', True), ('abcdef', 1, 4))
check('forward', solve('abcdef', 1, 4, 'XY', False), ('aXYef', 3, 3))
check('backward', solve('abcdef', 4, 1, 'XY', False), ('aXYef', 3, 3))
check('insertion', solve('ab', 1, 1, 'XYZ', False), ('aXYZb', 4, 4))
check('delete', solve('abc', 0, 3, '', False), ('', 0, 0))
check('no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
check('parameterized selected length', solve('a'*N, 0, N, 'X', False), ('X', 1, 1))
for repetition in range(N):
    check('repeat no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
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)

prompt:
Selected text remains after the inserted replacement.

Composition is preserved; replace the normalized half-open selection and collapse both endpoints immediately after inserted text.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(text, anchor, focus, replacement, composing):
    if composing: return (text, anchor, focus)
    lo = min(anchor, focus)
    hi = max(anchor, focus)
    result = text[:lo] + replacement + text[hi:]
    caret = hi + len(replacement)
    return (result, caret, caret)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('abcdef', 1, 4, 'XY', True), ('abcdef', 1, 4))
check('forward', solve('abcdef', 1, 4, 'XY', False), ('aXYef', 3, 3))
check('backward', solve('abcdef', 4, 1, 'XY', False), ('aXYef', 3, 3))
check('insertion', solve('ab', 1, 1, 'XYZ', False), ('aXYZb', 4, 4))
check('delete', solve('abc', 0, 3, '', False), ('', 0, 0))
check('no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
check('parameterized selected length', solve('a'*N, 0, N, 'X', False), ('X', 1, 1))
for repetition in range(N):
    check('repeat no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
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)

evaluation_group: xi-text-selection

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(text, anchor, focus, replacement, composing):
    if composing: return (text, anchor, focus)
    lo = min(anchor, focus)
    hi = max(anchor, focus)
    result = text[:lo] + replacement + text[hi:]
    caret = lo
    return (result, caret, caret)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('abcdef', 1, 4, 'XY', True), ('abcdef', 1, 4))
check('forward', solve('abcdef', 1, 4, 'XY', False), ('aXYef', 3, 3))
check('backward', solve('abcdef', 4, 1, 'XY', False), ('aXYef', 3, 3))
check('insertion', solve('ab', 1, 1, 'XYZ', False), ('aXYZb', 4, 4))
check('delete', solve('abc', 0, 3, '', False), ('', 0, 0))
check('no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
check('parameterized selected length', solve('a'*N, 0, N, 'X', False), ('X', 1, 1))
for repetition in range(N):
    check('repeat no selection', solve('abc', 2, 2, '', False), ('abc', 2, 2))
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)

prompt:
The caret is positioned using the deleted range length.

Composition is preserved; replace the normalized half-open selection and collapse both endpoints immediately after inserted text.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(selected, children, event, child):
    selected = set(selected)
    children = set(children)
    if event == 'all': selected = children
    elif event == 'none': selected -= children
    elif event == 'toggle': selected.symmetric_difference_update({child})
    visible = selected & children
    state = 'none' if not visible else ('all' if visible == children else 'mixed')
    return (sorted(selected), state)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all keeps outside', solve(['x','a'], ['a','b'], 'all', None), (['a', 'b', 'x'], 'all'))
check('none keeps outside', solve(['x','a'], ['a','b'], 'none', None), (['x'], 'none'))
check('toggle off', solve(['a'], ['a','b'], 'toggle', 'a'), ([], 'none'))
check('toggle on', solve([], ['a','b'], 'toggle', 'a'), (['a'], 'mixed'))
check('outside only', solve(['x'], ['a','b'], 'read', None), (['x'], 'none'))
check('all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
check('parameterized checked subtree', solve(list(range(N)), list(range(N)), 'read', None), (list(range(N)), 'all'))
for repetition in range(N):
    check('repeat all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
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)

evaluation_group: xi-checkbox-tree

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(selected, children, event, child):
    selected = set(selected)
    children = set(children)
    if event == 'all': selected ^= children
    elif event == 'none': selected -= children
    elif event == 'toggle': selected.symmetric_difference_update({child})
    visible = selected & children
    state = 'none' if not visible else ('all' if visible == children else 'mixed')
    return (sorted(selected), state)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all keeps outside', solve(['x','a'], ['a','b'], 'all', None), (['a', 'b', 'x'], 'all'))
check('none keeps outside', solve(['x','a'], ['a','b'], 'none', None), (['x'], 'none'))
check('toggle off', solve(['a'], ['a','b'], 'toggle', 'a'), ([], 'none'))
check('toggle on', solve([], ['a','b'], 'toggle', 'a'), (['a'], 'mixed'))
check('outside only', solve(['x'], ['a','b'], 'read', None), (['x'], 'none'))
check('all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
check('parameterized checked subtree', solve(list(range(N)), list(range(N)), 'read', None), (list(range(N)), 'all'))
for repetition in range(N):
    check('repeat all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
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)

prompt:
Selecting a subtree erases selections outside it.

Subtree actions preserve outside selections; toggle is symmetric; parent status depends only on selected descendants and distinguishes none, mixed and all.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(selected, children, event, child):
    selected = set(selected)
    children = set(children)
    if event == 'all': selected |= children
    elif event == 'none': selected.clear()
    elif event == 'toggle': selected.symmetric_difference_update({child})
    visible = selected & children
    state = 'none' if not visible else ('all' if visible == children else 'mixed')
    return (sorted(selected), state)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all keeps outside', solve(['x','a'], ['a','b'], 'all', None), (['a', 'b', 'x'], 'all'))
check('none keeps outside', solve(['x','a'], ['a','b'], 'none', None), (['x'], 'none'))
check('toggle off', solve(['a'], ['a','b'], 'toggle', 'a'), ([], 'none'))
check('toggle on', solve([], ['a','b'], 'toggle', 'a'), (['a'], 'mixed'))
check('outside only', solve(['x'], ['a','b'], 'read', None), (['x'], 'none'))
check('all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
check('parameterized checked subtree', solve(list(range(N)), list(range(N)), 'read', None), (list(range(N)), 'all'))
for repetition in range(N):
    check('repeat all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
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)

evaluation_group: xi-checkbox-tree

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(selected, children, event, child):
    selected = set(selected)
    children = set(children)
    if event == 'all': selected |= children
    elif event == 'none': selected &= children
    elif event == 'toggle': selected.symmetric_difference_update({child})
    visible = selected & children
    state = 'none' if not visible else ('all' if visible == children else 'mixed')
    return (sorted(selected), state)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all keeps outside', solve(['x','a'], ['a','b'], 'all', None), (['a', 'b', 'x'], 'all'))
check('none keeps outside', solve(['x','a'], ['a','b'], 'none', None), (['x'], 'none'))
check('toggle off', solve(['a'], ['a','b'], 'toggle', 'a'), ([], 'none'))
check('toggle on', solve([], ['a','b'], 'toggle', 'a'), (['a'], 'mixed'))
check('outside only', solve(['x'], ['a','b'], 'read', None), (['x'], 'none'))
check('all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
check('parameterized checked subtree', solve(list(range(N)), list(range(N)), 'read', None), (list(range(N)), 'all'))
for repetition in range(N):
    check('repeat all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
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)

prompt:
Clearing a subtree also clears independent selections.

Subtree actions preserve outside selections; toggle is symmetric; parent status depends only on selected descendants and distinguishes none, mixed and all.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(selected, children, event, child):
    selected = set(selected)
    children = set(children)
    if event == 'all': selected |= children
    elif event == 'none': selected -= children
    elif event == 'toggle': selected.add(child)
    visible = selected & children
    state = 'none' if not visible else ('all' if visible == children else 'mixed')
    return (sorted(selected), state)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all keeps outside', solve(['x','a'], ['a','b'], 'all', None), (['a', 'b', 'x'], 'all'))
check('none keeps outside', solve(['x','a'], ['a','b'], 'none', None), (['x'], 'none'))
check('toggle off', solve(['a'], ['a','b'], 'toggle', 'a'), ([], 'none'))
check('toggle on', solve([], ['a','b'], 'toggle', 'a'), (['a'], 'mixed'))
check('outside only', solve(['x'], ['a','b'], 'read', None), (['x'], 'none'))
check('all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
check('parameterized checked subtree', solve(list(range(N)), list(range(N)), 'read', None), (list(range(N)), 'all'))
for repetition in range(N):
    check('repeat all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
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)

evaluation_group: xi-checkbox-tree

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(selected, children, event, child):
    selected = set(selected)
    children = set(children)
    if event == 'all': selected |= children
    elif event == 'none': selected -= children
    elif event == 'toggle': selected.discard(child)
    visible = selected & children
    state = 'none' if not visible else ('all' if visible == children else 'mixed')
    return (sorted(selected), state)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all keeps outside', solve(['x','a'], ['a','b'], 'all', None), (['a', 'b', 'x'], 'all'))
check('none keeps outside', solve(['x','a'], ['a','b'], 'none', None), (['x'], 'none'))
check('toggle off', solve(['a'], ['a','b'], 'toggle', 'a'), ([], 'none'))
check('toggle on', solve([], ['a','b'], 'toggle', 'a'), (['a'], 'mixed'))
check('outside only', solve(['x'], ['a','b'], 'read', None), (['x'], 'none'))
check('all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
check('parameterized checked subtree', solve(list(range(N)), list(range(N)), 'read', None), (list(range(N)), 'all'))
for repetition in range(N):
    check('repeat all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
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)

prompt:
Clicking a checked child cannot deselect it.

Subtree actions preserve outside selections; toggle is symmetric; parent status depends only on selected descendants and distinguishes none, mixed and all.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(selected, children, event, child):
    selected = set(selected)
    children = set(children)
    if event == 'all': selected |= children
    elif event == 'none': selected -= children
    elif event == 'toggle': selected.symmetric_difference_update({child})
    visible = selected
    state = 'none' if not visible else ('all' if visible == children else 'mixed')
    return (sorted(selected), state)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all keeps outside', solve(['x','a'], ['a','b'], 'all', None), (['a', 'b', 'x'], 'all'))
check('none keeps outside', solve(['x','a'], ['a','b'], 'none', None), (['x'], 'none'))
check('toggle off', solve(['a'], ['a','b'], 'toggle', 'a'), ([], 'none'))
check('toggle on', solve([], ['a','b'], 'toggle', 'a'), (['a'], 'mixed'))
check('outside only', solve(['x'], ['a','b'], 'read', None), (['x'], 'none'))
check('all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
check('parameterized checked subtree', solve(list(range(N)), list(range(N)), 'read', None), (list(range(N)), 'all'))
for repetition in range(N):
    check('repeat all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
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)

evaluation_group: xi-checkbox-tree

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(selected, children, event, child):
    selected = set(selected)
    children = set(children)
    if event == 'all': selected |= children
    elif event == 'none': selected -= children
    elif event == 'toggle': selected.symmetric_difference_update({child})
    visible = children - selected
    state = 'none' if not visible else ('all' if visible == children else 'mixed')
    return (sorted(selected), state)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all keeps outside', solve(['x','a'], ['a','b'], 'all', None), (['a', 'b', 'x'], 'all'))
check('none keeps outside', solve(['x','a'], ['a','b'], 'none', None), (['x'], 'none'))
check('toggle off', solve(['a'], ['a','b'], 'toggle', 'a'), ([], 'none'))
check('toggle on', solve([], ['a','b'], 'toggle', 'a'), (['a'], 'mixed'))
check('outside only', solve(['x'], ['a','b'], 'read', None), (['x'], 'none'))
check('all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
check('parameterized checked subtree', solve(list(range(N)), list(range(N)), 'read', None), (list(range(N)), 'all'))
for repetition in range(N):
    check('repeat all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
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)

prompt:
Outside selections contaminate the parent indicator.

Subtree actions preserve outside selections; toggle is symmetric; parent status depends only on selected descendants and distinguishes none, mixed and all.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(selected, children, event, child):
    selected = set(selected)
    children = set(children)
    if event == 'all': selected |= children
    elif event == 'none': selected -= children
    elif event == 'toggle': selected.symmetric_difference_update({child})
    visible = selected & children
    state = 'none' if not visible else 'all'
    return (sorted(selected), state)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all keeps outside', solve(['x','a'], ['a','b'], 'all', None), (['a', 'b', 'x'], 'all'))
check('none keeps outside', solve(['x','a'], ['a','b'], 'none', None), (['x'], 'none'))
check('toggle off', solve(['a'], ['a','b'], 'toggle', 'a'), ([], 'none'))
check('toggle on', solve([], ['a','b'], 'toggle', 'a'), (['a'], 'mixed'))
check('outside only', solve(['x'], ['a','b'], 'read', None), (['x'], 'none'))
check('all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
check('parameterized checked subtree', solve(list(range(N)), list(range(N)), 'read', None), (list(range(N)), 'all'))
for repetition in range(N):
    check('repeat all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
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)

evaluation_group: xi-checkbox-tree

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(selected, children, event, child):
    selected = set(selected)
    children = set(children)
    if event == 'all': selected |= children
    elif event == 'none': selected -= children
    elif event == 'toggle': selected.symmetric_difference_update({child})
    visible = selected & children
    state = 'none' if not visible else 'mixed'
    return (sorted(selected), state)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all keeps outside', solve(['x','a'], ['a','b'], 'all', None), (['a', 'b', 'x'], 'all'))
check('none keeps outside', solve(['x','a'], ['a','b'], 'none', None), (['x'], 'none'))
check('toggle off', solve(['a'], ['a','b'], 'toggle', 'a'), ([], 'none'))
check('toggle on', solve([], ['a','b'], 'toggle', 'a'), (['a'], 'mixed'))
check('outside only', solve(['x'], ['a','b'], 'read', None), (['x'], 'none'))
check('all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
check('parameterized checked subtree', solve(list(range(N)), list(range(N)), 'read', None), (list(range(N)), 'all'))
for repetition in range(N):
    check('repeat all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
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)

prompt:
Partially selected parents are announced as fully checked.

Subtree actions preserve outside selections; toggle is symmetric; parent status depends only on selected descendants and distinguishes none, mixed and all.

split: open-access