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

N = 1
observations = []
def solve(event, d):
    if event == 'identity': return d['response_id']==d['value']
    if event == 'epoch': return d['response_epoch']==d['epoch']
    if event == 'value': return d['value']
    if event == 'query': return d['query']
    if event == 'empty-label': return d['label']
    if event == 'failure': return d['fallback'] if d['error'] else d['label']
    if event == 'pending': return True
    if event == 'request': return [d['value'],d['epoch']]
    if event == 'clear-error': return None
    if event == 'separate-rows': return []
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','response_id':'p0','label':'Pear','fallback':'Unknown choice','epoch':N,'response_epoch':N-1,'query':'pe','pending':True,'error':'missing','resolved':False}
boundary = {'value':'','response_id':'','label':'','fallback':'Unknown choice','epoch':N,'response_epoch':N,'query':'','pending':False,'error':None,'resolved':True}
check('normal identity', solve('identity', normal), False)
check('boundary identity', solve('identity', boundary), True)
check('normal epoch', solve('epoch', normal), False)
check('boundary epoch', solve('epoch', boundary), True)
check('normal value', solve('value', normal), 'p1')
check('boundary value', solve('value', boundary), '')
check('normal query', solve('query', normal), 'pe')
check('boundary query', solve('query', boundary), '')
check('normal empty-label', solve('empty-label', normal), 'Pear')
check('boundary empty-label', solve('empty-label', boundary), '')
check('normal failure', solve('failure', normal), 'Unknown choice')
check('boundary failure', solve('failure', boundary), '')
check('normal pending', solve('pending', normal), True)
check('boundary pending', solve('pending', boundary), False)
check('normal request', solve('request', normal), ['p1',N])
check('boundary request', solve('request', boundary), ['',N])
check('normal clear-error', solve('clear-error', normal), None)
check('boundary clear-error', solve('clear-error', boundary), None)
check('normal separate-rows', solve('separate-rows', normal), [])
check('boundary separate-rows', solve('separate-rows', boundary), [])
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('value', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(event, d):
    if event == 'identity': return d['response_id']==d['value']
    if event == 'epoch': return d['response_epoch']==d['epoch']
    if event == 'value': return d['value']
    if event == 'query': return d['query']
    if event == 'empty-label': return d['label']
    if event == 'failure': return d['fallback'] if d['error'] else d['label']
    if event == 'pending': return not bool(d['label'])
    if event == 'request': return [d['value'],d['epoch']]
    if event == 'clear-error': return None
    if event == 'separate-rows': return []
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','response_id':'p0','label':'Pear','fallback':'Unknown choice','epoch':N,'response_epoch':N-1,'query':'pe','pending':True,'error':'missing','resolved':False}
boundary = {'value':'','response_id':'','label':'','fallback':'Unknown choice','epoch':N,'response_epoch':N,'query':'','pending':False,'error':None,'resolved':True}
check('normal identity', solve('identity', normal), False)
check('boundary identity', solve('identity', boundary), True)
check('normal epoch', solve('epoch', normal), False)
check('boundary epoch', solve('epoch', boundary), True)
check('normal value', solve('value', normal), 'p1')
check('boundary value', solve('value', boundary), '')
check('normal query', solve('query', normal), 'pe')
check('boundary query', solve('query', boundary), '')
check('normal empty-label', solve('empty-label', normal), 'Pear')
check('boundary empty-label', solve('empty-label', boundary), '')
check('normal failure', solve('failure', normal), 'Unknown choice')
check('boundary failure', solve('failure', boundary), '')
check('normal pending', solve('pending', normal), True)
check('boundary pending', solve('pending', boundary), False)
check('normal request', solve('request', normal), ['p1',N])
check('boundary request', solve('request', boundary), ['',N])
check('normal clear-error', solve('clear-error', normal), None)
check('boundary clear-error', solve('clear-error', boundary), None)
check('normal separate-rows', solve('separate-rows', normal), [])
check('boundary separate-rows', solve('separate-rows', boundary), [])
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('value', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

A selected identifier may need asynchronous label resolution independently of query suggestions. Responses bind to selected identity and selection epoch. Until resolved the identity stays committed; failed resolution shows an explicit fallback and never inserts the identifier into the query. Empty labels are valid resolutions.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'identity': return d['response_id']==d['value']
    if event == 'epoch': return d['response_epoch']==d['epoch']
    if event == 'value': return d['value']
    if event == 'query': return d['query']
    if event == 'empty-label': return d['label']
    if event == 'failure': return d['fallback'] if d['error'] else d['label']
    if event == 'pending': return d['pending'] and not d['resolved']
    if event == 'request': return [d['query'],d['epoch']]
    if event == 'clear-error': return None
    if event == 'separate-rows': return []
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','response_id':'p0','label':'Pear','fallback':'Unknown choice','epoch':N,'response_epoch':N-1,'query':'pe','pending':True,'error':'missing','resolved':False}
boundary = {'value':'','response_id':'','label':'','fallback':'Unknown choice','epoch':N,'response_epoch':N,'query':'','pending':False,'error':None,'resolved':True}
check('normal identity', solve('identity', normal), False)
check('boundary identity', solve('identity', boundary), True)
check('normal epoch', solve('epoch', normal), False)
check('boundary epoch', solve('epoch', boundary), True)
check('normal value', solve('value', normal), 'p1')
check('boundary value', solve('value', boundary), '')
check('normal query', solve('query', normal), 'pe')
check('boundary query', solve('query', boundary), '')
check('normal empty-label', solve('empty-label', normal), 'Pear')
check('boundary empty-label', solve('empty-label', boundary), '')
check('normal failure', solve('failure', normal), 'Unknown choice')
check('boundary failure', solve('failure', boundary), '')
check('normal pending', solve('pending', normal), True)
check('boundary pending', solve('pending', boundary), False)
check('normal request', solve('request', normal), ['p1',N])
check('boundary request', solve('request', boundary), ['',N])
check('normal clear-error', solve('clear-error', normal), None)
check('boundary clear-error', solve('clear-error', boundary), None)
check('normal separate-rows', solve('separate-rows', normal), [])
check('boundary separate-rows', solve('separate-rows', boundary), [])
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('value', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(event, d):
    if event == 'identity': return d['response_id']==d['value']
    if event == 'epoch': return d['response_epoch']==d['epoch']
    if event == 'value': return d['value']
    if event == 'query': return d['query']
    if event == 'empty-label': return d['label']
    if event == 'failure': return d['fallback'] if d['error'] else d['label']
    if event == 'pending': return d['pending'] and not d['resolved']
    if event == 'request': return [d['value'],d['response_epoch']]
    if event == 'clear-error': return None
    if event == 'separate-rows': return []
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','response_id':'p0','label':'Pear','fallback':'Unknown choice','epoch':N,'response_epoch':N-1,'query':'pe','pending':True,'error':'missing','resolved':False}
boundary = {'value':'','response_id':'','label':'','fallback':'Unknown choice','epoch':N,'response_epoch':N,'query':'','pending':False,'error':None,'resolved':True}
check('normal identity', solve('identity', normal), False)
check('boundary identity', solve('identity', boundary), True)
check('normal epoch', solve('epoch', normal), False)
check('boundary epoch', solve('epoch', boundary), True)
check('normal value', solve('value', normal), 'p1')
check('boundary value', solve('value', boundary), '')
check('normal query', solve('query', normal), 'pe')
check('boundary query', solve('query', boundary), '')
check('normal empty-label', solve('empty-label', normal), 'Pear')
check('boundary empty-label', solve('empty-label', boundary), '')
check('normal failure', solve('failure', normal), 'Unknown choice')
check('boundary failure', solve('failure', boundary), '')
check('normal pending', solve('pending', normal), True)
check('boundary pending', solve('pending', boundary), False)
check('normal request', solve('request', normal), ['p1',N])
check('boundary request', solve('request', boundary), ['',N])
check('normal clear-error', solve('clear-error', normal), None)
check('boundary clear-error', solve('clear-error', boundary), None)
check('normal separate-rows', solve('separate-rows', normal), [])
check('boundary separate-rows', solve('separate-rows', boundary), [])
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('value', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

A selected identifier may need asynchronous label resolution independently of query suggestions. Responses bind to selected identity and selection epoch. Until resolved the identity stays committed; failed resolution shows an explicit fallback and never inserts the identifier into the query. Empty labels are valid resolutions.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'identity': return d['response_id']==d['value']
    if event == 'epoch': return d['response_epoch']==d['epoch']
    if event == 'value': return d['value']
    if event == 'query': return d['query']
    if event == 'empty-label': return d['label']
    if event == 'failure': return d['fallback'] if d['error'] else d['label']
    if event == 'pending': return d['pending'] and not d['resolved']
    if event == 'request': return [d['value'],d['epoch']]
    if event == 'clear-error': return d['error']
    if event == 'separate-rows': return []
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','response_id':'p0','label':'Pear','fallback':'Unknown choice','epoch':N,'response_epoch':N-1,'query':'pe','pending':True,'error':'missing','resolved':False}
boundary = {'value':'','response_id':'','label':'','fallback':'Unknown choice','epoch':N,'response_epoch':N,'query':'','pending':False,'error':None,'resolved':True}
check('normal identity', solve('identity', normal), False)
check('boundary identity', solve('identity', boundary), True)
check('normal epoch', solve('epoch', normal), False)
check('boundary epoch', solve('epoch', boundary), True)
check('normal value', solve('value', normal), 'p1')
check('boundary value', solve('value', boundary), '')
check('normal query', solve('query', normal), 'pe')
check('boundary query', solve('query', boundary), '')
check('normal empty-label', solve('empty-label', normal), 'Pear')
check('boundary empty-label', solve('empty-label', boundary), '')
check('normal failure', solve('failure', normal), 'Unknown choice')
check('boundary failure', solve('failure', boundary), '')
check('normal pending', solve('pending', normal), True)
check('boundary pending', solve('pending', boundary), False)
check('normal request', solve('request', normal), ['p1',N])
check('boundary request', solve('request', boundary), ['',N])
check('normal clear-error', solve('clear-error', normal), None)
check('boundary clear-error', solve('clear-error', boundary), None)
check('normal separate-rows', solve('separate-rows', normal), [])
check('boundary separate-rows', solve('separate-rows', boundary), [])
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('value', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(event, d):
    if event == 'identity': return d['response_id']==d['value']
    if event == 'epoch': return d['response_epoch']==d['epoch']
    if event == 'value': return d['value']
    if event == 'query': return d['query']
    if event == 'empty-label': return d['label']
    if event == 'failure': return d['fallback'] if d['error'] else d['label']
    if event == 'pending': return d['pending'] and not d['resolved']
    if event == 'request': return [d['value'],d['epoch']]
    if event == 'clear-error': return d['fallback']
    if event == 'separate-rows': return []
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','response_id':'p0','label':'Pear','fallback':'Unknown choice','epoch':N,'response_epoch':N-1,'query':'pe','pending':True,'error':'missing','resolved':False}
boundary = {'value':'','response_id':'','label':'','fallback':'Unknown choice','epoch':N,'response_epoch':N,'query':'','pending':False,'error':None,'resolved':True}
check('normal identity', solve('identity', normal), False)
check('boundary identity', solve('identity', boundary), True)
check('normal epoch', solve('epoch', normal), False)
check('boundary epoch', solve('epoch', boundary), True)
check('normal value', solve('value', normal), 'p1')
check('boundary value', solve('value', boundary), '')
check('normal query', solve('query', normal), 'pe')
check('boundary query', solve('query', boundary), '')
check('normal empty-label', solve('empty-label', normal), 'Pear')
check('boundary empty-label', solve('empty-label', boundary), '')
check('normal failure', solve('failure', normal), 'Unknown choice')
check('boundary failure', solve('failure', boundary), '')
check('normal pending', solve('pending', normal), True)
check('boundary pending', solve('pending', boundary), False)
check('normal request', solve('request', normal), ['p1',N])
check('boundary request', solve('request', boundary), ['',N])
check('normal clear-error', solve('clear-error', normal), None)
check('boundary clear-error', solve('clear-error', boundary), None)
check('normal separate-rows', solve('separate-rows', normal), [])
check('boundary separate-rows', solve('separate-rows', boundary), [])
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('value', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

A selected identifier may need asynchronous label resolution independently of query suggestions. Responses bind to selected identity and selection epoch. Until resolved the identity stays committed; failed resolution shows an explicit fallback and never inserts the identifier into the query. Empty labels are valid resolutions.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'identity': return d['response_id']==d['value']
    if event == 'epoch': return d['response_epoch']==d['epoch']
    if event == 'value': return d['value']
    if event == 'query': return d['query']
    if event == 'empty-label': return d['label']
    if event == 'failure': return d['fallback'] if d['error'] else d['label']
    if event == 'pending': return d['pending'] and not d['resolved']
    if event == 'request': return [d['value'],d['epoch']]
    if event == 'clear-error': return None
    if event == 'separate-rows': return [d['response_id']]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','response_id':'p0','label':'Pear','fallback':'Unknown choice','epoch':N,'response_epoch':N-1,'query':'pe','pending':True,'error':'missing','resolved':False}
boundary = {'value':'','response_id':'','label':'','fallback':'Unknown choice','epoch':N,'response_epoch':N,'query':'','pending':False,'error':None,'resolved':True}
check('normal identity', solve('identity', normal), False)
check('boundary identity', solve('identity', boundary), True)
check('normal epoch', solve('epoch', normal), False)
check('boundary epoch', solve('epoch', boundary), True)
check('normal value', solve('value', normal), 'p1')
check('boundary value', solve('value', boundary), '')
check('normal query', solve('query', normal), 'pe')
check('boundary query', solve('query', boundary), '')
check('normal empty-label', solve('empty-label', normal), 'Pear')
check('boundary empty-label', solve('empty-label', boundary), '')
check('normal failure', solve('failure', normal), 'Unknown choice')
check('boundary failure', solve('failure', boundary), '')
check('normal pending', solve('pending', normal), True)
check('boundary pending', solve('pending', boundary), False)
check('normal request', solve('request', normal), ['p1',N])
check('boundary request', solve('request', boundary), ['',N])
check('normal clear-error', solve('clear-error', normal), None)
check('boundary clear-error', solve('clear-error', boundary), None)
check('normal separate-rows', solve('separate-rows', normal), [])
check('boundary separate-rows', solve('separate-rows', boundary), [])
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('value', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(event, d):
    if event == 'identity': return d['response_id']==d['value']
    if event == 'epoch': return d['response_epoch']==d['epoch']
    if event == 'value': return d['value']
    if event == 'query': return d['query']
    if event == 'empty-label': return d['label']
    if event == 'failure': return d['fallback'] if d['error'] else d['label']
    if event == 'pending': return d['pending'] and not d['resolved']
    if event == 'request': return [d['value'],d['epoch']]
    if event == 'clear-error': return None
    if event == 'separate-rows': return [d['label']]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','response_id':'p0','label':'Pear','fallback':'Unknown choice','epoch':N,'response_epoch':N-1,'query':'pe','pending':True,'error':'missing','resolved':False}
boundary = {'value':'','response_id':'','label':'','fallback':'Unknown choice','epoch':N,'response_epoch':N,'query':'','pending':False,'error':None,'resolved':True}
check('normal identity', solve('identity', normal), False)
check('boundary identity', solve('identity', boundary), True)
check('normal epoch', solve('epoch', normal), False)
check('boundary epoch', solve('epoch', boundary), True)
check('normal value', solve('value', normal), 'p1')
check('boundary value', solve('value', boundary), '')
check('normal query', solve('query', normal), 'pe')
check('boundary query', solve('query', boundary), '')
check('normal empty-label', solve('empty-label', normal), 'Pear')
check('boundary empty-label', solve('empty-label', boundary), '')
check('normal failure', solve('failure', normal), 'Unknown choice')
check('boundary failure', solve('failure', boundary), '')
check('normal pending', solve('pending', normal), True)
check('boundary pending', solve('pending', boundary), False)
check('normal request', solve('request', normal), ['p1',N])
check('boundary request', solve('request', boundary), ['',N])
check('normal clear-error', solve('clear-error', normal), None)
check('boundary clear-error', solve('clear-error', boundary), None)
check('normal separate-rows', solve('separate-rows', normal), [])
check('boundary separate-rows', solve('separate-rows', boundary), [])
variant = dict(normal, **{'value':'id'+str(N)})
check('variant query or selection payload', solve('value', variant), 'id'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The separate-rows completion transition produces an incorrect observable state.

A selected identifier may need asynchronous label resolution independently of query suggestions. Responses bind to selected identity and selection epoch. Until resolved the identity stays committed; failed resolution shows an explicit fallback and never inserts the identifier into the query. Empty labels are valid resolutions.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'draft': return d['old_query']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 == 'draft': return d['old_value']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 draft completion transition produces an incorrect observable state.

Externally replaced input text is reconciled as draft text. It commits an identifier only for one exact eligible label match, never from old highlight or fuzzy matching. Ambiguous labels retain unresolved draft, and the replacement invalidates previous suggestion requests and ghost text.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'draft': return d['text']
    if event == 'matches': return d['matches']
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 == 'draft': return d['text']
    if event == 'matches': return []
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 matches completion transition produces an incorrect observable state.

Externally replaced input text is reconciled as draft text. It commits an identifier only for one exact eligible label match, never from old highlight or fuzzy matching. Ambiguous labels retain unresolved draft, and the replacement invalidates previous suggestion requests and ghost text.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if d['matches'] else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 ambiguous completion transition produces an incorrect observable state.

Externally replaced input text is reconciled as draft text. It commits an identifier only for one exact eligible label match, never from old highlight or fuzzy matching. Ambiguous labels retain unresolved draft, and the replacement invalidates previous suggestion requests and ghost text.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['matches'] else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['highlight']
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 exact completion transition produces an incorrect observable state.

Externally replaced input text is reconciled as draft text. It commits an identifier only for one exact eligible label match, never from old highlight or fuzzy matching. Ambiguous labels retain unresolved draft, and the replacement invalidates previous suggestion requests and ghost text.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return d['old_value']
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return d['highlight']
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 unresolved completion transition produces an incorrect observable state.

Externally replaced input text is reconciled as draft text. It commits an identifier only for one exact eligible label match, never from old highlight or fuzzy matching. Ambiguous labels retain unresolved draft, and the replacement invalidates previous suggestion requests and ghost text.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return d['ghost']
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return d['old_query']
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 ghost completion transition produces an incorrect observable state.

Externally replaced input text is reconciled as draft text. It commits an identifier only for one exact eligible label match, never from old highlight or fuzzy matching. Ambiguous labels retain unresolved draft, and the replacement invalidates previous suggestion requests and ghost text.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['old_query']
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text']
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 exact-display completion transition produces an incorrect observable state.

Externally replaced input text is reconciled as draft text. It commits an identifier only for one exact eligible label match, never from old highlight or fuzzy matching. Ambiguous labels retain unresolved draft, and the replacement invalidates previous suggestion requests and ghost text.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['old_query'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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-trigger completion transition produces an incorrect observable state.

Externally replaced input text is reconciled as draft text. It commits an identifier only for one exact eligible label match, never from old highlight or fuzzy matching. Ambiguous labels retain unresolved draft, and the replacement invalidates previous suggestion requests and ghost text.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return False
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return True
    if event == 'hover-witness': return d['highlight'] in d['matches'] and d['exact']
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 touched completion transition produces an incorrect observable state.

Externally replaced input text is reconciled as draft text. It commits an identifier only for one exact eligible label match, never from old highlight or fuzzy matching. Ambiguous labels retain unresolved draft, and the replacement invalidates previous suggestion requests and ghost text.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return d['highlight'] is not None
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 == 'draft': return d['text']
    if event == 'matches': return [x for x in d['matches'] if x in d['eligible']]
    if event == 'ambiguous': return d['matches'][0] if len(d['matches'])==1 else None
    if event == 'exact': return d['matches'][0] if d['exact'] and len(d['matches'])==1 else None
    if event == 'unresolved': return None
    if event == 'ghost': return ''
    if event == 'exact-display': return d['text'] if d['exact'] else None
    if event == 'query-trigger': return {'query':d['text'],'epoch':d['epoch']+1}
    if event == 'touched': return d['touched']
    if event == 'hover-witness': return True
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Pear','old_query':'pe','matches':['p1','p2'],'eligible':['p2'],'old_value':'p0','highlight':'p3','ghost':'ach','epoch':N,'exact':False,'touched':False}
boundary = {'text':'','old_query':'','matches':[''],'eligible':[''],'old_value':None,'highlight':None,'ghost':'','epoch':N,'exact':True,'touched':True}
check('normal draft', solve('draft', normal), 'Pear')
check('boundary draft', solve('draft', boundary), '')
check('normal matches', solve('matches', normal), ['p2'])
check('boundary matches', solve('matches', boundary), [''])
check('normal ambiguous', solve('ambiguous', normal), None)
check('boundary ambiguous', solve('ambiguous', boundary), '')
check('normal exact', solve('exact', normal), None)
check('boundary exact', solve('exact', boundary), '')
check('normal unresolved', solve('unresolved', normal), None)
check('boundary unresolved', solve('unresolved', boundary), None)
check('normal ghost', solve('ghost', normal), '')
check('boundary ghost', solve('ghost', boundary), '')
check('normal exact-display', solve('exact-display', normal), None)
check('boundary exact-display', solve('exact-display', boundary), '')
check('normal query-trigger', solve('query-trigger', normal), {'query':'Pear','epoch':N+1})
check('boundary query-trigger', solve('query-trigger', boundary), {'query':'','epoch':N+1})
check('normal touched', solve('touched', normal), False)
check('boundary touched', solve('touched', boundary), True)
check('normal hover-witness', solve('hover-witness', normal), False)
check('boundary hover-witness', solve('hover-witness', boundary), False)
variant = dict(normal, **{'text':'q'*N})
check('variant query or selection payload', solve('draft', variant), 'q'*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 hover-witness completion transition produces an incorrect observable state.

Externally replaced input text is reconciled as draft text. It commits an identifier only for one exact eligible label match, never from old highlight or fuzzy matching. Ambiguous labels retain unresolved draft, and the replacement invalidates previous suggestion requests and ghost text.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'text': return d['trigger']+d['label']
    if event == 'identity': return d['id']
    if event == 'trigger': return d['trigger']+d['label']
    if event == 'query': return d['query']
    if event == 'delimiter': return '' if d['after'].startswith(' ') else ' '
    if event == 'caret': return d['start']+len(d['trigger'])+len(d['label'])
    if event == 'span': return [d['start'],d['start']+len(d['trigger'])+len(d['label'])]
    if event == 'stale': return d['span_epoch']==d['epoch']
    if event == 'tail': return d['text'][d['end']:]
    if event == 'descriptor': return [d['trigger'],d['query']]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Hi @al now','start':3,'end':6,'label':'Alice','id':'u'+str(N),'trigger':'@','after':' now','query':'al','span_epoch':N-1,'epoch':N,'other':'#topic'}
boundary = {'text':'@','start':0,'end':1,'label':'','id':'','trigger':'@','after':'','query':'','span_epoch':N,'epoch':N,'other':''}
check('normal text', solve('text', normal), 'Hi @Alice now')
check('boundary text', solve('text', boundary), '@')
check('normal identity', solve('identity', normal), 'u'+str(N))
check('boundary identity', solve('identity', boundary), '')
check('normal trigger', solve('trigger', normal), '@Alice')
check('boundary trigger', solve('trigger', boundary), '@')
check('normal query', solve('query', normal), 'al')
check('boundary query', solve('query', boundary), '')
check('normal delimiter', solve('delimiter', normal), '')
check('boundary delimiter', solve('delimiter', boundary), ' ')
check('normal caret', solve('caret', normal), 9)
check('boundary caret', solve('caret', boundary), 1)
check('normal span', solve('span', normal), [3,9])
check('boundary span', solve('span', boundary), [0,1])
check('normal stale', solve('stale', normal), False)
check('boundary stale', solve('stale', boundary), True)
check('normal tail', solve('tail', normal), ' now')
check('boundary tail', solve('tail', boundary), '')
check('normal descriptor', solve('descriptor', normal), ['@','al'])
check('boundary descriptor', solve('descriptor', boundary), ['@',''])
variant = dict(normal, **{'id':'person'+str(N)})
check('variant query or selection payload', solve('identity', variant), 'person'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(event, d):
    if event == 'text': return d['text'][:d['start']]+d['label']+d['text'][d['end']:]
    if event == 'identity': return d['id']
    if event == 'trigger': return d['trigger']+d['label']
    if event == 'query': return d['query']
    if event == 'delimiter': return '' if d['after'].startswith(' ') else ' '
    if event == 'caret': return d['start']+len(d['trigger'])+len(d['label'])
    if event == 'span': return [d['start'],d['start']+len(d['trigger'])+len(d['label'])]
    if event == 'stale': return d['span_epoch']==d['epoch']
    if event == 'tail': return d['text'][d['end']:]
    if event == 'descriptor': return [d['trigger'],d['query']]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Hi @al now','start':3,'end':6,'label':'Alice','id':'u'+str(N),'trigger':'@','after':' now','query':'al','span_epoch':N-1,'epoch':N,'other':'#topic'}
boundary = {'text':'@','start':0,'end':1,'label':'','id':'','trigger':'@','after':'','query':'','span_epoch':N,'epoch':N,'other':''}
check('normal text', solve('text', normal), 'Hi @Alice now')
check('boundary text', solve('text', boundary), '@')
check('normal identity', solve('identity', normal), 'u'+str(N))
check('boundary identity', solve('identity', boundary), '')
check('normal trigger', solve('trigger', normal), '@Alice')
check('boundary trigger', solve('trigger', boundary), '@')
check('normal query', solve('query', normal), 'al')
check('boundary query', solve('query', boundary), '')
check('normal delimiter', solve('delimiter', normal), '')
check('boundary delimiter', solve('delimiter', boundary), ' ')
check('normal caret', solve('caret', normal), 9)
check('boundary caret', solve('caret', boundary), 1)
check('normal span', solve('span', normal), [3,9])
check('boundary span', solve('span', boundary), [0,1])
check('normal stale', solve('stale', normal), False)
check('boundary stale', solve('stale', boundary), True)
check('normal tail', solve('tail', normal), ' now')
check('boundary tail', solve('tail', boundary), '')
check('normal descriptor', solve('descriptor', normal), ['@','al'])
check('boundary descriptor', solve('descriptor', boundary), ['@',''])
variant = dict(normal, **{'id':'person'+str(N)})
check('variant query or selection payload', solve('identity', variant), 'person'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

A mention completion replaces only the active trigger span and stores a stable entity identifier separately from visible text. The trigger character is preserved exactly once, a trailing delimiter is added only when absent, and a stale mention query cannot replace a different trigger span. Offsets are code points.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'text': return d['text'][:d['start']]+d['trigger']+d['label']+d['text'][d['end']:]
    if event == 'identity': return d['label']
    if event == 'trigger': return d['trigger']+d['label']
    if event == 'query': return d['query']
    if event == 'delimiter': return '' if d['after'].startswith(' ') else ' '
    if event == 'caret': return d['start']+len(d['trigger'])+len(d['label'])
    if event == 'span': return [d['start'],d['start']+len(d['trigger'])+len(d['label'])]
    if event == 'stale': return d['span_epoch']==d['epoch']
    if event == 'tail': return d['text'][d['end']:]
    if event == 'descriptor': return [d['trigger'],d['query']]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Hi @al now','start':3,'end':6,'label':'Alice','id':'u'+str(N),'trigger':'@','after':' now','query':'al','span_epoch':N-1,'epoch':N,'other':'#topic'}
boundary = {'text':'@','start':0,'end':1,'label':'','id':'','trigger':'@','after':'','query':'','span_epoch':N,'epoch':N,'other':''}
check('normal text', solve('text', normal), 'Hi @Alice now')
check('boundary text', solve('text', boundary), '@')
check('normal identity', solve('identity', normal), 'u'+str(N))
check('boundary identity', solve('identity', boundary), '')
check('normal trigger', solve('trigger', normal), '@Alice')
check('boundary trigger', solve('trigger', boundary), '@')
check('normal query', solve('query', normal), 'al')
check('boundary query', solve('query', boundary), '')
check('normal delimiter', solve('delimiter', normal), '')
check('boundary delimiter', solve('delimiter', boundary), ' ')
check('normal caret', solve('caret', normal), 9)
check('boundary caret', solve('caret', boundary), 1)
check('normal span', solve('span', normal), [3,9])
check('boundary span', solve('span', boundary), [0,1])
check('normal stale', solve('stale', normal), False)
check('boundary stale', solve('stale', boundary), True)
check('normal tail', solve('tail', normal), ' now')
check('boundary tail', solve('tail', boundary), '')
check('normal descriptor', solve('descriptor', normal), ['@','al'])
check('boundary descriptor', solve('descriptor', boundary), ['@',''])
variant = dict(normal, **{'id':'person'+str(N)})
check('variant query or selection payload', solve('identity', variant), 'person'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(event, d):
    if event == 'text': return d['text'][:d['start']]+d['trigger']+d['label']+d['text'][d['end']:]
    if event == 'identity': return d['trigger']+d['label']
    if event == 'trigger': return d['trigger']+d['label']
    if event == 'query': return d['query']
    if event == 'delimiter': return '' if d['after'].startswith(' ') else ' '
    if event == 'caret': return d['start']+len(d['trigger'])+len(d['label'])
    if event == 'span': return [d['start'],d['start']+len(d['trigger'])+len(d['label'])]
    if event == 'stale': return d['span_epoch']==d['epoch']
    if event == 'tail': return d['text'][d['end']:]
    if event == 'descriptor': return [d['trigger'],d['query']]
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'text':'Hi @al now','start':3,'end':6,'label':'Alice','id':'u'+str(N),'trigger':'@','after':' now','query':'al','span_epoch':N-1,'epoch':N,'other':'#topic'}
boundary = {'text':'@','start':0,'end':1,'label':'','id':'','trigger':'@','after':'','query':'','span_epoch':N,'epoch':N,'other':''}
check('normal text', solve('text', normal), 'Hi @Alice now')
check('boundary text', solve('text', boundary), '@')
check('normal identity', solve('identity', normal), 'u'+str(N))
check('boundary identity', solve('identity', boundary), '')
check('normal trigger', solve('trigger', normal), '@Alice')
check('boundary trigger', solve('trigger', boundary), '@')
check('normal query', solve('query', normal), 'al')
check('boundary query', solve('query', boundary), '')
check('normal delimiter', solve('delimiter', normal), '')
check('boundary delimiter', solve('delimiter', boundary), ' ')
check('normal caret', solve('caret', normal), 9)
check('boundary caret', solve('caret', boundary), 1)
check('normal span', solve('span', normal), [3,9])
check('boundary span', solve('span', boundary), [0,1])
check('normal stale', solve('stale', normal), False)
check('boundary stale', solve('stale', boundary), True)
check('normal tail', solve('tail', normal), ' now')
check('boundary tail', solve('tail', boundary), '')
check('normal descriptor', solve('descriptor', normal), ['@','al'])
check('boundary descriptor', solve('descriptor', boundary), ['@',''])
variant = dict(normal, **{'id':'person'+str(N)})
check('variant query or selection payload', solve('identity', variant), 'person'+str(N))
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

A mention completion replaces only the active trigger span and stores a stable entity identifier separately from visible text. The trigger character is preserved exactly once, a trailing delimiter is added only when absent, and a stale mention query cannot replace a different trigger span. Offsets are code points.

split: open-access