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 == 'push':
        return [p['page']]
    if action == 'back':
        return p[:-1] if len(p)>1 else p
    if action == 'visible':
        return p[-1:]
    if action == 'dismiss':
        return []
    if action == 'back-context':
        return {'stack':p['stack'][:-1],'context':p['context']}
    if action == 'root-back':
        return 'dismiss' if len(p)==1 else 'pop'
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('push contract', solve('push', {'stack':['root'],'page':'child'+str(N)}), ['root','child'+str(N)])
check('back contract', solve('back', ['root','child'+str(N)]), ['root'])
check('visible contract', solve('visible', ['root','child'+str(N)]), ['child'+str(N)])
check('dismiss contract', solve('dismiss', ['root','a','b'+str(N)]), [])
check('back-context contract', solve('back-context', {'stack':['r','a'],'context':N,'ambient':N+1}), {'stack':['r'],'context':N})
check('root-back contract', solve('root-back', ['root'+str(N)]), 'dismiss')
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 == 'push':
        return [p['page']]+p['stack']
    if action == 'back':
        return p[:-1] if len(p)>1 else p
    if action == 'visible':
        return p[-1:]
    if action == 'dismiss':
        return []
    if action == 'back-context':
        return {'stack':p['stack'][:-1],'context':p['context']}
    if action == 'root-back':
        return 'dismiss' if len(p)==1 else 'pop'
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('push contract', solve('push', {'stack':['root'],'page':'child'+str(N)}), ['root','child'+str(N)])
check('back contract', solve('back', ['root','child'+str(N)]), ['root'])
check('visible contract', solve('visible', ['root','child'+str(N)]), ['child'+str(N)])
check('dismiss contract', solve('dismiss', ['root','a','b'+str(N)]), [])
check('back-context contract', solve('back-context', {'stack':['r','a'],'context':N,'ambient':N+1}), {'stack':['r'],'context':N})
check('root-back contract', solve('root-back', ['root'+str(N)]), 'dismiss')
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:
Opening a touch submenu overwrites its return page stack.

A compact touch menu displays one submenu sheet at a time with a reversible page stack; dismissal removes the entire stack and back preserves the context.

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 == 'push':
        return p['stack']+[p['page']]
    if action == 'back':
        return []
    if action == 'visible':
        return p[-1:]
    if action == 'dismiss':
        return []
    if action == 'back-context':
        return {'stack':p['stack'][:-1],'context':p['context']}
    if action == 'root-back':
        return 'dismiss' if len(p)==1 else 'pop'
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('push contract', solve('push', {'stack':['root'],'page':'child'+str(N)}), ['root','child'+str(N)])
check('back contract', solve('back', ['root','child'+str(N)]), ['root'])
check('visible contract', solve('visible', ['root','child'+str(N)]), ['child'+str(N)])
check('dismiss contract', solve('dismiss', ['root','a','b'+str(N)]), [])
check('back-context contract', solve('back-context', {'stack':['r','a'],'context':N,'ambient':N+1}), {'stack':['r'],'context':N})
check('root-back contract', solve('root-back', ['root'+str(N)]), 'dismiss')
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 == 'push':
        return p['stack']+[p['page']]
    if action == 'back':
        return p[1:]
    if action == 'visible':
        return p[-1:]
    if action == 'dismiss':
        return []
    if action == 'back-context':
        return {'stack':p['stack'][:-1],'context':p['context']}
    if action == 'root-back':
        return 'dismiss' if len(p)==1 else 'pop'
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('push contract', solve('push', {'stack':['root'],'page':'child'+str(N)}), ['root','child'+str(N)])
check('back contract', solve('back', ['root','child'+str(N)]), ['root'])
check('visible contract', solve('visible', ['root','child'+str(N)]), ['child'+str(N)])
check('dismiss contract', solve('dismiss', ['root','a','b'+str(N)]), [])
check('back-context contract', solve('back-context', {'stack':['r','a'],'context':N,'ambient':N+1}), {'stack':['r'],'context':N})
check('root-back contract', solve('root-back', ['root'+str(N)]), 'dismiss')
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:
Touch submenu Back removes the root page rather than the current page.

A compact touch menu displays one submenu sheet at a time with a reversible page stack; dismissal removes the entire stack and back preserves the context.

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 == 'push':
        return p['stack']+[p['page']]
    if action == 'back':
        return p[:-1] if len(p)>1 else p
    if action == 'visible':
        return p
    if action == 'dismiss':
        return []
    if action == 'back-context':
        return {'stack':p['stack'][:-1],'context':p['context']}
    if action == 'root-back':
        return 'dismiss' if len(p)==1 else 'pop'
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('push contract', solve('push', {'stack':['root'],'page':'child'+str(N)}), ['root','child'+str(N)])
check('back contract', solve('back', ['root','child'+str(N)]), ['root'])
check('visible contract', solve('visible', ['root','child'+str(N)]), ['child'+str(N)])
check('dismiss contract', solve('dismiss', ['root','a','b'+str(N)]), [])
check('back-context contract', solve('back-context', {'stack':['r','a'],'context':N,'ambient':N+1}), {'stack':['r'],'context':N})
check('root-back contract', solve('root-back', ['root'+str(N)]), 'dismiss')
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 == 'push':
        return p['stack']+[p['page']]
    if action == 'back':
        return p[:-1] if len(p)>1 else p
    if action == 'visible':
        return p[:1]
    if action == 'dismiss':
        return []
    if action == 'back-context':
        return {'stack':p['stack'][:-1],'context':p['context']}
    if action == 'root-back':
        return 'dismiss' if len(p)==1 else 'pop'
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('push contract', solve('push', {'stack':['root'],'page':'child'+str(N)}), ['root','child'+str(N)])
check('back contract', solve('back', ['root','child'+str(N)]), ['root'])
check('visible contract', solve('visible', ['root','child'+str(N)]), ['child'+str(N)])
check('dismiss contract', solve('dismiss', ['root','a','b'+str(N)]), [])
check('back-context contract', solve('back-context', {'stack':['r','a'],'context':N,'ambient':N+1}), {'stack':['r'],'context':N})
check('root-back contract', solve('root-back', ['root'+str(N)]), 'dismiss')
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:
Compact menu sheet shows ancestor pages alongside the active page.

A compact touch menu displays one submenu sheet at a time with a reversible page stack; dismissal removes the entire stack and back preserves the context.

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 == 'push':
        return p['stack']+[p['page']]
    if action == 'back':
        return p[:-1] if len(p)>1 else p
    if action == 'visible':
        return p[-1:]
    if action == 'dismiss':
        return p[:-1]
    if action == 'back-context':
        return {'stack':p['stack'][:-1],'context':p['context']}
    if action == 'root-back':
        return 'dismiss' if len(p)==1 else 'pop'
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('push contract', solve('push', {'stack':['root'],'page':'child'+str(N)}), ['root','child'+str(N)])
check('back contract', solve('back', ['root','child'+str(N)]), ['root'])
check('visible contract', solve('visible', ['root','child'+str(N)]), ['child'+str(N)])
check('dismiss contract', solve('dismiss', ['root','a','b'+str(N)]), [])
check('back-context contract', solve('back-context', {'stack':['r','a'],'context':N,'ambient':N+1}), {'stack':['r'],'context':N})
check('root-back contract', solve('root-back', ['root'+str(N)]), 'dismiss')
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 == 'push':
        return p['stack']+[p['page']]
    if action == 'back':
        return p[:-1] if len(p)>1 else p
    if action == 'visible':
        return p[-1:]
    if action == 'dismiss':
        return p[:1]
    if action == 'back-context':
        return {'stack':p['stack'][:-1],'context':p['context']}
    if action == 'root-back':
        return 'dismiss' if len(p)==1 else 'pop'
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('push contract', solve('push', {'stack':['root'],'page':'child'+str(N)}), ['root','child'+str(N)])
check('back contract', solve('back', ['root','child'+str(N)]), ['root'])
check('visible contract', solve('visible', ['root','child'+str(N)]), ['child'+str(N)])
check('dismiss contract', solve('dismiss', ['root','a','b'+str(N)]), [])
check('back-context contract', solve('back-context', {'stack':['r','a'],'context':N,'ambient':N+1}), {'stack':['r'],'context':N})
check('root-back contract', solve('root-back', ['root'+str(N)]), 'dismiss')
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:
Dismissing touch menu leaves its root sheet registered.

