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

N = 1
observations = []
def solve(data):
    cache,dependencies,mutations = data
    reverse = {}
    for consumer,provider,channel in dependencies:
        if channel == 'name': reverse.setdefault(provider,[]).append(consumer)
    invalid = set()
    for provider,kind in mutations:
        if kind == 'style': invalid.add(provider); continue
        if kind not in ('text','remove'): continue
        invalid = set()
        pending = [provider]
        seen = set()
        while pending:
            node = pending.pop()
            if node in seen: continue
            seen.add(node)
            invalid.add(node)
            pending.extend(reverse.get(node,[]))
    return [{key:value for key,value in cache.items() if key not in invalid},[key for key in cache if key in invalid]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':'A','b':'B','c':str(N),'keep':'K'},[['b','a','name'],['c','b','name']],[['a','text']]],), [{'keep':'K'},['a','b','c']])
check('contract fixture 2', solve([{'c':'C'},[['c','missing','name']],[['missing','remove']]],), [{},['c']])
check('contract fixture 3', solve([{'a':'A','b':'B'},[['b','a','description']],[['a','text']]],), [{'b':'B'},['a']])
check('contract fixture 4', solve([{'a':'A','b':'B'},[['b','a','name']],[['a','style']]],), [{'b':'B'},['a']])
check('contract fixture 5', solve([{'a':'A','b':'B'},[['b','a','name'],['a','b','name']],[['a','unrelated']]],), [{'a':'A','b':'B'},[]])
check('contract fixture 6', solve([{'z':'Z','a':'A'},[['a','z','name'],['z','a','name']],[['z','text']]],), [{},['z','a']])
check('contract fixture 7', solve([{'a':'A','b':'B'},[],[['a','text'],['b','text']]],), [{},['a','b']])
check('contract fixture 8', solve([{'n'+str(i):'Name'+str(i) for i in range(N+2)},[['n'+str(i),'n'+str(i-1),'name'] for i in range(1,N+2)],[['n0','text']]],), [{},['n'+str(i) for i in range(N+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)

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

N = 1
observations = []
def solve(data):
    cache,dependencies,mutations = data
    reverse = {}
    for consumer,provider,channel in dependencies:
        if channel == 'name': reverse.setdefault(provider,[]).append(consumer)
    invalid = set()
    for provider,kind in mutations:
        if kind == 'style': invalid.add(provider); continue
        if kind not in ('text','remove'): continue
        invalid.intersection_update({provider})
        pending = [provider]
        seen = set()
        while pending:
            node = pending.pop()
            if node in seen: continue
            seen.add(node)
            invalid.add(node)
            pending.extend(reverse.get(node,[]))
    return [{key:value for key,value in cache.items() if key not in invalid},[key for key in cache if key in invalid]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':'A','b':'B','c':str(N),'keep':'K'},[['b','a','name'],['c','b','name']],[['a','text']]],), [{'keep':'K'},['a','b','c']])
check('contract fixture 2', solve([{'c':'C'},[['c','missing','name']],[['missing','remove']]],), [{},['c']])
check('contract fixture 3', solve([{'a':'A','b':'B'},[['b','a','description']],[['a','text']]],), [{'b':'B'},['a']])
check('contract fixture 4', solve([{'a':'A','b':'B'},[['b','a','name']],[['a','style']]],), [{'b':'B'},['a']])
check('contract fixture 5', solve([{'a':'A','b':'B'},[['b','a','name'],['a','b','name']],[['a','unrelated']]],), [{'a':'A','b':'B'},[]])
check('contract fixture 6', solve([{'z':'Z','a':'A'},[['a','z','name'],['z','a','name']],[['z','text']]],), [{},['z','a']])
check('contract fixture 7', solve([{'a':'A','b':'B'},[],[['a','text'],['b','text']]],), [{},['a','b']])
check('contract fixture 8', solve([{'n'+str(i):'Name'+str(i) for i in range(N+2)},[['n'+str(i),'n'+str(i-1),'name'] for i in range(1,N+2)],[['n0','text']]],), [{},['n'+str(i) for i in range(N+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:
Later mutations erase previously discovered invalidations.

Input [cached_names,dependencies,mutations]. Dependencies [consumer,provider,channel] with channel name or description; only name affects cached names. Mutation [provider,kind] kind text,remove,style,unrelated; text/remove invalidate provider and all transitively dependent name consumers, style invalidates provider only, unrelated does nothing. Include only cached IDs in returned invalidated list but traverse uncached providers. Ignore cycles safely, preserve cache dictionary order in final result. Return [remaining_cache,invalidated_ids].

split: open-access


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

N = 1
observations = []
def solve(data):
    cache,dependencies,mutations = data
    reverse = {}
    for consumer,provider,channel in dependencies:
        if channel == 'name': reverse.setdefault(provider,[]).append(consumer)
    invalid = set()
    for provider,kind in mutations:
        if kind == 'style': invalid.add(provider); continue
        if kind not in ('text','remove'): continue
        pending = [provider]
        seen = set()
        while pending:
            node = pending.pop()
            if node in seen: continue
            seen.add(node)
            invalid.add(node)
            pending.extend(reverse.get(node,[]))
    return [{key:value for key,value in cache.items() if key not in invalid},sorted(key for key in cache if key in invalid)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':'A','b':'B','c':str(N),'keep':'K'},[['b','a','name'],['c','b','name']],[['a','text']]],), [{'keep':'K'},['a','b','c']])
check('contract fixture 2', solve([{'c':'C'},[['c','missing','name']],[['missing','remove']]],), [{},['c']])
check('contract fixture 3', solve([{'a':'A','b':'B'},[['b','a','description']],[['a','text']]],), [{'b':'B'},['a']])
check('contract fixture 4', solve([{'a':'A','b':'B'},[['b','a','name']],[['a','style']]],), [{'b':'B'},['a']])
check('contract fixture 5', solve([{'a':'A','b':'B'},[['b','a','name'],['a','b','name']],[['a','unrelated']]],), [{'a':'A','b':'B'},[]])
check('contract fixture 6', solve([{'z':'Z','a':'A'},[['a','z','name'],['z','a','name']],[['z','text']]],), [{},['z','a']])
check('contract fixture 7', solve([{'a':'A','b':'B'},[],[['a','text'],['b','text']]],), [{},['a','b']])
check('contract fixture 8', solve([{'n'+str(i):'Name'+str(i) for i in range(N+2)},[['n'+str(i),'n'+str(i-1),'name'] for i in range(1,N+2)],[['n0','text']]],), [{},['n'+str(i) for i in range(N+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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(data):
    cache,dependencies,mutations = data
    reverse = {}
    for consumer,provider,channel in dependencies:
        if channel == 'name': reverse.setdefault(provider,[]).append(consumer)
    invalid = set()
    for provider,kind in mutations:
        if kind == 'style': invalid.add(provider); continue
        if kind not in ('text','remove'): continue
        pending = [provider]
        seen = set()
        while pending:
            node = pending.pop()
            if node in seen: continue
            seen.add(node)
            invalid.add(node)
            pending.extend(reverse.get(node,[]))
    return [{key:value for key,value in cache.items() if key not in invalid},[key for key in reversed(cache) if key in invalid]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':'A','b':'B','c':str(N),'keep':'K'},[['b','a','name'],['c','b','name']],[['a','text']]],), [{'keep':'K'},['a','b','c']])
check('contract fixture 2', solve([{'c':'C'},[['c','missing','name']],[['missing','remove']]],), [{},['c']])
check('contract fixture 3', solve([{'a':'A','b':'B'},[['b','a','description']],[['a','text']]],), [{'b':'B'},['a']])
check('contract fixture 4', solve([{'a':'A','b':'B'},[['b','a','name']],[['a','style']]],), [{'b':'B'},['a']])
check('contract fixture 5', solve([{'a':'A','b':'B'},[['b','a','name'],['a','b','name']],[['a','unrelated']]],), [{'a':'A','b':'B'},[]])
check('contract fixture 6', solve([{'z':'Z','a':'A'},[['a','z','name'],['z','a','name']],[['z','text']]],), [{},['z','a']])
check('contract fixture 7', solve([{'a':'A','b':'B'},[],[['a','text'],['b','text']]],), [{},['a','b']])
check('contract fixture 8', solve([{'n'+str(i):'Name'+str(i) for i in range(N+2)},[['n'+str(i),'n'+str(i-1),'name'] for i in range(1,N+2)],[['n0','text']]],), [{},['n'+str(i) for i in range(N+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:
Invalidation output loses stable accessibility cache order.

Input [cached_names,dependencies,mutations]. Dependencies [consumer,provider,channel] with channel name or description; only name affects cached names. Mutation [provider,kind] kind text,remove,style,unrelated; text/remove invalidate provider and all transitively dependent name consumers, style invalidates provider only, unrelated does nothing. Include only cached IDs in returned invalidated list but traverse uncached providers. Ignore cycles safely, preserve cache dictionary order in final result. Return [remaining_cache,invalidated_ids].

split: open-access


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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and (x['enabled'] or x['busy']) and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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 advertise writable accessibility text.

Input semantic state record with required fields: enabled,readonly,editable,selectable,selected,expandable,expanded,checkable,checked,mixed,visible,offscreen,focused,focusable,busy,invalid. Output ordered API capability/state strings. editable only when editable,enabled,not readonly; selected only selectable; expanded/collapsed only expandable; mixed has priority over checked for checkable; invisible and offscreen differ; focused may be true independently of focusable; busy and invalid are independent. Return lexically sorted unique state names. readonly is always reported when true even if noneditable.

split: open-access


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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] : out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and (not x['readonly'] or x['enabled']): out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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:
Read-only controls advertise writable accessibility text.

Input semantic state record with required fields: enabled,readonly,editable,selectable,selected,expandable,expanded,checkable,checked,mixed,visible,offscreen,focused,focusable,busy,invalid. Output ordered API capability/state strings. editable only when editable,enabled,not readonly; selected only selectable; expanded/collapsed only expandable; mixed has priority over checked for checkable; invisible and offscreen differ; focused may be true independently of focusable; busy and invalid are independent. Return lexically sorted unique state names. readonly is always reported when true even if noneditable.

split: open-access


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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selected'] or x['selectable']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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 state is exported without selection capability.

Input semantic state record with required fields: enabled,readonly,editable,selectable,selected,expandable,expanded,checkable,checked,mixed,visible,offscreen,focused,focusable,busy,invalid. Output ordered API capability/state strings. editable only when editable,enabled,not readonly; selected only selectable; expanded/collapsed only expandable; mixed has priority over checked for checkable; invisible and offscreen differ; focused may be true independently of focusable; busy and invalid are independent. Return lexically sorted unique state names. readonly is always reported when true even if noneditable.

split: open-access


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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if True: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable'] or x['expanded']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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:
Expanded state is exported on nonexpandable objects.

Input semantic state record with required fields: enabled,readonly,editable,selectable,selected,expandable,expanded,checkable,checked,mixed,visible,offscreen,focused,focusable,busy,invalid. Output ordered API capability/state strings. editable only when editable,enabled,not readonly; selected only selectable; expanded/collapsed only expandable; mixed has priority over checked for checkable; invisible and offscreen differ; focused may be true independently of focusable; busy and invalid are independent. Return lexically sorted unique state names. readonly is always reported when true even if noneditable.

split: open-access


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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed'] and not x['checked']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed'] and not x['busy']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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:
Checked state overrides a mixed value in a tri-state semantic.

Input semantic state record with required fields: enabled,readonly,editable,selectable,selected,expandable,expanded,checkable,checked,mixed,visible,offscreen,focused,focusable,busy,invalid. Output ordered API capability/state strings. editable only when editable,enabled,not readonly; selected only selectable; expanded/collapsed only expandable; mixed has priority over checked for checkable; invisible and offscreen differ; focused may be true independently of focusable; busy and invalid are independent. Return lexically sorted unique state names. readonly is always reported when true even if noneditable.

split: open-access


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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if True:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable'] or x['checked']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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:
Checked states leak from objects without check semantics.

Input semantic state record with required fields: enabled,readonly,editable,selectable,selected,expandable,expanded,checkable,checked,mixed,visible,offscreen,focused,focusable,busy,invalid. Output ordered API capability/state strings. editable only when editable,enabled,not readonly; selected only selectable; expanded/collapsed only expandable; mixed has priority over checked for checkable; invisible and offscreen differ; focused may be true independently of focusable; busy and invalid are independent. Return lexically sorted unique state names. readonly is always reported when true even if noneditable.

split: open-access


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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if not x['visible']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen'] and not x['visible']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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:
Offscreen state is conflated with invisibility.

Input semantic state record with required fields: enabled,readonly,editable,selectable,selected,expandable,expanded,checkable,checked,mixed,visible,offscreen,focused,focusable,busy,invalid. Output ordered API capability/state strings. editable only when editable,enabled,not readonly; selected only selectable; expanded/collapsed only expandable; mixed has priority over checked for checkable; invisible and offscreen differ; focused may be true independently of focusable; busy and invalid are independent. Return lexically sorted unique state names. readonly is always reported when true even if noneditable.

split: open-access


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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused'] and x['focusable']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused'] and not x['busy']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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:
Focused state is suppressed when focusability changes.

Input semantic state record with required fields: enabled,readonly,editable,selectable,selected,expandable,expanded,checkable,checked,mixed,visible,offscreen,focused,focusable,busy,invalid. Output ordered API capability/state strings. editable only when editable,enabled,not readonly; selected only selectable; expanded/collapsed only expandable; mixed has priority over checked for checkable; invisible and offscreen differ; focused may be true independently of focusable; busy and invalid are independent. Return lexically sorted unique state names. readonly is always reported when true even if noneditable.

split: open-access


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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly'] and x['editable']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly'] and x['enabled'] and x['editable']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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:
Read-only metadata is omitted on noneditable semantic objects.

Input semantic state record with required fields: enabled,readonly,editable,selectable,selected,expandable,expanded,checkable,checked,mixed,visible,offscreen,focused,focusable,busy,invalid. Output ordered API capability/state strings. editable only when editable,enabled,not readonly; selected only selectable; expanded/collapsed only expandable; mixed has priority over checked for checkable; invisible and offscreen differ; focused may be true independently of focusable; busy and invalid are independent. Return lexically sorted unique state names. readonly is always reported when true even if noneditable.

split: open-access


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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid'] and not x['busy']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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

N = 1
observations = []
def solve(data):
    x = data
    out = []
    if not x['enabled']: out.append('unavailable')
    if x['readonly']: out.append('readonly')
    if x['editable'] and x['enabled'] and not x['readonly']: out.append('editable')
    if x['selectable'] and x['selected']: out.append('selected')
    if x['expandable']: out.append('expanded' if x['expanded'] else 'collapsed')
    if x['checkable']:
        if x['mixed']: out.append('mixed')
        elif x['checked']: out.append('checked')
    if not x['visible']: out.append('invisible')
    if x['offscreen']: out.append('offscreen')
    if x['focused']: out.append('focused')
    if x['busy']: out.append('busy')
    if x['invalid'] and x['editable']: out.append('invalid')
    return sorted(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(enabled=True,readonly=False,editable=True,selectable=True,selected=bool(N%2),expandable=True,expanded=False,checkable=True,checked=True,mixed=True,visible=True,offscreen=True,focused=True,focusable=False,busy=True,invalid=True),), ['busy','collapsed','editable','focused','invalid','mixed','offscreen']+(['selected'] if N%2 else []))
check('contract fixture 2', solve(dict(enabled=False,readonly=True,editable=True,selectable=False,selected=True,expandable=False,expanded=True,checkable=False,checked=True,mixed=True,visible=False,offscreen=False,focused=False,focusable=True,busy=False,invalid=False),), ['invisible','readonly','unavailable'])
check('contract fixture 3', solve(dict(enabled=True,readonly=True,editable=False,selectable=True,selected=False,expandable=True,expanded=True,checkable=True,checked=True,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=True),), ['checked','expanded','invalid','readonly'])
check('contract fixture 4', solve(dict(enabled=False,readonly=False,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=True,checked=False,mixed=False,visible=True,offscreen=True,focused=False,focusable=False,busy=True,invalid=False),), ['busy','offscreen','unavailable'])
check('contract fixture 5', solve(dict(enabled=True,readonly=True,editable=True,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), ['readonly'])
check('contract fixture 6', solve(dict(enabled=True,readonly=False,editable=False,selectable=False,selected=False,expandable=False,expanded=False,checkable=False,checked=False,mixed=False,visible=True,offscreen=False,focused=False,focusable=False,busy=False,invalid=False),), [])
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:
Busy state suppresses simultaneous invalid metadata.

Input semantic state record with required fields: enabled,readonly,editable,selectable,selected,expandable,expanded,checkable,checked,mixed,visible,offscreen,focused,focusable,busy,invalid. Output ordered API capability/state strings. editable only when editable,enabled,not readonly; selected only selectable; expanded/collapsed only expandable; mixed has priority over checked for checkable; invisible and offscreen differ; focused may be true independently of focusable; busy and invalid are independent. Return lexically sorted unique state names. readonly is always reported when true even if noneditable.

split: open-access


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

N = 1
observations = []
def solve(data):
    segments,mode = data
    text = ''
    runs = []
    for base,annotation,fallback,language,hidden in segments:
        annotation = annotation
        parts = []
        if mode == 'annotation' and annotation: parts = [(annotation,'annotation')]
        else:
            parts = [(base,'base')]
            if mode == 'combined' and annotation and annotation != base: parts.append(('('+annotation+')','annotation'))
        for value,source in parts:
            if not value: continue
            start = len(text)
            text += value
            runs.append([start,len(text),language,source])
    return [text,runs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['字'*N,'ji','fallback','ja',False]],'combined'],), ['字'*N+'(ji)',[[0,N,'ja','base'],[N,N+4,'ja','annotation']]])
check('contract fixture 2', solve([[['字','ji','fallback','ja',False]],'annotation'],), ['ji',[[0,2,'ja','annotation']]])
check('contract fixture 3', solve([[['字','ji','fallback','ja',True]],'annotation'],), ['字',[[0,1,'ja','base']]])
check('contract fixture 4', solve([[['same','same','fallback','',False]],'combined'],), ['same',[[0,4,'','base']]])
check('contract fixture 5', solve([[['A','','fallback','en',False],['B','bee','fallback','en',False]],'base'],), ['AB',[[0,1,'en','base'],[1,2,'en','base']]])
check('contract fixture 6', solve([[['','','fallback','en',False]],'combined'],), ['',[]])
check('contract fixture 7', solve([[['A','','fallback','en',False]],'annotation'],), ['A',[[0,1,'en','base']]])
check('contract fixture 8', solve([[],'annotation'],), ['',[]])
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

N = 1
observations = []
def solve(data):
    segments,mode = data
    text = ''
    runs = []
    for base,annotation,fallback,language,hidden in segments:
        annotation = annotation if annotation else ''
        parts = []
        if mode == 'annotation' and annotation: parts = [(annotation,'annotation')]
        else:
            parts = [(base,'base')]
            if mode == 'combined' and annotation and annotation != base: parts.append(('('+annotation+')','annotation'))
        for value,source in parts:
            if not value: continue
            start = len(text)
            text += value
            runs.append([start,len(text),language,source])
    return [text,runs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['字'*N,'ji','fallback','ja',False]],'combined'],), ['字'*N+'(ji)',[[0,N,'ja','base'],[N,N+4,'ja','annotation']]])
check('contract fixture 2', solve([[['字','ji','fallback','ja',False]],'annotation'],), ['ji',[[0,2,'ja','annotation']]])
check('contract fixture 3', solve([[['字','ji','fallback','ja',True]],'annotation'],), ['字',[[0,1,'ja','base']]])
check('contract fixture 4', solve([[['same','same','fallback','',False]],'combined'],), ['same',[[0,4,'','base']]])
check('contract fixture 5', solve([[['A','','fallback','en',False],['B','bee','fallback','en',False]],'base'],), ['AB',[[0,1,'en','base'],[1,2,'en','base']]])
check('contract fixture 6', solve([[['','','fallback','en',False]],'combined'],), ['',[]])
check('contract fixture 7', solve([[['A','','fallback','en',False]],'annotation'],), ['A',[[0,1,'en','base']]])
check('contract fixture 8', solve([[],'annotation'],), ['',[]])
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 ruby annotations remain exposed as pronunciations.

Input [segments,mode] where segments [base,annotation,fallback,language,hidden_annotation]. mode is base,annotation,combined. In annotation mode use nonempty visible annotation, otherwise base. Combined adds parenthesized visible annotation only when nonempty and different from base; fallback is markup-only content and never exposed. Return [text,runs] with runs [start,end,language,source], omitting zero-length contributions. Each segment is concatenated without implicit spaces. Combined annotation run includes parentheses. Source is base or annotation. Preserve original strings and language, including empty language.

split: open-access


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

N = 1
observations = []
def solve(data):
    segments,mode = data
    text = ''
    runs = []
    for base,annotation,fallback,language,hidden in segments:
        annotation = '' if hidden else annotation
        parts = []
        if annotation: parts = [(annotation,'annotation')]
        else:
            parts = [(base,'base')]
            if mode == 'combined' and annotation and annotation != base: parts.append(('('+annotation+')','annotation'))
        for value,source in parts:
            if not value: continue
            start = len(text)
            text += value
            runs.append([start,len(text),language,source])
    return [text,runs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['字'*N,'ji','fallback','ja',False]],'combined'],), ['字'*N+'(ji)',[[0,N,'ja','base'],[N,N+4,'ja','annotation']]])
check('contract fixture 2', solve([[['字','ji','fallback','ja',False]],'annotation'],), ['ji',[[0,2,'ja','annotation']]])
check('contract fixture 3', solve([[['字','ji','fallback','ja',True]],'annotation'],), ['字',[[0,1,'ja','base']]])
check('contract fixture 4', solve([[['same','same','fallback','',False]],'combined'],), ['same',[[0,4,'','base']]])
check('contract fixture 5', solve([[['A','','fallback','en',False],['B','bee','fallback','en',False]],'base'],), ['AB',[[0,1,'en','base'],[1,2,'en','base']]])
check('contract fixture 6', solve([[['','','fallback','en',False]],'combined'],), ['',[]])
check('contract fixture 7', solve([[['A','','fallback','en',False]],'annotation'],), ['A',[[0,1,'en','base']]])
check('contract fixture 8', solve([[],'annotation'],), ['',[]])
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

N = 1
observations = []
def solve(data):
    segments,mode = data
    text = ''
    runs = []
    for base,annotation,fallback,language,hidden in segments:
        annotation = '' if hidden else annotation
        parts = []
        if mode != 'combined' and annotation: parts = [(annotation,'annotation')]
        else:
            parts = [(base,'base')]
            if mode == 'combined' and annotation and annotation != base: parts.append(('('+annotation+')','annotation'))
        for value,source in parts:
            if not value: continue
            start = len(text)
            text += value
            runs.append([start,len(text),language,source])
    return [text,runs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['字'*N,'ji','fallback','ja',False]],'combined'],), ['字'*N+'(ji)',[[0,N,'ja','base'],[N,N+4,'ja','annotation']]])
check('contract fixture 2', solve([[['字','ji','fallback','ja',False]],'annotation'],), ['ji',[[0,2,'ja','annotation']]])
check('contract fixture 3', solve([[['字','ji','fallback','ja',True]],'annotation'],), ['字',[[0,1,'ja','base']]])
check('contract fixture 4', solve([[['same','same','fallback','',False]],'combined'],), ['same',[[0,4,'','base']]])
check('contract fixture 5', solve([[['A','','fallback','en',False],['B','bee','fallback','en',False]],'base'],), ['AB',[[0,1,'en','base'],[1,2,'en','base']]])
check('contract fixture 6', solve([[['','','fallback','en',False]],'combined'],), ['',[]])
check('contract fixture 7', solve([[['A','','fallback','en',False]],'annotation'],), ['A',[[0,1,'en','base']]])
check('contract fixture 8', solve([[],'annotation'],), ['',[]])
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:
Ruby base mode unexpectedly substitutes pronunciation text.

Input [segments,mode] where segments [base,annotation,fallback,language,hidden_annotation]. mode is base,annotation,combined. In annotation mode use nonempty visible annotation, otherwise base. Combined adds parenthesized visible annotation only when nonempty and different from base; fallback is markup-only content and never exposed. Return [text,runs] with runs [start,end,language,source], omitting zero-length contributions. Each segment is concatenated without implicit spaces. Combined annotation run includes parentheses. Source is base or annotation. Preserve original strings and language, including empty language.

split: open-access


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

N = 1
observations = []
def solve(data):
    segments,mode = data
    text = ''
    runs = []
    for base,annotation,fallback,language,hidden in segments:
        annotation = '' if hidden else annotation
        parts = []
        if mode == 'annotation': parts = [(annotation,'annotation')]
        else:
            parts = [(base,'base')]
            if mode == 'combined' and annotation and annotation != base: parts.append(('('+annotation+')','annotation'))
        for value,source in parts:
            if not value: continue
            start = len(text)
            text += value
            runs.append([start,len(text),language,source])
    return [text,runs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['字'*N,'ji','fallback','ja',False]],'combined'],), ['字'*N+'(ji)',[[0,N,'ja','base'],[N,N+4,'ja','annotation']]])
