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

N = 1
observations = []
def solve(event, d):
    if event == 'trim': return d['draft'].strip()
    if event == 'exact': return d['draft'].strip().casefold() in [x.casefold() for x in d['labels']]
    if event == 'nonempty': return bool(d['draft'].strip())
    if event == 'permission': return d['allow']
    if event == 'busy': return not d['pending']
    if event == 'row-id': return d['draft'].strip()
    if event == 'resolve': return d['persisted']
    if event == 'failure': return {'draft':d['draft'],'error':d['error'],'pending':False}
    if event == 'pending-value': return None if d['pending'] else d['persisted']
    if event == 'retry': return {'text':d['draft'].strip(),'query_epoch':d['query_epoch']+1}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'  Plum  ','labels':['Pear','plum'],'allow':True,'pending':True,'temporary':'tmp:'+str(N),'persisted':'p'+str(N),'error':'rejected','query_epoch':N}
boundary = {'draft':'   ','labels':[],'allow':False,'pending':False,'temporary':'tmp:'+str(N),'persisted':'','error':None,'query_epoch':N}
check('normal trim', solve('trim', normal), 'Plum')
check('boundary trim', solve('trim', boundary), '')
check('normal exact', solve('exact', normal), True)
check('boundary exact', solve('exact', boundary), False)
check('normal nonempty', solve('nonempty', normal), True)
check('boundary nonempty', solve('nonempty', boundary), False)
check('normal permission', solve('permission', normal), True)
check('boundary permission', solve('permission', boundary), False)
check('normal busy', solve('busy', normal), False)
check('boundary busy', solve('busy', boundary), True)
check('normal row-id', solve('row-id', normal), 'create:Plum')
check('boundary row-id', solve('row-id', boundary), 'create:')
check('normal resolve', solve('resolve', normal), 'p'+str(N))
check('boundary resolve', solve('resolve', boundary), '')
check('normal failure', solve('failure', normal), {'draft':'  Plum  ','error':'rejected','pending':False})
check('boundary failure', solve('failure', boundary), {'draft':'   ','error':None,'pending':False})
check('normal pending-value', solve('pending-value', normal), None)
check('boundary pending-value', solve('pending-value', boundary), '')
check('normal retry', solve('retry', normal), {'text':'Plum','query_epoch':N+1})
check('boundary retry', solve('retry', boundary), {'text':'','query_epoch':N+1})
variant = dict(normal, **{'draft':' '*N+'Plum'+' '*N})
check('variant query or selection payload', solve('trim', variant), 'Plum')
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 == 'trim': return d['draft'].strip()
    if event == 'exact': return d['draft'].strip().casefold() in [x.casefold() for x in d['labels']]
    if event == 'nonempty': return bool(d['draft'].strip())
    if event == 'permission': return d['allow']
    if event == 'busy': return not d['pending']
    if event == 'row-id': return d['temporary']
    if event == 'resolve': return d['persisted']
    if event == 'failure': return {'draft':d['draft'],'error':d['error'],'pending':False}
    if event == 'pending-value': return None if d['pending'] else d['persisted']
    if event == 'retry': return {'text':d['draft'].strip(),'query_epoch':d['query_epoch']+1}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'  Plum  ','labels':['Pear','plum'],'allow':True,'pending':True,'temporary':'tmp:'+str(N),'persisted':'p'+str(N),'error':'rejected','query_epoch':N}
