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 == 'secondary':
        return p['button']==2 and not p['dragging']
    if action == 'pen':
        return p['type']=='pen' and bool(p['buttons'] & 2)
    if action == 'hold':
        return p['elapsed']>=p['delay'] and p['travel']<=p['slop']
    if action == 'release':
        return p['armed'] and not p['cancelled']
    if action == 'duplicate':
        return p['incoming']!=p['last']
    if action == 'native-policy':
        return p['handled']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('secondary contract', solve('secondary', {'button':2,'dragging':True,'distance':N}), False)
check('pen contract', solve('pen', {'type':'pen','buttons':3,'pressure':N/10}), True)
check('hold contract', solve('hold', {'elapsed':N+10,'delay':10,'travel':20,'slop':5}), False)
check('release contract', solve('release', {'armed':True,'cancelled':True,'id':N}), False)
check('duplicate contract', solve('duplicate', {'incoming':N,'last':N}), False)
check('native-policy contract', solve('native-policy', {'handled':True,'custom_available':False,'target':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('ordinary pen contact', solve('pen', {'type':'pen','buttons':1,'pressure':N/10}), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'secondary':
        return p['button']==2 and not p['dragging']
    if action == 'pen':
        return p['type']=='pen' and bool(p['buttons'] & 2)
    if action == 'hold':
        return p['elapsed']>=p['delay'] and p['travel']<=p['slop']
    if action == 'release':
        return p['armed'] and not p['cancelled']
    if action == 'duplicate':
        return p['incoming']!=p['last']
    if action == 'native-policy':
        return p['handled'] or p['custom_available']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('secondary contract', solve('secondary', {'button':2,'dragging':True,'distance':N}), False)
check('pen contract', solve('pen', {'type':'pen','buttons':3,'pressure':N/10}), True)
check('hold contract', solve('hold', {'elapsed':N+10,'delay':10,'travel':20,'slop':5}), False)
check('release contract', solve('release', {'armed':True,'cancelled':True,'id':N}), False)
check('duplicate contract', solve('duplicate', {'incoming':N,'last':N}), False)
check('native-policy contract', solve('native-policy', {'handled':True,'custom_available':False,'target':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('ordinary pen contact', solve('pen', {'type':'pen','buttons':1,'pressure':N/10}), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Context event suppresses native fallback without a custom menu.

A context menu recognizes secondary-button invocation, pen barrel input and completed hold gestures; concurrent triggers are coalesced by invocation 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 == 'direction':
        return p['x']>p['previous']
    if action == 'expiry':
        return p['now']<p['deadline']
    if action == 'vertical-band':
        return p['top']<=p['y']<=p['bottom']
    if action == 'pointer-owner':
        return p['pointer']==p['owner']
    if action == 'deadline':
        return p['started']+p['budget']
    if action == 'distance':
        return abs(p['edge']-p['x'])<abs(p['edge']-p['previous'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('direction contract', solve('direction', {'x':N,'previous':N+2,'side':-1}), True)
check('expiry contract', solve('expiry', {'now':N+10,'deadline':N+10}), False)
check('vertical-band contract', solve('vertical-band', {'top':N+1,'bottom':N+4,'y':N}), False)
check('pointer-owner contract', solve('pointer-owner', {'pointer':N+1,'owner':N}), False)
check('deadline contract', solve('deadline', {'started':N,'now':N+5,'budget':10}), N+10)
check('distance contract', solve('distance', {'edge':N+10,'x':N,'previous':N+2}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('away from left submenu',solve('direction',{'x':N+2,'previous':N,'side':-1}),False)
check('below submenu corridor',solve('vertical-band',{'top':N,'bottom':N+3,'y':N+4}),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)

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 == 'direction':
        return p['x']!=p['previous']
    if action == 'expiry':
        return p['now']<p['deadline']
    if action == 'vertical-band':
        return p['top']<=p['y']<=p['bottom']
    if action == 'pointer-owner':
        return p['pointer']==p['owner']
    if action == 'deadline':
        return p['started']+p['budget']
    if action == 'distance':
        return abs(p['edge']-p['x'])<abs(p['edge']-p['previous'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('direction contract', solve('direction', {'x':N,'previous':N+2,'side':-1}), True)
check('expiry contract', solve('expiry', {'now':N+10,'deadline':N+10}), False)
check('vertical-band contract', solve('vertical-band', {'top':N+1,'bottom':N+4,'y':N}), False)
check('pointer-owner contract', solve('pointer-owner', {'pointer':N+1,'owner':N}), False)
check('deadline contract', solve('deadline', {'started':N,'now':N+5,'budget':10}), N+10)
check('distance contract', solve('distance', {'edge':N+10,'x':N,'previous':N+2}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('away from left submenu',solve('direction',{'x':N+2,'previous':N,'side':-1}),False)
check('below submenu corridor',solve('vertical-band',{'top':N,'bottom':N+3,'y':N+4}),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:
Left-opening submenu intent tests movement in the wrong direction.

Submenu pointer intent uses signed direction, bounded time and a declared inclusive triangular corridor; unrelated pointer streams cannot renew it.

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 == 'direction':
        return (p['x']-p['previous'])*p['side']>0
    if action == 'expiry':
        return p['now']<=p['deadline']
    if action == 'vertical-band':
        return p['top']<=p['y']<=p['bottom']
    if action == 'pointer-owner':
        return p['pointer']==p['owner']
    if action == 'deadline':
        return p['started']+p['budget']
    if action == 'distance':
        return abs(p['edge']-p['x'])<abs(p['edge']-p['previous'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('direction contract', solve('direction', {'x':N,'previous':N+2,'side':-1}), True)
check('expiry contract', solve('expiry', {'now':N+10,'deadline':N+10}), False)
check('vertical-band contract', solve('vertical-band', {'top':N+1,'bottom':N+4,'y':N}), False)
check('pointer-owner contract', solve('pointer-owner', {'pointer':N+1,'owner':N}), False)
check('deadline contract', solve('deadline', {'started':N,'now':N+5,'budget':10}), N+10)
check('distance contract', solve('distance', {'edge':N+10,'x':N,'previous':N+2}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('away from left submenu',solve('direction',{'x':N+2,'previous':N,'side':-1}),False)
check('below submenu corridor',solve('vertical-band',{'top':N,'bottom':N+3,'y':N+4}),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 == 'direction':
        return (p['x']-p['previous'])*p['side']>0
    if action == 'expiry':
        return True
    if action == 'vertical-band':
        return p['top']<=p['y']<=p['bottom']
    if action == 'pointer-owner':
        return p['pointer']==p['owner']
    if action == 'deadline':
        return p['started']+p['budget']
    if action == 'distance':
        return abs(p['edge']-p['x'])<abs(p['edge']-p['previous'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('direction contract', solve('direction', {'x':N,'previous':N+2,'side':-1}), True)
check('expiry contract', solve('expiry', {'now':N+10,'deadline':N+10}), False)
check('vertical-band contract', solve('vertical-band', {'top':N+1,'bottom':N+4,'y':N}), False)
check('pointer-owner contract', solve('pointer-owner', {'pointer':N+1,'owner':N}), False)
check('deadline contract', solve('deadline', {'started':N,'now':N+5,'budget':10}), N+10)
check('distance contract', solve('distance', {'edge':N+10,'x':N,'previous':N+2}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('away from left submenu',solve('direction',{'x':N+2,'previous':N,'side':-1}),False)
check('below submenu corridor',solve('vertical-band',{'top':N,'bottom':N+3,'y':N+4}),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:
Expired submenu intent keeps sibling menus blocked.

Submenu pointer intent uses signed direction, bounded time and a declared inclusive triangular corridor; unrelated pointer streams cannot renew it.

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 == 'direction':
        return (p['x']-p['previous'])*p['side']>0
    if action == 'expiry':
        return p['now']<p['deadline']
    if action == 'vertical-band':
        return p['y']>=p['top']
    if action == 'pointer-owner':
        return p['pointer']==p['owner']
    if action == 'deadline':
        return p['started']+p['budget']
    if action == 'distance':
        return abs(p['edge']-p['x'])<abs(p['edge']-p['previous'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('direction contract', solve('direction', {'x':N,'previous':N+2,'side':-1}), True)
check('expiry contract', solve('expiry', {'now':N+10,'deadline':N+10}), False)
check('vertical-band contract', solve('vertical-band', {'top':N+1,'bottom':N+4,'y':N}), False)
check('pointer-owner contract', solve('pointer-owner', {'pointer':N+1,'owner':N}), False)
check('deadline contract', solve('deadline', {'started':N,'now':N+5,'budget':10}), N+10)
check('distance contract', solve('distance', {'edge':N+10,'x':N,'previous':N+2}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('away from left submenu',solve('direction',{'x':N+2,'previous':N,'side':-1}),False)
check('below submenu corridor',solve('vertical-band',{'top':N,'bottom':N+3,'y':N+4}),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 == 'direction':
        return (p['x']-p['previous'])*p['side']>0
    if action == 'expiry':
        return p['now']<p['deadline']
    if action == 'vertical-band':
        return p['y']<=p['bottom']
    if action == 'pointer-owner':
        return p['pointer']==p['owner']
    if action == 'deadline':
        return p['started']+p['budget']
    if action == 'distance':
        return abs(p['edge']-p['x'])<abs(p['edge']-p['previous'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('direction contract', solve('direction', {'x':N,'previous':N+2,'side':-1}), True)
check('expiry contract', solve('expiry', {'now':N+10,'deadline':N+10}), False)
check('vertical-band contract', solve('vertical-band', {'top':N+1,'bottom':N+4,'y':N}), False)
check('pointer-owner contract', solve('pointer-owner', {'pointer':N+1,'owner':N}), False)
check('deadline contract', solve('deadline', {'started':N,'now':N+5,'budget':10}), N+10)
check('distance contract', solve('distance', {'edge':N+10,'x':N,'previous':N+2}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('away from left submenu',solve('direction',{'x':N+2,'previous':N,'side':-1}),False)
check('below submenu corridor',solve('vertical-band',{'top':N,'bottom':N+3,'y':N+4}),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:
Pointer intent accepts points outside the submenu vertical band.

Submenu pointer intent uses signed direction, bounded time and a declared inclusive triangular corridor; unrelated pointer streams cannot renew it.

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 == 'direction':
        return (p['x']-p['previous'])*p['side']>0
    if action == 'expiry':
        return p['now']<p['deadline']
    if action == 'vertical-band':
        return p['top']<=p['y']<=p['bottom']
    if action == 'pointer-owner':
        return True
    if action == 'deadline':
        return p['started']+p['budget']
    if action == 'distance':
        return abs(p['edge']-p['x'])<abs(p['edge']-p['previous'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('direction contract', solve('direction', {'x':N,'previous':N+2,'side':-1}), True)
check('expiry contract', solve('expiry', {'now':N+10,'deadline':N+10}), False)
check('vertical-band contract', solve('vertical-band', {'top':N+1,'bottom':N+4,'y':N}), False)
check('pointer-owner contract', solve('pointer-owner', {'pointer':N+1,'owner':N}), False)
check('deadline contract', solve('deadline', {'started':N,'now':N+5,'budget':10}), N+10)
check('distance contract', solve('distance', {'edge':N+10,'x':N,'previous':N+2}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('away from left submenu',solve('direction',{'x':N+2,'previous':N,'side':-1}),False)
check('below submenu corridor',solve('vertical-band',{'top':N,'bottom':N+3,'y':N+4}),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 == 'direction':
        return (p['x']-p['previous'])*p['side']>0
    if action == 'expiry':
        return p['now']<p['deadline']
    if action == 'vertical-band':
        return p['top']<=p['y']<=p['bottom']
    if action == 'pointer-owner':
        return p['pointer']>=p['owner']
    if action == 'deadline':
        return p['started']+p['budget']
    if action == 'distance':
        return abs(p['edge']-p['x'])<abs(p['edge']-p['previous'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('direction contract', solve('direction', {'x':N,'previous':N+2,'side':-1}), True)
check('expiry contract', solve('expiry', {'now':N+10,'deadline':N+10}), False)
check('vertical-band contract', solve('vertical-band', {'top':N+1,'bottom':N+4,'y':N}), False)
check('pointer-owner contract', solve('pointer-owner', {'pointer':N+1,'owner':N}), False)
check('deadline contract', solve('deadline', {'started':N,'now':N+5,'budget':10}), N+10)
check('distance contract', solve('distance', {'edge':N+10,'x':N,'previous':N+2}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('away from left submenu',solve('direction',{'x':N+2,'previous':N,'side':-1}),False)
check('below submenu corridor',solve('vertical-band',{'top':N,'bottom':N+3,'y':N+4}),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:
Another pointer renews an active submenu intent corridor.

Submenu pointer intent uses signed direction, bounded time and a declared inclusive triangular corridor; unrelated pointer streams cannot renew it.

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 == 'direction':
        return (p['x']-p['previous'])*p['side']>0
    if action == 'expiry':
        return p['now']<p['deadline']
    if action == 'vertical-band':
        return p['top']<=p['y']<=p['bottom']
    if action == 'pointer-owner':
        return p['pointer']==p['owner']
    if action == 'deadline':
        return p['now']+p['budget']
    if action == 'distance':
        return abs(p['edge']-p['x'])<abs(p['edge']-p['previous'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('direction contract', solve('direction', {'x':N,'previous':N+2,'side':-1}), True)
check('expiry contract', solve('expiry', {'now':N+10,'deadline':N+10}), False)
check('vertical-band contract', solve('vertical-band', {'top':N+1,'bottom':N+4,'y':N}), False)
check('pointer-owner contract', solve('pointer-owner', {'pointer':N+1,'owner':N}), False)
check('deadline contract', solve('deadline', {'started':N,'now':N+5,'budget':10}), N+10)
check('distance contract', solve('distance', {'edge':N+10,'x':N,'previous':N+2}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('away from left submenu',solve('direction',{'x':N+2,'previous':N,'side':-1}),False)
check('below submenu corridor',solve('vertical-band',{'top':N,'bottom':N+3,'y':N+4}),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 == 'direction':
        return (p['x']-p['previous'])*p['side']>0
    if action == 'expiry':
        return p['now']<p['deadline']
    if action == 'vertical-band':
        return p['top']<=p['y']<=p['bottom']
    if action == 'pointer-owner':
        return p['pointer']==p['owner']
    if action == 'deadline':
        return p['started']+2*p['budget']
    if action == 'distance':
        return abs(p['edge']-p['x'])<abs(p['edge']-p['previous'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('direction contract', solve('direction', {'x':N,'previous':N+2,'side':-1}), True)
check('expiry contract', solve('expiry', {'now':N+10,'deadline':N+10}), False)
check('vertical-band contract', solve('vertical-band', {'top':N+1,'bottom':N+4,'y':N}), False)
check('pointer-owner contract', solve('pointer-owner', {'pointer':N+1,'owner':N}), False)
check('deadline contract', solve('deadline', {'started':N,'now':N+5,'budget':10}), N+10)
check('distance contract', solve('distance', {'edge':N+10,'x':N,'previous':N+2}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('away from left submenu',solve('direction',{'x':N+2,'previous':N,'side':-1}),False)
check('below submenu corridor',solve('vertical-band',{'top':N,'bottom':N+3,'y':N+4}),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:
Submenu intent deadline drifts forward on every move.

Submenu pointer intent uses signed direction, bounded time and a declared inclusive triangular corridor; unrelated pointer streams cannot renew it.

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 == 'direction':
        return (p['x']-p['previous'])*p['side']>0
    if action == 'expiry':
        return p['now']<p['deadline']
    if action == 'vertical-band':
        return p['top']<=p['y']<=p['bottom']
    if action == 'pointer-owner':
        return p['pointer']==p['owner']
    if action == 'deadline':
        return p['started']+p['budget']
    if action == 'distance':
        return p['x']!=p['previous']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('direction contract', solve('direction', {'x':N,'previous':N+2,'side':-1}), True)
check('expiry contract', solve('expiry', {'now':N+10,'deadline':N+10}), False)
check('vertical-band contract', solve('vertical-band', {'top':N+1,'bottom':N+4,'y':N}), False)
check('pointer-owner contract', solve('pointer-owner', {'pointer':N+1,'owner':N}), False)
check('deadline contract', solve('deadline', {'started':N,'now':N+5,'budget':10}), N+10)
check('distance contract', solve('distance', {'edge':N+10,'x':N,'previous':N+2}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('away from left submenu',solve('direction',{'x':N+2,'previous':N,'side':-1}),False)
check('below submenu corridor',solve('vertical-band',{'top':N,'bottom':N+3,'y':N+4}),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 == 'direction':
        return (p['x']-p['previous'])*p['side']>0
    if action == 'expiry':
        return p['now']<p['deadline']
    if action == 'vertical-band':
        return p['top']<=p['y']<=p['bottom']
    if action == 'pointer-owner':
        return p['pointer']==p['owner']
    if action == 'deadline':
        return p['started']+p['budget']
    if action == 'distance':
        return abs(p['edge']-p['x'])>abs(p['edge']-p['previous'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('direction contract', solve('direction', {'x':N,'previous':N+2,'side':-1}), True)
check('expiry contract', solve('expiry', {'now':N+10,'deadline':N+10}), False)
check('vertical-band contract', solve('vertical-band', {'top':N+1,'bottom':N+4,'y':N}), False)
check('pointer-owner contract', solve('pointer-owner', {'pointer':N+1,'owner':N}), False)
check('deadline contract', solve('deadline', {'started':N,'now':N+5,'budget':10}), N+10)
check('distance contract', solve('distance', {'edge':N+10,'x':N,'previous':N+2}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('away from left submenu',solve('direction',{'x':N+2,'previous':N,'side':-1}),False)
check('below submenu corridor',solve('vertical-band',{'top':N,'bottom':N+3,'y':N+4}),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:
Moving away from a submenu extends its pointer grace period.

Submenu pointer intent uses signed direction, bounded time and a declared inclusive triangular corridor; unrelated pointer streams cannot renew it.

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 == 'open-at':
        return p['delay']
    if action == 'replace-job':
        return [x for x in p['jobs'] if x['owner']!=p['new']['owner']]+[p['new']]
    if action == 'entry-cancel':
        return [x for x in p['jobs'] if not (x['owner']==p['owner'] and x['kind']=='close')]
    if action == 'due':
        return [x for x in p['jobs'] if x['at']<=p['now']]
    if action == 'leave-grace':
        return max(p['base'],p['intent'])
    if action == 'late-fire':
        return p['owner']==p['current'] and p['inside']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open-at contract', solve('open-at', {'entered':N,'now':N+3,'delay':10}), N+10)
check('replace-job contract', solve('replace-job', {'jobs':[{'owner':'a','at':N},{'owner':'b','at':N}],'new':{'owner':'a','at':N+1}}), [{'owner':'b','at':N},{'owner':'a','at':N+1}])
check('entry-cancel contract', solve('entry-cancel', {'owner':'a','jobs':[{'owner':'a','kind':'close','at':N},{'owner':'b','kind':'open','at':N}]}), [{'owner':'b','kind':'open','at':N}])
check('due contract', solve('due', {'jobs':[{'at':N},{'at':N+1}],'now':N}), [{'at':N}])
check('leave-grace contract', solve('leave-grace', {'base':N+1,'intent':N+5}), N+5)
check('late-fire contract', solve('late-fire', {'owner':'a'+str(N),'current':'a'+str(N),'inside':False}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('inside different owner',solve('late-fire',{'owner':N,'current':N+1,'inside':True}),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 == 'open-at':
        return p['now']+p['delay']
    if action == 'replace-job':
        return [x for x in p['jobs'] if x['owner']!=p['new']['owner']]+[p['new']]
    if action == 'entry-cancel':
        return [x for x in p['jobs'] if not (x['owner']==p['owner'] and x['kind']=='close')]
    if action == 'due':
        return [x for x in p['jobs'] if x['at']<=p['now']]
    if action == 'leave-grace':
        return max(p['base'],p['intent'])
    if action == 'late-fire':
        return p['owner']==p['current'] and p['inside']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open-at contract', solve('open-at', {'entered':N,'now':N+3,'delay':10}), N+10)
check('replace-job contract', solve('replace-job', {'jobs':[{'owner':'a','at':N},{'owner':'b','at':N}],'new':{'owner':'a','at':N+1}}), [{'owner':'b','at':N},{'owner':'a','at':N+1}])
check('entry-cancel contract', solve('entry-cancel', {'owner':'a','jobs':[{'owner':'a','kind':'close','at':N},{'owner':'b','kind':'open','at':N}]}), [{'owner':'b','kind':'open','at':N}])
check('due contract', solve('due', {'jobs':[{'at':N},{'at':N+1}],'now':N}), [{'at':N}])
check('leave-grace contract', solve('leave-grace', {'base':N+1,'intent':N+5}), N+5)
check('late-fire contract', solve('late-fire', {'owner':'a'+str(N),'current':'a'+str(N),'inside':False}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('inside different owner',solve('late-fire',{'owner':N,'current':N+1,'inside':True}),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:
Hover-open deadline is recalculated after delayed event delivery.

Menu hover work is keyed by owner and pointer incarnation; scheduling honors open delays and close grace without retaining superseded jobs.

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 == 'open-at':
        return p['entered']+p['delay']
    if action == 'replace-job':
        return p['jobs']+[p['new']]
    if action == 'entry-cancel':
        return [x for x in p['jobs'] if not (x['owner']==p['owner'] and x['kind']=='close')]
    if action == 'due':
        return [x for x in p['jobs'] if x['at']<=p['now']]
    if action == 'leave-grace':
        return max(p['base'],p['intent'])
    if action == 'late-fire':
        return p['owner']==p['current'] and p['inside']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open-at contract', solve('open-at', {'entered':N,'now':N+3,'delay':10}), N+10)
check('replace-job contract', solve('replace-job', {'jobs':[{'owner':'a','at':N},{'owner':'b','at':N}],'new':{'owner':'a','at':N+1}}), [{'owner':'b','at':N},{'owner':'a','at':N+1}])
check('entry-cancel contract', solve('entry-cancel', {'owner':'a','jobs':[{'owner':'a','kind':'close','at':N},{'owner':'b','kind':'open','at':N}]}), [{'owner':'b','kind':'open','at':N}])
check('due contract', solve('due', {'jobs':[{'at':N},{'at':N+1}],'now':N}), [{'at':N}])
check('leave-grace contract', solve('leave-grace', {'base':N+1,'intent':N+5}), N+5)
check('late-fire contract', solve('late-fire', {'owner':'a'+str(N),'current':'a'+str(N),'inside':False}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('inside different owner',solve('late-fire',{'owner':N,'current':N+1,'inside':True}),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 == 'open-at':
        return p['entered']+p['delay']
    if action == 'replace-job':
        return [p['new']]
    if action == 'entry-cancel':
        return [x for x in p['jobs'] if not (x['owner']==p['owner'] and x['kind']=='close')]
    if action == 'due':
        return [x for x in p['jobs'] if x['at']<=p['now']]
    if action == 'leave-grace':
        return max(p['base'],p['intent'])
    if action == 'late-fire':
        return p['owner']==p['current'] and p['inside']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open-at contract', solve('open-at', {'entered':N,'now':N+3,'delay':10}), N+10)
check('replace-job contract', solve('replace-job', {'jobs':[{'owner':'a','at':N},{'owner':'b','at':N}],'new':{'owner':'a','at':N+1}}), [{'owner':'b','at':N},{'owner':'a','at':N+1}])
check('entry-cancel contract', solve('entry-cancel', {'owner':'a','jobs':[{'owner':'a','kind':'close','at':N},{'owner':'b','kind':'open','at':N}]}), [{'owner':'b','kind':'open','at':N}])
check('due contract', solve('due', {'jobs':[{'at':N},{'at':N+1}],'now':N}), [{'at':N}])
check('leave-grace contract', solve('leave-grace', {'base':N+1,'intent':N+5}), N+5)
check('late-fire contract', solve('late-fire', {'owner':'a'+str(N),'current':'a'+str(N),'inside':False}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('inside different owner',solve('late-fire',{'owner':N,'current':N+1,'inside':True}),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:
Replacing one hover timer retains stale timer ownership.

Menu hover work is keyed by owner and pointer incarnation; scheduling honors open delays and close grace without retaining superseded jobs.

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 == 'open-at':
        return p['entered']+p['delay']
    if action == 'replace-job':
        return [x for x in p['jobs'] if x['owner']!=p['new']['owner']]+[p['new']]
    if action == 'entry-cancel':
        return p['jobs']
    if action == 'due':
        return [x for x in p['jobs'] if x['at']<=p['now']]
    if action == 'leave-grace':
        return max(p['base'],p['intent'])
    if action == 'late-fire':
        return p['owner']==p['current'] and p['inside']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open-at contract', solve('open-at', {'entered':N,'now':N+3,'delay':10}), N+10)
check('replace-job contract', solve('replace-job', {'jobs':[{'owner':'a','at':N},{'owner':'b','at':N}],'new':{'owner':'a','at':N+1}}), [{'owner':'b','at':N},{'owner':'a','at':N+1}])
check('entry-cancel contract', solve('entry-cancel', {'owner':'a','jobs':[{'owner':'a','kind':'close','at':N},{'owner':'b','kind':'open','at':N}]}), [{'owner':'b','kind':'open','at':N}])
check('due contract', solve('due', {'jobs':[{'at':N},{'at':N+1}],'now':N}), [{'at':N}])
check('leave-grace contract', solve('leave-grace', {'base':N+1,'intent':N+5}), N+5)
check('late-fire contract', solve('late-fire', {'owner':'a'+str(N),'current':'a'+str(N),'inside':False}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('inside different owner',solve('late-fire',{'owner':N,'current':N+1,'inside':True}),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 == 'open-at':
        return p['entered']+p['delay']
    if action == 'replace-job':
        return [x for x in p['jobs'] if x['owner']!=p['new']['owner']]+[p['new']]
    if action == 'entry-cancel':
        return []
    if action == 'due':
        return [x for x in p['jobs'] if x['at']<=p['now']]
    if action == 'leave-grace':
        return max(p['base'],p['intent'])
    if action == 'late-fire':
        return p['owner']==p['current'] and p['inside']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open-at contract', solve('open-at', {'entered':N,'now':N+3,'delay':10}), N+10)
check('replace-job contract', solve('replace-job', {'jobs':[{'owner':'a','at':N},{'owner':'b','at':N}],'new':{'owner':'a','at':N+1}}), [{'owner':'b','at':N},{'owner':'a','at':N+1}])
check('entry-cancel contract', solve('entry-cancel', {'owner':'a','jobs':[{'owner':'a','kind':'close','at':N},{'owner':'b','kind':'open','at':N}]}), [{'owner':'b','kind':'open','at':N}])
check('due contract', solve('due', {'jobs':[{'at':N},{'at':N+1}],'now':N}), [{'at':N}])
check('leave-grace contract', solve('leave-grace', {'base':N+1,'intent':N+5}), N+5)
check('late-fire contract', solve('late-fire', {'owner':'a'+str(N),'current':'a'+str(N),'inside':False}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('inside different owner',solve('late-fire',{'owner':N,'current':N+1,'inside':True}),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:
Returning to a submenu fails to cancel its pending close.

Menu hover work is keyed by owner and pointer incarnation; scheduling honors open delays and close grace without retaining superseded jobs.

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 == 'open-at':
        return p['entered']+p['delay']
    if action == 'replace-job':
        return [x for x in p['jobs'] if x['owner']!=p['new']['owner']]+[p['new']]
    if action == 'entry-cancel':
        return [x for x in p['jobs'] if not (x['owner']==p['owner'] and x['kind']=='close')]
    if action == 'due':
        return p['jobs']
    if action == 'leave-grace':
        return max(p['base'],p['intent'])
    if action == 'late-fire':
        return p['owner']==p['current'] and p['inside']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open-at contract', solve('open-at', {'entered':N,'now':N+3,'delay':10}), N+10)
check('replace-job contract', solve('replace-job', {'jobs':[{'owner':'a','at':N},{'owner':'b','at':N}],'new':{'owner':'a','at':N+1}}), [{'owner':'b','at':N},{'owner':'a','at':N+1}])
check('entry-cancel contract', solve('entry-cancel', {'owner':'a','jobs':[{'owner':'a','kind':'close','at':N},{'owner':'b','kind':'open','at':N}]}), [{'owner':'b','kind':'open','at':N}])
check('due contract', solve('due', {'jobs':[{'at':N},{'at':N+1}],'now':N}), [{'at':N}])
check('leave-grace contract', solve('leave-grace', {'base':N+1,'intent':N+5}), N+5)
check('late-fire contract', solve('late-fire', {'owner':'a'+str(N),'current':'a'+str(N),'inside':False}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('inside different owner',solve('late-fire',{'owner':N,'current':N+1,'inside':True}),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 == 'open-at':
        return p['entered']+p['delay']
    if action == 'replace-job':
        return [x for x in p['jobs'] if x['owner']!=p['new']['owner']]+[p['new']]
    if action == 'entry-cancel':
        return [x for x in p['jobs'] if not (x['owner']==p['owner'] and x['kind']=='close')]
    if action == 'due':
        return [x for x in p['jobs'] if x['at']<p['now']]
    if action == 'leave-grace':
        return max(p['base'],p['intent'])
    if action == 'late-fire':
        return p['owner']==p['current'] and p['inside']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open-at contract', solve('open-at', {'entered':N,'now':N+3,'delay':10}), N+10)
check('replace-job contract', solve('replace-job', {'jobs':[{'owner':'a','at':N},{'owner':'b','at':N}],'new':{'owner':'a','at':N+1}}), [{'owner':'b','at':N},{'owner':'a','at':N+1}])
check('entry-cancel contract', solve('entry-cancel', {'owner':'a','jobs':[{'owner':'a','kind':'close','at':N},{'owner':'b','kind':'open','at':N}]}), [{'owner':'b','kind':'open','at':N}])
check('due contract', solve('due', {'jobs':[{'at':N},{'at':N+1}],'now':N}), [{'at':N}])
check('leave-grace contract', solve('leave-grace', {'base':N+1,'intent':N+5}), N+5)
check('late-fire contract', solve('late-fire', {'owner':'a'+str(N),'current':'a'+str(N),'inside':False}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('inside different owner',solve('late-fire',{'owner':N,'current':N+1,'inside':True}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Menu hover scheduler skips jobs exactly at the deadline.

Menu hover work is keyed by owner and pointer incarnation; scheduling honors open delays and close grace without retaining superseded jobs.

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 == 'open-at':
        return p['entered']+p['delay']
    if action == 'replace-job':
        return [x for x in p['jobs'] if x['owner']!=p['new']['owner']]+[p['new']]
    if action == 'entry-cancel':
        return [x for x in p['jobs'] if not (x['owner']==p['owner'] and x['kind']=='close')]
    if action == 'due':
        return [x for x in p['jobs'] if x['at']<=p['now']]
    if action == 'leave-grace':
        return p['base']
    if action == 'late-fire':
        return p['owner']==p['current'] and p['inside']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open-at contract', solve('open-at', {'entered':N,'now':N+3,'delay':10}), N+10)
check('replace-job contract', solve('replace-job', {'jobs':[{'owner':'a','at':N},{'owner':'b','at':N}],'new':{'owner':'a','at':N+1}}), [{'owner':'b','at':N},{'owner':'a','at':N+1}])
check('entry-cancel contract', solve('entry-cancel', {'owner':'a','jobs':[{'owner':'a','kind':'close','at':N},{'owner':'b','kind':'open','at':N}]}), [{'owner':'b','kind':'open','at':N}])
check('due contract', solve('due', {'jobs':[{'at':N},{'at':N+1}],'now':N}), [{'at':N}])
check('leave-grace contract', solve('leave-grace', {'base':N+1,'intent':N+5}), N+5)
check('late-fire contract', solve('late-fire', {'owner':'a'+str(N),'current':'a'+str(N),'inside':False}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('inside different owner',solve('late-fire',{'owner':N,'current':N+1,'inside':True}),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 == 'open-at':
        return p['entered']+p['delay']
    if action == 'replace-job':
        return [x for x in p['jobs'] if x['owner']!=p['new']['owner']]+[p['new']]
    if action == 'entry-cancel':
        return [x for x in p['jobs'] if not (x['owner']==p['owner'] and x['kind']=='close')]
    if action == 'due':
        return [x for x in p['jobs'] if x['at']<=p['now']]
    if action == 'leave-grace':
        return min(p['base'],p['intent'])
    if action == 'late-fire':
        return p['owner']==p['current'] and p['inside']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open-at contract', solve('open-at', {'entered':N,'now':N+3,'delay':10}), N+10)
check('replace-job contract', solve('replace-job', {'jobs':[{'owner':'a','at':N},{'owner':'b','at':N}],'new':{'owner':'a','at':N+1}}), [{'owner':'b','at':N},{'owner':'a','at':N+1}])
check('entry-cancel contract', solve('entry-cancel', {'owner':'a','jobs':[{'owner':'a','kind':'close','at':N},{'owner':'b','kind':'open','at':N}]}), [{'owner':'b','kind':'open','at':N}])
check('due contract', solve('due', {'jobs':[{'at':N},{'at':N+1}],'now':N}), [{'at':N}])
check('leave-grace contract', solve('leave-grace', {'base':N+1,'intent':N+5}), N+5)
check('late-fire contract', solve('late-fire', {'owner':'a'+str(N),'current':'a'+str(N),'inside':False}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('inside different owner',solve('late-fire',{'owner':N,'current':N+1,'inside':True}),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:
Submenu leave timer ignores a longer active intent corridor.

Menu hover work is keyed by owner and pointer incarnation; scheduling honors open delays and close grace without retaining superseded jobs.

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 == 'open-at':
        return p['entered']+p['delay']
    if action == 'replace-job':
        return [x for x in p['jobs'] if x['owner']!=p['new']['owner']]+[p['new']]
    if action == 'entry-cancel':
        return [x for x in p['jobs'] if not (x['owner']==p['owner'] and x['kind']=='close')]
    if action == 'due':
        return [x for x in p['jobs'] if x['at']<=p['now']]
    if action == 'leave-grace':
        return max(p['base'],p['intent'])
    if action == 'late-fire':
        return p['owner']==p['current']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open-at contract', solve('open-at', {'entered':N,'now':N+3,'delay':10}), N+10)
check('replace-job contract', solve('replace-job', {'jobs':[{'owner':'a','at':N},{'owner':'b','at':N}],'new':{'owner':'a','at':N+1}}), [{'owner':'b','at':N},{'owner':'a','at':N+1}])
check('entry-cancel contract', solve('entry-cancel', {'owner':'a','jobs':[{'owner':'a','kind':'close','at':N},{'owner':'b','kind':'open','at':N}]}), [{'owner':'b','kind':'open','at':N}])
check('due contract', solve('due', {'jobs':[{'at':N},{'at':N+1}],'now':N}), [{'at':N}])
check('leave-grace contract', solve('leave-grace', {'base':N+1,'intent':N+5}), N+5)
check('late-fire contract', solve('late-fire', {'owner':'a'+str(N),'current':'a'+str(N),'inside':False}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('inside different owner',solve('late-fire',{'owner':N,'current':N+1,'inside':True}),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 == 'open-at':
        return p['entered']+p['delay']
    if action == 'replace-job':
        return [x for x in p['jobs'] if x['owner']!=p['new']['owner']]+[p['new']]
    if action == 'entry-cancel':
        return [x for x in p['jobs'] if not (x['owner']==p['owner'] and x['kind']=='close')]
    if action == 'due':
        return [x for x in p['jobs'] if x['at']<=p['now']]
    if action == 'leave-grace':
        return max(p['base'],p['intent'])
    if action == 'late-fire':
        return p['inside']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open-at contract', solve('open-at', {'entered':N,'now':N+3,'delay':10}), N+10)
check('replace-job contract', solve('replace-job', {'jobs':[{'owner':'a','at':N},{'owner':'b','at':N}],'new':{'owner':'a','at':N+1}}), [{'owner':'b','at':N},{'owner':'a','at':N+1}])
check('entry-cancel contract', solve('entry-cancel', {'owner':'a','jobs':[{'owner':'a','kind':'close','at':N},{'owner':'b','kind':'open','at':N}]}), [{'owner':'b','kind':'open','at':N}])
check('due contract', solve('due', {'jobs':[{'at':N},{'at':N+1}],'now':N}), [{'at':N}])
check('leave-grace contract', solve('leave-grace', {'base':N+1,'intent':N+5}), N+5)
check('late-fire contract', solve('late-fire', {'owner':'a'+str(N),'current':'a'+str(N),'inside':False}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('inside different owner',solve('late-fire',{'owner':N,'current':N+1,'inside':True}),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:
Queued hover event opens a submenu after pointer departure.

Menu hover work is keyed by owner and pointer incarnation; scheduling honors open delays and close grace without retaining superseded jobs.

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 == 'top':
        return p[0] if p else None
    if action == 'raise':
        return [x for x in p['stack'] if x!=p['id']]+[p['id']]
    if action == 'remove-subtree':
        return [x for x in p['stack'] if p['owner'] not in x['ancestors'] and x['id']!=p['owner']]
    if action == 'root-of':
        return p['ancestors'][0] if p['ancestors'] else p['id']
    if action == 'depth-z':
        return p['base']+p['depth']*p['stride']
    if action == 'detach':
        return [dict(x,parent=None) if x['parent']==p['removed'] else x for x in p['rows']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
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 == 'top':
        return None
    if action == 'raise':
        return [x for x in p['stack'] if x!=p['id']]+[p['id']]
    if action == 'remove-subtree':
        return [x for x in p['stack'] if p['owner'] not in x['ancestors'] and x['id']!=p['owner']]
    if action == 'root-of':
        return p['ancestors'][0] if p['ancestors'] else p['id']
    if action == 'depth-z':
        return p['base']+p['depth']*p['stride']
    if action == 'detach':
        return [dict(x,parent=None) if x['parent']==p['removed'] else x for x in p['rows']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
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 hit routing chooses the oldest surface instead of the topmost.

Menu surfaces form an ownership stack independent of document overlays; operations preserve unrelated roots and remove owned descendants.

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 == 'top':
        return p[-1] if p else None
    if action == 'raise':
        return p['stack']+[p['id']]
    if action == 'remove-subtree':
        return [x for x in p['stack'] if p['owner'] not in x['ancestors'] and x['id']!=p['owner']]
    if action == 'root-of':
        return p['ancestors'][0] if p['ancestors'] else p['id']
    if action == 'depth-z':
        return p['base']+p['depth']*p['stride']
    if action == 'detach':
        return [dict(x,parent=None) if x['parent']==p['removed'] else x for x in p['rows']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
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 == 'top':
        return p[-1] if p else None
    if action == 'raise':
        return [p['id']]+[x for x in p['stack'] if x!=p['id']]
    if action == 'remove-subtree':
        return [x for x in p['stack'] if p['owner'] not in x['ancestors'] and x['id']!=p['owner']]
    if action == 'root-of':
        return p['ancestors'][0] if p['ancestors'] else p['id']
    if action == 'depth-z':
        return p['base']+p['depth']*p['stride']
    if action == 'detach':
        return [dict(x,parent=None) if x['parent']==p['removed'] else x for x in p['rows']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
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:
Raising an existing menu creates a duplicate surface entry.

Menu surfaces form an ownership stack independent of document overlays; operations preserve unrelated roots and remove owned descendants.

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 == 'top':
        return p[-1] if p else None
    if action == 'raise':
        return [x for x in p['stack'] if x!=p['id']]+[p['id']]
    if action == 'remove-subtree':
        return [x for x in p['stack'] if x['id']!=p['owner']]
    if action == 'root-of':
        return p['ancestors'][0] if p['ancestors'] else p['id']
    if action == 'depth-z':
        return p['base']+p['depth']*p['stride']
    if action == 'detach':
        return [dict(x,parent=None) if x['parent']==p['removed'] else x for x in p['rows']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
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 == 'top':
        return p[-1] if p else None
    if action == 'raise':
        return [x for x in p['stack'] if x!=p['id']]+[p['id']]
    if action == 'remove-subtree':
        return []
    if action == 'root-of':
        return p['ancestors'][0] if p['ancestors'] else p['id']
    if action == 'depth-z':
        return p['base']+p['depth']*p['stride']
    if action == 'detach':
        return [dict(x,parent=None) if x['parent']==p['removed'] else x for x in p['rows']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
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:
Removing a parent popup leaves child surfaces registered.

Menu surfaces form an ownership stack independent of document overlays; operations preserve unrelated roots and remove owned descendants.

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 == 'top':
        return p[-1] if p else None
    if action == 'raise':
        return [x for x in p['stack'] if x!=p['id']]+[p['id']]
    if action == 'remove-subtree':
        return [x for x in p['stack'] if p['owner'] not in x['ancestors'] and x['id']!=p['owner']]
    if action == 'root-of':
        return p['id']
    if action == 'depth-z':
        return p['base']+p['depth']*p['stride']
    if action == 'detach':
        return [dict(x,parent=None) if x['parent']==p['removed'] else x for x in p['rows']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
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 == 'top':
        return p[-1] if p else None
    if action == 'raise':
        return [x for x in p['stack'] if x!=p['id']]+[p['id']]
    if action == 'remove-subtree':
        return [x for x in p['stack'] if p['owner'] not in x['ancestors'] and x['id']!=p['owner']]
    if action == 'root-of':
        return p['ancestors'][-1] if p['ancestors'] else p['id']
    if action == 'depth-z':
        return p['base']+p['depth']*p['stride']
    if action == 'detach':
        return [dict(x,parent=None) if x['parent']==p['removed'] else x for x in p['rows']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
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:
Cascade root identity is replaced by its nearest parent.

Menu surfaces form an ownership stack independent of document overlays; operations preserve unrelated roots and remove owned descendants.

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 == 'top':
        return p[-1] if p else None
    if action == 'raise':
        return [x for x in p['stack'] if x!=p['id']]+[p['id']]
    if action == 'remove-subtree':
        return [x for x in p['stack'] if p['owner'] not in x['ancestors'] and x['id']!=p['owner']]
    if action == 'root-of':
        return p['ancestors'][0] if p['ancestors'] else p['id']
    if action == 'depth-z':
        return p['base']+p['depth']
    if action == 'detach':
        return [dict(x,parent=None) if x['parent']==p['removed'] else x for x in p['rows']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
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 == 'top':
        return p[-1] if p else None
    if action == 'raise':
        return [x for x in p['stack'] if x!=p['id']]+[p['id']]
    if action == 'remove-subtree':
        return [x for x in p['stack'] if p['owner'] not in x['ancestors'] and x['id']!=p['owner']]
    if action == 'root-of':
        return p['ancestors'][0] if p['ancestors'] else p['id']
    if action == 'depth-z':
        return p['base']+p['stride']
    if action == 'detach':
        return [dict(x,parent=None) if x['parent']==p['removed'] else x for x in p['rows']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
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:
Nested menu surface levels ignore the reserved z-order stride.

Menu surfaces form an ownership stack independent of document overlays; operations preserve unrelated roots and remove owned descendants.

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 == 'top':
        return p[-1] if p else None
    if action == 'raise':
        return [x for x in p['stack'] if x!=p['id']]+[p['id']]
    if action == 'remove-subtree':
        return [x for x in p['stack'] if p['owner'] not in x['ancestors'] and x['id']!=p['owner']]
    if action == 'root-of':
        return p['ancestors'][0] if p['ancestors'] else p['id']
    if action == 'depth-z':
        return p['base']+p['depth']*p['stride']
    if action == 'detach':
        return p['rows']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
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 == 'top':
        return p[-1] if p else None
    if action == 'raise':
        return [x for x in p['stack'] if x!=p['id']]+[p['id']]
    if action == 'remove-subtree':
        return [x for x in p['stack'] if p['owner'] not in x['ancestors'] and x['id']!=p['owner']]
    if action == 'root-of':
        return p['ancestors'][0] if p['ancestors'] else p['id']
    if action == 'depth-z':
        return p['base']+p['depth']*p['stride']
    if action == 'detach':
        return [dict(x,parent=None) for x in p['rows']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Detached menu root still references a removed host.

Menu surfaces form an ownership stack independent of document overlays; operations preserve unrelated roots and remove owned descendants.

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

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

prompt:
Right submenu placement forgets the owner-edge overlap.

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

split: open-access


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

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

prompt:
Left submenu placement applies overlap in the wrong direction.

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

split: open-access


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

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

prompt:
Clipped submenu chooses the smaller side when neither side fits.

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

split: open-access


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

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

prompt:
Submenu content starts below the owning row due to padding.

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

split: open-access


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

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

prompt:
Portaled submenu mixes root-relative and screen coordinates.

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

split: open-access