A compact touch menu displays one submenu sheet at a time with a reversible page stack; dismissal removes the entire stack and back preserves the context.

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 == 'push':
        return p['stack']+[p['page']]
    if action == 'back':
        return p[:-1] if len(p)>1 else p
    if action == 'visible':
        return p[-1:]
    if action == 'dismiss':
        return []
    if action == 'back-context':
        return {'stack':p['stack'][:-1],'context':None}
    if action == 'root-back':
        return 'dismiss' if len(p)==1 else 'pop'
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('push contract', solve('push', {'stack':['root'],'page':'child'+str(N)}), ['root','child'+str(N)])
check('back contract', solve('back', ['root','child'+str(N)]), ['root'])
check('visible contract', solve('visible', ['root','child'+str(N)]), ['child'+str(N)])
check('dismiss contract', solve('dismiss', ['root','a','b'+str(N)]), [])
check('back-context contract', solve('back-context', {'stack':['r','a'],'context':N,'ambient':N+1}), {'stack':['r'],'context':N})
check('root-back contract', solve('root-back', ['root'+str(N)]), 'dismiss')
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 == 'push':
        return p['stack']+[p['page']]
    if action == 'back':
        return p[:-1] if len(p)>1 else p
    if action == 'visible':
        return p[-1:]
    if action == 'dismiss':
        return []
    if action == 'back-context':
        return {'stack':p['stack'][:-1],'context':p['ambient']}
    if action == 'root-back':
        return 'dismiss' if len(p)==1 else 'pop'
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('push contract', solve('push', {'stack':['root'],'page':'child'+str(N)}), ['root','child'+str(N)])
check('back contract', solve('back', ['root','child'+str(N)]), ['root'])
check('visible contract', solve('visible', ['root','child'+str(N)]), ['child'+str(N)])
check('dismiss contract', solve('dismiss', ['root','a','b'+str(N)]), [])
check('back-context contract', solve('back-context', {'stack':['r','a'],'context':N,'ambient':N+1}), {'stack':['r'],'context':N})
check('root-back contract', solve('root-back', ['root'+str(N)]), 'dismiss')
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:
Touch submenu Back loses its original document context.

A compact touch menu displays one submenu sheet at a time with a reversible page stack; dismissal removes the entire stack and back preserves the context.

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 == 'push':
        return p['stack']+[p['page']]
    if action == 'back':
        return p[:-1] if len(p)>1 else p
    if action == 'visible':
        return p[-1:]
    if action == 'dismiss':
        return []
    if action == 'back-context':
        return {'stack':p['stack'][:-1],'context':p['context']}
    if action == 'root-back':
        return 'pop'
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('push contract', solve('push', {'stack':['root'],'page':'child'+str(N)}), ['root','child'+str(N)])
check('back contract', solve('back', ['root','child'+str(N)]), ['root'])
check('visible contract', solve('visible', ['root','child'+str(N)]), ['child'+str(N)])
check('dismiss contract', solve('dismiss', ['root','a','b'+str(N)]), [])
check('back-context contract', solve('back-context', {'stack':['r','a'],'context':N,'ambient':N+1}), {'stack':['r'],'context':N})
check('root-back contract', solve('root-back', ['root'+str(N)]), 'dismiss')
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 == 'push':
        return p['stack']+[p['page']]
    if action == 'back':
        return p[:-1] if len(p)>1 else p
    if action == 'visible':
        return p[-1:]
    if action == 'dismiss':
        return []
    if action == 'back-context':
        return {'stack':p['stack'][:-1],'context':p['context']}
    if action == 'root-back':
        return 'ignore'
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('push contract', solve('push', {'stack':['root'],'page':'child'+str(N)}), ['root','child'+str(N)])
check('back contract', solve('back', ['root','child'+str(N)]), ['root'])
check('visible contract', solve('visible', ['root','child'+str(N)]), ['child'+str(N)])
check('dismiss contract', solve('dismiss', ['root','a','b'+str(N)]), [])
check('back-context contract', solve('back-context', {'stack':['r','a'],'context':N,'ambient':N+1}), {'stack':['r'],'context':N})
check('root-back contract', solve('root-back', ['root'+str(N)]), 'dismiss')
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:
Root touch-menu Back attempts to reveal a nonexistent parent.