boundary = {'draft':'   ','labels':[],'allow':False,'pending':False,'temporary':'tmp:'+str(N),'persisted':'','error':None,'query_epoch':N}
check('normal trim', solve('trim', normal), 'Plum')
check('boundary trim', solve('trim', boundary), '')
check('normal exact', solve('exact', normal), True)
check('boundary exact', solve('exact', boundary), False)
check('normal nonempty', solve('nonempty', normal), True)
check('boundary nonempty', solve('nonempty', boundary), False)
check('normal permission', solve('permission', normal), True)
check('boundary permission', solve('permission', boundary), False)
check('normal busy', solve('busy', normal), False)
check('boundary busy', solve('busy', boundary), True)
check('normal row-id', solve('row-id', normal), 'create:Plum')
check('boundary row-id', solve('row-id', boundary), 'create:')
check('normal resolve', solve('resolve', normal), 'p'+str(N))
check('boundary resolve', solve('resolve', boundary), '')
check('normal failure', solve('failure', normal), {'draft':'  Plum  ','error':'rejected','pending':False})
check('boundary failure', solve('failure', boundary), {'draft':'   ','error':None,'pending':False})
check('normal pending-value', solve('pending-value', normal), None)
check('boundary pending-value', solve('pending-value', boundary), '')
check('normal retry', solve('retry', normal), {'text':'Plum','query_epoch':N+1})
check('boundary retry', solve('retry', boundary), {'text':'','query_epoch':N+1})
variant = dict(normal, **{'draft':' '*N+'Plum'+' '*N})
check('variant query or selection payload', solve('trim', variant), 'Plum')
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-id completion transition produces an incorrect observable state.

This picker may create a new option from trimmed draft only when creation is enabled, the draft is nonempty, no case-insensitive exact label exists, and no create transaction is pending. Synthetic create rows carry a distinct namespace and raw text is never mistaken for a persisted identifier.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'trim': return d['draft'].strip()
    if event == 'exact': return d['draft'].strip().casefold() in [x.casefold() for x in d['labels']]
    if event == 'nonempty': return bool(d['draft'].strip())
    if event == 'permission': return d['allow']
    if event == 'busy': return not d['pending']
    if event == 'row-id': return 'create:'+d['draft'].strip()
    if event == 'resolve': return d['temporary']
    if event == 'failure': return {'draft':d['draft'],'error':d['error'],'pending':False}
    if event == 'pending-value': return None if d['pending'] else d['persisted']
    if event == 'retry': return {'text':d['draft'].strip(),'query_epoch':d['query_epoch']+1}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'  Plum  ','labels':['Pear','plum'],'allow':True,'pending':True,'temporary':'tmp:'+str(N),'persisted':'p'+str(N),'error':'rejected','query_epoch':N}
boundary = {'draft':'   ','labels':[],'allow':False,'pending':False,'temporary':'tmp:'+str(N),'persisted':'','error':None,'query_epoch':N}
check('normal trim', solve('trim', normal), 'Plum')
check('boundary trim', solve('trim', boundary), '')
check('normal exact', solve('exact', normal), True)
check('boundary exact', solve('exact', boundary), False)
check('normal nonempty', solve('nonempty', normal), True)
check('boundary nonempty', solve('nonempty', boundary), False)
check('normal permission', solve('permission', normal), True)
check('boundary permission', solve('permission', boundary), False)
check('normal busy', solve('busy', normal), False)
check('boundary busy', solve('busy', boundary), True)
check('normal row-id', solve('row-id', normal), 'create:Plum')
check('boundary row-id', solve('row-id', boundary), 'create:')
check('normal resolve', solve('resolve', normal), 'p'+str(N))
check('boundary resolve', solve('resolve', boundary), '')
check('normal failure', solve('failure', normal), {'draft':'  Plum  ','error':'rejected','pending':False})
check('boundary failure', solve('failure', boundary), {'draft':'   ','error':None,'pending':False})
check('normal pending-value', solve('pending-value', normal), None)
check('boundary pending-value', solve('pending-value', boundary), '')
check('normal retry', solve('retry', normal), {'text':'Plum','query_epoch':N+1})
check('boundary retry', solve('retry', boundary), {'text':'','query_epoch':N+1})
variant = dict(normal, **{'draft':' '*N+'Plum'+' '*N})
check('variant query or selection payload', solve('trim', variant), 'Plum')
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 == 'trim': return d['draft'].strip()
    if event == 'exact': return d['draft'].strip().casefold() in [x.casefold() for x in d['labels']]
    if event == 'nonempty': return bool(d['draft'].strip())
    if event == 'permission': return d['allow']
    if event == 'busy': return not d['pending']
    if event == 'row-id': return 'create:'+d['draft'].strip()
    if event == 'resolve': return d['persisted'] or d['temporary']
    if event == 'failure': return {'draft':d['draft'],'error':d['error'],'pending':False}
    if event == 'pending-value': return None if d['pending'] else d['persisted']
    if event == 'retry': return {'text':d['draft'].strip(),'query_epoch':d['query_epoch']+1}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'  Plum  ','labels':['Pear','plum'],'allow':True,'pending':True,'temporary':'tmp:'+str(N),'persisted':'p'+str(N),'error':'rejected','query_epoch':N}
