broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'right':
        return p['x']+p['width']-p['overlap']
    if action == 'left':
        return p['x']-p['submenu']+p['overlap']
    if action == 'side':
        return 'right' if p['right']>=p['width'] else ('left' if p['left']>=p['width'] else ('right' if p['right']>=p['left'] else 'left'))
    if action == 'row-align':
        return p['row_y']-p['padding']
    if action == 'root-relative':
        return [p['screen'][0]-p['root'][0],p['screen'][1]-p['root'][1]]
    if action == 'gap-hit':
        return p['owner_right']<=p['x']<=p['menu_left']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('right contract', solve('right', {'x':N,'width':20,'overlap':2}), N+18)
check('left contract', solve('left', {'x':N+30,'submenu':10,'overlap':2}), N+22)
check('side contract', solve('side', {'right':N+5,'left':N+2,'width':N+10}), 'right')
check('row-align contract', solve('row-align', {'row_y':N+20,'padding':3}), N+17)
check('root-relative contract', solve('root-relative', {'screen':[10*N,20*N],'root':[N,2*N]}), [9*N,18*N])
check('gap-hit contract', solve('gap-hit', {'owner_right':N+5,'menu_left':N+8,'x':N,'top':0,'bottom':10,'y':5}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('only left fits',solve('side',{'right':N,'left':N+10,'width':N+5}),'left')
check('bridge vertical miss',solve('gap-hit',{'owner_right':N,'menu_left':N+4,'x':N+2,'top':3,'bottom':8,'y':10}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'right':
        return p['x']+p['width']-p['overlap']
    if action == 'left':
        return p['x']-p['submenu']+p['overlap']
    if action == 'side':
        return 'right' if p['right']>=p['width'] else ('left' if p['left']>=p['width'] else ('right' if p['right']>=p['left'] else 'left'))
    if action == 'row-align':
        return p['row_y']-p['padding']
    if action == 'root-relative':
        return [p['screen'][0]-p['root'][0],p['screen'][1]-p['root'][1]]
    if action == 'gap-hit':
        return p['top']<=p['y']<=p['bottom']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('right contract', solve('right', {'x':N,'width':20,'overlap':2}), N+18)
check('left contract', solve('left', {'x':N+30,'submenu':10,'overlap':2}), N+22)
check('side contract', solve('side', {'right':N+5,'left':N+2,'width':N+10}), 'right')
check('row-align contract', solve('row-align', {'row_y':N+20,'padding':3}), N+17)
check('root-relative contract', solve('root-relative', {'screen':[10*N,20*N],'root':[N,2*N]}), [9*N,18*N])
check('gap-hit contract', solve('gap-hit', {'owner_right':N+5,'menu_left':N+8,'x':N,'top':0,'bottom':10,'y':5}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('only left fits',solve('side',{'right':N,'left':N+10,'width':N+5}),'left')
check('bridge vertical miss',solve('gap-hit',{'owner_right':N,'menu_left':N+4,'x':N+2,'top':3,'bottom':8,'y':10}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Menu bridge hit region ignores its horizontal bounds.

Submenu placement uses owner edges, overlap compensation, available side space and root-relative coordinates under a stipulated rectangular layout.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'nearest':
        return next((x['id'] for x in reversed(p) if x['context']),None)
    if action == 'exclude':
        return next((x['id'] for x in p if x['context'] and not x['excluded']),None)
    if action == 'document':
        return [x for x in p['path'] if x['document']==p['document']]
    if action == 'detached':
        return p['connected'] and p['owner_exists']
    if action == 'fallback':
        return p['local'] if p['local'] is not None else p['document']
    if action == 'hit-target':
        return p['captured'] if p['capture_valid'] else p['hit']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', [{'id':N,'context':True},{'id':N+1,'context':True}]), N)
check('exclude contract', solve('exclude', [{'id':N,'context':True,'excluded':True},{'id':N+1,'context':False,'excluded':False},{'id':N+2,'context':True,'excluded':False}]), N+2)
check('document contract', solve('document', {'document':'a','path':[{'id':N,'document':'a'},{'id':N+1,'document':'b'}]}), [{'id':N,'document':'a'}])
check('detached contract', solve('detached', {'connected':False,'owner_exists':True,'id':N}), False)
check('fallback contract', solve('fallback', {'local':0,'document':N+1}), 0)
check('hit-target contract', solve('hit-target', {'captured':N,'capture_valid':True,'hit':N+1,'capture_owner':'canvas'}), N)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'nearest':
        return p[-1]['id']
    if action == 'exclude':
        return next((x['id'] for x in p if x['context'] and not x['excluded']),None)
    if action == 'document':
        return [x for x in p['path'] if x['document']==p['document']]
    if action == 'detached':
        return p['connected'] and p['owner_exists']
    if action == 'fallback':
        return p['local'] if p['local'] is not None else p['document']
    if action == 'hit-target':
        return p['captured'] if p['capture_valid'] else p['hit']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', [{'id':N,'context':True},{'id':N+1,'context':True}]), N)
check('exclude contract', solve('exclude', [{'id':N,'context':True,'excluded':True},{'id':N+1,'context':False,'excluded':False},{'id':N+2,'context':True,'excluded':False}]), N+2)
check('document contract', solve('document', {'document':'a','path':[{'id':N,'document':'a'},{'id':N+1,'document':'b'}]}), [{'id':N,'document':'a'}])
check('detached contract', solve('detached', {'connected':False,'owner_exists':True,'id':N}), False)
check('fallback contract', solve('fallback', {'local':0,'document':N+1}), 0)
check('hit-target contract', solve('hit-target', {'captured':N,'capture_valid':True,'hit':N+1,'capture_owner':'canvas'}), N)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Context invocation resolves to a distant ancestor menu.

Context invocations choose the nearest eligible context owner from a composed target path; nested ownership, exclusions and document boundaries are explicit.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'nearest':
        return next((x['id'] for x in p if x['context']),None)
    if action == 'exclude':
        return next((x['id'] for x in p if x['context']),None)
    if action == 'document':
        return [x for x in p['path'] if x['document']==p['document']]
    if action == 'detached':
        return p['connected'] and p['owner_exists']
    if action == 'fallback':
        return p['local'] if p['local'] is not None else p['document']
    if action == 'hit-target':
        return p['captured'] if p['capture_valid'] else p['hit']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', [{'id':N,'context':True},{'id':N+1,'context':True}]), N)
check('exclude contract', solve('exclude', [{'id':N,'context':True,'excluded':True},{'id':N+1,'context':False,'excluded':False},{'id':N+2,'context':True,'excluded':False}]), N+2)
check('document contract', solve('document', {'document':'a','path':[{'id':N,'document':'a'},{'id':N+1,'document':'b'}]}), [{'id':N,'document':'a'}])
check('detached contract', solve('detached', {'connected':False,'owner_exists':True,'id':N}), False)
check('fallback contract', solve('fallback', {'local':0,'document':N+1}), 0)
check('hit-target contract', solve('hit-target', {'captured':N,'capture_valid':True,'hit':N+1,'capture_owner':'canvas'}), N)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'nearest':
        return next((x['id'] for x in p if x['context']),None)
    if action == 'exclude':
        return next((x['id'] for x in p if not x['excluded']),None)
    if action == 'document':
        return [x for x in p['path'] if x['document']==p['document']]
    if action == 'detached':
        return p['connected'] and p['owner_exists']
    if action == 'fallback':
        return p['local'] if p['local'] is not None else p['document']
    if action == 'hit-target':
        return p['captured'] if p['capture_valid'] else p['hit']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', [{'id':N,'context':True},{'id':N+1,'context':True}]), N)
check('exclude contract', solve('exclude', [{'id':N,'context':True,'excluded':True},{'id':N+1,'context':False,'excluded':False},{'id':N+2,'context':True,'excluded':False}]), N+2)
check('document contract', solve('document', {'document':'a','path':[{'id':N,'document':'a'},{'id':N+1,'document':'b'}]}), [{'id':N,'document':'a'}])
check('detached contract', solve('detached', {'connected':False,'owner_exists':True,'id':N}), False)
check('fallback contract', solve('fallback', {'local':0,'document':N+1}), 0)
check('hit-target contract', solve('hit-target', {'captured':N,'capture_valid':True,'hit':N+1,'capture_owner':'canvas'}), N)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Excluded context owner is still used to build a menu.

Context invocations choose the nearest eligible context owner from a composed target path; nested ownership, exclusions and document boundaries are explicit.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'nearest':
        return next((x['id'] for x in p if x['context']),None)
    if action == 'exclude':
        return next((x['id'] for x in p if x['context'] and not x['excluded']),None)
    if action == 'document':
        return p['path']
    if action == 'detached':
        return p['connected'] and p['owner_exists']
    if action == 'fallback':
        return p['local'] if p['local'] is not None else p['document']
    if action == 'hit-target':
        return p['captured'] if p['capture_valid'] else p['hit']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', [{'id':N,'context':True},{'id':N+1,'context':True}]), N)
check('exclude contract', solve('exclude', [{'id':N,'context':True,'excluded':True},{'id':N+1,'context':False,'excluded':False},{'id':N+2,'context':True,'excluded':False}]), N+2)
check('document contract', solve('document', {'document':'a','path':[{'id':N,'document':'a'},{'id':N+1,'document':'b'}]}), [{'id':N,'document':'a'}])
check('detached contract', solve('detached', {'connected':False,'owner_exists':True,'id':N}), False)
check('fallback contract', solve('fallback', {'local':0,'document':N+1}), 0)
check('hit-target contract', solve('hit-target', {'captured':N,'capture_valid':True,'hit':N+1,'capture_owner':'canvas'}), N)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'nearest':
        return next((x['id'] for x in p if x['context']),None)
    if action == 'exclude':
        return next((x['id'] for x in p if x['context'] and not x['excluded']),None)
    if action == 'document':
        return [x for x in p['path'] if x['document']!=p['document']]
    if action == 'detached':
        return p['connected'] and p['owner_exists']
    if action == 'fallback':
        return p['local'] if p['local'] is not None else p['document']
    if action == 'hit-target':
        return p['captured'] if p['capture_valid'] else p['hit']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', [{'id':N,'context':True},{'id':N+1,'context':True}]), N)
check('exclude contract', solve('exclude', [{'id':N,'context':True,'excluded':True},{'id':N+1,'context':False,'excluded':False},{'id':N+2,'context':True,'excluded':False}]), N+2)
check('document contract', solve('document', {'document':'a','path':[{'id':N,'document':'a'},{'id':N+1,'document':'b'}]}), [{'id':N,'document':'a'}])
check('detached contract', solve('detached', {'connected':False,'owner_exists':True,'id':N}), False)
check('fallback contract', solve('fallback', {'local':0,'document':N+1}), 0)
check('hit-target contract', solve('hit-target', {'captured':N,'capture_valid':True,'hit':N+1,'capture_owner':'canvas'}), N)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Context menu resolution crosses a document ownership boundary.

Context invocations choose the nearest eligible context owner from a composed target path; nested ownership, exclusions and document boundaries are explicit.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'nearest':
        return next((x['id'] for x in p if x['context']),None)
    if action == 'exclude':
        return next((x['id'] for x in p if x['context'] and not x['excluded']),None)
    if action == 'document':
        return [x for x in p['path'] if x['document']==p['document']]
    if action == 'detached':
        return p['owner_exists']
    if action == 'fallback':
        return p['local'] if p['local'] is not None else p['document']
    if action == 'hit-target':
        return p['captured'] if p['capture_valid'] else p['hit']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', [{'id':N,'context':True},{'id':N+1,'context':True}]), N)
check('exclude contract', solve('exclude', [{'id':N,'context':True,'excluded':True},{'id':N+1,'context':False,'excluded':False},{'id':N+2,'context':True,'excluded':False}]), N+2)
check('document contract', solve('document', {'document':'a','path':[{'id':N,'document':'a'},{'id':N+1,'document':'b'}]}), [{'id':N,'document':'a'}])
check('detached contract', solve('detached', {'connected':False,'owner_exists':True,'id':N}), False)
check('fallback contract', solve('fallback', {'local':0,'document':N+1}), 0)
check('hit-target contract', solve('hit-target', {'captured':N,'capture_valid':True,'hit':N+1,'capture_owner':'canvas'}), N)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'nearest':
        return next((x['id'] for x in p if x['context']),None)
    if action == 'exclude':
        return next((x['id'] for x in p if x['context'] and not x['excluded']),None)
    if action == 'document':
        return [x for x in p['path'] if x['document']==p['document']]
    if action == 'detached':
        return p['connected'] or p['owner_exists']
    if action == 'fallback':
        return p['local'] if p['local'] is not None else p['document']
    if action == 'hit-target':
        return p['captured'] if p['capture_valid'] else p['hit']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', [{'id':N,'context':True},{'id':N+1,'context':True}]), N)
check('exclude contract', solve('exclude', [{'id':N,'context':True,'excluded':True},{'id':N+1,'context':False,'excluded':False},{'id':N+2,'context':True,'excluded':False}]), N+2)
check('document contract', solve('document', {'document':'a','path':[{'id':N,'document':'a'},{'id':N+1,'document':'b'}]}), [{'id':N,'document':'a'}])
check('detached contract', solve('detached', {'connected':False,'owner_exists':True,'id':N}), False)
check('fallback contract', solve('fallback', {'local':0,'document':N+1}), 0)
check('hit-target contract', solve('hit-target', {'captured':N,'capture_valid':True,'hit':N+1,'capture_owner':'canvas'}), N)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Detached context target retains an actionable menu owner.

Context invocations choose the nearest eligible context owner from a composed target path; nested ownership, exclusions and document boundaries are explicit.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'nearest':
        return next((x['id'] for x in p if x['context']),None)
    if action == 'exclude':
        return next((x['id'] for x in p if x['context'] and not x['excluded']),None)
    if action == 'document':
        return [x for x in p['path'] if x['document']==p['document']]
    if action == 'detached':
        return p['connected'] and p['owner_exists']
    if action == 'fallback':
        return p['local'] or p['document']
    if action == 'hit-target':
        return p['captured'] if p['capture_valid'] else p['hit']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', [{'id':N,'context':True},{'id':N+1,'context':True}]), N)
check('exclude contract', solve('exclude', [{'id':N,'context':True,'excluded':True},{'id':N+1,'context':False,'excluded':False},{'id':N+2,'context':True,'excluded':False}]), N+2)
check('document contract', solve('document', {'document':'a','path':[{'id':N,'document':'a'},{'id':N+1,'document':'b'}]}), [{'id':N,'document':'a'}])
check('detached contract', solve('detached', {'connected':False,'owner_exists':True,'id':N}), False)
check('fallback contract', solve('fallback', {'local':0,'document':N+1}), 0)
check('hit-target contract', solve('hit-target', {'captured':N,'capture_valid':True,'hit':N+1,'capture_owner':'canvas'}), N)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'nearest':
        return next((x['id'] for x in p if x['context']),None)
    if action == 'exclude':
        return next((x['id'] for x in p if x['context'] and not x['excluded']),None)
    if action == 'document':
        return [x for x in p['path'] if x['document']==p['document']]
    if action == 'detached':
        return p['connected'] and p['owner_exists']
    if action == 'fallback':
        return p['document']
    if action == 'hit-target':
        return p['captured'] if p['capture_valid'] else p['hit']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', [{'id':N,'context':True},{'id':N+1,'context':True}]), N)
check('exclude contract', solve('exclude', [{'id':N,'context':True,'excluded':True},{'id':N+1,'context':False,'excluded':False},{'id':N+2,'context':True,'excluded':False}]), N+2)
check('document contract', solve('document', {'document':'a','path':[{'id':N,'document':'a'},{'id':N+1,'document':'b'}]}), [{'id':N,'document':'a'}])
check('detached contract', solve('detached', {'connected':False,'owner_exists':True,'id':N}), False)
check('fallback contract', solve('fallback', {'local':0,'document':N+1}), 0)
check('hit-target contract', solve('hit-target', {'captured':N,'capture_valid':True,'hit':N+1,'capture_owner':'canvas'}), N)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Falsy valid context owner falls through to document menu.

Context invocations choose the nearest eligible context owner from a composed target path; nested ownership, exclusions and document boundaries are explicit.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'nearest':
        return next((x['id'] for x in p if x['context']),None)
    if action == 'exclude':
        return next((x['id'] for x in p if x['context'] and not x['excluded']),None)
    if action == 'document':
        return [x for x in p['path'] if x['document']==p['document']]
    if action == 'detached':
        return p['connected'] and p['owner_exists']
    if action == 'fallback':
        return p['local'] if p['local'] is not None else p['document']
    if action == 'hit-target':
        return p['hit']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', [{'id':N,'context':True},{'id':N+1,'context':True}]), N)
check('exclude contract', solve('exclude', [{'id':N,'context':True,'excluded':True},{'id':N+1,'context':False,'excluded':False},{'id':N+2,'context':True,'excluded':False}]), N+2)
check('document contract', solve('document', {'document':'a','path':[{'id':N,'document':'a'},{'id':N+1,'document':'b'}]}), [{'id':N,'document':'a'}])
check('detached contract', solve('detached', {'connected':False,'owner_exists':True,'id':N}), False)
check('fallback contract', solve('fallback', {'local':0,'document':N+1}), 0)
check('hit-target contract', solve('hit-target', {'captured':N,'capture_valid':True,'hit':N+1,'capture_owner':'canvas'}), N)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'nearest':
        return next((x['id'] for x in p if x['context']),None)
    if action == 'exclude':
        return next((x['id'] for x in p if x['context'] and not x['excluded']),None)
    if action == 'document':
        return [x for x in p['path'] if x['document']==p['document']]
    if action == 'detached':
        return p['connected'] and p['owner_exists']
    if action == 'fallback':
        return p['local'] if p['local'] is not None else p['document']
    if action == 'hit-target':
        return p['capture_owner']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', [{'id':N,'context':True},{'id':N+1,'context':True}]), N)
check('exclude contract', solve('exclude', [{'id':N,'context':True,'excluded':True},{'id':N+1,'context':False,'excluded':False},{'id':N+2,'context':True,'excluded':False}]), N+2)
check('document contract', solve('document', {'document':'a','path':[{'id':N,'document':'a'},{'id':N+1,'document':'b'}]}), [{'id':N,'document':'a'}])
check('detached contract', solve('detached', {'connected':False,'owner_exists':True,'id':N}), False)
check('fallback contract', solve('fallback', {'local':0,'document':N+1}), 0)
check('hit-target contract', solve('hit-target', {'captured':N,'capture_valid':True,'hit':N+1,'capture_owner':'canvas'}), N)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Captured context gesture uses a transient visual hit target.

Context invocations choose the nearest eligible context owner from a composed target path; nested ownership, exclusions and document boundaries are explicit.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'listeners':
        return []
    if action == 'timer-handles':
        return sorted({x for x in p if x is not None})
    if action == 'content':
        return {'rows':[],'loading':False,'error':None}
    if action == 'lease':
        return max(0,p['leases']-int(not p['already_closed']))
    if action == 'child-order':
        return [x['id'] for x in sorted(p,key=lambda x:len(x['menu_path']),reverse=True)]
    if action == 'anchor-null':
        return None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('listeners contract', solve('listeners', {'session':N,'listeners':[{'session':N,'id':'a'},{'session':N+1,'id':'b'}]}), [{'session':N+1,'id':'b'}])
check('timer-handles contract', solve('timer-handles', [0,N,N,None]), [0,N])
check('content contract', solve('content', {'rows':[N],'loading':True}), {'rows':[],'loading':False,'error':None})
check('lease contract', solve('lease', {'leases':N+1,'already_closed':True}), N+1)
check('child-order contract', solve('child-order', [{'id':'child','menu_path':['r','a']},{'id':'root','menu_path':['r']},{'id':N,'menu_path':['r','a','b']}]), [N,'child','root'])
check('anchor-null contract', solve('anchor-null', {'anchor':N,'fallback':'document'}), None)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'listeners':
        return p['listeners']
    if action == 'timer-handles':
        return sorted({x for x in p if x is not None})
    if action == 'content':
        return {'rows':[],'loading':False,'error':None}
    if action == 'lease':
        return max(0,p['leases']-int(not p['already_closed']))
    if action == 'child-order':
        return [x['id'] for x in sorted(p,key=lambda x:len(x['menu_path']),reverse=True)]
    if action == 'anchor-null':
        return None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('listeners contract', solve('listeners', {'session':N,'listeners':[{'session':N,'id':'a'},{'session':N+1,'id':'b'}]}), [{'session':N+1,'id':'b'}])
check('timer-handles contract', solve('timer-handles', [0,N,N,None]), [0,N])
check('content contract', solve('content', {'rows':[N],'loading':True}), {'rows':[],'loading':False,'error':None})
check('lease contract', solve('lease', {'leases':N+1,'already_closed':True}), N+1)
check('child-order contract', solve('child-order', [{'id':'child','menu_path':['r','a']},{'id':'root','menu_path':['r']},{'id':N,'menu_path':['r','a','b']}]), [N,'child','root'])
check('anchor-null contract', solve('anchor-null', {'anchor':N,'fallback':'document'}), None)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Menu teardown leaks its own event subscriptions.

Each popup owns subscriptions, timers, content and anchors; teardown releases exactly owned resources and is safe when repeated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'listeners':
        return [x for x in p['listeners'] if x['session']!=p['session']]
    if action == 'timer-handles':
        return sorted(set(x for x in p if x))
    if action == 'content':
        return {'rows':[],'loading':False,'error':None}
    if action == 'lease':
        return max(0,p['leases']-int(not p['already_closed']))
    if action == 'child-order':
        return [x['id'] for x in sorted(p,key=lambda x:len(x['menu_path']),reverse=True)]
    if action == 'anchor-null':
        return None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('listeners contract', solve('listeners', {'session':N,'listeners':[{'session':N,'id':'a'},{'session':N+1,'id':'b'}]}), [{'session':N+1,'id':'b'}])
check('timer-handles contract', solve('timer-handles', [0,N,N,None]), [0,N])
check('content contract', solve('content', {'rows':[N],'loading':True}), {'rows':[],'loading':False,'error':None})
check('lease contract', solve('lease', {'leases':N+1,'already_closed':True}), N+1)
check('child-order contract', solve('child-order', [{'id':'child','menu_path':['r','a']},{'id':'root','menu_path':['r']},{'id':N,'menu_path':['r','a','b']}]), [N,'child','root'])
check('anchor-null contract', solve('anchor-null', {'anchor':N,'fallback':'document'}), None)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'listeners':
        return [x for x in p['listeners'] if x['session']!=p['session']]
    if action == 'timer-handles':
        return [x for x in p if x is not None]
    if action == 'content':
        return {'rows':[],'loading':False,'error':None}
    if action == 'lease':
        return max(0,p['leases']-int(not p['already_closed']))
    if action == 'child-order':
        return [x['id'] for x in sorted(p,key=lambda x:len(x['menu_path']),reverse=True)]
    if action == 'anchor-null':
        return None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('listeners contract', solve('listeners', {'session':N,'listeners':[{'session':N,'id':'a'},{'session':N+1,'id':'b'}]}), [{'session':N+1,'id':'b'}])
check('timer-handles contract', solve('timer-handles', [0,N,N,None]), [0,N])
check('content contract', solve('content', {'rows':[N],'loading':True}), {'rows':[],'loading':False,'error':None})
check('lease contract', solve('lease', {'leases':N+1,'already_closed':True}), N+1)
check('child-order contract', solve('child-order', [{'id':'child','menu_path':['r','a']},{'id':'root','menu_path':['r']},{'id':N,'menu_path':['r','a','b']}]), [N,'child','root'])
check('anchor-null contract', solve('anchor-null', {'anchor':N,'fallback':'document'}), None)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Menu teardown treats timer handle zero as absent.

Each popup owns subscriptions, timers, content and anchors; teardown releases exactly owned resources and is safe when repeated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'listeners':
        return [x for x in p['listeners'] if x['session']!=p['session']]
    if action == 'timer-handles':
        return sorted({x for x in p if x is not None})
    if action == 'content':
        return {'rows':p['rows'],'loading':False,'error':None}
    if action == 'lease':
        return max(0,p['leases']-int(not p['already_closed']))
    if action == 'child-order':
        return [x['id'] for x in sorted(p,key=lambda x:len(x['menu_path']),reverse=True)]
    if action == 'anchor-null':
        return None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('listeners contract', solve('listeners', {'session':N,'listeners':[{'session':N,'id':'a'},{'session':N+1,'id':'b'}]}), [{'session':N+1,'id':'b'}])
check('timer-handles contract', solve('timer-handles', [0,N,N,None]), [0,N])
check('content contract', solve('content', {'rows':[N],'loading':True}), {'rows':[],'loading':False,'error':None})
check('lease contract', solve('lease', {'leases':N+1,'already_closed':True}), N+1)
check('child-order contract', solve('child-order', [{'id':'child','menu_path':['r','a']},{'id':'root','menu_path':['r']},{'id':N,'menu_path':['r','a','b']}]), [N,'child','root'])
check('anchor-null contract', solve('anchor-null', {'anchor':N,'fallback':'document'}), None)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'listeners':
        return [x for x in p['listeners'] if x['session']!=p['session']]
    if action == 'timer-handles':
        return sorted({x for x in p if x is not None})
    if action == 'content':
        return {'rows':[],'loading':p['loading'],'error':None}
    if action == 'lease':
        return max(0,p['leases']-int(not p['already_closed']))
    if action == 'child-order':
        return [x['id'] for x in sorted(p,key=lambda x:len(x['menu_path']),reverse=True)]
    if action == 'anchor-null':
        return None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('listeners contract', solve('listeners', {'session':N,'listeners':[{'session':N,'id':'a'},{'session':N+1,'id':'b'}]}), [{'session':N+1,'id':'b'}])
check('timer-handles contract', solve('timer-handles', [0,N,N,None]), [0,N])
check('content contract', solve('content', {'rows':[N],'loading':True}), {'rows':[],'loading':False,'error':None})
check('lease contract', solve('lease', {'leases':N+1,'already_closed':True}), N+1)
check('child-order contract', solve('child-order', [{'id':'child','menu_path':['r','a']},{'id':'root','menu_path':['r']},{'id':N,'menu_path':['r','a','b']}]), [N,'child','root'])
check('anchor-null contract', solve('anchor-null', {'anchor':N,'fallback':'document'}), None)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Disposed submenu retains provider rows or loading state.

Each popup owns subscriptions, timers, content and anchors; teardown releases exactly owned resources and is safe when repeated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'listeners':
        return [x for x in p['listeners'] if x['session']!=p['session']]
    if action == 'timer-handles':
        return sorted({x for x in p if x is not None})
    if action == 'content':
        return {'rows':[],'loading':False,'error':None}
    if action == 'lease':
        return p['leases']-1
    if action == 'child-order':
        return [x['id'] for x in sorted(p,key=lambda x:len(x['menu_path']),reverse=True)]
    if action == 'anchor-null':
        return None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('listeners contract', solve('listeners', {'session':N,'listeners':[{'session':N,'id':'a'},{'session':N+1,'id':'b'}]}), [{'session':N+1,'id':'b'}])
check('timer-handles contract', solve('timer-handles', [0,N,N,None]), [0,N])
check('content contract', solve('content', {'rows':[N],'loading':True}), {'rows':[],'loading':False,'error':None})
check('lease contract', solve('lease', {'leases':N+1,'already_closed':True}), N+1)
check('child-order contract', solve('child-order', [{'id':'child','menu_path':['r','a']},{'id':'root','menu_path':['r']},{'id':N,'menu_path':['r','a','b']}]), [N,'child','root'])
check('anchor-null contract', solve('anchor-null', {'anchor':N,'fallback':'document'}), None)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'listeners':
        return [x for x in p['listeners'] if x['session']!=p['session']]
    if action == 'timer-handles':
        return sorted({x for x in p if x is not None})
    if action == 'content':
        return {'rows':[],'loading':False,'error':None}
    if action == 'lease':
        return max(0,p['leases']-1)
    if action == 'child-order':
        return [x['id'] for x in sorted(p,key=lambda x:len(x['menu_path']),reverse=True)]
    if action == 'anchor-null':
        return None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('listeners contract', solve('listeners', {'session':N,'listeners':[{'session':N,'id':'a'},{'session':N+1,'id':'b'}]}), [{'session':N+1,'id':'b'}])
check('timer-handles contract', solve('timer-handles', [0,N,N,None]), [0,N])
check('content contract', solve('content', {'rows':[N],'loading':True}), {'rows':[],'loading':False,'error':None})
check('lease contract', solve('lease', {'leases':N+1,'already_closed':True}), N+1)
check('child-order contract', solve('child-order', [{'id':'child','menu_path':['r','a']},{'id':'root','menu_path':['r']},{'id':N,'menu_path':['r','a','b']}]), [N,'child','root'])
check('anchor-null contract', solve('anchor-null', {'anchor':N,'fallback':'document'}), None)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Repeated popup teardown consumes another menu anchor lease.

Each popup owns subscriptions, timers, content and anchors; teardown releases exactly owned resources and is safe when repeated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'listeners':
        return [x for x in p['listeners'] if x['session']!=p['session']]
    if action == 'timer-handles':
        return sorted({x for x in p if x is not None})
    if action == 'content':
        return {'rows':[],'loading':False,'error':None}
    if action == 'lease':
        return max(0,p['leases']-int(not p['already_closed']))
    if action == 'child-order':
        return [x['id'] for x in reversed(p)]
    if action == 'anchor-null':
        return None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('listeners contract', solve('listeners', {'session':N,'listeners':[{'session':N,'id':'a'},{'session':N+1,'id':'b'}]}), [{'session':N+1,'id':'b'}])
check('timer-handles contract', solve('timer-handles', [0,N,N,None]), [0,N])
check('content contract', solve('content', {'rows':[N],'loading':True}), {'rows':[],'loading':False,'error':None})
check('lease contract', solve('lease', {'leases':N+1,'already_closed':True}), N+1)
check('child-order contract', solve('child-order', [{'id':'child','menu_path':['r','a']},{'id':'root','menu_path':['r']},{'id':N,'menu_path':['r','a','b']}]), [N,'child','root'])
check('anchor-null contract', solve('anchor-null', {'anchor':N,'fallback':'document'}), None)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'listeners':
        return [x for x in p['listeners'] if x['session']!=p['session']]
    if action == 'timer-handles':
        return sorted({x for x in p if x is not None})
    if action == 'content':
        return {'rows':[],'loading':False,'error':None}
    if action == 'lease':
        return max(0,p['leases']-int(not p['already_closed']))
    if action == 'child-order':
        return [x['id'] for x in p]
    if action == 'anchor-null':
        return None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('listeners contract', solve('listeners', {'session':N,'listeners':[{'session':N,'id':'a'},{'session':N+1,'id':'b'}]}), [{'session':N+1,'id':'b'}])
check('timer-handles contract', solve('timer-handles', [0,N,N,None]), [0,N])
check('content contract', solve('content', {'rows':[N],'loading':True}), {'rows':[],'loading':False,'error':None})
check('lease contract', solve('lease', {'leases':N+1,'already_closed':True}), N+1)
check('child-order contract', solve('child-order', [{'id':'child','menu_path':['r','a']},{'id':'root','menu_path':['r']},{'id':N,'menu_path':['r','a','b']}]), [N,'child','root'])
check('anchor-null contract', solve('anchor-null', {'anchor':N,'fallback':'document'}), None)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Popup cleanup reverses registration order instead of menu ancestor depth.

Each popup owns subscriptions, timers, content and anchors; teardown releases exactly owned resources and is safe when repeated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'listeners':
        return [x for x in p['listeners'] if x['session']!=p['session']]
    if action == 'timer-handles':
        return sorted({x for x in p if x is not None})
    if action == 'content':
        return {'rows':[],'loading':False,'error':None}
    if action == 'lease':
        return max(0,p['leases']-int(not p['already_closed']))
    if action == 'child-order':
        return [x['id'] for x in sorted(p,key=lambda x:len(x['menu_path']),reverse=True)]
    if action == 'anchor-null':
        return p['anchor']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('listeners contract', solve('listeners', {'session':N,'listeners':[{'session':N,'id':'a'},{'session':N+1,'id':'b'}]}), [{'session':N+1,'id':'b'}])
check('timer-handles contract', solve('timer-handles', [0,N,N,None]), [0,N])
check('content contract', solve('content', {'rows':[N],'loading':True}), {'rows':[],'loading':False,'error':None})
check('lease contract', solve('lease', {'leases':N+1,'already_closed':True}), N+1)
check('child-order contract', solve('child-order', [{'id':'child','menu_path':['r','a']},{'id':'root','menu_path':['r']},{'id':N,'menu_path':['r','a','b']}]), [N,'child','root'])
check('anchor-null contract', solve('anchor-null', {'anchor':N,'fallback':'document'}), None)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'listeners':
        return [x for x in p['listeners'] if x['session']!=p['session']]
    if action == 'timer-handles':
        return sorted({x for x in p if x is not None})
    if action == 'content':
        return {'rows':[],'loading':False,'error':None}
    if action == 'lease':
        return max(0,p['leases']-int(not p['already_closed']))
    if action == 'child-order':
        return [x['id'] for x in sorted(p,key=lambda x:len(x['menu_path']),reverse=True)]
    if action == 'anchor-null':
        return p['fallback']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('listeners contract', solve('listeners', {'session':N,'listeners':[{'session':N,'id':'a'},{'session':N+1,'id':'b'}]}), [{'session':N+1,'id':'b'}])
check('timer-handles contract', solve('timer-handles', [0,N,N,None]), [0,N])
check('content contract', solve('content', {'rows':[N],'loading':True}), {'rows':[],'loading':False,'error':None})
check('lease contract', solve('lease', {'leases':N+1,'already_closed':True}), N+1)
check('child-order contract', solve('child-order', [{'id':'child','menu_path':['r','a']},{'id':'root','menu_path':['r']},{'id':N,'menu_path':['r','a','b']}]), [N,'child','root'])
check('anchor-null contract', solve('anchor-null', {'anchor':N,'fallback':'document'}), None)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Disposed context menu retains a stale anchor reference.

Each popup owns subscriptions, timers, content and anchors; teardown releases exactly owned resources and is safe when repeated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'retain-live':
        return p['old']
    if action == 'new-order':
        return [x for x in p['new'] if x in p['old']]
    if action == 'annotation':
        return {x:p['annotations'][x] for x in p['new'] if x in p['annotations']}
    if action == 'provider-version':
        return p['incoming']>p['current']
    if action == 'path-valid':
        return all(x in p['parents'] and p['parents'][x]==y for y,x in zip(p['chain'],p['chain'][1:]))
    if action == 'anchor-id':
        return next((i for i,x in enumerate(p['rows']) if x==p['owner']),None)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retain-live contract', solve('retain-live', {'old':[N,N+1],'new':[N+1,N+2]}), [N+1])
check('new-order contract', solve('new-order', {'old':[N,N+1],'new':[N+1,N]}), [N+1,N])
check('annotation contract', solve('annotation', {'new':['a'],'annotations':{'a':N,'gone':N+1}}), {'a':N})
check('provider-version contract', solve('provider-version', {'incoming':N,'current':N}), False)
check('path-valid contract', solve('path-valid', {'chain':['r','a',str(N)],'parents':{'a':'r',str(N):'other'}}), False)
check('anchor-id contract', solve('anchor-id', {'rows':['x','y','owner'+str(N)],'owner':'owner'+str(N),'old_index':1}), 2)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'retain-live':
        return p['new']
    if action == 'new-order':
        return [x for x in p['new'] if x in p['old']]
    if action == 'annotation':
        return {x:p['annotations'][x] for x in p['new'] if x in p['annotations']}
    if action == 'provider-version':
        return p['incoming']>p['current']
    if action == 'path-valid':
        return all(x in p['parents'] and p['parents'][x]==y for y,x in zip(p['chain'],p['chain'][1:]))
    if action == 'anchor-id':
        return next((i for i,x in enumerate(p['rows']) if x==p['owner']),None)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retain-live contract', solve('retain-live', {'old':[N,N+1],'new':[N+1,N+2]}), [N+1])
check('new-order contract', solve('new-order', {'old':[N,N+1],'new':[N+1,N]}), [N+1,N])
check('annotation contract', solve('annotation', {'new':['a'],'annotations':{'a':N,'gone':N+1}}), {'a':N})
check('provider-version contract', solve('provider-version', {'incoming':N,'current':N}), False)
check('path-valid contract', solve('path-valid', {'chain':['r','a',str(N)],'parents':{'a':'r',str(N):'other'}}), False)
check('anchor-id contract', solve('anchor-id', {'rows':['x','y','owner'+str(N)],'owner':'owner'+str(N),'old_index':1}), 2)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Refresh preserves menu commands that the provider removed.

Refreshing an open menu reconciles immutable command IDs, provider revisions and annotations without confusing display positions with identity.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'retain-live':
        return [x for x in p['old'] if x in p['new']]
    if action == 'new-order':
        return [x for x in p['old'] if x in p['new']]
    if action == 'annotation':
        return {x:p['annotations'][x] for x in p['new'] if x in p['annotations']}
    if action == 'provider-version':
        return p['incoming']>p['current']
    if action == 'path-valid':
        return all(x in p['parents'] and p['parents'][x]==y for y,x in zip(p['chain'],p['chain'][1:]))
    if action == 'anchor-id':
        return next((i for i,x in enumerate(p['rows']) if x==p['owner']),None)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retain-live contract', solve('retain-live', {'old':[N,N+1],'new':[N+1,N+2]}), [N+1])
check('new-order contract', solve('new-order', {'old':[N,N+1],'new':[N+1,N]}), [N+1,N])
check('annotation contract', solve('annotation', {'new':['a'],'annotations':{'a':N,'gone':N+1}}), {'a':N})
check('provider-version contract', solve('provider-version', {'incoming':N,'current':N}), False)
check('path-valid contract', solve('path-valid', {'chain':['r','a',str(N)],'parents':{'a':'r',str(N):'other'}}), False)
check('anchor-id contract', solve('anchor-id', {'rows':['x','y','owner'+str(N)],'owner':'owner'+str(N),'old_index':1}), 2)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'retain-live':
        return [x for x in p['old'] if x in p['new']]
    if action == 'new-order':
        return sorted(set(p['old']) & set(p['new']))
    if action == 'annotation':
        return {x:p['annotations'][x] for x in p['new'] if x in p['annotations']}
    if action == 'provider-version':
        return p['incoming']>p['current']
    if action == 'path-valid':
        return all(x in p['parents'] and p['parents'][x]==y for y,x in zip(p['chain'],p['chain'][1:]))
    if action == 'anchor-id':
        return next((i for i,x in enumerate(p['rows']) if x==p['owner']),None)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retain-live contract', solve('retain-live', {'old':[N,N+1],'new':[N+1,N+2]}), [N+1])
check('new-order contract', solve('new-order', {'old':[N,N+1],'new':[N+1,N]}), [N+1,N])
check('annotation contract', solve('annotation', {'new':['a'],'annotations':{'a':N,'gone':N+1}}), {'a':N})
check('provider-version contract', solve('provider-version', {'incoming':N,'current':N}), False)
check('path-valid contract', solve('path-valid', {'chain':['r','a',str(N)],'parents':{'a':'r',str(N):'other'}}), False)
check('anchor-id contract', solve('anchor-id', {'rows':['x','y','owner'+str(N)],'owner':'owner'+str(N),'old_index':1}), 2)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Menu refresh restores obsolete provider order.

Refreshing an open menu reconciles immutable command IDs, provider revisions and annotations without confusing display positions with identity.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'retain-live':
        return [x for x in p['old'] if x in p['new']]
    if action == 'new-order':
        return [x for x in p['new'] if x in p['old']]
    if action == 'annotation':
        return p['annotations']
    if action == 'provider-version':
        return p['incoming']>p['current']
    if action == 'path-valid':
        return all(x in p['parents'] and p['parents'][x]==y for y,x in zip(p['chain'],p['chain'][1:]))
    if action == 'anchor-id':
        return next((i for i,x in enumerate(p['rows']) if x==p['owner']),None)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retain-live contract', solve('retain-live', {'old':[N,N+1],'new':[N+1,N+2]}), [N+1])
check('new-order contract', solve('new-order', {'old':[N,N+1],'new':[N+1,N]}), [N+1,N])
check('annotation contract', solve('annotation', {'new':['a'],'annotations':{'a':N,'gone':N+1}}), {'a':N})
check('provider-version contract', solve('provider-version', {'incoming':N,'current':N}), False)
check('path-valid contract', solve('path-valid', {'chain':['r','a',str(N)],'parents':{'a':'r',str(N):'other'}}), False)
check('anchor-id contract', solve('anchor-id', {'rows':['x','y','owner'+str(N)],'owner':'owner'+str(N),'old_index':1}), 2)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'retain-live':
        return [x for x in p['old'] if x in p['new']]
    if action == 'new-order':
        return [x for x in p['new'] if x in p['old']]
    if action == 'annotation':
        return {}
    if action == 'provider-version':
        return p['incoming']>p['current']
    if action == 'path-valid':
        return all(x in p['parents'] and p['parents'][x]==y for y,x in zip(p['chain'],p['chain'][1:]))
    if action == 'anchor-id':
        return next((i for i,x in enumerate(p['rows']) if x==p['owner']),None)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retain-live contract', solve('retain-live', {'old':[N,N+1],'new':[N+1,N+2]}), [N+1])
check('new-order contract', solve('new-order', {'old':[N,N+1],'new':[N+1,N]}), [N+1,N])
check('annotation contract', solve('annotation', {'new':['a'],'annotations':{'a':N,'gone':N+1}}), {'a':N})
check('provider-version contract', solve('provider-version', {'incoming':N,'current':N}), False)
check('path-valid contract', solve('path-valid', {'chain':['r','a',str(N)],'parents':{'a':'r',str(N):'other'}}), False)
check('anchor-id contract', solve('anchor-id', {'rows':['x','y','owner'+str(N)],'owner':'owner'+str(N),'old_index':1}), 2)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Menu refresh carries annotations for deleted commands.

Refreshing an open menu reconciles immutable command IDs, provider revisions and annotations without confusing display positions with identity.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'retain-live':
        return [x for x in p['old'] if x in p['new']]
    if action == 'new-order':
        return [x for x in p['new'] if x in p['old']]
    if action == 'annotation':
        return {x:p['annotations'][x] for x in p['new'] if x in p['annotations']}
    if action == 'provider-version':
        return p['incoming']>=p['current']
    if action == 'path-valid':
        return all(x in p['parents'] and p['parents'][x]==y for y,x in zip(p['chain'],p['chain'][1:]))
    if action == 'anchor-id':
        return next((i for i,x in enumerate(p['rows']) if x==p['owner']),None)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retain-live contract', solve('retain-live', {'old':[N,N+1],'new':[N+1,N+2]}), [N+1])
check('new-order contract', solve('new-order', {'old':[N,N+1],'new':[N+1,N]}), [N+1,N])
check('annotation contract', solve('annotation', {'new':['a'],'annotations':{'a':N,'gone':N+1}}), {'a':N})
check('provider-version contract', solve('provider-version', {'incoming':N,'current':N}), False)
check('path-valid contract', solve('path-valid', {'chain':['r','a',str(N)],'parents':{'a':'r',str(N):'other'}}), False)
check('anchor-id contract', solve('anchor-id', {'rows':['x','y','owner'+str(N)],'owner':'owner'+str(N),'old_index':1}), 2)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'retain-live':
        return [x for x in p['old'] if x in p['new']]
    if action == 'new-order':
        return [x for x in p['new'] if x in p['old']]
    if action == 'annotation':
        return {x:p['annotations'][x] for x in p['new'] if x in p['annotations']}
    if action == 'provider-version':
        return True
    if action == 'path-valid':
        return all(x in p['parents'] and p['parents'][x]==y for y,x in zip(p['chain'],p['chain'][1:]))
    if action == 'anchor-id':
        return next((i for i,x in enumerate(p['rows']) if x==p['owner']),None)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retain-live contract', solve('retain-live', {'old':[N,N+1],'new':[N+1,N+2]}), [N+1])
check('new-order contract', solve('new-order', {'old':[N,N+1],'new':[N+1,N]}), [N+1,N])
check('annotation contract', solve('annotation', {'new':['a'],'annotations':{'a':N,'gone':N+1}}), {'a':N})
check('provider-version contract', solve('provider-version', {'incoming':N,'current':N}), False)
check('path-valid contract', solve('path-valid', {'chain':['r','a',str(N)],'parents':{'a':'r',str(N):'other'}}), False)
check('anchor-id contract', solve('anchor-id', {'rows':['x','y','owner'+str(N)],'owner':'owner'+str(N),'old_index':1}), 2)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Equal-version menu snapshots unnecessarily replace live content.

Refreshing an open menu reconciles immutable command IDs, provider revisions and annotations without confusing display positions with identity.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'retain-live':
        return [x for x in p['old'] if x in p['new']]
    if action == 'new-order':
        return [x for x in p['new'] if x in p['old']]
    if action == 'annotation':
        return {x:p['annotations'][x] for x in p['new'] if x in p['annotations']}
    if action == 'provider-version':
        return p['incoming']>p['current']
    if action == 'path-valid':
        return all(x in p['parents'] for x in p['chain'][1:])
    if action == 'anchor-id':
        return next((i for i,x in enumerate(p['rows']) if x==p['owner']),None)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retain-live contract', solve('retain-live', {'old':[N,N+1],'new':[N+1,N+2]}), [N+1])
check('new-order contract', solve('new-order', {'old':[N,N+1],'new':[N+1,N]}), [N+1,N])
check('annotation contract', solve('annotation', {'new':['a'],'annotations':{'a':N,'gone':N+1}}), {'a':N})
check('provider-version contract', solve('provider-version', {'incoming':N,'current':N}), False)
check('path-valid contract', solve('path-valid', {'chain':['r','a',str(N)],'parents':{'a':'r',str(N):'other'}}), False)
check('anchor-id contract', solve('anchor-id', {'rows':['x','y','owner'+str(N)],'owner':'owner'+str(N),'old_index':1}), 2)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'retain-live':
        return [x for x in p['old'] if x in p['new']]
    if action == 'new-order':
        return [x for x in p['new'] if x in p['old']]
    if action == 'annotation':
        return {x:p['annotations'][x] for x in p['new'] if x in p['annotations']}
    if action == 'provider-version':
        return p['incoming']>p['current']
    if action == 'path-valid':
        return True
    if action == 'anchor-id':
        return next((i for i,x in enumerate(p['rows']) if x==p['owner']),None)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retain-live contract', solve('retain-live', {'old':[N,N+1],'new':[N+1,N+2]}), [N+1])
check('new-order contract', solve('new-order', {'old':[N,N+1],'new':[N+1,N]}), [N+1,N])
check('annotation contract', solve('annotation', {'new':['a'],'annotations':{'a':N,'gone':N+1}}), {'a':N})
check('provider-version contract', solve('provider-version', {'incoming':N,'current':N}), False)
check('path-valid contract', solve('path-valid', {'chain':['r','a',str(N)],'parents':{'a':'r',str(N):'other'}}), False)
check('anchor-id contract', solve('anchor-id', {'rows':['x','y','owner'+str(N)],'owner':'owner'+str(N),'old_index':1}), 2)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Menu refresh keeps a cascade whose child was reparented.

Refreshing an open menu reconciles immutable command IDs, provider revisions and annotations without confusing display positions with identity.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'retain-live':
        return [x for x in p['old'] if x in p['new']]
    if action == 'new-order':
        return [x for x in p['new'] if x in p['old']]
    if action == 'annotation':
        return {x:p['annotations'][x] for x in p['new'] if x in p['annotations']}
    if action == 'provider-version':
        return p['incoming']>p['current']
    if action == 'path-valid':
        return all(x in p['parents'] and p['parents'][x]==y for y,x in zip(p['chain'],p['chain'][1:]))
    if action == 'anchor-id':
        return p['old_index']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retain-live contract', solve('retain-live', {'old':[N,N+1],'new':[N+1,N+2]}), [N+1])
check('new-order contract', solve('new-order', {'old':[N,N+1],'new':[N+1,N]}), [N+1,N])
check('annotation contract', solve('annotation', {'new':['a'],'annotations':{'a':N,'gone':N+1}}), {'a':N})
check('provider-version contract', solve('provider-version', {'incoming':N,'current':N}), False)
check('path-valid contract', solve('path-valid', {'chain':['r','a',str(N)],'parents':{'a':'r',str(N):'other'}}), False)
check('anchor-id contract', solve('anchor-id', {'rows':['x','y','owner'+str(N)],'owner':'owner'+str(N),'old_index':1}), 2)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'retain-live':
        return [x for x in p['old'] if x in p['new']]
    if action == 'new-order':
        return [x for x in p['new'] if x in p['old']]
    if action == 'annotation':
        return {x:p['annotations'][x] for x in p['new'] if x in p['annotations']}
    if action == 'provider-version':
        return p['incoming']>p['current']
    if action == 'path-valid':
        return all(x in p['parents'] and p['parents'][x]==y for y,x in zip(p['chain'],p['chain'][1:]))
    if action == 'anchor-id':
        return 0
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retain-live contract', solve('retain-live', {'old':[N,N+1],'new':[N+1,N+2]}), [N+1])
check('new-order contract', solve('new-order', {'old':[N,N+1],'new':[N+1,N]}), [N+1,N])
check('annotation contract', solve('annotation', {'new':['a'],'annotations':{'a':N,'gone':N+1}}), {'a':N})
check('provider-version contract', solve('provider-version', {'incoming':N,'current':N}), False)
check('path-valid contract', solve('path-valid', {'chain':['r','a',str(N)],'parents':{'a':'r',str(N):'other'}}), False)
check('anchor-id contract', solve('anchor-id', {'rows':['x','y','owner'+str(N)],'owner':'owner'+str(N),'old_index':1}), 2)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Menu refresh pins a submenu to the old row index.

Refreshing an open menu reconciles immutable command IDs, provider revisions and annotations without confusing display positions with identity.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'bound-order':
        return p['runtime']+p['bound']
    if action == 'allowlist':
        return {k:v for k,v in p['caller'].items() if k in p['allowed']}
    if action == 'explicit-null':
        return p['args']['target'] if 'target' in p['args'] else p['default']
    if action == 'required':
        return sorted(set(p['required'])-set(p['args']))
    if action == 'prefix':
        return p['namespace']+'.'+p['name']
    if action == 'frozen-list':
        return p['captured'][:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bound-order contract', solve('bound-order', {'bound':['document',N],'runtime':['copy']}), ['document',N,'copy'])
check('allowlist contract', solve('allowlist', {'caller':{'count':N,'owner':'rogue'},'allowed':['count']}), {'count':N})
check('explicit-null contract', solve('explicit-null', {'args':{'target':None},'default':N}), None)
check('required contract', solve('required', {'required':['a','b'],'args':{'a':N,'c':1}}), ['b'])
check('prefix contract', solve('prefix', {'namespace':'item'+str(N),'name':'mode'}), 'item'+str(N)+'.mode')
check('frozen-list contract', solve('frozen-list', {'captured':list(range(N+2)),'live':[-1]}), list(range(N+2)))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'bound-order':
        return p['bound']
    if action == 'allowlist':
        return {k:v for k,v in p['caller'].items() if k in p['allowed']}
    if action == 'explicit-null':
        return p['args']['target'] if 'target' in p['args'] else p['default']
    if action == 'required':
        return sorted(set(p['required'])-set(p['args']))
    if action == 'prefix':
        return p['namespace']+'.'+p['name']
    if action == 'frozen-list':
        return p['captured'][:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bound-order contract', solve('bound-order', {'bound':['document',N],'runtime':['copy']}), ['document',N,'copy'])
check('allowlist contract', solve('allowlist', {'caller':{'count':N,'owner':'rogue'},'allowed':['count']}), {'count':N})
check('explicit-null contract', solve('explicit-null', {'args':{'target':None},'default':N}), None)
check('required contract', solve('required', {'required':['a','b'],'args':{'a':N,'c':1}}), ['b'])
check('prefix contract', solve('prefix', {'namespace':'item'+str(N),'name':'mode'}), 'item'+str(N)+'.mode')
check('frozen-list contract', solve('frozen-list', {'captured':list(range(N+2)),'live':[-1]}), list(range(N+2)))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Menu command positional arguments reverse bound and runtime order.

Menu entries bind explicit invocation arguments, permit caller overrides only for allowed names, and distinguish missing values from explicit null.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'bound-order':
        return p['bound']+p['runtime']
    if action == 'allowlist':
        return p['caller']
    if action == 'explicit-null':
        return p['args']['target'] if 'target' in p['args'] else p['default']
    if action == 'required':
        return sorted(set(p['required'])-set(p['args']))
    if action == 'prefix':
        return p['namespace']+'.'+p['name']
    if action == 'frozen-list':
        return p['captured'][:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bound-order contract', solve('bound-order', {'bound':['document',N],'runtime':['copy']}), ['document',N,'copy'])
check('allowlist contract', solve('allowlist', {'caller':{'count':N,'owner':'rogue'},'allowed':['count']}), {'count':N})
check('explicit-null contract', solve('explicit-null', {'args':{'target':None},'default':N}), None)
check('required contract', solve('required', {'required':['a','b'],'args':{'a':N,'c':1}}), ['b'])
check('prefix contract', solve('prefix', {'namespace':'item'+str(N),'name':'mode'}), 'item'+str(N)+'.mode')
check('frozen-list contract', solve('frozen-list', {'captured':list(range(N+2)),'live':[-1]}), list(range(N+2)))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'bound-order':
        return p['bound']+p['runtime']
    if action == 'allowlist':
        return {k:v for k,v in p['caller'].items() if k not in p['allowed']}
    if action == 'explicit-null':
        return p['args']['target'] if 'target' in p['args'] else p['default']
    if action == 'required':
        return sorted(set(p['required'])-set(p['args']))
    if action == 'prefix':
        return p['namespace']+'.'+p['name']
    if action == 'frozen-list':
        return p['captured'][:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bound-order contract', solve('bound-order', {'bound':['document',N],'runtime':['copy']}), ['document',N,'copy'])
check('allowlist contract', solve('allowlist', {'caller':{'count':N,'owner':'rogue'},'allowed':['count']}), {'count':N})
check('explicit-null contract', solve('explicit-null', {'args':{'target':None},'default':N}), None)
check('required contract', solve('required', {'required':['a','b'],'args':{'a':N,'c':1}}), ['b'])
check('prefix contract', solve('prefix', {'namespace':'item'+str(N),'name':'mode'}), 'item'+str(N)+'.mode')
check('frozen-list contract', solve('frozen-list', {'captured':list(range(N+2)),'live':[-1]}), list(range(N+2)))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Context menu caller overrides protected command arguments.

Menu entries bind explicit invocation arguments, permit caller overrides only for allowed names, and distinguish missing values from explicit null.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'bound-order':
        return p['bound']+p['runtime']
    if action == 'allowlist':
        return {k:v for k,v in p['caller'].items() if k in p['allowed']}
    if action == 'explicit-null':
        return p['args'].get('target') or p['default']
    if action == 'required':
        return sorted(set(p['required'])-set(p['args']))
    if action == 'prefix':
        return p['namespace']+'.'+p['name']
    if action == 'frozen-list':
        return p['captured'][:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bound-order contract', solve('bound-order', {'bound':['document',N],'runtime':['copy']}), ['document',N,'copy'])
check('allowlist contract', solve('allowlist', {'caller':{'count':N,'owner':'rogue'},'allowed':['count']}), {'count':N})
check('explicit-null contract', solve('explicit-null', {'args':{'target':None},'default':N}), None)
check('required contract', solve('required', {'required':['a','b'],'args':{'a':N,'c':1}}), ['b'])
check('prefix contract', solve('prefix', {'namespace':'item'+str(N),'name':'mode'}), 'item'+str(N)+'.mode')
check('frozen-list contract', solve('frozen-list', {'captured':list(range(N+2)),'live':[-1]}), list(range(N+2)))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'bound-order':
        return p['bound']+p['runtime']
    if action == 'allowlist':
        return {k:v for k,v in p['caller'].items() if k in p['allowed']}
    if action == 'explicit-null':
        return p['default']
    if action == 'required':
        return sorted(set(p['required'])-set(p['args']))
    if action == 'prefix':
        return p['namespace']+'.'+p['name']
    if action == 'frozen-list':
        return p['captured'][:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bound-order contract', solve('bound-order', {'bound':['document',N],'runtime':['copy']}), ['document',N,'copy'])
check('allowlist contract', solve('allowlist', {'caller':{'count':N,'owner':'rogue'},'allowed':['count']}), {'count':N})
check('explicit-null contract', solve('explicit-null', {'args':{'target':None},'default':N}), None)
check('required contract', solve('required', {'required':['a','b'],'args':{'a':N,'c':1}}), ['b'])
check('prefix contract', solve('prefix', {'namespace':'item'+str(N),'name':'mode'}), 'item'+str(N)+'.mode')
check('frozen-list contract', solve('frozen-list', {'captured':list(range(N+2)),'live':[-1]}), list(range(N+2)))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Explicit empty menu argument is replaced by an ambient default.

Menu entries bind explicit invocation arguments, permit caller overrides only for allowed names, and distinguish missing values from explicit null.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'bound-order':
        return p['bound']+p['runtime']
    if action == 'allowlist':
        return {k:v for k,v in p['caller'].items() if k in p['allowed']}
    if action == 'explicit-null':
        return p['args']['target'] if 'target' in p['args'] else p['default']
    if action == 'required':
        return []
    if action == 'prefix':
        return p['namespace']+'.'+p['name']
    if action == 'frozen-list':
        return p['captured'][:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bound-order contract', solve('bound-order', {'bound':['document',N],'runtime':['copy']}), ['document',N,'copy'])
check('allowlist contract', solve('allowlist', {'caller':{'count':N,'owner':'rogue'},'allowed':['count']}), {'count':N})
check('explicit-null contract', solve('explicit-null', {'args':{'target':None},'default':N}), None)
check('required contract', solve('required', {'required':['a','b'],'args':{'a':N,'c':1}}), ['b'])
check('prefix contract', solve('prefix', {'namespace':'item'+str(N),'name':'mode'}), 'item'+str(N)+'.mode')
check('frozen-list contract', solve('frozen-list', {'captured':list(range(N+2)),'live':[-1]}), list(range(N+2)))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'bound-order':
        return p['bound']+p['runtime']
    if action == 'allowlist':
        return {k:v for k,v in p['caller'].items() if k in p['allowed']}
    if action == 'explicit-null':
        return p['args']['target'] if 'target' in p['args'] else p['default']
    if action == 'required':
        return sorted(set(p['args'])-set(p['required']))
    if action == 'prefix':
        return p['namespace']+'.'+p['name']
    if action == 'frozen-list':
        return p['captured'][:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bound-order contract', solve('bound-order', {'bound':['document',N],'runtime':['copy']}), ['document',N,'copy'])
check('allowlist contract', solve('allowlist', {'caller':{'count':N,'owner':'rogue'},'allowed':['count']}), {'count':N})
check('explicit-null contract', solve('explicit-null', {'args':{'target':None},'default':N}), None)
check('required contract', solve('required', {'required':['a','b'],'args':{'a':N,'c':1}}), ['b'])
check('prefix contract', solve('prefix', {'namespace':'item'+str(N),'name':'mode'}), 'item'+str(N)+'.mode')
check('frozen-list contract', solve('frozen-list', {'captured':list(range(N+2)),'live':[-1]}), list(range(N+2)))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Menu command omits required argument presence validation.

Menu entries bind explicit invocation arguments, permit caller overrides only for allowed names, and distinguish missing values from explicit null.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'bound-order':
        return p['bound']+p['runtime']
    if action == 'allowlist':
        return {k:v for k,v in p['caller'].items() if k in p['allowed']}
    if action == 'explicit-null':
        return p['args']['target'] if 'target' in p['args'] else p['default']
    if action == 'required':
        return sorted(set(p['required'])-set(p['args']))
    if action == 'prefix':
        return p['name']
    if action == 'frozen-list':
        return p['captured'][:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bound-order contract', solve('bound-order', {'bound':['document',N],'runtime':['copy']}), ['document',N,'copy'])
check('allowlist contract', solve('allowlist', {'caller':{'count':N,'owner':'rogue'},'allowed':['count']}), {'count':N})
check('explicit-null contract', solve('explicit-null', {'args':{'target':None},'default':N}), None)
check('required contract', solve('required', {'required':['a','b'],'args':{'a':N,'c':1}}), ['b'])
check('prefix contract', solve('prefix', {'namespace':'item'+str(N),'name':'mode'}), 'item'+str(N)+'.mode')
check('frozen-list contract', solve('frozen-list', {'captured':list(range(N+2)),'live':[-1]}), list(range(N+2)))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'bound-order':
        return p['bound']+p['runtime']
    if action == 'allowlist':
        return {k:v for k,v in p['caller'].items() if k in p['allowed']}
    if action == 'explicit-null':
        return p['args']['target'] if 'target' in p['args'] else p['default']
    if action == 'required':
        return sorted(set(p['required'])-set(p['args']))
    if action == 'prefix':
        return p['namespace']+p['name']
    if action == 'frozen-list':
        return p['captured'][:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bound-order contract', solve('bound-order', {'bound':['document',N],'runtime':['copy']}), ['document',N,'copy'])
check('allowlist contract', solve('allowlist', {'caller':{'count':N,'owner':'rogue'},'allowed':['count']}), {'count':N})
check('explicit-null contract', solve('explicit-null', {'args':{'target':None},'default':N}), None)
check('required contract', solve('required', {'required':['a','b'],'args':{'a':N,'c':1}}), ['b'])
check('prefix contract', solve('prefix', {'namespace':'item'+str(N),'name':'mode'}), 'item'+str(N)+'.mode')
check('frozen-list contract', solve('frozen-list', {'captured':list(range(N+2)),'live':[-1]}), list(range(N+2)))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Menu argument binding loses a parameter namespace boundary.

Menu entries bind explicit invocation arguments, permit caller overrides only for allowed names, and distinguish missing values from explicit null.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'bound-order':
        return p['bound']+p['runtime']
    if action == 'allowlist':
        return {k:v for k,v in p['caller'].items() if k in p['allowed']}
    if action == 'explicit-null':
        return p['args']['target'] if 'target' in p['args'] else p['default']
    if action == 'required':
        return sorted(set(p['required'])-set(p['args']))
    if action == 'prefix':
        return p['namespace']+'.'+p['name']
    if action == 'frozen-list':
        return p['live'][:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bound-order contract', solve('bound-order', {'bound':['document',N],'runtime':['copy']}), ['document',N,'copy'])
check('allowlist contract', solve('allowlist', {'caller':{'count':N,'owner':'rogue'},'allowed':['count']}), {'count':N})
check('explicit-null contract', solve('explicit-null', {'args':{'target':None},'default':N}), None)
check('required contract', solve('required', {'required':['a','b'],'args':{'a':N,'c':1}}), ['b'])
check('prefix contract', solve('prefix', {'namespace':'item'+str(N),'name':'mode'}), 'item'+str(N)+'.mode')
check('frozen-list contract', solve('frozen-list', {'captured':list(range(N+2)),'live':[-1]}), list(range(N+2)))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'bound-order':
        return p['bound']+p['runtime']
    if action == 'allowlist':
        return {k:v for k,v in p['caller'].items() if k in p['allowed']}
    if action == 'explicit-null':
        return p['args']['target'] if 'target' in p['args'] else p['default']
    if action == 'required':
        return sorted(set(p['required'])-set(p['args']))
    if action == 'prefix':
        return p['namespace']+'.'+p['name']
    if action == 'frozen-list':
        return p['captured'][:1]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bound-order contract', solve('bound-order', {'bound':['document',N],'runtime':['copy']}), ['document',N,'copy'])
check('allowlist contract', solve('allowlist', {'caller':{'count':N,'owner':'rogue'},'allowed':['count']}), {'count':N})
check('explicit-null contract', solve('explicit-null', {'args':{'target':None},'default':N}), None)
check('required contract', solve('required', {'required':['a','b'],'args':{'a':N,'c':1}}), ['b'])
check('prefix contract', solve('prefix', {'namespace':'item'+str(N),'name':'mode'}), 'item'+str(N)+'.mode')
check('frozen-list contract', solve('frozen-list', {'captured':list(range(N+2)),'live':[-1]}), list(range(N+2)))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
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:
Menu command argument binding truncates a captured document batch.

Menu entries bind explicit invocation arguments, permit caller overrides only for allowed names, and distinguish missing values from explicit null.

split: open-access