check('contract fixture 2', solve([[['字','ji','fallback','ja',False]],'annotation'],), ['ji',[[0,2,'ja','annotation']]])
check('contract fixture 3', solve([[['字','ji','fallback','ja',True]],'annotation'],), ['字',[[0,1,'ja','base']]])
check('contract fixture 4', solve([[['same','same','fallback','',False]],'combined'],), ['same',[[0,4,'','base']]])
check('contract fixture 5', solve([[['A','','fallback','en',False],['B','bee','fallback','en',False]],'base'],), ['AB',[[0,1,'en','base'],[1,2,'en','base']]])
check('contract fixture 6', solve([[['','','fallback','en',False]],'combined'],), ['',[]])
check('contract fixture 7', solve([[['A','','fallback','en',False]],'annotation'],), ['A',[[0,1,'en','base']]])
check('contract fixture 8', solve([[],'annotation'],), ['',[]])
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

N = 1
observations = []
def solve(data):
    segments,mode = data
    text = ''
    runs = []
    for base,annotation,fallback,language,hidden in segments:
        annotation = '' if hidden else annotation
        parts = []
        if mode == 'annotation' and not hidden: parts = [(annotation,'annotation')]
        else:
            parts = [(base,'base')]
            if mode == 'combined' and annotation and annotation != base: parts.append(('('+annotation+')','annotation'))
        for value,source in parts:
            if not value: continue
            start = len(text)
            text += value
            runs.append([start,len(text),language,source])
    return [text,runs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['字'*N,'ji','fallback','ja',False]],'combined'],), ['字'*N+'(ji)',[[0,N,'ja','base'],[N,N+4,'ja','annotation']]])
