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

N = 1
observations = []
def solve(event, d):
    if event == 'visible': return d['ids']
    if event == 'eligible': return [x for x in d['ids'] if x not in d['disabled']]
    if event == 'commit': return d['active'] if d['active'] in d['ids'] and d['active'] not in d['disabled'] else None
    if event == 'reason': return d['reason'].get(d['active'])
    if event == 'selected': return None if d['value'] in d['disabled'] else d['value']
    if event == 'row-flags': return [x in d['disabled'] for x in d['ids']]
    if event == 'first-enabled': return next((x for x in d['ids'] if x not in d['disabled']),None)
    if event == 'status': return 'empty' if not d['ids'] else 'available' if any(x not in d['disabled'] for x in d['ids']) else 'unavailable'
    if event == 'validation': return d['value'] is None or d['value'] not in d['disabled']
    if event == 'revalidate': return {'active':None if d['active'] in d['disabled'] else d['active'],'epoch':d['epoch']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'ids':['a','b','c'],'disabled':['a','c'],'labels':['Same','Same','See'],'active':'a','value':'c','reason':{'a':'retired','c':'restricted'},'epoch':N}
boundary = {'ids':[],'disabled':[],'labels':[],'active':None,'value':None,'reason':{},'epoch':N}
check('normal visible', solve('visible', normal), ['a','b','c'])
check('boundary visible', solve('visible', boundary), [])
check('normal eligible', solve('eligible', normal), ['b'])
check('boundary eligible', solve('eligible', boundary), [])
check('normal commit', solve('commit', normal), None)
check('boundary commit', solve('commit', boundary), None)
check('normal reason', solve('reason', normal), 'retired')
check('boundary reason', solve('reason', boundary), None)
check('normal selected', solve('selected', normal), 'c')
check('boundary selected', solve('selected', boundary), None)
check('normal row-flags', solve('row-flags', normal), [True,False,True])
check('boundary row-flags', solve('row-flags', boundary), [])
check('normal first-enabled', solve('first-enabled', normal), 'b')
check('boundary first-enabled', solve('first-enabled', boundary), None)
check('normal status', solve('status', normal), 'available')
check('boundary status', solve('status', boundary), 'empty')
check('normal validation', solve('validation', normal), False)
check('boundary validation', solve('validation', boundary), True)
check('normal revalidate', solve('revalidate', normal), {'active':None,'epoch':N})
check('boundary revalidate', solve('revalidate', boundary), {'active':None,'epoch':N})
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('selected', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'visible': return d['ids']
    if event == 'eligible': return [x for x in d['ids'] if x not in d['disabled']]
    if event == 'commit': return d['active'] if d['active'] in d['ids'] and d['active'] not in d['disabled'] else None
    if event == 'reason': return d['reason'].get(d['active'])
    if event == 'selected': return d['active']
    if event == 'row-flags': return [x in d['disabled'] for x in d['ids']]
    if event == 'first-enabled': return next((x for x in d['ids'] if x not in d['disabled']),None)
    if event == 'status': return 'empty' if not d['ids'] else 'available' if any(x not in d['disabled'] for x in d['ids']) else 'unavailable'
    if event == 'validation': return d['value'] is None or d['value'] not in d['disabled']
    if event == 'revalidate': return {'active':None if d['active'] in d['disabled'] else d['active'],'epoch':d['epoch']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'ids':['a','b','c'],'disabled':['a','c'],'labels':['Same','Same','See'],'active':'a','value':'c','reason':{'a':'retired','c':'restricted'},'epoch':N}
boundary = {'ids':[],'disabled':[],'labels':[],'active':None,'value':None,'reason':{},'epoch':N}
check('normal visible', solve('visible', normal), ['a','b','c'])
check('boundary visible', solve('visible', boundary), [])
check('normal eligible', solve('eligible', normal), ['b'])
check('boundary eligible', solve('eligible', boundary), [])
check('normal commit', solve('commit', normal), None)
check('boundary commit', solve('commit', boundary), None)
check('normal reason', solve('reason', normal), 'retired')
check('boundary reason', solve('reason', boundary), None)
check('normal selected', solve('selected', normal), 'c')
check('boundary selected', solve('selected', boundary), None)
check('normal row-flags', solve('row-flags', normal), [True,False,True])
check('boundary row-flags', solve('row-flags', boundary), [])
check('normal first-enabled', solve('first-enabled', normal), 'b')
check('boundary first-enabled', solve('first-enabled', boundary), None)
check('normal status', solve('status', normal), 'available')
check('boundary status', solve('status', boundary), 'empty')
check('normal validation', solve('validation', normal), False)
check('boundary validation', solve('validation', boundary), True)
check('normal revalidate', solve('revalidate', normal), {'active':None,'epoch':N})
check('boundary revalidate', solve('revalidate', boundary), {'active':None,'epoch':N})
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('selected', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The selected completion transition produces an incorrect observable state.

Unavailable options remain visible with reasons but cannot be committed or auto-selected. Availability is attached to identity, not display text. A committed unavailable value remains represented for correction. Disabled-only responses are distinct from empty results.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'visible': return d['ids']
    if event == 'eligible': return [x for x in d['ids'] if x not in d['disabled']]
    if event == 'commit': return d['active'] if d['active'] in d['ids'] and d['active'] not in d['disabled'] else None
    if event == 'reason': return d['reason'].get(d['active'])
    if event == 'selected': return d['value']
    if event == 'row-flags': return [label in [d['labels'][d['ids'].index(x)] for x in d['disabled']] for label in d['labels']]
    if event == 'first-enabled': return next((x for x in d['ids'] if x not in d['disabled']),None)
    if event == 'status': return 'empty' if not d['ids'] else 'available' if any(x not in d['disabled'] for x in d['ids']) else 'unavailable'
    if event == 'validation': return d['value'] is None or d['value'] not in d['disabled']
    if event == 'revalidate': return {'active':None if d['active'] in d['disabled'] else d['active'],'epoch':d['epoch']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'ids':['a','b','c'],'disabled':['a','c'],'labels':['Same','Same','See'],'active':'a','value':'c','reason':{'a':'retired','c':'restricted'},'epoch':N}
boundary = {'ids':[],'disabled':[],'labels':[],'active':None,'value':None,'reason':{},'epoch':N}
check('normal visible', solve('visible', normal), ['a','b','c'])
check('boundary visible', solve('visible', boundary), [])
check('normal eligible', solve('eligible', normal), ['b'])
check('boundary eligible', solve('eligible', boundary), [])
check('normal commit', solve('commit', normal), None)
check('boundary commit', solve('commit', boundary), None)
check('normal reason', solve('reason', normal), 'retired')
check('boundary reason', solve('reason', boundary), None)
check('normal selected', solve('selected', normal), 'c')
check('boundary selected', solve('selected', boundary), None)
check('normal row-flags', solve('row-flags', normal), [True,False,True])
check('boundary row-flags', solve('row-flags', boundary), [])
check('normal first-enabled', solve('first-enabled', normal), 'b')
check('boundary first-enabled', solve('first-enabled', boundary), None)
check('normal status', solve('status', normal), 'available')
check('boundary status', solve('status', boundary), 'empty')
check('normal validation', solve('validation', normal), False)
check('boundary validation', solve('validation', boundary), True)
check('normal revalidate', solve('revalidate', normal), {'active':None,'epoch':N})
check('boundary revalidate', solve('revalidate', boundary), {'active':None,'epoch':N})
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('selected', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'visible': return d['ids']
    if event == 'eligible': return [x for x in d['ids'] if x not in d['disabled']]
    if event == 'commit': return d['active'] if d['active'] in d['ids'] and d['active'] not in d['disabled'] else None
    if event == 'reason': return d['reason'].get(d['active'])
    if event == 'selected': return d['value']
    if event == 'row-flags': return [False for x in d['ids']]
    if event == 'first-enabled': return next((x for x in d['ids'] if x not in d['disabled']),None)
    if event == 'status': return 'empty' if not d['ids'] else 'available' if any(x not in d['disabled'] for x in d['ids']) else 'unavailable'
    if event == 'validation': return d['value'] is None or d['value'] not in d['disabled']
    if event == 'revalidate': return {'active':None if d['active'] in d['disabled'] else d['active'],'epoch':d['epoch']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'ids':['a','b','c'],'disabled':['a','c'],'labels':['Same','Same','See'],'active':'a','value':'c','reason':{'a':'retired','c':'restricted'},'epoch':N}
boundary = {'ids':[],'disabled':[],'labels':[],'active':None,'value':None,'reason':{},'epoch':N}
check('normal visible', solve('visible', normal), ['a','b','c'])
check('boundary visible', solve('visible', boundary), [])
check('normal eligible', solve('eligible', normal), ['b'])
check('boundary eligible', solve('eligible', boundary), [])
check('normal commit', solve('commit', normal), None)
check('boundary commit', solve('commit', boundary), None)
check('normal reason', solve('reason', normal), 'retired')
check('boundary reason', solve('reason', boundary), None)
check('normal selected', solve('selected', normal), 'c')
check('boundary selected', solve('selected', boundary), None)
check('normal row-flags', solve('row-flags', normal), [True,False,True])
check('boundary row-flags', solve('row-flags', boundary), [])
check('normal first-enabled', solve('first-enabled', normal), 'b')
check('boundary first-enabled', solve('first-enabled', boundary), None)
check('normal status', solve('status', normal), 'available')
check('boundary status', solve('status', boundary), 'empty')
check('normal validation', solve('validation', normal), False)
check('boundary validation', solve('validation', boundary), True)
check('normal revalidate', solve('revalidate', normal), {'active':None,'epoch':N})
check('boundary revalidate', solve('revalidate', boundary), {'active':None,'epoch':N})
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('selected', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The row-flags completion transition produces an incorrect observable state.

Unavailable options remain visible with reasons but cannot be committed or auto-selected. Availability is attached to identity, not display text. A committed unavailable value remains represented for correction. Disabled-only responses are distinct from empty results.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'visible': return d['ids']
    if event == 'eligible': return [x for x in d['ids'] if x not in d['disabled']]
    if event == 'commit': return d['active'] if d['active'] in d['ids'] and d['active'] not in d['disabled'] else None
    if event == 'reason': return d['reason'].get(d['active'])
    if event == 'selected': return d['value']
    if event == 'row-flags': return [x in d['disabled'] for x in d['ids']]
    if event == 'first-enabled': return next(iter(d['ids']),None)
    if event == 'status': return 'empty' if not d['ids'] else 'available' if any(x not in d['disabled'] for x in d['ids']) else 'unavailable'
    if event == 'validation': return d['value'] is None or d['value'] not in d['disabled']
    if event == 'revalidate': return {'active':None if d['active'] in d['disabled'] else d['active'],'epoch':d['epoch']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'ids':['a','b','c'],'disabled':['a','c'],'labels':['Same','Same','See'],'active':'a','value':'c','reason':{'a':'retired','c':'restricted'},'epoch':N}
boundary = {'ids':[],'disabled':[],'labels':[],'active':None,'value':None,'reason':{},'epoch':N}
check('normal visible', solve('visible', normal), ['a','b','c'])
check('boundary visible', solve('visible', boundary), [])
check('normal eligible', solve('eligible', normal), ['b'])
check('boundary eligible', solve('eligible', boundary), [])
check('normal commit', solve('commit', normal), None)
check('boundary commit', solve('commit', boundary), None)
check('normal reason', solve('reason', normal), 'retired')
check('boundary reason', solve('reason', boundary), None)
check('normal selected', solve('selected', normal), 'c')
check('boundary selected', solve('selected', boundary), None)
check('normal row-flags', solve('row-flags', normal), [True,False,True])
check('boundary row-flags', solve('row-flags', boundary), [])
check('normal first-enabled', solve('first-enabled', normal), 'b')
check('boundary first-enabled', solve('first-enabled', boundary), None)
check('normal status', solve('status', normal), 'available')
check('boundary status', solve('status', boundary), 'empty')
check('normal validation', solve('validation', normal), False)
check('boundary validation', solve('validation', boundary), True)
check('normal revalidate', solve('revalidate', normal), {'active':None,'epoch':N})
check('boundary revalidate', solve('revalidate', boundary), {'active':None,'epoch':N})
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('selected', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'visible': return d['ids']
    if event == 'eligible': return [x for x in d['ids'] if x not in d['disabled']]
    if event == 'commit': return d['active'] if d['active'] in d['ids'] and d['active'] not in d['disabled'] else None
    if event == 'reason': return d['reason'].get(d['active'])
    if event == 'selected': return d['value']
    if event == 'row-flags': return [x in d['disabled'] for x in d['ids']]
    if event == 'first-enabled': return next(iter(reversed(d['ids'])),None)
    if event == 'status': return 'empty' if not d['ids'] else 'available' if any(x not in d['disabled'] for x in d['ids']) else 'unavailable'
    if event == 'validation': return d['value'] is None or d['value'] not in d['disabled']
    if event == 'revalidate': return {'active':None if d['active'] in d['disabled'] else d['active'],'epoch':d['epoch']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'ids':['a','b','c'],'disabled':['a','c'],'labels':['Same','Same','See'],'active':'a','value':'c','reason':{'a':'retired','c':'restricted'},'epoch':N}
boundary = {'ids':[],'disabled':[],'labels':[],'active':None,'value':None,'reason':{},'epoch':N}
check('normal visible', solve('visible', normal), ['a','b','c'])
check('boundary visible', solve('visible', boundary), [])
check('normal eligible', solve('eligible', normal), ['b'])
check('boundary eligible', solve('eligible', boundary), [])
check('normal commit', solve('commit', normal), None)
check('boundary commit', solve('commit', boundary), None)
check('normal reason', solve('reason', normal), 'retired')
check('boundary reason', solve('reason', boundary), None)
check('normal selected', solve('selected', normal), 'c')
check('boundary selected', solve('selected', boundary), None)
check('normal row-flags', solve('row-flags', normal), [True,False,True])
check('boundary row-flags', solve('row-flags', boundary), [])
check('normal first-enabled', solve('first-enabled', normal), 'b')
check('boundary first-enabled', solve('first-enabled', boundary), None)
check('normal status', solve('status', normal), 'available')
check('boundary status', solve('status', boundary), 'empty')
check('normal validation', solve('validation', normal), False)
check('boundary validation', solve('validation', boundary), True)
check('normal revalidate', solve('revalidate', normal), {'active':None,'epoch':N})
check('boundary revalidate', solve('revalidate', boundary), {'active':None,'epoch':N})
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('selected', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The first-enabled completion transition produces an incorrect observable state.

Unavailable options remain visible with reasons but cannot be committed or auto-selected. Availability is attached to identity, not display text. A committed unavailable value remains represented for correction. Disabled-only responses are distinct from empty results.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'visible': return d['ids']
    if event == 'eligible': return [x for x in d['ids'] if x not in d['disabled']]
    if event == 'commit': return d['active'] if d['active'] in d['ids'] and d['active'] not in d['disabled'] else None
    if event == 'reason': return d['reason'].get(d['active'])
    if event == 'selected': return d['value']
    if event == 'row-flags': return [x in d['disabled'] for x in d['ids']]
    if event == 'first-enabled': return next((x for x in d['ids'] if x not in d['disabled']),None)
    if event == 'status': return 'unavailable' if d['disabled'] else 'available'
    if event == 'validation': return d['value'] is None or d['value'] not in d['disabled']
    if event == 'revalidate': return {'active':None if d['active'] in d['disabled'] else d['active'],'epoch':d['epoch']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'ids':['a','b','c'],'disabled':['a','c'],'labels':['Same','Same','See'],'active':'a','value':'c','reason':{'a':'retired','c':'restricted'},'epoch':N}
boundary = {'ids':[],'disabled':[],'labels':[],'active':None,'value':None,'reason':{},'epoch':N}
check('normal visible', solve('visible', normal), ['a','b','c'])
check('boundary visible', solve('visible', boundary), [])
check('normal eligible', solve('eligible', normal), ['b'])
check('boundary eligible', solve('eligible', boundary), [])
check('normal commit', solve('commit', normal), None)
check('boundary commit', solve('commit', boundary), None)
check('normal reason', solve('reason', normal), 'retired')
check('boundary reason', solve('reason', boundary), None)
check('normal selected', solve('selected', normal), 'c')
check('boundary selected', solve('selected', boundary), None)
check('normal row-flags', solve('row-flags', normal), [True,False,True])
check('boundary row-flags', solve('row-flags', boundary), [])
check('normal first-enabled', solve('first-enabled', normal), 'b')
check('boundary first-enabled', solve('first-enabled', boundary), None)
check('normal status', solve('status', normal), 'available')
check('boundary status', solve('status', boundary), 'empty')
check('normal validation', solve('validation', normal), False)
check('boundary validation', solve('validation', boundary), True)
check('normal revalidate', solve('revalidate', normal), {'active':None,'epoch':N})
check('boundary revalidate', solve('revalidate', boundary), {'active':None,'epoch':N})
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('selected', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'visible': return d['ids']
    if event == 'eligible': return [x for x in d['ids'] if x not in d['disabled']]
    if event == 'commit': return d['active'] if d['active'] in d['ids'] and d['active'] not in d['disabled'] else None
    if event == 'reason': return d['reason'].get(d['active'])
    if event == 'selected': return d['value']
    if event == 'row-flags': return [x in d['disabled'] for x in d['ids']]
    if event == 'first-enabled': return next((x for x in d['ids'] if x not in d['disabled']),None)
    if event == 'status': return 'available'
    if event == 'validation': return d['value'] is None or d['value'] not in d['disabled']
    if event == 'revalidate': return {'active':None if d['active'] in d['disabled'] else d['active'],'epoch':d['epoch']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'ids':['a','b','c'],'disabled':['a','c'],'labels':['Same','Same','See'],'active':'a','value':'c','reason':{'a':'retired','c':'restricted'},'epoch':N}
boundary = {'ids':[],'disabled':[],'labels':[],'active':None,'value':None,'reason':{},'epoch':N}
check('normal visible', solve('visible', normal), ['a','b','c'])
check('boundary visible', solve('visible', boundary), [])
check('normal eligible', solve('eligible', normal), ['b'])
check('boundary eligible', solve('eligible', boundary), [])
check('normal commit', solve('commit', normal), None)
check('boundary commit', solve('commit', boundary), None)
check('normal reason', solve('reason', normal), 'retired')
check('boundary reason', solve('reason', boundary), None)
check('normal selected', solve('selected', normal), 'c')
check('boundary selected', solve('selected', boundary), None)
check('normal row-flags', solve('row-flags', normal), [True,False,True])
check('boundary row-flags', solve('row-flags', boundary), [])
check('normal first-enabled', solve('first-enabled', normal), 'b')
check('boundary first-enabled', solve('first-enabled', boundary), None)
check('normal status', solve('status', normal), 'available')
check('boundary status', solve('status', boundary), 'empty')
check('normal validation', solve('validation', normal), False)
check('boundary validation', solve('validation', boundary), True)
check('normal revalidate', solve('revalidate', normal), {'active':None,'epoch':N})
check('boundary revalidate', solve('revalidate', boundary), {'active':None,'epoch':N})
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('selected', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The status completion transition produces an incorrect observable state.

Unavailable options remain visible with reasons but cannot be committed or auto-selected. Availability is attached to identity, not display text. A committed unavailable value remains represented for correction. Disabled-only responses are distinct from empty results.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'visible': return d['ids']
    if event == 'eligible': return [x for x in d['ids'] if x not in d['disabled']]
    if event == 'commit': return d['active'] if d['active'] in d['ids'] and d['active'] not in d['disabled'] else None
    if event == 'reason': return d['reason'].get(d['active'])
    if event == 'selected': return d['value']
    if event == 'row-flags': return [x in d['disabled'] for x in d['ids']]
    if event == 'first-enabled': return next((x for x in d['ids'] if x not in d['disabled']),None)
    if event == 'status': return 'empty' if not d['ids'] else 'available' if any(x not in d['disabled'] for x in d['ids']) else 'unavailable'
    if event == 'validation': return d['value'] is None or d['value'] in d['ids']
    if event == 'revalidate': return {'active':None if d['active'] in d['disabled'] else d['active'],'epoch':d['epoch']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'ids':['a','b','c'],'disabled':['a','c'],'labels':['Same','Same','See'],'active':'a','value':'c','reason':{'a':'retired','c':'restricted'},'epoch':N}
boundary = {'ids':[],'disabled':[],'labels':[],'active':None,'value':None,'reason':{},'epoch':N}
check('normal visible', solve('visible', normal), ['a','b','c'])
check('boundary visible', solve('visible', boundary), [])
check('normal eligible', solve('eligible', normal), ['b'])
check('boundary eligible', solve('eligible', boundary), [])
check('normal commit', solve('commit', normal), None)
check('boundary commit', solve('commit', boundary), None)
check('normal reason', solve('reason', normal), 'retired')
check('boundary reason', solve('reason', boundary), None)
check('normal selected', solve('selected', normal), 'c')
check('boundary selected', solve('selected', boundary), None)
check('normal row-flags', solve('row-flags', normal), [True,False,True])
check('boundary row-flags', solve('row-flags', boundary), [])
check('normal first-enabled', solve('first-enabled', normal), 'b')
check('boundary first-enabled', solve('first-enabled', boundary), None)
check('normal status', solve('status', normal), 'available')
check('boundary status', solve('status', boundary), 'empty')
check('normal validation', solve('validation', normal), False)
check('boundary validation', solve('validation', boundary), True)
check('normal revalidate', solve('revalidate', normal), {'active':None,'epoch':N})
check('boundary revalidate', solve('revalidate', boundary), {'active':None,'epoch':N})
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('selected', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'visible': return d['ids']
    if event == 'eligible': return [x for x in d['ids'] if x not in d['disabled']]
    if event == 'commit': return d['active'] if d['active'] in d['ids'] and d['active'] not in d['disabled'] else None
    if event == 'reason': return d['reason'].get(d['active'])
    if event == 'selected': return d['value']
    if event == 'row-flags': return [x in d['disabled'] for x in d['ids']]
    if event == 'first-enabled': return next((x for x in d['ids'] if x not in d['disabled']),None)
    if event == 'status': return 'empty' if not d['ids'] else 'available' if any(x not in d['disabled'] for x in d['ids']) else 'unavailable'
    if event == 'validation': return True
    if event == 'revalidate': return {'active':None if d['active'] in d['disabled'] else d['active'],'epoch':d['epoch']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'ids':['a','b','c'],'disabled':['a','c'],'labels':['Same','Same','See'],'active':'a','value':'c','reason':{'a':'retired','c':'restricted'},'epoch':N}
boundary = {'ids':[],'disabled':[],'labels':[],'active':None,'value':None,'reason':{},'epoch':N}
check('normal visible', solve('visible', normal), ['a','b','c'])
check('boundary visible', solve('visible', boundary), [])
check('normal eligible', solve('eligible', normal), ['b'])
check('boundary eligible', solve('eligible', boundary), [])
check('normal commit', solve('commit', normal), None)
check('boundary commit', solve('commit', boundary), None)
check('normal reason', solve('reason', normal), 'retired')
check('boundary reason', solve('reason', boundary), None)
check('normal selected', solve('selected', normal), 'c')
check('boundary selected', solve('selected', boundary), None)
check('normal row-flags', solve('row-flags', normal), [True,False,True])
check('boundary row-flags', solve('row-flags', boundary), [])
check('normal first-enabled', solve('first-enabled', normal), 'b')
check('boundary first-enabled', solve('first-enabled', boundary), None)
check('normal status', solve('status', normal), 'available')
check('boundary status', solve('status', boundary), 'empty')
check('normal validation', solve('validation', normal), False)
check('boundary validation', solve('validation', boundary), True)
check('normal revalidate', solve('revalidate', normal), {'active':None,'epoch':N})
check('boundary revalidate', solve('revalidate', boundary), {'active':None,'epoch':N})
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('selected', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The validation completion transition produces an incorrect observable state.

Unavailable options remain visible with reasons but cannot be committed or auto-selected. Availability is attached to identity, not display text. A committed unavailable value remains represented for correction. Disabled-only responses are distinct from empty results.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'visible': return d['ids']
    if event == 'eligible': return [x for x in d['ids'] if x not in d['disabled']]
    if event == 'commit': return d['active'] if d['active'] in d['ids'] and d['active'] not in d['disabled'] else None
    if event == 'reason': return d['reason'].get(d['active'])
    if event == 'selected': return d['value']
    if event == 'row-flags': return [x in d['disabled'] for x in d['ids']]
    if event == 'first-enabled': return next((x for x in d['ids'] if x not in d['disabled']),None)
    if event == 'status': return 'empty' if not d['ids'] else 'available' if any(x not in d['disabled'] for x in d['ids']) else 'unavailable'
    if event == 'validation': return d['value'] is None or d['value'] not in d['disabled']
    if event == 'revalidate': return {'active':d['active'],'epoch':d['epoch']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'ids':['a','b','c'],'disabled':['a','c'],'labels':['Same','Same','See'],'active':'a','value':'c','reason':{'a':'retired','c':'restricted'},'epoch':N}
boundary = {'ids':[],'disabled':[],'labels':[],'active':None,'value':None,'reason':{},'epoch':N}
check('normal visible', solve('visible', normal), ['a','b','c'])
check('boundary visible', solve('visible', boundary), [])
check('normal eligible', solve('eligible', normal), ['b'])
check('boundary eligible', solve('eligible', boundary), [])
check('normal commit', solve('commit', normal), None)
check('boundary commit', solve('commit', boundary), None)
check('normal reason', solve('reason', normal), 'retired')
check('boundary reason', solve('reason', boundary), None)
check('normal selected', solve('selected', normal), 'c')
check('boundary selected', solve('selected', boundary), None)
check('normal row-flags', solve('row-flags', normal), [True,False,True])
check('boundary row-flags', solve('row-flags', boundary), [])
check('normal first-enabled', solve('first-enabled', normal), 'b')
check('boundary first-enabled', solve('first-enabled', boundary), None)
check('normal status', solve('status', normal), 'available')
check('boundary status', solve('status', boundary), 'empty')
check('normal validation', solve('validation', normal), False)
check('boundary validation', solve('validation', boundary), True)
check('normal revalidate', solve('revalidate', normal), {'active':None,'epoch':N})
check('boundary revalidate', solve('revalidate', boundary), {'active':None,'epoch':N})
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('selected', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'visible': return d['ids']
    if event == 'eligible': return [x for x in d['ids'] if x not in d['disabled']]
    if event == 'commit': return d['active'] if d['active'] in d['ids'] and d['active'] not in d['disabled'] else None
    if event == 'reason': return d['reason'].get(d['active'])
    if event == 'selected': return d['value']
    if event == 'row-flags': return [x in d['disabled'] for x in d['ids']]
    if event == 'first-enabled': return next((x for x in d['ids'] if x not in d['disabled']),None)
    if event == 'status': return 'empty' if not d['ids'] else 'available' if any(x not in d['disabled'] for x in d['ids']) else 'unavailable'
    if event == 'validation': return d['value'] is None or d['value'] not in d['disabled']
    if event == 'revalidate': return {'active':None,'epoch':d['epoch']+1}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'ids':['a','b','c'],'disabled':['a','c'],'labels':['Same','Same','See'],'active':'a','value':'c','reason':{'a':'retired','c':'restricted'},'epoch':N}
boundary = {'ids':[],'disabled':[],'labels':[],'active':None,'value':None,'reason':{},'epoch':N}
check('normal visible', solve('visible', normal), ['a','b','c'])
check('boundary visible', solve('visible', boundary), [])
check('normal eligible', solve('eligible', normal), ['b'])
check('boundary eligible', solve('eligible', boundary), [])
check('normal commit', solve('commit', normal), None)
check('boundary commit', solve('commit', boundary), None)
check('normal reason', solve('reason', normal), 'retired')
check('boundary reason', solve('reason', boundary), None)
check('normal selected', solve('selected', normal), 'c')
check('boundary selected', solve('selected', boundary), None)
check('normal row-flags', solve('row-flags', normal), [True,False,True])
check('boundary row-flags', solve('row-flags', boundary), [])
check('normal first-enabled', solve('first-enabled', normal), 'b')
check('boundary first-enabled', solve('first-enabled', boundary), None)
check('normal status', solve('status', normal), 'available')
check('boundary status', solve('status', boundary), 'empty')
check('normal validation', solve('validation', normal), False)
check('boundary validation', solve('validation', boundary), True)
check('normal revalidate', solve('revalidate', normal), {'active':None,'epoch':N})
check('boundary revalidate', solve('revalidate', boundary), {'active':None,'epoch':N})
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('selected', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The revalidate completion transition produces an incorrect observable state.

Unavailable options remain visible with reasons but cannot be committed or auto-selected. Availability is attached to identity, not display text. A committed unavailable value remains represented for correction. Disabled-only responses are distinct from empty results.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'initial': return d['pending']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial': return not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The initial completion transition produces an incorrect observable state.

A loading snapshot distinguishes initial loading, background refreshing, settled-empty, error and cancellation. Only settled successful empty responses show no-results. Existing rows may remain visible during refresh but are bound to the draft they represent; stale errors never overwrite a newer query status.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return False
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and not d['rows']
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The refreshing completion transition produces an incorrect observable state.

A loading snapshot distinguishes initial loading, background refreshing, settled-empty, error and cancellation. Only settled successful empty responses show no-results. Existing rows may remain visible during refresh but are bound to the draft they represent; stale errors never overwrite a newer query status.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return not d['rows'] and bool(d['query'])
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return not d['rows'] and d['pending']
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The empty completion transition produces an incorrect observable state.

A loading snapshot distinguishes initial loading, background refreshing, settled-empty, error and cancellation. Only settled successful empty responses show no-results. Existing rows may remain visible during refresh but are bound to the draft they represent; stale errors never overwrite a newer query status.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error']
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']<=d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The error completion transition produces an incorrect observable state.

A loading snapshot distinguishes initial loading, background refreshing, settled-empty, error and cancellation. Only settled successful empty responses show no-results. Existing rows may remain visible during refresh but are bound to the draft they represent; stale errors never overwrite a newer query status.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows']
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['query'].startswith(d['rows_query']) else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The selectable completion transition produces an incorrect observable state.

A loading snapshot distinguishes initial loading, background refreshing, settled-empty, error and cancellation. Only settled successful empty responses show no-results. Existing rows may remain visible during refresh but are bound to the draft they represent; stale errors never overwrite a newer query status.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return 'cancelled' if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The cancel completion transition produces an incorrect observable state.

A loading snapshot distinguishes initial loading, background refreshing, settled-empty, error and cancellation. Only settled successful empty responses show no-results. Existing rows may remain visible during refresh but are bound to the draft they represent; stale errors never overwrite a newer query status.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending'] or d['settled']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return True
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The busy completion transition produces an incorrect observable state.

A loading snapshot distinguishes initial loading, background refreshing, settled-empty, error and cancellation. Only settled successful empty responses show no-results. Existing rows may remain visible during refresh but are bound to the draft they represent; stale errors never overwrite a newer query status.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return [] if d['pending'] else d['rows']
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return []
    if event == 'status-priority': return 'error' if d['error'] else 'loading' if d['pending'] else 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The preserve completion transition produces an incorrect observable state.

A loading snapshot distinguishes initial loading, background refreshing, settled-empty, error and cancellation. Only settled successful empty responses show no-results. Existing rows may remain visible during refresh but are bound to the draft they represent; stale errors never overwrite a newer query status.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'loading' if d['pending'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial': return d['pending'] and not d['rows']
    if event == 'refreshing': return d['pending'] and bool(d['rows'])
    if event == 'empty': return d['settled'] and not d['pending'] and not d['rows'] and d['error'] is None
    if event == 'error': return d['error'] if d['error_epoch']==d['epoch'] else None
    if event == 'selectable': return d['rows'] if d['rows_query']==d['query'] else []
    if event == 'cancel': return None if d['cancelled'] else d['error']
    if event == 'busy': return d['pending']
    if event == 'preserve': return d['rows']
    if event == 'status-priority': return 'empty' if not d['rows'] else 'results'
    if event == 'retry-label': return {'query':d['query'],'error':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'pending':True,'rows':['a'],'query':'pe','rows_query':'p','error':'timeout','error_epoch':N-1,'epoch':N,'settled':False,'cancelled':True}
boundary = {'pending':False,'rows':[],'query':'','rows_query':'','error':None,'error_epoch':N,'epoch':N,'settled':True,'cancelled':False}
check('normal initial', solve('initial', normal), False)
check('boundary initial', solve('initial', boundary), False)
check('normal refreshing', solve('refreshing', normal), True)
check('boundary refreshing', solve('refreshing', boundary), False)
check('normal empty', solve('empty', normal), False)
check('boundary empty', solve('empty', boundary), True)
check('normal error', solve('error', normal), None)
check('boundary error', solve('error', boundary), None)
check('normal selectable', solve('selectable', normal), [])
check('boundary selectable', solve('selectable', boundary), [])
check('normal cancel', solve('cancel', normal), None)
check('boundary cancel', solve('cancel', boundary), None)
check('normal busy', solve('busy', normal), True)
check('boundary busy', solve('busy', boundary), False)
check('normal preserve', solve('preserve', normal), ['a'])
check('boundary preserve', solve('preserve', boundary), [])
check('normal status-priority', solve('status-priority', normal), 'error')
check('boundary status-priority', solve('status-priority', boundary), 'empty')
check('normal retry-label', solve('retry-label', normal), {'query':'pe','error':'timeout'})
check('boundary retry-label', solve('retry-label', boundary), {'query':'','error':None})
variant = dict(normal, **{'query':'q'*N})
check('variant query or selection payload', solve('retry-label', variant), {'query':'q'*N,'error':'timeout'})
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The status-priority completion transition produces an incorrect observable state.

A loading snapshot distinguishes initial loading, background refreshing, settled-empty, error and cancellation. Only settled successful empty responses show no-results. Existing rows may remain visible during refresh but are bound to the draft they represent; stale errors never overwrite a newer query status.

split: open-access