A compact touch menu displays one submenu sheet at a time with a reversible page stack; dismissal removes the entire stack and back preserves the context.

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 == 'center':
        return 'ring'
    if action == 'outer':
        return p['radius']<=p['outer']
    if action == 'angle':
        return (p['degrees']-p['rotation'])%360
    if action == 'sector':
        return int(p['angle']//(360/p['count']))
    if action == 'empty-sector':
        return p['commands'][p['sector']] if p['sector']<len(p['commands']) else None
    if action == 'gap':
        return p['local']>=p['gap']/2 and p['local']<p['width']-p['gap']/2
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('center contract', solve('center', {'radius':N,'inner':N+2}), None)
check('outer contract', solve('outer', {'radius':N+10,'outer':N+9}), False)
check('angle contract', solve('angle', {'degrees':N+30,'rotation':20}), N+10)
check('sector contract', solve('sector', {'angle':80+N,'count':4}), 0)
check('empty-sector contract', solve('empty-sector', {'commands':[N,N+1],'sector':3}), None)
check('gap contract', solve('gap', {'local':N/10,'gap':4,'width':90}), False)
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 == 'center':
        return None if p['radius']>p['inner'] else 'ring'
    if action == 'outer':
        return p['radius']<=p['outer']
    if action == 'angle':
        return (p['degrees']-p['rotation'])%360
    if action == 'sector':
        return int(p['angle']//(360/p['count']))
    if action == 'empty-sector':
        return p['commands'][p['sector']] if p['sector']<len(p['commands']) else None
    if action == 'gap':
        return p['local']>=p['gap']/2 and p['local']<p['width']-p['gap']/2
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('center contract', solve('center', {'radius':N,'inner':N+2}), None)
check('outer contract', solve('outer', {'radius':N+10,'outer':N+9}), False)
check('angle contract', solve('angle', {'degrees':N+30,'rotation':20}), N+10)
check('sector contract', solve('sector', {'angle':80+N,'count':4}), 0)
check('empty-sector contract', solve('empty-sector', {'commands':[N,N+1],'sector':3}), None)
check('gap contract', solve('gap', {'local':N/10,'gap':4,'width':90}), False)
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:
Radial menu center invokes a ring command.

A radial menu has half-open angular sectors, an inactive central disk and a bounded outer radius; only displayed command sectors are hittable.

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 == 'center':
        return None if p['radius']<p['inner'] else 'ring'
    if action == 'outer':
        return True
    if action == 'angle':
        return (p['degrees']-p['rotation'])%360
    if action == 'sector':
        return int(p['angle']//(360/p['count']))
    if action == 'empty-sector':
        return p['commands'][p['sector']] if p['sector']<len(p['commands']) else None
    if action == 'gap':
        return p['local']>=p['gap']/2 and p['local']<p['width']-p['gap']/2
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('center contract', solve('center', {'radius':N,'inner':N+2}), None)
check('outer contract', solve('outer', {'radius':N+10,'outer':N+9}), False)
check('angle contract', solve('angle', {'degrees':N+30,'rotation':20}), N+10)
check('sector contract', solve('sector', {'angle':80+N,'count':4}), 0)
check('empty-sector contract', solve('empty-sector', {'commands':[N,N+1],'sector':3}), None)
check('gap contract', solve('gap', {'local':N/10,'gap':4,'width':90}), False)
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 == 'center':
        return None if p['radius']<p['inner'] else 'ring'
    if action == 'outer':
        return p['radius']>=p['outer']
    if action == 'angle':
        return (p['degrees']-p['rotation'])%360
    if action == 'sector':
        return int(p['angle']//(360/p['count']))
    if action == 'empty-sector':
        return p['commands'][p['sector']] if p['sector']<len(p['commands']) else None
    if action == 'gap':
        return p['local']>=p['gap']/2 and p['local']<p['width']-p['gap']/2
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('center contract', solve('center', {'radius':N,'inner':N+2}), None)
check('outer contract', solve('outer', {'radius':N+10,'outer':N+9}), False)
check('angle contract', solve('angle', {'degrees':N+30,'rotation':20}), N+10)
check('sector contract', solve('sector', {'angle':80+N,'count':4}), 0)
check('empty-sector contract', solve('empty-sector', {'commands':[N,N+1],'sector':3}), None)
check('gap contract', solve('gap', {'local':N/10,'gap':4,'width':90}), False)
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:
Pointer beyond radial menu radius still hits a command.

A radial menu has half-open angular sectors, an inactive central disk and a bounded outer radius; only displayed command sectors are hittable.

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 == 'center':
        return None if p['radius']<p['inner'] else 'ring'
    if action == 'outer':
        return p['radius']<=p['outer']
    if action == 'angle':
        return p['degrees']%360
    if action == 'sector':
        return int(p['angle']//(360/p['count']))
    if action == 'empty-sector':
        return p['commands'][p['sector']] if p['sector']<len(p['commands']) else None
    if action == 'gap':
        return p['local']>=p['gap']/2 and p['local']<p['width']-p['gap']/2
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('center contract', solve('center', {'radius':N,'inner':N+2}), None)
check('outer contract', solve('outer', {'radius':N+10,'outer':N+9}), False)
check('angle contract', solve('angle', {'degrees':N+30,'rotation':20}), N+10)
check('sector contract', solve('sector', {'angle':80+N,'count':4}), 0)
check('empty-sector contract', solve('empty-sector', {'commands':[N,N+1],'sector':3}), None)
check('gap contract', solve('gap', {'local':N/10,'gap':4,'width':90}), False)
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 == 'center':
        return None if p['radius']<p['inner'] else 'ring'
    if action == 'outer':
        return p['radius']<=p['outer']
    if action == 'angle':
        return (p['degrees']+p['rotation'])%360
    if action == 'sector':
        return int(p['angle']//(360/p['count']))
    if action == 'empty-sector':
        return p['commands'][p['sector']] if p['sector']<len(p['commands']) else None
    if action == 'gap':
        return p['local']>=p['gap']/2 and p['local']<p['width']-p['gap']/2
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('center contract', solve('center', {'radius':N,'inner':N+2}), None)
check('outer contract', solve('outer', {'radius':N+10,'outer':N+9}), False)
check('angle contract', solve('angle', {'degrees':N+30,'rotation':20}), N+10)
check('sector contract', solve('sector', {'angle':80+N,'count':4}), 0)
check('empty-sector contract', solve('empty-sector', {'commands':[N,N+1],'sector':3}), None)
check('gap contract', solve('gap', {'local':N/10,'gap':4,'width':90}), False)
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:
Rotated radial menu hit testing ignores its displayed rotation.

A radial menu has half-open angular sectors, an inactive central disk and a bounded outer radius; only displayed command sectors are hittable.

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 == 'center':
        return None if p['radius']<p['inner'] else 'ring'
    if action == 'outer':
        return p['radius']<=p['outer']
    if action == 'angle':
        return (p['degrees']-p['rotation'])%360
    if action == 'sector':
        return round(p['angle']/(360/p['count']))
    if action == 'empty-sector':
        return p['commands'][p['sector']] if p['sector']<len(p['commands']) else None
    if action == 'gap':
        return p['local']>=p['gap']/2 and p['local']<p['width']-p['gap']/2
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('center contract', solve('center', {'radius':N,'inner':N+2}), None)
check('outer contract', solve('outer', {'radius':N+10,'outer':N+9}), False)
check('angle contract', solve('angle', {'degrees':N+30,'rotation':20}), N+10)
check('sector contract', solve('sector', {'angle':80+N,'count':4}), 0)
check('empty-sector contract', solve('empty-sector', {'commands':[N,N+1],'sector':3}), None)
check('gap contract', solve('gap', {'local':N/10,'gap':4,'width':90}), False)
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 == 'center':
        return None if p['radius']<p['inner'] else 'ring'
    if action == 'outer':
        return p['radius']<=p['outer']
    if action == 'angle':
        return (p['degrees']-p['rotation'])%360
    if action == 'sector':
        return int(p['angle']//(360/p['count']))+1
    if action == 'empty-sector':
        return p['commands'][p['sector']] if p['sector']<len(p['commands']) else None
    if action == 'gap':
        return p['local']>=p['gap']/2 and p['local']<p['width']-p['gap']/2
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('center contract', solve('center', {'radius':N,'inner':N+2}), None)
check('outer contract', solve('outer', {'radius':N+10,'outer':N+9}), False)
check('angle contract', solve('angle', {'degrees':N+30,'rotation':20}), N+10)
check('sector contract', solve('sector', {'angle':80+N,'count':4}), 0)
check('empty-sector contract', solve('empty-sector', {'commands':[N,N+1],'sector':3}), None)
check('gap contract', solve('gap', {'local':N/10,'gap':4,'width':90}), False)
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:
Radial menu rounds near-edge hits into the next sector.

A radial menu has half-open angular sectors, an inactive central disk and a bounded outer radius; only displayed command sectors are hittable.

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 == 'center':
        return None if p['radius']<p['inner'] else 'ring'
    if action == 'outer':
        return p['radius']<=p['outer']
    if action == 'angle':
        return (p['degrees']-p['rotation'])%360
    if action == 'sector':
        return int(p['angle']//(360/p['count']))
    if action == 'empty-sector':
        return p['commands'][p['sector']%len(p['commands'])]
    if action == 'gap':
        return p['local']>=p['gap']/2 and p['local']<p['width']-p['gap']/2
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('center contract', solve('center', {'radius':N,'inner':N+2}), None)
check('outer contract', solve('outer', {'radius':N+10,'outer':N+9}), False)
check('angle contract', solve('angle', {'degrees':N+30,'rotation':20}), N+10)
check('sector contract', solve('sector', {'angle':80+N,'count':4}), 0)
check('empty-sector contract', solve('empty-sector', {'commands':[N,N+1],'sector':3}), None)
check('gap contract', solve('gap', {'local':N/10,'gap':4,'width':90}), False)
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 == 'center':
        return None if p['radius']<p['inner'] else 'ring'
    if action == 'outer':
        return p['radius']<=p['outer']
    if action == 'angle':
        return (p['degrees']-p['rotation'])%360
    if action == 'sector':
        return int(p['angle']//(360/p['count']))
    if action == 'empty-sector':
        return p['commands'][-1]
    if action == 'gap':
        return p['local']>=p['gap']/2 and p['local']<p['width']-p['gap']/2
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('center contract', solve('center', {'radius':N,'inner':N+2}), None)
check('outer contract', solve('outer', {'radius':N+10,'outer':N+9}), False)
check('angle contract', solve('angle', {'degrees':N+30,'rotation':20}), N+10)
check('sector contract', solve('sector', {'angle':80+N,'count':4}), 0)
check('empty-sector contract', solve('empty-sector', {'commands':[N,N+1],'sector':3}), None)
check('gap contract', solve('gap', {'local':N/10,'gap':4,'width':90}), False)
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:
Unused radial sector wraps onto an existing command.

A radial menu has half-open angular sectors, an inactive central disk and a bounded outer radius; only displayed command sectors are hittable.

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 == 'center':
        return None if p['radius']<p['inner'] else 'ring'
    if action == 'outer':
        return p['radius']<=p['outer']
    if action == 'angle':
        return (p['degrees']-p['rotation'])%360
    if action == 'sector':
        return int(p['angle']//(360/p['count']))
    if action == 'empty-sector':
        return p['commands'][p['sector']] if p['sector']<len(p['commands']) else None
    if action == 'gap':
        return p['local']<p['width']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('center contract', solve('center', {'radius':N,'inner':N+2}), None)
check('outer contract', solve('outer', {'radius':N+10,'outer':N+9}), False)
check('angle contract', solve('angle', {'degrees':N+30,'rotation':20}), N+10)
check('sector contract', solve('sector', {'angle':80+N,'count':4}), 0)
check('empty-sector contract', solve('empty-sector', {'commands':[N,N+1],'sector':3}), None)
check('gap contract', solve('gap', {'local':N/10,'gap':4,'width':90}), False)
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 == 'center':
        return None if p['radius']<p['inner'] else 'ring'
    if action == 'outer':
        return p['radius']<=p['outer']
    if action == 'angle':
        return (p['degrees']-p['rotation'])%360
    if action == 'sector':
        return int(p['angle']//(360/p['count']))
    if action == 'empty-sector':
        return p['commands'][p['sector']] if p['sector']<len(p['commands']) else None
    if action == 'gap':
        return p['local']>=0
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('center contract', solve('center', {'radius':N,'inner':N+2}), None)
check('outer contract', solve('outer', {'radius':N+10,'outer':N+9}), False)
check('angle contract', solve('angle', {'degrees':N+30,'rotation':20}), N+10)
check('sector contract', solve('sector', {'angle':80+N,'count':4}), 0)
check('empty-sector contract', solve('empty-sector', {'commands':[N,N+1],'sector':3}), None)
check('gap contract', solve('gap', {'local':N/10,'gap':4,'width':90}), False)
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:
Radial menu decorative sector gap remains actionable.

A radial menu has half-open angular sectors, an inactive central disk and a bounded outer radius; only displayed command sectors are hittable.

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 == 'origin':
        return p['end']
    if action == 'threshold':
        return p['dx']**2+p['dy']**2>=p['threshold']**2
    if action == 'retrace':
        return p['segments'][:-1] if p['direction']==(p['segments'][-1]+2)%4 else p['segments']+[p['direction']]
    if action == 'segment-reset':
        return p['turn'][:]
    if action == 'leaf-required':
        return p['kind']=='command' and p['complete']
    if action == 'trailing-jitter':
        return p['completed'][-1] if p['tail_distance']<p['threshold'] else p['tail_sector']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('origin contract', solve('origin', {'start':[N,N+1],'end':[N+3,N+5]}), [3,4])
check('threshold contract', solve('threshold', {'dx':3*N,'dy':4*N,'threshold':6*N}), False)
check('retrace contract', solve('retrace', {'segments':[N%4,(N+1)%4,(N+2)%4],'direction':N%4}), [N%4,(N+1)%4])
check('segment-reset contract', solve('segment-reset', {'turn':[N+2,N+3],'original':[0,0],'last':[N+5,N+6]}), [N+2,N+3])
check('leaf-required contract', solve('leaf-required', {'kind':'submenu','complete':True,'sector':N}), False)
check('trailing-jitter contract', solve('trailing-jitter', {'completed':[N,N+1],'tail_sector':N+2,'tail_distance':1,'threshold':5}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('incomplete command stroke',solve('leaf-required',{'kind':'command','complete':False,'sector':N}),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 == 'origin':
        return [p['start'][0]-p['end'][0],p['start'][1]-p['end'][1]]
    if action == 'threshold':
        return p['dx']**2+p['dy']**2>=p['threshold']**2
    if action == 'retrace':
        return p['segments'][:-1] if p['direction']==(p['segments'][-1]+2)%4 else p['segments']+[p['direction']]
    if action == 'segment-reset':
        return p['turn'][:]
    if action == 'leaf-required':
        return p['kind']=='command' and p['complete']
    if action == 'trailing-jitter':
        return p['completed'][-1] if p['tail_distance']<p['threshold'] else p['tail_sector']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('origin contract', solve('origin', {'start':[N,N+1],'end':[N+3,N+5]}), [3,4])
check('threshold contract', solve('threshold', {'dx':3*N,'dy':4*N,'threshold':6*N}), False)
check('retrace contract', solve('retrace', {'segments':[N%4,(N+1)%4,(N+2)%4],'direction':N%4}), [N%4,(N+1)%4])
check('segment-reset contract', solve('segment-reset', {'turn':[N+2,N+3],'original':[0,0],'last':[N+5,N+6]}), [N+2,N+3])
check('leaf-required contract', solve('leaf-required', {'kind':'submenu','complete':True,'sector':N}), False)
check('trailing-jitter contract', solve('trailing-jitter', {'completed':[N,N+1],'tail_sector':N+2,'tail_distance':1,'threshold':5}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('incomplete command stroke',solve('leaf-required',{'kind':'command','complete':False,'sector':N}),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:
Marking-menu direction uses global coordinates instead of gesture origin.

A marking menu resolves completed directional strokes after sufficient displacement. Cardinal directions are 0..3; an opposite segment retraces one level, and subthreshold tail jitter preserves the completed sector.

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 == 'origin':
        return [p['end'][0]-p['start'][0],p['end'][1]-p['start'][1]]
    if action == 'threshold':
        return abs(p['dx'])+abs(p['dy'])>=p['threshold']
    if action == 'retrace':
        return p['segments'][:-1] if p['direction']==(p['segments'][-1]+2)%4 else p['segments']+[p['direction']]
    if action == 'segment-reset':
        return p['turn'][:]
    if action == 'leaf-required':
        return p['kind']=='command' and p['complete']
    if action == 'trailing-jitter':
        return p['completed'][-1] if p['tail_distance']<p['threshold'] else p['tail_sector']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('origin contract', solve('origin', {'start':[N,N+1],'end':[N+3,N+5]}), [3,4])
check('threshold contract', solve('threshold', {'dx':3*N,'dy':4*N,'threshold':6*N}), False)
check('retrace contract', solve('retrace', {'segments':[N%4,(N+1)%4,(N+2)%4],'direction':N%4}), [N%4,(N+1)%4])
check('segment-reset contract', solve('segment-reset', {'turn':[N+2,N+3],'original':[0,0],'last':[N+5,N+6]}), [N+2,N+3])
check('leaf-required contract', solve('leaf-required', {'kind':'submenu','complete':True,'sector':N}), False)
check('trailing-jitter contract', solve('trailing-jitter', {'completed':[N,N+1],'tail_sector':N+2,'tail_distance':1,'threshold':5}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('incomplete command stroke',solve('leaf-required',{'kind':'command','complete':False,'sector':N}),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 == 'origin':
        return [p['end'][0]-p['start'][0],p['end'][1]-p['start'][1]]
    if action == 'threshold':
        return p['dx']**2+p['dy']**2>=p['threshold']
    if action == 'retrace':
        return p['segments'][:-1] if p['direction']==(p['segments'][-1]+2)%4 else p['segments']+[p['direction']]
    if action == 'segment-reset':
        return p['turn'][:]
    if action == 'leaf-required':
        return p['kind']=='command' and p['complete']
    if action == 'trailing-jitter':
        return p['completed'][-1] if p['tail_distance']<p['threshold'] else p['tail_sector']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('origin contract', solve('origin', {'start':[N,N+1],'end':[N+3,N+5]}), [3,4])
check('threshold contract', solve('threshold', {'dx':3*N,'dy':4*N,'threshold':6*N}), False)
check('retrace contract', solve('retrace', {'segments':[N%4,(N+1)%4,(N+2)%4],'direction':N%4}), [N%4,(N+1)%4])
check('segment-reset contract', solve('segment-reset', {'turn':[N+2,N+3],'original':[0,0],'last':[N+5,N+6]}), [N+2,N+3])
check('leaf-required contract', solve('leaf-required', {'kind':'submenu','complete':True,'sector':N}), False)
check('trailing-jitter contract', solve('trailing-jitter', {'completed':[N,N+1],'tail_sector':N+2,'tail_distance':1,'threshold':5}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('incomplete command stroke',solve('leaf-required',{'kind':'command','complete':False,'sector':N}),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:
Marking-menu movement threshold uses incompatible distance units.

A marking menu resolves completed directional strokes after sufficient displacement. Cardinal directions are 0..3; an opposite segment retraces one level, and subthreshold tail jitter preserves the completed sector.

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 == 'origin':
        return [p['end'][0]-p['start'][0],p['end'][1]-p['start'][1]]
    if action == 'threshold':
        return p['dx']**2+p['dy']**2>=p['threshold']**2
    if action == 'retrace':
        return p['segments']+[p['direction']]
    if action == 'segment-reset':
        return p['turn'][:]
    if action == 'leaf-required':
        return p['kind']=='command' and p['complete']
    if action == 'trailing-jitter':
        return p['completed'][-1] if p['tail_distance']<p['threshold'] else p['tail_sector']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('origin contract', solve('origin', {'start':[N,N+1],'end':[N+3,N+5]}), [3,4])
check('threshold contract', solve('threshold', {'dx':3*N,'dy':4*N,'threshold':6*N}), False)
check('retrace contract', solve('retrace', {'segments':[N%4,(N+1)%4,(N+2)%4],'direction':N%4}), [N%4,(N+1)%4])
check('segment-reset contract', solve('segment-reset', {'turn':[N+2,N+3],'original':[0,0],'last':[N+5,N+6]}), [N+2,N+3])
check('leaf-required contract', solve('leaf-required', {'kind':'submenu','complete':True,'sector':N}), False)
check('trailing-jitter contract', solve('trailing-jitter', {'completed':[N,N+1],'tail_sector':N+2,'tail_distance':1,'threshold':5}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('incomplete command stroke',solve('leaf-required',{'kind':'command','complete':False,'sector':N}),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 == 'origin':
        return [p['end'][0]-p['start'][0],p['end'][1]-p['start'][1]]
    if action == 'threshold':
        return p['dx']**2+p['dy']**2>=p['threshold']**2
    if action == 'retrace':
        return [] if p['direction']==(p['segments'][-1]+2)%4 else p['segments']+[p['direction']]
    if action == 'segment-reset':
        return p['turn'][:]
    if action == 'leaf-required':
        return p['kind']=='command' and p['complete']
    if action == 'trailing-jitter':
        return p['completed'][-1] if p['tail_distance']<p['threshold'] else p['tail_sector']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('origin contract', solve('origin', {'start':[N,N+1],'end':[N+3,N+5]}), [3,4])
check('threshold contract', solve('threshold', {'dx':3*N,'dy':4*N,'threshold':6*N}), False)
check('retrace contract', solve('retrace', {'segments':[N%4,(N+1)%4,(N+2)%4],'direction':N%4}), [N%4,(N+1)%4])
check('segment-reset contract', solve('segment-reset', {'turn':[N+2,N+3],'original':[0,0],'last':[N+5,N+6]}), [N+2,N+3])
check('leaf-required contract', solve('leaf-required', {'kind':'submenu','complete':True,'sector':N}), False)
check('trailing-jitter contract', solve('trailing-jitter', {'completed':[N,N+1],'tail_sector':N+2,'tail_distance':1,'threshold':5}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('incomplete command stroke',solve('leaf-required',{'kind':'command','complete':False,'sector':N}),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:
Marking-menu retrace appends a new submenu segment instead of returning one level.

A marking menu resolves completed directional strokes after sufficient displacement. Cardinal directions are 0..3; an opposite segment retraces one level, and subthreshold tail jitter preserves the completed sector.

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 == 'origin':
        return [p['end'][0]-p['start'][0],p['end'][1]-p['start'][1]]
    if action == 'threshold':
        return p['dx']**2+p['dy']**2>=p['threshold']**2
    if action == 'retrace':
        return p['segments'][:-1] if p['direction']==(p['segments'][-1]+2)%4 else p['segments']+[p['direction']]
    if action == 'segment-reset':
        return p['original'][:]
    if action == 'leaf-required':
        return p['kind']=='command' and p['complete']
    if action == 'trailing-jitter':
        return p['completed'][-1] if p['tail_distance']<p['threshold'] else p['tail_sector']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('origin contract', solve('origin', {'start':[N,N+1],'end':[N+3,N+5]}), [3,4])
check('threshold contract', solve('threshold', {'dx':3*N,'dy':4*N,'threshold':6*N}), False)
check('retrace contract', solve('retrace', {'segments':[N%4,(N+1)%4,(N+2)%4],'direction':N%4}), [N%4,(N+1)%4])
check('segment-reset contract', solve('segment-reset', {'turn':[N+2,N+3],'original':[0,0],'last':[N+5,N+6]}), [N+2,N+3])
check('leaf-required contract', solve('leaf-required', {'kind':'submenu','complete':True,'sector':N}), False)
check('trailing-jitter contract', solve('trailing-jitter', {'completed':[N,N+1],'tail_sector':N+2,'tail_distance':1,'threshold':5}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('incomplete command stroke',solve('leaf-required',{'kind':'command','complete':False,'sector':N}),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 == 'origin':
        return [p['end'][0]-p['start'][0],p['end'][1]-p['start'][1]]
    if action == 'threshold':
        return p['dx']**2+p['dy']**2>=p['threshold']**2
    if action == 'retrace':
        return p['segments'][:-1] if p['direction']==(p['segments'][-1]+2)%4 else p['segments']+[p['direction']]
    if action == 'segment-reset':
        return p['last'][:]
    if action == 'leaf-required':
        return p['kind']=='command' and p['complete']
    if action == 'trailing-jitter':
        return p['completed'][-1] if p['tail_distance']<p['threshold'] else p['tail_sector']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('origin contract', solve('origin', {'start':[N,N+1],'end':[N+3,N+5]}), [3,4])
check('threshold contract', solve('threshold', {'dx':3*N,'dy':4*N,'threshold':6*N}), False)
check('retrace contract', solve('retrace', {'segments':[N%4,(N+1)%4,(N+2)%4],'direction':N%4}), [N%4,(N+1)%4])
check('segment-reset contract', solve('segment-reset', {'turn':[N+2,N+3],'original':[0,0],'last':[N+5,N+6]}), [N+2,N+3])
check('leaf-required contract', solve('leaf-required', {'kind':'submenu','complete':True,'sector':N}), False)
check('trailing-jitter contract', solve('trailing-jitter', {'completed':[N,N+1],'tail_sector':N+2,'tail_distance':1,'threshold':5}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('incomplete command stroke',solve('leaf-required',{'kind':'command','complete':False,'sector':N}),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:
Nested marking-menu stroke starts from the wrong segment origin.

A marking menu resolves completed directional strokes after sufficient displacement. Cardinal directions are 0..3; an opposite segment retraces one level, and subthreshold tail jitter preserves the completed sector.

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 == 'origin':
        return [p['end'][0]-p['start'][0],p['end'][1]-p['start'][1]]
    if action == 'threshold':
        return p['dx']**2+p['dy']**2>=p['threshold']**2
    if action == 'retrace':
        return p['segments'][:-1] if p['direction']==(p['segments'][-1]+2)%4 else p['segments']+[p['direction']]
    if action == 'segment-reset':
        return p['turn'][:]
    if action == 'leaf-required':
        return p['complete']
    if action == 'trailing-jitter':
        return p['completed'][-1] if p['tail_distance']<p['threshold'] else p['tail_sector']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('origin contract', solve('origin', {'start':[N,N+1],'end':[N+3,N+5]}), [3,4])
check('threshold contract', solve('threshold', {'dx':3*N,'dy':4*N,'threshold':6*N}), False)
check('retrace contract', solve('retrace', {'segments':[N%4,(N+1)%4,(N+2)%4],'direction':N%4}), [N%4,(N+1)%4])
check('segment-reset contract', solve('segment-reset', {'turn':[N+2,N+3],'original':[0,0],'last':[N+5,N+6]}), [N+2,N+3])
check('leaf-required contract', solve('leaf-required', {'kind':'submenu','complete':True,'sector':N}), False)
check('trailing-jitter contract', solve('trailing-jitter', {'completed':[N,N+1],'tail_sector':N+2,'tail_distance':1,'threshold':5}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('incomplete command stroke',solve('leaf-required',{'kind':'command','complete':False,'sector':N}),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 == 'origin':
        return [p['end'][0]-p['start'][0],p['end'][1]-p['start'][1]]
    if action == 'threshold':
        return p['dx']**2+p['dy']**2>=p['threshold']**2
    if action == 'retrace':
        return p['segments'][:-1] if p['direction']==(p['segments'][-1]+2)%4 else p['segments']+[p['direction']]
    if action == 'segment-reset':
        return p['turn'][:]
    if action == 'leaf-required':
        return p['kind']=='command'
    if action == 'trailing-jitter':
        return p['completed'][-1] if p['tail_distance']<p['threshold'] else p['tail_sector']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('origin contract', solve('origin', {'start':[N,N+1],'end':[N+3,N+5]}), [3,4])
check('threshold contract', solve('threshold', {'dx':3*N,'dy':4*N,'threshold':6*N}), False)
check('retrace contract', solve('retrace', {'segments':[N%4,(N+1)%4,(N+2)%4],'direction':N%4}), [N%4,(N+1)%4])
check('segment-reset contract', solve('segment-reset', {'turn':[N+2,N+3],'original':[0,0],'last':[N+5,N+6]}), [N+2,N+3])
check('leaf-required contract', solve('leaf-required', {'kind':'submenu','complete':True,'sector':N}), False)
check('trailing-jitter contract', solve('trailing-jitter', {'completed':[N,N+1],'tail_sector':N+2,'tail_distance':1,'threshold':5}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('incomplete command stroke',solve('leaf-required',{'kind':'command','complete':False,'sector':N}),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:
Incomplete marking gesture executes a branch-only menu item.

A marking menu resolves completed directional strokes after sufficient displacement. Cardinal directions are 0..3; an opposite segment retraces one level, and subthreshold tail jitter preserves the completed sector.

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 == 'origin':
        return [p['end'][0]-p['start'][0],p['end'][1]-p['start'][1]]
    if action == 'threshold':
        return p['dx']**2+p['dy']**2>=p['threshold']**2
    if action == 'retrace':
        return p['segments'][:-1] if p['direction']==(p['segments'][-1]+2)%4 else p['segments']+[p['direction']]
    if action == 'segment-reset':
        return p['turn'][:]
    if action == 'leaf-required':
        return p['kind']=='command' and p['complete']
    if action == 'trailing-jitter':
        return p['tail_sector']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('origin contract', solve('origin', {'start':[N,N+1],'end':[N+3,N+5]}), [3,4])
check('threshold contract', solve('threshold', {'dx':3*N,'dy':4*N,'threshold':6*N}), False)
check('retrace contract', solve('retrace', {'segments':[N%4,(N+1)%4,(N+2)%4],'direction':N%4}), [N%4,(N+1)%4])
check('segment-reset contract', solve('segment-reset', {'turn':[N+2,N+3],'original':[0,0],'last':[N+5,N+6]}), [N+2,N+3])
check('leaf-required contract', solve('leaf-required', {'kind':'submenu','complete':True,'sector':N}), False)
check('trailing-jitter contract', solve('trailing-jitter', {'completed':[N,N+1],'tail_sector':N+2,'tail_distance':1,'threshold':5}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('incomplete command stroke',solve('leaf-required',{'kind':'command','complete':False,'sector':N}),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 == 'origin':
        return [p['end'][0]-p['start'][0],p['end'][1]-p['start'][1]]
    if action == 'threshold':
        return p['dx']**2+p['dy']**2>=p['threshold']**2
    if action == 'retrace':
        return p['segments'][:-1] if p['direction']==(p['segments'][-1]+2)%4 else p['segments']+[p['direction']]
    if action == 'segment-reset':
        return p['turn'][:]
    if action == 'leaf-required':
        return p['kind']=='command' and p['complete']
    if action == 'trailing-jitter':
        return None if p['tail_distance']<p['threshold'] else p['tail_sector']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('origin contract', solve('origin', {'start':[N,N+1],'end':[N+3,N+5]}), [3,4])
check('threshold contract', solve('threshold', {'dx':3*N,'dy':4*N,'threshold':6*N}), False)
check('retrace contract', solve('retrace', {'segments':[N%4,(N+1)%4,(N+2)%4],'direction':N%4}), [N%4,(N+1)%4])
check('segment-reset contract', solve('segment-reset', {'turn':[N+2,N+3],'original':[0,0],'last':[N+5,N+6]}), [N+2,N+3])
check('leaf-required contract', solve('leaf-required', {'kind':'submenu','complete':True,'sector':N}), False)
check('trailing-jitter contract', solve('trailing-jitter', {'completed':[N,N+1],'tail_sector':N+2,'tail_distance':1,'threshold':5}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('incomplete command stroke',solve('leaf-required',{'kind':'command','complete':False,'sector':N}),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:
Short final marking-menu jitter replaces the last completed command sector.

A marking menu resolves completed directional strokes after sufficient displacement. Cardinal directions are 0..3; an opposite segment retraces one level, and subthreshold tail jitter preserves the completed sector.

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 == 'indicator-column':
        return max((x['indicator_width'] for x in p),default=0)
    if action == 'badge':
        return None if p['count'] is None else str(p['count'])
    if action == 'label-command':
        return p['command']
    if action == 'suffix-order':
        return p['label']+(' '+p['suffix'] if p['suffix'] else '')
    if action == 'icon-space':
        return p['column_width'] if p['column_enabled'] else 0
    if action == 'separator-span':
        return sum(p['columns'])+p['gap']*(len(p['columns'])-1)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('indicator-column contract', solve('indicator-column', [{'visible':False,'indicator_width':N+10},{'visible':True,'indicator_width':2}]), 2)
check('badge contract', solve('badge', {'count':0,'revision':N}), '0')
check('label-command contract', solve('label-command', {'command':'cmd'+str(N),'label':'Copy','badge':'2'}), 'cmd'+str(N))
check('suffix-order contract', solve('suffix-order', {'label':'Item '+str(N),'suffix':'(new)'}), 'Item '+str(N)+' (new)')
check('icon-space contract', solve('icon-space', {'column_width':N+4,'column_enabled':True,'own_width':0}), N+4)
check('separator-span contract', solve('separator-span', {'columns':[N,10,4],'gap':2}), N+18)
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 == 'indicator-column':
        return sum(x['indicator_width'] for x in p)
    if action == 'badge':
        return None if p['count'] is None else str(p['count'])
    if action == 'label-command':
        return p['command']
    if action == 'suffix-order':
        return p['label']+(' '+p['suffix'] if p['suffix'] else '')
    if action == 'icon-space':
        return p['column_width'] if p['column_enabled'] else 0
    if action == 'separator-span':
        return sum(p['columns'])+p['gap']*(len(p['columns'])-1)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('indicator-column contract', solve('indicator-column', [{'visible':False,'indicator_width':N+10},{'visible':True,'indicator_width':2}]), 2)
check('badge contract', solve('badge', {'count':0,'revision':N}), '0')
check('label-command contract', solve('label-command', {'command':'cmd'+str(N),'label':'Copy','badge':'2'}), 'cmd'+str(N))
check('suffix-order contract', solve('suffix-order', {'label':'Item '+str(N),'suffix':'(new)'}), 'Item '+str(N)+' (new)')
check('icon-space contract', solve('icon-space', {'column_width':N+4,'column_enabled':True,'own_width':0}), N+4)
check('separator-span contract', solve('separator-span', {'columns':[N,10,4],'gap':2}), N+18)
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:
Hidden submenu indicator widens every visible menu row.

Menu decoration columns are measured from visible command rows; text, badges and submenu indicators remain separate from command 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 == 'indicator-column':
        return max((x['indicator_width'] for x in p if x['visible']),default=0)
    if action == 'badge':
        return str(p['count']) if p['count'] else None
    if action == 'label-command':
        return p['command']
    if action == 'suffix-order':
        return p['label']+(' '+p['suffix'] if p['suffix'] else '')
    if action == 'icon-space':
        return p['column_width'] if p['column_enabled'] else 0
    if action == 'separator-span':
        return sum(p['columns'])+p['gap']*(len(p['columns'])-1)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('indicator-column contract', solve('indicator-column', [{'visible':False,'indicator_width':N+10},{'visible':True,'indicator_width':2}]), 2)
check('badge contract', solve('badge', {'count':0,'revision':N}), '0')
check('label-command contract', solve('label-command', {'command':'cmd'+str(N),'label':'Copy','badge':'2'}), 'cmd'+str(N))
check('suffix-order contract', solve('suffix-order', {'label':'Item '+str(N),'suffix':'(new)'}), 'Item '+str(N)+' (new)')
check('icon-space contract', solve('icon-space', {'column_width':N+4,'column_enabled':True,'own_width':0}), N+4)
check('separator-span contract', solve('separator-span', {'columns':[N,10,4],'gap':2}), N+18)
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 == 'indicator-column':
        return max((x['indicator_width'] for x in p if x['visible']),default=0)
    if action == 'badge':
        return None
    if action == 'label-command':
        return p['command']
    if action == 'suffix-order':
        return p['label']+(' '+p['suffix'] if p['suffix'] else '')
    if action == 'icon-space':
        return p['column_width'] if p['column_enabled'] else 0
    if action == 'separator-span':
        return sum(p['columns'])+p['gap']*(len(p['columns'])-1)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('indicator-column contract', solve('indicator-column', [{'visible':False,'indicator_width':N+10},{'visible':True,'indicator_width':2}]), 2)
check('badge contract', solve('badge', {'count':0,'revision':N}), '0')
check('label-command contract', solve('label-command', {'command':'cmd'+str(N),'label':'Copy','badge':'2'}), 'cmd'+str(N))
check('suffix-order contract', solve('suffix-order', {'label':'Item '+str(N),'suffix':'(new)'}), 'Item '+str(N)+' (new)')
check('icon-space contract', solve('icon-space', {'column_width':N+4,'column_enabled':True,'own_width':0}), N+4)
check('separator-span contract', solve('separator-span', {'columns':[N,10,4],'gap':2}), N+18)
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:
Zero-valued menu badge is hidden as if missing.

Menu decoration columns are measured from visible command rows; text, badges and submenu indicators remain separate from command 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 == 'indicator-column':
        return max((x['indicator_width'] for x in p if x['visible']),default=0)
    if action == 'badge':
        return None if p['count'] is None else str(p['count'])
    if action == 'label-command':
        return p['label']
    if action == 'suffix-order':
        return p['label']+(' '+p['suffix'] if p['suffix'] else '')
    if action == 'icon-space':
        return p['column_width'] if p['column_enabled'] else 0
    if action == 'separator-span':
        return sum(p['columns'])+p['gap']*(len(p['columns'])-1)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('indicator-column contract', solve('indicator-column', [{'visible':False,'indicator_width':N+10},{'visible':True,'indicator_width':2}]), 2)
check('badge contract', solve('badge', {'count':0,'revision':N}), '0')
check('label-command contract', solve('label-command', {'command':'cmd'+str(N),'label':'Copy','badge':'2'}), 'cmd'+str(N))
check('suffix-order contract', solve('suffix-order', {'label':'Item '+str(N),'suffix':'(new)'}), 'Item '+str(N)+' (new)')
check('icon-space contract', solve('icon-space', {'column_width':N+4,'column_enabled':True,'own_width':0}), N+4)
check('separator-span contract', solve('separator-span', {'columns':[N,10,4],'gap':2}), N+18)
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 == 'indicator-column':
        return max((x['indicator_width'] for x in p if x['visible']),default=0)
    if action == 'badge':
        return None if p['count'] is None else str(p['count'])
    if action == 'label-command':
        return p['label']+' '+p['badge']
    if action == 'suffix-order':
        return p['label']+(' '+p['suffix'] if p['suffix'] else '')
    if action == 'icon-space':
        return p['column_width'] if p['column_enabled'] else 0
    if action == 'separator-span':
        return sum(p['columns'])+p['gap']*(len(p['columns'])-1)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('indicator-column contract', solve('indicator-column', [{'visible':False,'indicator_width':N+10},{'visible':True,'indicator_width':2}]), 2)
check('badge contract', solve('badge', {'count':0,'revision':N}), '0')
check('label-command contract', solve('label-command', {'command':'cmd'+str(N),'label':'Copy','badge':'2'}), 'cmd'+str(N))
check('suffix-order contract', solve('suffix-order', {'label':'Item '+str(N),'suffix':'(new)'}), 'Item '+str(N)+' (new)')
check('icon-space contract', solve('icon-space', {'column_width':N+4,'column_enabled':True,'own_width':0}), N+4)
check('separator-span contract', solve('separator-span', {'columns':[N,10,4],'gap':2}), N+18)
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:
Decorated menu label is substituted for its command identity.

Menu decoration columns are measured from visible command rows; text, badges and submenu indicators remain separate from command 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 == 'indicator-column':
        return max((x['indicator_width'] for x in p if x['visible']),default=0)
    if action == 'badge':
        return None if p['count'] is None else str(p['count'])
    if action == 'label-command':
        return p['command']
    if action == 'suffix-order':
        return p['suffix']+' '+p['label']
    if action == 'icon-space':
        return p['column_width'] if p['column_enabled'] else 0
    if action == 'separator-span':
        return sum(p['columns'])+p['gap']*(len(p['columns'])-1)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('indicator-column contract', solve('indicator-column', [{'visible':False,'indicator_width':N+10},{'visible':True,'indicator_width':2}]), 2)
check('badge contract', solve('badge', {'count':0,'revision':N}), '0')
check('label-command contract', solve('label-command', {'command':'cmd'+str(N),'label':'Copy','badge':'2'}), 'cmd'+str(N))
check('suffix-order contract', solve('suffix-order', {'label':'Item '+str(N),'suffix':'(new)'}), 'Item '+str(N)+' (new)')
check('icon-space contract', solve('icon-space', {'column_width':N+4,'column_enabled':True,'own_width':0}), N+4)
check('separator-span contract', solve('separator-span', {'columns':[N,10,4],'gap':2}), N+18)
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 == 'indicator-column':
        return max((x['indicator_width'] for x in p if x['visible']),default=0)
    if action == 'badge':
        return None if p['count'] is None else str(p['count'])
    if action == 'label-command':
        return p['command']
    if action == 'suffix-order':
        return p['label']
    if action == 'icon-space':
        return p['column_width'] if p['column_enabled'] else 0
    if action == 'separator-span':
        return sum(p['columns'])+p['gap']*(len(p['columns'])-1)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('indicator-column contract', solve('indicator-column', [{'visible':False,'indicator_width':N+10},{'visible':True,'indicator_width':2}]), 2)
check('badge contract', solve('badge', {'count':0,'revision':N}), '0')
check('label-command contract', solve('label-command', {'command':'cmd'+str(N),'label':'Copy','badge':'2'}), 'cmd'+str(N))
check('suffix-order contract', solve('suffix-order', {'label':'Item '+str(N),'suffix':'(new)'}), 'Item '+str(N)+' (new)')
check('icon-space contract', solve('icon-space', {'column_width':N+4,'column_enabled':True,'own_width':0}), N+4)
check('separator-span contract', solve('separator-span', {'columns':[N,10,4],'gap':2}), N+18)
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 suffix decoration is prepended to the command label.

Menu decoration columns are measured from visible command rows; text, badges and submenu indicators remain separate from command 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 == 'indicator-column':
        return max((x['indicator_width'] for x in p if x['visible']),default=0)
    if action == 'badge':
        return None if p['count'] is None else str(p['count'])
    if action == 'label-command':
        return p['command']
    if action == 'suffix-order':
        return p['label']+(' '+p['suffix'] if p['suffix'] else '')
    if action == 'icon-space':
        return p['own_width']
    if action == 'separator-span':
        return sum(p['columns'])+p['gap']*(len(p['columns'])-1)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('indicator-column contract', solve('indicator-column', [{'visible':False,'indicator_width':N+10},{'visible':True,'indicator_width':2}]), 2)
check('badge contract', solve('badge', {'count':0,'revision':N}), '0')
check('label-command contract', solve('label-command', {'command':'cmd'+str(N),'label':'Copy','badge':'2'}), 'cmd'+str(N))
check('suffix-order contract', solve('suffix-order', {'label':'Item '+str(N),'suffix':'(new)'}), 'Item '+str(N)+' (new)')
check('icon-space contract', solve('icon-space', {'column_width':N+4,'column_enabled':True,'own_width':0}), N+4)
check('separator-span contract', solve('separator-span', {'columns':[N,10,4],'gap':2}), N+18)
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 == 'indicator-column':
        return max((x['indicator_width'] for x in p if x['visible']),default=0)
    if action == 'badge':
        return None if p['count'] is None else str(p['count'])
    if action == 'label-command':
        return p['command']
    if action == 'suffix-order':
        return p['label']+(' '+p['suffix'] if p['suffix'] else '')
    if action == 'icon-space':
        return p['column_width'] if p['own_width'] else 0
    if action == 'separator-span':
        return sum(p['columns'])+p['gap']*(len(p['columns'])-1)
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('indicator-column contract', solve('indicator-column', [{'visible':False,'indicator_width':N+10},{'visible':True,'indicator_width':2}]), 2)
check('badge contract', solve('badge', {'count':0,'revision':N}), '0')
check('label-command contract', solve('label-command', {'command':'cmd'+str(N),'label':'Copy','badge':'2'}), 'cmd'+str(N))
check('suffix-order contract', solve('suffix-order', {'label':'Item '+str(N),'suffix':'(new)'}), 'Item '+str(N)+' (new)')
check('icon-space contract', solve('icon-space', {'column_width':N+4,'column_enabled':True,'own_width':0}), N+4)
check('separator-span contract', solve('separator-span', {'columns':[N,10,4],'gap':2}), N+18)
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 rows without icons lose alignment with decorated siblings.

Menu decoration columns are measured from visible command rows; text, badges and submenu indicators remain separate from command 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 == 'indicator-column':
        return max((x['indicator_width'] for x in p if x['visible']),default=0)
    if action == 'badge':
        return None if p['count'] is None else str(p['count'])
    if action == 'label-command':
        return p['command']
    if action == 'suffix-order':
        return p['label']+(' '+p['suffix'] if p['suffix'] else '')
    if action == 'icon-space':
        return p['column_width'] if p['column_enabled'] else 0
    if action == 'separator-span':
        return sum(p['columns'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('indicator-column contract', solve('indicator-column', [{'visible':False,'indicator_width':N+10},{'visible':True,'indicator_width':2}]), 2)
check('badge contract', solve('badge', {'count':0,'revision':N}), '0')
check('label-command contract', solve('label-command', {'command':'cmd'+str(N),'label':'Copy','badge':'2'}), 'cmd'+str(N))
check('suffix-order contract', solve('suffix-order', {'label':'Item '+str(N),'suffix':'(new)'}), 'Item '+str(N)+' (new)')
check('icon-space contract', solve('icon-space', {'column_width':N+4,'column_enabled':True,'own_width':0}), N+4)
check('separator-span contract', solve('separator-span', {'columns':[N,10,4],'gap':2}), N+18)
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 == 'indicator-column':
        return max((x['indicator_width'] for x in p if x['visible']),default=0)
    if action == 'badge':
        return None if p['count'] is None else str(p['count'])
    if action == 'label-command':
        return p['command']
    if action == 'suffix-order':
        return p['label']+(' '+p['suffix'] if p['suffix'] else '')
    if action == 'icon-space':
        return p['column_width'] if p['column_enabled'] else 0
    if action == 'separator-span':
        return sum(p['columns'])+p['gap']*len(p['columns'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('indicator-column contract', solve('indicator-column', [{'visible':False,'indicator_width':N+10},{'visible':True,'indicator_width':2}]), 2)
check('badge contract', solve('badge', {'count':0,'revision':N}), '0')
check('label-command contract', solve('label-command', {'command':'cmd'+str(N),'label':'Copy','badge':'2'}), 'cmd'+str(N))
check('suffix-order contract', solve('suffix-order', {'label':'Item '+str(N),'suffix':'(new)'}), 'Item '+str(N)+' (new)')
check('icon-space contract', solve('icon-space', {'column_width':N+4,'column_enabled':True,'own_width':0}), N+4)
check('separator-span contract', solve('separator-span', {'columns':[N,10,4],'gap':2}), N+18)
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 separator width omits inter-column spacing.

Menu decoration columns are measured from visible command rows; text, badges and submenu indicators remain separate from command 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 == 'base':
        return True
    if action == 'insert-after':
        return p['rows'][:p['rows'].index(p['anchor'])+1]+[p['new']]+p['rows'][p['rows'].index(p['anchor'])+1:]
    if action == 'missing-anchor':
        return 'reject' if p['anchor'] not in p['rows'] else 'apply'
    if action == 'rollback':
        return p['before'] if p['failed'] else p['working']
    if action == 'replace-kind':
        return dict(p['replacement'],id=p['old']['id'])
    if action == 'revision-step':
        return p['base']+int(p['committed'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('base contract', solve('base', {'base':N,'revision':N+1}), False)
check('insert-after contract', solve('insert-after', {'rows':['a','b'],'anchor':'a','new':N}), ['a',N,'b'])
check('missing-anchor contract', solve('missing-anchor', {'rows':[N],'anchor':N+1}), 'reject')
check('rollback contract', solve('rollback', {'before':[N,N+1],'working':[N+2],'failed':True}), [N,N+1])
check('replace-kind contract', solve('replace-kind', {'old':{'id':N,'kind':'command','handler':'old'},'replacement':{'kind':'submenu','children':[N+1]}}), {'id':N,'kind':'submenu','children':[N+1]})
check('revision-step contract', solve('revision-step', {'base':N,'committed':True,'operation_count':3}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('failed patch retains revision',solve('revision-step',{'base':N,'committed':False,'operation_count':2}),N)
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 == 'base':
        return p['base']<=p['revision']
    if action == 'insert-after':
        return p['rows'][:p['rows'].index(p['anchor'])+1]+[p['new']]+p['rows'][p['rows'].index(p['anchor'])+1:]
    if action == 'missing-anchor':
        return 'reject' if p['anchor'] not in p['rows'] else 'apply'
    if action == 'rollback':
        return p['before'] if p['failed'] else p['working']
    if action == 'replace-kind':
        return dict(p['replacement'],id=p['old']['id'])
    if action == 'revision-step':
        return p['base']+int(p['committed'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('base contract', solve('base', {'base':N,'revision':N+1}), False)
check('insert-after contract', solve('insert-after', {'rows':['a','b'],'anchor':'a','new':N}), ['a',N,'b'])
check('missing-anchor contract', solve('missing-anchor', {'rows':[N],'anchor':N+1}), 'reject')
check('rollback contract', solve('rollback', {'before':[N,N+1],'working':[N+2],'failed':True}), [N,N+1])
check('replace-kind contract', solve('replace-kind', {'old':{'id':N,'kind':'command','handler':'old'},'replacement':{'kind':'submenu','children':[N+1]}}), {'id':N,'kind':'submenu','children':[N+1]})
check('revision-step contract', solve('revision-step', {'base':N,'committed':True,'operation_count':3}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('failed patch retains revision',solve('revision-step',{'base':N,'committed':False,'operation_count':2}),N)
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 patch is applied to an incompatible base snapshot.

Provider menu patches apply to one base revision atomically; row edits use stable IDs and insertion anchors, while missing anchors reject the patch.

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 == 'base':
        return p['base']==p['revision']
    if action == 'insert-after':
        return p['rows']+[p['new']]
    if action == 'missing-anchor':
        return 'reject' if p['anchor'] not in p['rows'] else 'apply'
    if action == 'rollback':
        return p['before'] if p['failed'] else p['working']
    if action == 'replace-kind':
        return dict(p['replacement'],id=p['old']['id'])
    if action == 'revision-step':
        return p['base']+int(p['committed'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('base contract', solve('base', {'base':N,'revision':N+1}), False)
check('insert-after contract', solve('insert-after', {'rows':['a','b'],'anchor':'a','new':N}), ['a',N,'b'])
check('missing-anchor contract', solve('missing-anchor', {'rows':[N],'anchor':N+1}), 'reject')
check('rollback contract', solve('rollback', {'before':[N,N+1],'working':[N+2],'failed':True}), [N,N+1])
check('replace-kind contract', solve('replace-kind', {'old':{'id':N,'kind':'command','handler':'old'},'replacement':{'kind':'submenu','children':[N+1]}}), {'id':N,'kind':'submenu','children':[N+1]})
check('revision-step contract', solve('revision-step', {'base':N,'committed':True,'operation_count':3}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('failed patch retains revision',solve('revision-step',{'base':N,'committed':False,'operation_count':2}),N)
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 == 'base':
        return p['base']==p['revision']
    if action == 'insert-after':
        return [p['new']]+p['rows']
    if action == 'missing-anchor':
        return 'reject' if p['anchor'] not in p['rows'] else 'apply'
    if action == 'rollback':
        return p['before'] if p['failed'] else p['working']
    if action == 'replace-kind':
        return dict(p['replacement'],id=p['old']['id'])
    if action == 'revision-step':
        return p['base']+int(p['committed'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('base contract', solve('base', {'base':N,'revision':N+1}), False)
check('insert-after contract', solve('insert-after', {'rows':['a','b'],'anchor':'a','new':N}), ['a',N,'b'])
check('missing-anchor contract', solve('missing-anchor', {'rows':[N],'anchor':N+1}), 'reject')
check('rollback contract', solve('rollback', {'before':[N,N+1],'working':[N+2],'failed':True}), [N,N+1])
check('replace-kind contract', solve('replace-kind', {'old':{'id':N,'kind':'command','handler':'old'},'replacement':{'kind':'submenu','children':[N+1]}}), {'id':N,'kind':'submenu','children':[N+1]})
check('revision-step contract', solve('revision-step', {'base':N,'committed':True,'operation_count':3}), N+1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('failed patch retains revision',solve('revision-step',{'base':N,'committed':False,'operation_count':2}),N)
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 patch insertion ignores its stable row anchor.

Provider menu patches apply to one base revision atomically; row edits use stable IDs and insertion anchors, while missing anchors reject the patch.

split: open-access