check('contract fixture 2', solve([[['字','ji','fallback','ja',False]],'annotation'],), ['ji',[[0,2,'ja','annotation']]])
check('contract fixture 3', solve([[['字','ji','fallback','ja',True]],'annotation'],), ['字',[[0,1,'ja','base']]])
check('contract fixture 4', solve([[['same','same','fallback','',False]],'combined'],), ['same',[[0,4,'','base']]])
check('contract fixture 5', solve([[['A','','fallback','en',False],['B','bee','fallback','en',False]],'base'],), ['AB',[[0,1,'en','base'],[1,2,'en','base']]])
check('contract fixture 6', solve([[['','','fallback','en',False]],'combined'],), ['',[]])
check('contract fixture 7', solve([[['A','','fallback','en',False]],'annotation'],), ['A',[[0,1,'en','base']]])
check('contract fixture 8', solve([[],'annotation'],), ['',[]])
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 absent pronunciation erases the base text.

Input [segments,mode] where segments [base,annotation,fallback,language,hidden_annotation]. mode is base,annotation,combined. In annotation mode use nonempty visible annotation, otherwise base. Combined adds parenthesized visible annotation only when nonempty and different from base; fallback is markup-only content and never exposed. Return [text,runs] with runs [start,end,language,source], omitting zero-length contributions. Each segment is concatenated without implicit spaces. Combined annotation run includes parentheses. Source is base or annotation. Preserve original strings and language, including empty language.