boundary = {'draft':'   ','labels':[],'allow':False,'pending':False,'temporary':'tmp:'+str(N),'persisted':'','error':None,'query_epoch':N}
check('normal trim', solve('trim', normal), 'Plum')
check('boundary trim', solve('trim', boundary), '')
check('normal exact', solve('exact', normal), True)
check('boundary exact', solve('exact', boundary), False)
check('normal nonempty', solve('nonempty', normal), True)
check('boundary nonempty', solve('nonempty', boundary), False)
check('normal permission', solve('permission', normal), True)
check('boundary permission', solve('permission', boundary), False)
check('normal busy', solve('busy', normal), False)
check('boundary busy', solve('busy', boundary), True)
check('normal row-id', solve('row-id', normal), 'create:Plum')
check('boundary row-id', solve('row-id', boundary), 'create:')
check('normal resolve', solve('resolve', normal), 'p'+str(N))
check('boundary resolve', solve('resolve', boundary), '')
check('normal failure', solve('failure', normal), {'draft':'  Plum  ','error':'rejected','pending':False})
check('boundary failure', solve('failure', boundary), {'draft':'   ','error':None,'pending':False})
check('normal pending-value', solve('pending-value', normal), None)
check('boundary pending-value', solve('pending-value', boundary), '')
check('normal retry', solve('retry', normal), {'text':'Plum','query_epoch':N+1})
check('boundary retry', solve('retry', boundary), {'text':'','query_epoch':N+1})
variant = dict(normal, **{'draft':' '*N+'Plum'+' '*N})
check('variant query or selection payload', solve('trim', variant), 'Plum')
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 resolve completion transition produces an incorrect observable state.

This picker may create a new option from trimmed draft only when creation is enabled, the draft is nonempty, no case-insensitive exact label exists, and no create transaction is pending. Synthetic create rows carry a distinct namespace and raw text is never mistaken for a persisted identifier.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'trim': return d['draft'].strip()
    if event == 'exact': return d['draft'].strip().casefold() in [x.casefold() for x in d['labels']]
    if event == 'nonempty': return bool(d['draft'].strip())
    if event == 'permission': return d['allow']
    if event == 'busy': return not d['pending']
    if event == 'row-id': return 'create:'+d['draft'].strip()
    if event == 'resolve': return d['persisted']
    if event == 'failure': return {'draft':'','error':d['error'],'pending':False}
    if event == 'pending-value': return None if d['pending'] else d['persisted']
    if event == 'retry': return {'text':d['draft'].strip(),'query_epoch':d['query_epoch']+1}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'  Plum  ','labels':['Pear','plum'],'allow':True,'pending':True,'temporary':'tmp:'+str(N),'persisted':'p'+str(N),'error':'rejected','query_epoch':N}
