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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if row[3] is not None: aria = row[3]
        if row[4] and row[2] and row[5] not in chain[:chain.index(ident)]: native = True
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if not aria and row[3] is not None: aria = row[3]
        if row[4] and row[2] and row[5] not in chain[:chain.index(ident)]: native = True
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An ancestor overwrites a nearer explicit disabled override.

Input preorder nodes [id,parent,native_disabled,aria_disabled,fieldset,first_legend] and queried ID. Native disabled inherits from disabled fieldsets except descendants of their first_legend; nested disabled fieldsets remain independently effective. aria_disabled is tri-state None/True/False and nearest explicit ancestor value wins, but never cancels native disabled. Return [native_effective,aria_effective,effective] for queried node, or None when missing. An explicit native-disabled node remains disabled even when inside an exempt legend. first_legend ID belongs to fieldset; all parent links exist or None.

split: open-access


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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and bool(row[3]): aria = row[3]
        if row[4] and row[2] and row[5] not in chain[:chain.index(ident)]: native = True
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] not in (None,False): aria = row[3]
        if row[4] and row[2] and row[5] not in chain[:chain.index(ident)]: native = True
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Explicit aria-disabled false is treated as missing.

Input preorder nodes [id,parent,native_disabled,aria_disabled,fieldset,first_legend] and queried ID. Native disabled inherits from disabled fieldsets except descendants of their first_legend; nested disabled fieldsets remain independently effective. aria_disabled is tri-state None/True/False and nearest explicit ancestor value wins, but never cancels native disabled. Return [native_effective,aria_effective,effective] for queried node, or None when missing. An explicit native-disabled node remains disabled even when inside an exempt legend. first_legend ID belongs to fieldset; all parent links exist or None.

split: open-access


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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if row[2] and row[5] not in chain[:chain.index(ident)]: native = True
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if (row[4] or ident != query) and row[2] and row[5] not in chain[:chain.index(ident)]: native = True
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Ordinary disabled containers disable every descendant.

Input preorder nodes [id,parent,native_disabled,aria_disabled,fieldset,first_legend] and queried ID. Native disabled inherits from disabled fieldsets except descendants of their first_legend; nested disabled fieldsets remain independently effective. aria_disabled is tri-state None/True/False and nearest explicit ancestor value wins, but never cancels native disabled. Return [native_effective,aria_effective,effective] for queried node, or None when missing. An explicit native-disabled node remains disabled even when inside an exempt legend. first_legend ID belongs to fieldset; all parent links exist or None.

split: open-access


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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if row[4] and row[5] not in chain[:chain.index(ident)]: native = True
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if row[4] and row[2] is not None and row[5] not in chain[:chain.index(ident)]: native = True
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Enabled fieldsets contribute a native disabled state.

Input preorder nodes [id,parent,native_disabled,aria_disabled,fieldset,first_legend] and queried ID. Native disabled inherits from disabled fieldsets except descendants of their first_legend; nested disabled fieldsets remain independently effective. aria_disabled is tri-state None/True/False and nearest explicit ancestor value wins, but never cancels native disabled. Return [native_effective,aria_effective,effective] for queried node, or None when missing. An explicit native-disabled node remains disabled even when inside an exempt legend. first_legend ID belongs to fieldset; all parent links exist or None.

split: open-access


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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if row[4] and row[2] and True: native = True
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if row[4] and row[2] and row[5] != query: native = True
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
First legend descendants lose their fieldset exemption.

Input preorder nodes [id,parent,native_disabled,aria_disabled,fieldset,first_legend] and queried ID. Native disabled inherits from disabled fieldsets except descendants of their first_legend; nested disabled fieldsets remain independently effective. aria_disabled is tri-state None/True/False and nearest explicit ancestor value wins, but never cancels native disabled. Return [native_effective,aria_effective,effective] for queried node, or None when missing. An explicit native-disabled node remains disabled even when inside an exempt legend. first_legend ID belongs to fieldset; all parent links exist or None.

split: open-access


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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if row[4] and row[2]: native = row[5] not in chain[:chain.index(ident)]
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if row[4] and row[2]: native = row[5] != query and row[5] not in chain[:chain.index(ident)]
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An outer legend exemption clears a nested disabled fieldset.

Input preorder nodes [id,parent,native_disabled,aria_disabled,fieldset,first_legend] and queried ID. Native disabled inherits from disabled fieldsets except descendants of their first_legend; nested disabled fieldsets remain independently effective. aria_disabled is tri-state None/True/False and nearest explicit ancestor value wins, but never cancels native disabled. Return [native_effective,aria_effective,effective] for queried node, or None when missing. An explicit native-disabled node remains disabled even when inside an exempt legend. first_legend ID belongs to fieldset; all parent links exist or None.