split: open-access


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

N = 1
observations = []
def solve(data):
    segments,mode = data
    text = ''
    runs = []
    for base,annotation,fallback,language,hidden in segments:
        annotation = '' if hidden else annotation
        parts = []
        if mode == 'annotation' and annotation: parts = [(annotation,'annotation')]
        else:
            parts = [(base,'base')]
            if mode != 'annotation' and annotation and annotation != base: parts.append(('('+annotation+')','annotation'))
        for value,source in parts:
            if not value: continue
            start = len(text)
            text += value
            runs.append([start,len(text),language,source])
    return [text,runs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['字'*N,'ji','fallback','ja',False]],'combined'],), ['字'*N+'(ji)',[[0,N,'ja','base'],[N,N+4,'ja','annotation']]])
check('contract fixture 2', solve([[['字','ji','fallback','ja',False]],'annotation'],), ['ji',[[0,2,'ja','annotation']]])
check('contract fixture 3', solve([[['字','ji','fallback','ja',True]],'annotation'],), ['字',[[0,1,'ja','base']]])
check('contract fixture 4', solve([[['same','same','fallback','',False]],'combined'],), ['same',[[0,4,'','base']]])
check('contract fixture 5', solve([[['A','','fallback','en',False],['B','bee','fallback','en',False]],'base'],), ['AB',[[0,1,'en','base'],[1,2,'en','base']]])
check('contract fixture 6', solve([[['','','fallback','en',False]],'combined'],), ['',[]])
check('contract fixture 7', solve([[['A','','fallback','en',False]],'annotation'],), ['A',[[0,1,'en','base']]])
check('contract fixture 8', solve([[],'annotation'],), ['',[]])
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