boundary = {'draft':'   ','labels':[],'allow':False,'pending':False,'temporary':'tmp:'+str(N),'persisted':'','error':None,'query_epoch':N}
check('normal trim', solve('trim', normal), 'Plum')
check('boundary trim', solve('trim', boundary), '')
check('normal exact', solve('exact', normal), True)
check('boundary exact', solve('exact', boundary), False)
check('normal nonempty', solve('nonempty', normal), True)
check('boundary nonempty', solve('nonempty', boundary), False)
check('normal permission', solve('permission', normal), True)
check('boundary permission', solve('permission', boundary), False)
check('normal busy', solve('busy', normal), False)
check('boundary busy', solve('busy', boundary), True)
check('normal row-id', solve('row-id', normal), 'create:Plum')
check('boundary row-id', solve('row-id', boundary), 'create:')
check('normal resolve', solve('resolve', normal), 'p'+str(N))
check('boundary resolve', solve('resolve', boundary), '')
check('normal failure', solve('failure', normal), {'draft':'  Plum  ','error':'rejected','pending':False})
check('boundary failure', solve('failure', boundary), {'draft':'   ','error':None,'pending':False})
check('normal pending-value', solve('pending-value', normal), None)
check('boundary pending-value', solve('pending-value', boundary), '')
check('normal retry', solve('retry', normal), {'text':'Plum','query_epoch':N+1})
check('boundary retry', solve('retry', boundary), {'text':'','query_epoch':N+1})
variant = dict(normal, **{'draft':' '*N+'Plum'+' '*N})
check('variant query or selection payload', solve('trim', variant), 'Plum')
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 == 'trim': return d['draft'].strip()
    if event == 'exact': return d['draft'].strip().casefold() in [x.casefold() for x in d['labels']]
    if event == 'nonempty': return bool(d['draft'].strip())
    if event == 'permission': return d['allow']
    if event == 'busy': return not d['pending']
    if event == 'row-id': return 'create:'+d['draft'].strip()
    if event == 'resolve': return d['persisted']
    if event == 'failure': return {'draft':d['draft'],'error':None,'pending':False}
    if event == 'pending-value': return None if d['pending'] else d['persisted']
    if event == 'retry': return {'text':d['draft'].strip(),'query_epoch':d['query_epoch']+1}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'  Plum  ','labels':['Pear','plum'],'allow':True,'pending':True,'temporary':'tmp:'+str(N),'persisted':'p'+str(N),'error':'rejected','query_epoch':N}
boundary = {'draft':'   ','labels':[],'allow':False,'pending':False,'temporary':'tmp:'+str(N),'persisted':'','error':None,'query_epoch':N}
check('normal trim', solve('trim', normal), 'Plum')
check('boundary trim', solve('trim', boundary), '')
check('normal exact', solve('exact', normal), True)
check('boundary exact', solve('exact', boundary), False)
check('normal nonempty', solve('nonempty', normal), True)
check('boundary nonempty', solve('nonempty', boundary), False)
check('normal permission', solve('permission', normal), True)
check('boundary permission', solve('permission', boundary), False)
check('normal busy', solve('busy', normal), False)
check('boundary busy', solve('busy', boundary), True)
check('normal row-id', solve('row-id', normal), 'create:Plum')
check('boundary row-id', solve('row-id', boundary), 'create:')
check('normal resolve', solve('resolve', normal), 'p'+str(N))
check('boundary resolve', solve('resolve', boundary), '')
check('normal failure', solve('failure', normal), {'draft':'  Plum  ','error':'rejected','pending':False})
check('boundary failure', solve('failure', boundary), {'draft':'   ','error':None,'pending':False})
check('normal pending-value', solve('pending-value', normal), None)
check('boundary pending-value', solve('pending-value', boundary), '')
check('normal retry', solve('retry', normal), {'text':'Plum','query_epoch':N+1})
check('boundary retry', solve('retry', boundary), {'text':'','query_epoch':N+1})
variant = dict(normal, **{'draft':' '*N+'Plum'+' '*N})
check('variant query or selection payload', solve('trim', variant), 'Plum')
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 failure completion transition produces an incorrect observable state.