split: open-access


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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if row[4] and row[2] and row[5] not in chain[:chain.index(ident)]: native = True
    aria = False if aria is None else aria
    return [native,aria,aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if row[4] and row[2] and row[5] not in chain[:chain.index(ident)]: native = True
    aria = False if aria is None else aria
    return [native,aria,native and aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
ARIA override incorrectly cancels native disabled semantics.

Input preorder nodes [id,parent,native_disabled,aria_disabled,fieldset,first_legend] and queried ID. Native disabled inherits from disabled fieldsets except descendants of their first_legend; nested disabled fieldsets remain independently effective. aria_disabled is tri-state None/True/False and nearest explicit ancestor value wins, but never cancels native disabled. Return [native_effective,aria_effective,effective] for queried node, or None when missing. An explicit native-disabled node remains disabled even when inside an exempt legend. first_legend ID belongs to fieldset; all parent links exist or None.

split: open-access


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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if row[4] and row[2] and row[5] not in chain[:chain.index(ident)]: native = True
    aria = aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1]
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if row[4] and row[2] and row[5] not in chain[:chain.index(ident)]: native = True
    aria = True if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Missing disabled metadata is exposed as unknown instead of false.

Input preorder nodes [id,parent,native_disabled,aria_disabled,fieldset,first_legend] and queried ID. Native disabled inherits from disabled fieldsets except descendants of their first_legend; nested disabled fieldsets remain independently effective. aria_disabled is tri-state None/True/False and nearest explicit ancestor value wins, but never cancels native disabled. Return [native_effective,aria_effective,effective] for queried node, or None when missing. An explicit native-disabled node remains disabled even when inside an exempt legend. first_legend ID belongs to fieldset; all parent links exist or None.

split: open-access


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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1] if len(chain)<2 else None
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if row[4] and row[2] and row[5] not in chain[:chain.index(ident)]: native = True
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(data):
    nodes,query = data
    index = {row[0]:row for row in nodes}
    if query not in index: return None
    chain = []
    current = query
    while current is not None:
        chain.append(current)
        current = index[current][1] if len(chain)<1 else None
    native = bool(index[query][2])
    aria = None
    for ident in chain:
        row = index[ident]
        if aria is None and row[3] is not None: aria = row[3]
        if row[4] and row[2] and row[5] not in chain[:chain.index(ident)]: native = True
    aria = False if aria is None else aria
    return [native,aria,native or aria]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['f',None,True,None,True,'legend'],['legend','f',False,None,False,None],['x','legend',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 2', solve([[['f',None,True,None,True,'legend'],['x','f',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 3', solve([[['a',None,False,True,False,None],['b','a',False,False,False,None],['x','b',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 4', solve([[['a',None,False,True,False,None],['x','a',True,False,False,None]],'x'],), [True,False,True])
check('contract fixture 5', solve([[['a',None,False,True,False,None],[str(N),'a',False,None,False,None]],str(N)],), [False,True,True])
check('contract fixture 6', solve([[['f',None,True,None,True,'l'],['l','f',False,None,False,None],['nested','l',True,None,True,None],['x','nested',False,None,False,None]],'x'],), [True,False,True])
check('contract fixture 7', solve([[['parent',None,True,None,False,None],['x','parent',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 8', solve([[['f',None,False,None,True,None],['x','f',False,None,False,None]],'x'],), [False,False,False])
check('contract fixture 9', solve([[['a',None,False,True,False,None],['b','a',False,None,False,None],['x','b',False,None,False,None]],'x'],), [False,True,True])
check('contract fixture 10', solve([[['n0',None,False,True,False,None]]+[['n'+str(i),'n'+str(i-1),False,None,False,None] for i in range(1,N+3)],'n'+str(N+2)],), [False,True,True])
check('contract fixture 11', solve([[],'missing'],), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Disabled inheritance checks only the immediate container.

Input preorder nodes [id,parent,native_disabled,aria_disabled,fieldset,first_legend] and queried ID. Native disabled inherits from disabled fieldsets except descendants of their first_legend; nested disabled fieldsets remain independently effective. aria_disabled is tri-state None/True/False and nearest explicit ancestor value wins, but never cancels native disabled. Return [native_effective,aria_effective,effective] for queried node, or None when missing. An explicit native-disabled node remains disabled even when inside an exempt legend. first_legend ID belongs to fieldset; all parent links exist or None.

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(consumer,[]).append(provider)
    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 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(provider)
    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 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:
Name invalidation walks providers instead of their consumers.

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 True: 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 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 in ('name','description'): 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 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:
Description-only references invalidate cached names.

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': kind = 'text'
        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 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': kind = 'remove'
        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 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:
Style-only changes invalidate dependent accessible names.

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': 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 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.discard(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 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:
Style changes fail to invalidate their own computed name.

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 != 'text': 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 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',): 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 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:
Removed label providers do not invalidate consumers.

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 False: 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 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 == 'unknown': 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 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:
Nonsemantic mutations invalidate name caches.

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 or node not in cache: 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
        pending = [provider]
        seen = set()
        while pending:
            node = pending.pop()
            if node in seen or not cache.get(node): 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:
Name dependency traversal stops at uncached providers.

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)
            if node == provider: 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
        pending = [provider]
        seen = set()
        while pending:
            node = pending.pop()
            if node in seen: continue
            seen.add(node)
            invalid.add(node)
            if len(seen)<2: 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:
Name changes invalidate only direct references.

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