N = 1
observations = []
def solve(data):
    segments,mode = data
    text = ''
    runs = []
    for base,annotation,fallback,language,hidden in segments:
        annotation = '' if hidden else annotation
        parts = []
        if mode == 'annotation' and annotation: parts = [(annotation,'annotation')]
        else:
            parts = [(base,'base')]
            if annotation and annotation != base: parts.append(('('+annotation+')','annotation'))
        for value,source in parts:
            if not value: continue
            start = len(text)
            text += value
            runs.append([start,len(text),language,source])
    return [text,runs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['字'*N,'ji','fallback','ja',False]],'combined'],), ['字'*N+'(ji)',[[0,N,'ja','base'],[N,N+4,'ja','annotation']]])
check('contract fixture 2', solve([[['字','ji','fallback','ja',False]],'annotation'],), ['ji',[[0,2,'ja','annotation']]])
check('contract fixture 3', solve([[['字','ji','fallback','ja',True]],'annotation'],), ['字',[[0,1,'ja','base']]])
check('contract fixture 4', solve([[['same','same','fallback','',False]],'combined'],), ['same',[[0,4,'','base']]])
check('contract fixture 5', solve([[['A','','fallback','en',False],['B','bee','fallback','en',False]],'base'],), ['AB',[[0,1,'en','base'],[1,2,'en','base']]])
check('contract fixture 6', solve([[['','','fallback','en',False]],'combined'],), ['',[]])
check('contract fixture 7', solve([[['A','','fallback','en',False]],'annotation'],), ['A',[[0,1,'en','base']]])
check('contract fixture 8', solve([[],'annotation'],), ['',[]])
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:
Ruby annotations are appended in base-only mode.

Input [segments,mode] where segments [base,annotation,fallback,language,hidden_annotation]. mode is base,annotation,combined. In annotation mode use nonempty visible annotation, otherwise base. Combined adds parenthesized visible annotation only when nonempty and different from base; fallback is markup-only content and never exposed. Return [text,runs] with runs [start,end,language,source], omitting zero-length contributions. Each segment is concatenated without implicit spaces. Combined annotation run includes parentheses. Source is base or annotation. Preserve original strings and language, including empty language.

split: open-access