This picker may create a new option from trimmed draft only when creation is enabled, the draft is nonempty, no case-insensitive exact label exists, and no create transaction is pending. Synthetic create rows carry a distinct namespace and raw text is never mistaken for a persisted identifier.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'trim': return d['draft'].strip()
    if event == 'exact': return d['draft'].strip().casefold() in [x.casefold() for x in d['labels']]
    if event == 'nonempty': return bool(d['draft'].strip())
    if event == 'permission': return d['allow']
    if event == 'busy': return not d['pending']
    if event == 'row-id': return 'create:'+d['draft'].strip()
    if event == 'resolve': return d['persisted']
    if event == 'failure': return {'draft':d['draft'],'error':d['error'],'pending':False}
    if event == 'pending-value': return d['temporary']
    if event == 'retry': return {'text':d['draft'].strip(),'query_epoch':d['query_epoch']+1}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'  Plum  ','labels':['Pear','plum'],'allow':True,'pending':True,'temporary':'tmp:'+str(N),'persisted':'p'+str(N),'error':'rejected','query_epoch':N}
boundary = {'draft':'   ','labels':[],'allow':False,'pending':False,'temporary':'tmp:'+str(N),'persisted':'','error':None,'query_epoch':N}
check('normal trim', solve('trim', normal), 'Plum')
check('boundary trim', solve('trim', boundary), '')
check('normal exact', solve('exact', normal), True)
check('boundary exact', solve('exact', boundary), False)
check('normal nonempty', solve('nonempty', normal), True)
check('boundary nonempty', solve('nonempty', boundary), False)
check('normal permission', solve('permission', normal), True)
check('boundary permission', solve('permission', boundary), False)
check('normal busy', solve('busy', normal), False)
check('boundary busy', solve('busy', boundary), True)
check('normal row-id', solve('row-id', normal), 'create:Plum')
check('boundary row-id', solve('row-id', boundary), 'create:')
check('normal resolve', solve('resolve', normal), 'p'+str(N))
check('boundary resolve', solve('resolve', boundary), '')
check('normal failure', solve('failure', normal), {'draft':'  Plum  ','error':'rejected','pending':False})
check('boundary failure', solve('failure', boundary), {'draft':'   ','error':None,'pending':False})
check('normal pending-value', solve('pending-value', normal), None)
check('boundary pending-value', solve('pending-value', boundary), '')
check('normal retry', solve('retry', normal), {'text':'Plum','query_epoch':N+1})
check('boundary retry', solve('retry', boundary), {'text':'','query_epoch':N+1})
variant = dict(normal, **{'draft':' '*N+'Plum'+' '*N})
check('variant query or selection payload', solve('trim', variant), 'Plum')
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 == 'trim': return d['draft'].strip()
    if event == 'exact': return d['draft'].strip().casefold() in [x.casefold() for x in d['labels']]
    if event == 'nonempty': return bool(d['draft'].strip())
    if event == 'permission': return d['allow']
    if event == 'busy': return not d['pending']
    if event == 'row-id': return 'create:'+d['draft'].strip()
    if event == 'resolve': return d['persisted']
    if event == 'failure': return {'draft':d['draft'],'error':d['error'],'pending':False}
    if event == 'pending-value': return d['persisted']
    if event == 'retry': return {'text':d['draft'].strip(),'query_epoch':d['query_epoch']+1}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'  Plum  ','labels':['Pear','plum'],'allow':True,'pending':True,'temporary':'tmp:'+str(N),'persisted':'p'+str(N),'error':'rejected','query_epoch':N}
boundary = {'draft':'   ','labels':[],'allow':False,'pending':False,'temporary':'tmp:'+str(N),'persisted':'','error':None,'query_epoch':N}
check('normal trim', solve('trim', normal), 'Plum')
check('boundary trim', solve('trim', boundary), '')
check('normal exact', solve('exact', normal), True)
check('boundary exact', solve('exact', boundary), False)
check('normal nonempty', solve('nonempty', normal), True)
check('boundary nonempty', solve('nonempty', boundary), False)
check('normal permission', solve('permission', normal), True)
check('boundary permission', solve('permission', boundary), False)
check('normal busy', solve('busy', normal), False)
check('boundary busy', solve('busy', boundary), True)
check('normal row-id', solve('row-id', normal), 'create:Plum')
check('boundary row-id', solve('row-id', boundary), 'create:')
check('normal resolve', solve('resolve', normal), 'p'+str(N))
check('boundary resolve', solve('resolve', boundary), '')
check('normal failure', solve('failure', normal), {'draft':'  Plum  ','error':'rejected','pending':False})
check('boundary failure', solve('failure', boundary), {'draft':'   ','error':None,'pending':False})
check('normal pending-value', solve('pending-value', normal), None)
check('boundary pending-value', solve('pending-value', boundary), '')
check('normal retry', solve('retry', normal), {'text':'Plum','query_epoch':N+1})
check('boundary retry', solve('retry', boundary), {'text':'','query_epoch':N+1})
variant = dict(normal, **{'draft':' '*N+'Plum'+' '*N})
check('variant query or selection payload', solve('trim', variant), 'Plum')
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 pending-value completion transition produces an incorrect observable state.

This picker may create a new option from trimmed draft only when creation is enabled, the draft is nonempty, no case-insensitive exact label exists, and no create transaction is pending. Synthetic create rows carry a distinct namespace and raw text is never mistaken for a persisted identifier.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'trim': return d['draft'].strip()
    if event == 'exact': return d['draft'].strip().casefold() in [x.casefold() for x in d['labels']]
    if event == 'nonempty': return bool(d['draft'].strip())
    if event == 'permission': return d['allow']
    if event == 'busy': return not d['pending']
    if event == 'row-id': return 'create:'+d['draft'].strip()
    if event == 'resolve': return d['persisted']
    if event == 'failure': return {'draft':d['draft'],'error':d['error'],'pending':False}
    if event == 'pending-value': return None if d['pending'] else d['persisted']
    if event == 'retry': return {'text':d['draft'].strip(),'query_epoch':d['query_epoch']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'  Plum  ','labels':['Pear','plum'],'allow':True,'pending':True,'temporary':'tmp:'+str(N),'persisted':'p'+str(N),'error':'rejected','query_epoch':N}
boundary = {'draft':'   ','labels':[],'allow':False,'pending':False,'temporary':'tmp:'+str(N),'persisted':'','error':None,'query_epoch':N}
check('normal trim', solve('trim', normal), 'Plum')
check('boundary trim', solve('trim', boundary), '')
check('normal exact', solve('exact', normal), True)
check('boundary exact', solve('exact', boundary), False)
check('normal nonempty', solve('nonempty', normal), True)
check('boundary nonempty', solve('nonempty', boundary), False)
check('normal permission', solve('permission', normal), True)
check('boundary permission', solve('permission', boundary), False)
check('normal busy', solve('busy', normal), False)
check('boundary busy', solve('busy', boundary), True)
check('normal row-id', solve('row-id', normal), 'create:Plum')
check('boundary row-id', solve('row-id', boundary), 'create:')
check('normal resolve', solve('resolve', normal), 'p'+str(N))
check('boundary resolve', solve('resolve', boundary), '')
check('normal failure', solve('failure', normal), {'draft':'  Plum  ','error':'rejected','pending':False})
check('boundary failure', solve('failure', boundary), {'draft':'   ','error':None,'pending':False})
check('normal pending-value', solve('pending-value', normal), None)
check('boundary pending-value', solve('pending-value', boundary), '')
check('normal retry', solve('retry', normal), {'text':'Plum','query_epoch':N+1})
check('boundary retry', solve('retry', boundary), {'text':'','query_epoch':N+1})
variant = dict(normal, **{'draft':' '*N+'Plum'+' '*N})
check('variant query or selection payload', solve('trim', variant), 'Plum')
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 == 'trim': return d['draft'].strip()
    if event == 'exact': return d['draft'].strip().casefold() in [x.casefold() for x in d['labels']]
    if event == 'nonempty': return bool(d['draft'].strip())
    if event == 'permission': return d['allow']
    if event == 'busy': return not d['pending']
    if event == 'row-id': return 'create:'+d['draft'].strip()
    if event == 'resolve': return d['persisted']
    if event == 'failure': return {'draft':d['draft'],'error':d['error'],'pending':False}
    if event == 'pending-value': return None if d['pending'] else d['persisted']
    if event == 'retry': return {'text':d['draft'],'query_epoch':d['query_epoch']+1}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'draft':'  Plum  ','labels':['Pear','plum'],'allow':True,'pending':True,'temporary':'tmp:'+str(N),'persisted':'p'+str(N),'error':'rejected','query_epoch':N}
boundary = {'draft':'   ','labels':[],'allow':False,'pending':False,'temporary':'tmp:'+str(N),'persisted':'','error':None,'query_epoch':N}
check('normal trim', solve('trim', normal), 'Plum')
check('boundary trim', solve('trim', boundary), '')
check('normal exact', solve('exact', normal), True)
check('boundary exact', solve('exact', boundary), False)
check('normal nonempty', solve('nonempty', normal), True)
check('boundary nonempty', solve('nonempty', boundary), False)
check('normal permission', solve('permission', normal), True)
check('boundary permission', solve('permission', boundary), False)
check('normal busy', solve('busy', normal), False)
check('boundary busy', solve('busy', boundary), True)
check('normal row-id', solve('row-id', normal), 'create:Plum')
check('boundary row-id', solve('row-id', boundary), 'create:')
check('normal resolve', solve('resolve', normal), 'p'+str(N))
check('boundary resolve', solve('resolve', boundary), '')
check('normal failure', solve('failure', normal), {'draft':'  Plum  ','error':'rejected','pending':False})
check('boundary failure', solve('failure', boundary), {'draft':'   ','error':None,'pending':False})
check('normal pending-value', solve('pending-value', normal), None)
check('boundary pending-value', solve('pending-value', boundary), '')
check('normal retry', solve('retry', normal), {'text':'Plum','query_epoch':N+1})
check('boundary retry', solve('retry', boundary), {'text':'','query_epoch':N+1})
variant = dict(normal, **{'draft':' '*N+'Plum'+' '*N})
check('variant query or selection payload', solve('trim', variant), 'Plum')
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 retry completion transition produces an incorrect observable state.

This picker may create a new option from trimmed draft only when creation is enabled, the draft is nonempty, no case-insensitive exact label exists, and no create transaction is pending. Synthetic create rows carry a distinct namespace and raw text is never mistaken for a persisted identifier.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'key': return [d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 == 'key': return [d['cache_scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 key completion transition produces an incorrect observable state.

Cached result presentation is bound to exact query and dependency scope. A cache hit may render immediately but must be marked stale until refreshed. Empty cached results are valid hits. Cache misses preserve no previous-query selectable rows; selected labels are independently retained.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query'].startswith(d['cache_query'])
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return bool(d['cached'])
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 query-match completion transition produces an incorrect observable state.

Cached result presentation is bound to exact query and dependency scope. A cache hit may render immediately but must be marked stale until refreshed. Empty cached results are valid hits. Cache misses preserve no previous-query selectable rows; selected labels are independently retained.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return True
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['query'].startswith(d['cache_query'])
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 scope-match completion transition produces an incorrect observable state.

Cached result presentation is bound to exact query and dependency scope. A cache hit may render immediately but must be marked stale until refreshed. Empty cached results are valid hits. Cache misses preserve no previous-query selectable rows; selected labels are independently retained.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return bool(d['cached'])
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry'] and bool(d['query'])
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 empty-hit completion transition produces an incorrect observable state.

Cached result presentation is bound to exact query and dependency scope. A cache hit may render immediately but must be marked stale until refreshed. Empty cached results are valid hits. Cache misses preserve no previous-query selectable rows; selected labels are independently retained.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return False
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return bool(d['cached']) and d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 stale-badge completion transition produces an incorrect observable state.

Cached result presentation is bound to exact query and dependency scope. A cache hit may render immediately but must be marked stale until refreshed. Empty cached results are valid hits. Cache misses preserve no previous-query selectable rows; selected labels are independently retained.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['has_entry']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not bool(d['cached'])
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 refresh completion transition produces an incorrect observable state.

Cached result presentation is bound to exact query and dependency scope. A cache hit may render immediately but must be marked stale until refreshed. Empty cached results are valid hits. Cache misses preserve no previous-query selectable rows; selected labels are independently retained.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached']
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query'].startswith(d['cache_query']) else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 miss-rows completion transition produces an incorrect observable state.

Cached result presentation is bound to exact query and dependency scope. A cache hit may render immediately but must be marked stale until refreshed. Empty cached results are valid hits. Cache misses preserve no previous-query selectable rows; selected labels are independently retained.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return ''
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['cached'][0] if d['cached'] else ''
    if event == 'cache-provenance': return {'origin':'cache','query':d['cache_query'],'epoch':d['cache_epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 value-label completion transition produces an incorrect observable state.

Cached result presentation is bound to exact query and dependency scope. A cache hit may render immediately but must be marked stale until refreshed. Empty cached results are valid hits. Cache misses preserve no previous-query selectable rows; selected labels are independently retained.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'network','query':d['query'],'epoch':d['epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 == 'key': return [d['scope'],d['query']]
    if event == 'query-match': return d['query']==d['cache_query']
    if event == 'scope-match': return d['scope']==d['cache_scope']
    if event == 'empty-hit': return d['has_entry']
    if event == 'stale-badge': return not d['fresh']
    if event == 'refresh': return not d['fresh']
    if event == 'miss-rows': return d['cached'] if d['query']==d['cache_query'] and d['scope']==d['cache_scope'] else []
    if event == 'value-label': return d['selected_label']
    if event == 'cache-provenance': return {'origin':'cache','query':d['query'],'epoch':d['epoch']}
    if event == 'refresh-error': return {'rows':d['cached'],'warning':d['error']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'query':'pe','scope':'fruit','cache_query':'p','cache_scope':'all','cached':['p1'],'has_entry':True,'fresh':False,'selected_label':'Pear','epoch':N,'cache_epoch':N-1,'error':'offline'}
boundary = {'query':'','scope':'all','cache_query':'','cache_scope':'all','cached':[],'has_entry':True,'fresh':True,'selected_label':'','epoch':N,'cache_epoch':N,'error':None}
check('normal key', solve('key', normal), ['fruit','pe'])
check('boundary key', solve('key', boundary), ['all',''])
check('normal query-match', solve('query-match', normal), False)
check('boundary query-match', solve('query-match', boundary), True)
check('normal scope-match', solve('scope-match', normal), False)
check('boundary scope-match', solve('scope-match', boundary), True)
check('normal empty-hit', solve('empty-hit', normal), True)
check('boundary empty-hit', solve('empty-hit', boundary), True)
check('normal stale-badge', solve('stale-badge', normal), True)
check('boundary stale-badge', solve('stale-badge', boundary), False)
check('normal refresh', solve('refresh', normal), True)
check('boundary refresh', solve('refresh', boundary), False)
check('normal miss-rows', solve('miss-rows', normal), [])
check('boundary miss-rows', solve('miss-rows', boundary), [])
check('normal value-label', solve('value-label', normal), 'Pear')
check('boundary value-label', solve('value-label', boundary), '')
check('normal cache-provenance', solve('cache-provenance', normal), {'origin':'cache','query':'p','epoch':N-1})
check('boundary cache-provenance', solve('cache-provenance', boundary), {'origin':'cache','query':'','epoch':N})
check('normal refresh-error', solve('refresh-error', normal), {'rows':['p1'],'warning':'offline'})
check('boundary refresh-error', solve('refresh-error', boundary), {'rows':[],'warning':None})
variant = dict(normal, **{'selected_label':'L'*N})
check('variant query or selection payload', solve('value-label', variant), 'L'*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 cache-provenance completion transition produces an incorrect observable state.

Cached result presentation is bound to exact query and dependency scope. A cache hit may render immediately but must be marked stale until refreshed. Empty cached results are valid hits. Cache misses preserve no previous-query selectable rows; selected labels are independently retained.

split: open-access