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 == 'cardinality':
        return p['count']>=p['min']
    if action == 'all-types':
        return all(t in p['supported'] for t in p['types'])
    if action == 'nonempty':
        return bool(p['targets']) and all(p['valid'])
    if action == 'busy':
        return not p['document_busy'] and not p['command_busy']
    if action == 'reason':
        return next((x['reason'] for x in p if not x['ok']),None)
    if action == 'expiry':
        return p['now']<p['expires']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cardinality contract', solve('cardinality', {'min':1,'max':N+1,'count':N+2}), False)
check('all-types contract', solve('all-types', {'types':['text','binary'+str(N)],'supported':['text']}), False)
check('nonempty contract', solve('nonempty', {'targets':[],'valid':[],'revision':N}), False)
check('busy contract', solve('busy', {'document_busy':False,'command_busy':True,'id':N}), False)
check('reason contract', solve('reason', [{'ok':False,'reason':'first'+str(N)},{'ok':False,'reason':'second'}]), 'first'+str(N))
check('expiry contract', solve('expiry', {'now':N,'expires':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('too few context objects',solve('cardinality',{'min':N+1,'max':N+3,'count':N}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'cardinality':
        return p['count']<=p['max']
    if action == 'all-types':
        return all(t in p['supported'] for t in p['types'])
    if action == 'nonempty':
        return bool(p['targets']) and all(p['valid'])
    if action == 'busy':
        return not p['document_busy'] and not p['command_busy']
    if action == 'reason':
        return next((x['reason'] for x in p if not x['ok']),None)
    if action == 'expiry':
        return p['now']<p['expires']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cardinality contract', solve('cardinality', {'min':1,'max':N+1,'count':N+2}), False)
check('all-types contract', solve('all-types', {'types':['text','binary'+str(N)],'supported':['text']}), False)
check('nonempty contract', solve('nonempty', {'targets':[],'valid':[],'revision':N}), False)
check('busy contract', solve('busy', {'document_busy':False,'command_busy':True,'id':N}), False)
check('reason contract', solve('reason', [{'ok':False,'reason':'first'+str(N)},{'ok':False,'reason':'second'}]), 'first'+str(N))
check('expiry contract', solve('expiry', {'now':N,'expires':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('too few context objects',solve('cardinality',{'min':N+1,'max':N+3,'count':N}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Menu batch command overlooks its upper cardinality limit.

Menu-specific command availability combines document cardinality, type support and command preconditions; explanations have a deterministic policy order.

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 == 'cardinality':
        return p['min']<=p['count']<=p['max']
    if action == 'all-types':
        return any(t in p['supported'] for t in p['types'])
    if action == 'nonempty':
        return bool(p['targets']) and all(p['valid'])
    if action == 'busy':
        return not p['document_busy'] and not p['command_busy']
    if action == 'reason':
        return next((x['reason'] for x in p if not x['ok']),None)
    if action == 'expiry':
        return p['now']<p['expires']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cardinality contract', solve('cardinality', {'min':1,'max':N+1,'count':N+2}), False)
check('all-types contract', solve('all-types', {'types':['text','binary'+str(N)],'supported':['text']}), False)
check('nonempty contract', solve('nonempty', {'targets':[],'valid':[],'revision':N}), False)
check('busy contract', solve('busy', {'document_busy':False,'command_busy':True,'id':N}), False)
check('reason contract', solve('reason', [{'ok':False,'reason':'first'+str(N)},{'ok':False,'reason':'second'}]), 'first'+str(N))
check('expiry contract', solve('expiry', {'now':N,'expires':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('too few context objects',solve('cardinality',{'min':N+1,'max':N+3,'count':N}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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 == 'cardinality':
        return p['min']<=p['count']<=p['max']
    if action == 'all-types':
        return bool(set(p['types']) & set(p['supported']))
    if action == 'nonempty':
        return bool(p['targets']) and all(p['valid'])
    if action == 'busy':
        return not p['document_busy'] and not p['command_busy']
    if action == 'reason':
        return next((x['reason'] for x in p if not x['ok']),None)
    if action == 'expiry':
        return p['now']<p['expires']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cardinality contract', solve('cardinality', {'min':1,'max':N+1,'count':N+2}), False)
check('all-types contract', solve('all-types', {'types':['text','binary'+str(N)],'supported':['text']}), False)
check('nonempty contract', solve('nonempty', {'targets':[],'valid':[],'revision':N}), False)
check('busy contract', solve('busy', {'document_busy':False,'command_busy':True,'id':N}), False)
check('reason contract', solve('reason', [{'ok':False,'reason':'first'+str(N)},{'ok':False,'reason':'second'}]), 'first'+str(N))
check('expiry contract', solve('expiry', {'now':N,'expires':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('too few context objects',solve('cardinality',{'min':N+1,'max':N+3,'count':N}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Menu command accepts a mixed unsupported document batch.

Menu-specific command availability combines document cardinality, type support and command preconditions; explanations have a deterministic policy order.

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 == 'cardinality':
        return p['min']<=p['count']<=p['max']
    if action == 'all-types':
        return all(t in p['supported'] for t in p['types'])
    if action == 'nonempty':
        return all(p['valid'])
    if action == 'busy':
        return not p['document_busy'] and not p['command_busy']
    if action == 'reason':
        return next((x['reason'] for x in p if not x['ok']),None)
    if action == 'expiry':
        return p['now']<p['expires']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cardinality contract', solve('cardinality', {'min':1,'max':N+1,'count':N+2}), False)
check('all-types contract', solve('all-types', {'types':['text','binary'+str(N)],'supported':['text']}), False)
check('nonempty contract', solve('nonempty', {'targets':[],'valid':[],'revision':N}), False)
check('busy contract', solve('busy', {'document_busy':False,'command_busy':True,'id':N}), False)
check('reason contract', solve('reason', [{'ok':False,'reason':'first'+str(N)},{'ok':False,'reason':'second'}]), 'first'+str(N))
check('expiry contract', solve('expiry', {'now':N,'expires':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('too few context objects',solve('cardinality',{'min':N+1,'max':N+3,'count':N}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'cardinality':
        return p['min']<=p['count']<=p['max']
    if action == 'all-types':
        return all(t in p['supported'] for t in p['types'])
    if action == 'nonempty':
        return not any(not x for x in p['valid'])
    if action == 'busy':
        return not p['document_busy'] and not p['command_busy']
    if action == 'reason':
        return next((x['reason'] for x in p if not x['ok']),None)
    if action == 'expiry':
        return p['now']<p['expires']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cardinality contract', solve('cardinality', {'min':1,'max':N+1,'count':N+2}), False)
check('all-types contract', solve('all-types', {'types':['text','binary'+str(N)],'supported':['text']}), False)
check('nonempty contract', solve('nonempty', {'targets':[],'valid':[],'revision':N}), False)
check('busy contract', solve('busy', {'document_busy':False,'command_busy':True,'id':N}), False)
check('reason contract', solve('reason', [{'ok':False,'reason':'first'+str(N)},{'ok':False,'reason':'second'}]), 'first'+str(N))
check('expiry contract', solve('expiry', {'now':N,'expires':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('too few context objects',solve('cardinality',{'min':N+1,'max':N+3,'count':N}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Vacuous target validation enables an empty context command.

Menu-specific command availability combines document cardinality, type support and command preconditions; explanations have a deterministic policy order.

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 == 'cardinality':
        return p['min']<=p['count']<=p['max']
    if action == 'all-types':
        return all(t in p['supported'] for t in p['types'])
    if action == 'nonempty':
        return bool(p['targets']) and all(p['valid'])
    if action == 'busy':
        return not p['document_busy']
    if action == 'reason':
        return next((x['reason'] for x in p if not x['ok']),None)
    if action == 'expiry':
        return p['now']<p['expires']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cardinality contract', solve('cardinality', {'min':1,'max':N+1,'count':N+2}), False)
check('all-types contract', solve('all-types', {'types':['text','binary'+str(N)],'supported':['text']}), False)
check('nonempty contract', solve('nonempty', {'targets':[],'valid':[],'revision':N}), False)
check('busy contract', solve('busy', {'document_busy':False,'command_busy':True,'id':N}), False)
check('reason contract', solve('reason', [{'ok':False,'reason':'first'+str(N)},{'ok':False,'reason':'second'}]), 'first'+str(N))
check('expiry contract', solve('expiry', {'now':N,'expires':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('too few context objects',solve('cardinality',{'min':N+1,'max':N+3,'count':N}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'cardinality':
        return p['min']<=p['count']<=p['max']
    if action == 'all-types':
        return all(t in p['supported'] for t in p['types'])
    if action == 'nonempty':
        return bool(p['targets']) and all(p['valid'])
    if action == 'busy':
        return not p['document_busy'] or not p['command_busy']
    if action == 'reason':
        return next((x['reason'] for x in p if not x['ok']),None)
    if action == 'expiry':
        return p['now']<p['expires']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cardinality contract', solve('cardinality', {'min':1,'max':N+1,'count':N+2}), False)
check('all-types contract', solve('all-types', {'types':['text','binary'+str(N)],'supported':['text']}), False)
check('nonempty contract', solve('nonempty', {'targets':[],'valid':[],'revision':N}), False)
check('busy contract', solve('busy', {'document_busy':False,'command_busy':True,'id':N}), False)
check('reason contract', solve('reason', [{'ok':False,'reason':'first'+str(N)},{'ok':False,'reason':'second'}]), 'first'+str(N))
check('expiry contract', solve('expiry', {'now':N,'expires':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('too few context objects',solve('cardinality',{'min':N+1,'max':N+3,'count':N}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Busy menu command remains available because its document is idle.

Menu-specific command availability combines document cardinality, type support and command preconditions; explanations have a deterministic policy order.

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 == 'cardinality':
        return p['min']<=p['count']<=p['max']
    if action == 'all-types':
        return all(t in p['supported'] for t in p['types'])
    if action == 'nonempty':
        return bool(p['targets']) and all(p['valid'])
    if action == 'busy':
        return not p['document_busy'] and not p['command_busy']
    if action == 'reason':
        return next((x['reason'] for x in reversed(p) if not x['ok']),None)
    if action == 'expiry':
        return p['now']<p['expires']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cardinality contract', solve('cardinality', {'min':1,'max':N+1,'count':N+2}), False)
check('all-types contract', solve('all-types', {'types':['text','binary'+str(N)],'supported':['text']}), False)
check('nonempty contract', solve('nonempty', {'targets':[],'valid':[],'revision':N}), False)
check('busy contract', solve('busy', {'document_busy':False,'command_busy':True,'id':N}), False)
check('reason contract', solve('reason', [{'ok':False,'reason':'first'+str(N)},{'ok':False,'reason':'second'}]), 'first'+str(N))
check('expiry contract', solve('expiry', {'now':N,'expires':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('too few context objects',solve('cardinality',{'min':N+1,'max':N+3,'count':N}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'cardinality':
        return p['min']<=p['count']<=p['max']
    if action == 'all-types':
        return all(t in p['supported'] for t in p['types'])
    if action == 'nonempty':
        return bool(p['targets']) and all(p['valid'])
    if action == 'busy':
        return not p['document_busy'] and not p['command_busy']
    if action == 'reason':
        return None
    if action == 'expiry':
        return p['now']<p['expires']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cardinality contract', solve('cardinality', {'min':1,'max':N+1,'count':N+2}), False)
check('all-types contract', solve('all-types', {'types':['text','binary'+str(N)],'supported':['text']}), False)
check('nonempty contract', solve('nonempty', {'targets':[],'valid':[],'revision':N}), False)
check('busy contract', solve('busy', {'document_busy':False,'command_busy':True,'id':N}), False)
check('reason contract', solve('reason', [{'ok':False,'reason':'first'+str(N)},{'ok':False,'reason':'second'}]), 'first'+str(N))
check('expiry contract', solve('expiry', {'now':N,'expires':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('too few context objects',solve('cardinality',{'min':N+1,'max':N+3,'count':N}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Menu availability explanation reports a lower-priority denial.

Menu-specific command availability combines document cardinality, type support and command preconditions; explanations have a deterministic policy order.

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 == 'cardinality':
        return p['min']<=p['count']<=p['max']
    if action == 'all-types':
        return all(t in p['supported'] for t in p['types'])
    if action == 'nonempty':
        return bool(p['targets']) and all(p['valid'])
    if action == 'busy':
        return not p['document_busy'] and not p['command_busy']
    if action == 'reason':
        return next((x['reason'] for x in p if not x['ok']),None)
    if action == 'expiry':
        return p['now']<=p['expires']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cardinality contract', solve('cardinality', {'min':1,'max':N+1,'count':N+2}), False)
check('all-types contract', solve('all-types', {'types':['text','binary'+str(N)],'supported':['text']}), False)
check('nonempty contract', solve('nonempty', {'targets':[],'valid':[],'revision':N}), False)
check('busy contract', solve('busy', {'document_busy':False,'command_busy':True,'id':N}), False)
check('reason contract', solve('reason', [{'ok':False,'reason':'first'+str(N)},{'ok':False,'reason':'second'}]), 'first'+str(N))
check('expiry contract', solve('expiry', {'now':N,'expires':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('too few context objects',solve('cardinality',{'min':N+1,'max':N+3,'count':N}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'cardinality':
        return p['min']<=p['count']<=p['max']
    if action == 'all-types':
        return all(t in p['supported'] for t in p['types'])
    if action == 'nonempty':
        return bool(p['targets']) and all(p['valid'])
    if action == 'busy':
        return not p['document_busy'] and not p['command_busy']
    if action == 'reason':
        return next((x['reason'] for x in p if not x['ok']),None)
    if action == 'expiry':
        return p['now']>=p['expires']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cardinality contract', solve('cardinality', {'min':1,'max':N+1,'count':N+2}), False)
check('all-types contract', solve('all-types', {'types':['text','binary'+str(N)],'supported':['text']}), False)
check('nonempty contract', solve('nonempty', {'targets':[],'valid':[],'revision':N}), False)
check('busy contract', solve('busy', {'document_busy':False,'command_busy':True,'id':N}), False)
check('reason contract', solve('reason', [{'ok':False,'reason':'first'+str(N)},{'ok':False,'reason':'second'}]), 'first'+str(N))
check('expiry contract', solve('expiry', {'now':N,'expires':N}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
check('too few context objects',solve('cardinality',{'min':N+1,'max':N+3,'count':N}),False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Expired menu capability remains available at its boundary.

Menu-specific command availability combines document cardinality, type support and command preconditions; explanations have a deterministic policy order.

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 == 'ancestors':
        return sorted(p['matches'])
    if action == 'command-count':
        return sum(x['kind']=='command' for x in p)
    if action == 'disabled-match':
        return [x for x in p if x['matches']]
    if action == 'group-header':
        return [x for x in p['headers'] if x in p['surviving_groups']]
    if action == 'query-clear':
        return p['original']
    if action == 'owner-match':
        return p['direct_match'] or bool(p['descendant_matches'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ancestors contract', solve('ancestors', {'matches':['c'+str(N)],'ancestors':{'c'+str(N):['r','tools']}}), sorted(['c'+str(N),'r','tools']))
check('command-count contract', solve('command-count', [{'kind':'header'},{'kind':'command','id':N},{'kind':'separator'}]), 1)
check('disabled-match contract', solve('disabled-match', [{'matches':True,'enabled':False,'id':N},{'matches':False,'enabled':True,'id':N+1}]), [{'matches':True,'enabled':False,'id':N}])
check('group-header contract', solve('group-header', {'headers':['a','b'],'surviving_groups':['b','c'+str(N)]}), ['b'])
check('query-clear contract', solve('query-clear', {'original':list(range(N+3)),'filtered':[N]}), list(range(N+3)))
check('owner-match contract', solve('owner-match', {'direct_match':False,'descendant_matches':[N]}), True)
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 == 'ancestors':
        return sorted({a for x in p['matches'] for a in p['ancestors'][x]})
    if action == 'command-count':
        return sum(x['kind']=='command' for x in p)
    if action == 'disabled-match':
        return [x for x in p if x['matches']]
    if action == 'group-header':
        return [x for x in p['headers'] if x in p['surviving_groups']]
    if action == 'query-clear':
        return p['original']
    if action == 'owner-match':
        return p['direct_match'] or bool(p['descendant_matches'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ancestors contract', solve('ancestors', {'matches':['c'+str(N)],'ancestors':{'c'+str(N):['r','tools']}}), sorted(['c'+str(N),'r','tools']))
check('command-count contract', solve('command-count', [{'kind':'header'},{'kind':'command','id':N},{'kind':'separator'}]), 1)
check('disabled-match contract', solve('disabled-match', [{'matches':True,'enabled':False,'id':N},{'matches':False,'enabled':True,'id':N+1}]), [{'matches':True,'enabled':False,'id':N}])
check('group-header contract', solve('group-header', {'headers':['a','b'],'surviving_groups':['b','c'+str(N)]}), ['b'])
check('query-clear contract', solve('query-clear', {'original':list(range(N+3)),'filtered':[N]}), list(range(N+3)))
check('owner-match contract', solve('owner-match', {'direct_match':False,'descendant_matches':[N]}), True)
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:
Filtered submenu results lose their ancestor menu headings.

Menu filtering retains matching leaves and required ancestor headers, counts only commands, and discards decorations orphaned by filtering.

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 == 'ancestors':
        return sorted(set(p['matches']) | {a for x in p['matches'] for a in p['ancestors'][x]})
    if action == 'command-count':
        return len(p)
    if action == 'disabled-match':
        return [x for x in p if x['matches']]
    if action == 'group-header':
        return [x for x in p['headers'] if x in p['surviving_groups']]
    if action == 'query-clear':
        return p['original']
    if action == 'owner-match':
        return p['direct_match'] or bool(p['descendant_matches'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ancestors contract', solve('ancestors', {'matches':['c'+str(N)],'ancestors':{'c'+str(N):['r','tools']}}), sorted(['c'+str(N),'r','tools']))
check('command-count contract', solve('command-count', [{'kind':'header'},{'kind':'command','id':N},{'kind':'separator'}]), 1)
check('disabled-match contract', solve('disabled-match', [{'matches':True,'enabled':False,'id':N},{'matches':False,'enabled':True,'id':N+1}]), [{'matches':True,'enabled':False,'id':N}])
check('group-header contract', solve('group-header', {'headers':['a','b'],'surviving_groups':['b','c'+str(N)]}), ['b'])
check('query-clear contract', solve('query-clear', {'original':list(range(N+3)),'filtered':[N]}), list(range(N+3)))
check('owner-match contract', solve('owner-match', {'direct_match':False,'descendant_matches':[N]}), True)
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 == 'ancestors':
        return sorted(set(p['matches']) | {a for x in p['matches'] for a in p['ancestors'][x]})
    if action == 'command-count':
        return sum(x['kind']!='separator' for x in p)
    if action == 'disabled-match':
        return [x for x in p if x['matches']]
    if action == 'group-header':
        return [x for x in p['headers'] if x in p['surviving_groups']]
    if action == 'query-clear':
        return p['original']
    if action == 'owner-match':
        return p['direct_match'] or bool(p['descendant_matches'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ancestors contract', solve('ancestors', {'matches':['c'+str(N)],'ancestors':{'c'+str(N):['r','tools']}}), sorted(['c'+str(N),'r','tools']))
check('command-count contract', solve('command-count', [{'kind':'header'},{'kind':'command','id':N},{'kind':'separator'}]), 1)
check('disabled-match contract', solve('disabled-match', [{'matches':True,'enabled':False,'id':N},{'matches':False,'enabled':True,'id':N+1}]), [{'matches':True,'enabled':False,'id':N}])
check('group-header contract', solve('group-header', {'headers':['a','b'],'surviving_groups':['b','c'+str(N)]}), ['b'])
check('query-clear contract', solve('query-clear', {'original':list(range(N+3)),'filtered':[N]}), list(range(N+3)))
check('owner-match contract', solve('owner-match', {'direct_match':False,'descendant_matches':[N]}), True)
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:
Filtered result counter includes menu headings.

Menu filtering retains matching leaves and required ancestor headers, counts only commands, and discards decorations orphaned by filtering.

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 == 'ancestors':
        return sorted(set(p['matches']) | {a for x in p['matches'] for a in p['ancestors'][x]})
    if action == 'command-count':
        return sum(x['kind']=='command' for x in p)
    if action == 'disabled-match':
        return [x for x in p if x['matches'] and x['enabled']]
    if action == 'group-header':
        return [x for x in p['headers'] if x in p['surviving_groups']]
    if action == 'query-clear':
        return p['original']
    if action == 'owner-match':
        return p['direct_match'] or bool(p['descendant_matches'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ancestors contract', solve('ancestors', {'matches':['c'+str(N)],'ancestors':{'c'+str(N):['r','tools']}}), sorted(['c'+str(N),'r','tools']))
check('command-count contract', solve('command-count', [{'kind':'header'},{'kind':'command','id':N},{'kind':'separator'}]), 1)
check('disabled-match contract', solve('disabled-match', [{'matches':True,'enabled':False,'id':N},{'matches':False,'enabled':True,'id':N+1}]), [{'matches':True,'enabled':False,'id':N}])
check('group-header contract', solve('group-header', {'headers':['a','b'],'surviving_groups':['b','c'+str(N)]}), ['b'])
check('query-clear contract', solve('query-clear', {'original':list(range(N+3)),'filtered':[N]}), list(range(N+3)))
check('owner-match contract', solve('owner-match', {'direct_match':False,'descendant_matches':[N]}), True)
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 == 'ancestors':
        return sorted(set(p['matches']) | {a for x in p['matches'] for a in p['ancestors'][x]})
    if action == 'command-count':
        return sum(x['kind']=='command' for x in p)
    if action == 'disabled-match':
        return [x for x in p if x['enabled']]
    if action == 'group-header':
        return [x for x in p['headers'] if x in p['surviving_groups']]
    if action == 'query-clear':
        return p['original']
    if action == 'owner-match':
        return p['direct_match'] or bool(p['descendant_matches'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ancestors contract', solve('ancestors', {'matches':['c'+str(N)],'ancestors':{'c'+str(N):['r','tools']}}), sorted(['c'+str(N),'r','tools']))
check('command-count contract', solve('command-count', [{'kind':'header'},{'kind':'command','id':N},{'kind':'separator'}]), 1)
check('disabled-match contract', solve('disabled-match', [{'matches':True,'enabled':False,'id':N},{'matches':False,'enabled':True,'id':N+1}]), [{'matches':True,'enabled':False,'id':N}])
check('group-header contract', solve('group-header', {'headers':['a','b'],'surviving_groups':['b','c'+str(N)]}), ['b'])
check('query-clear contract', solve('query-clear', {'original':list(range(N+3)),'filtered':[N]}), list(range(N+3)))
check('owner-match contract', solve('owner-match', {'direct_match':False,'descendant_matches':[N]}), True)
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 filter removes informative unavailable command results.

Menu filtering retains matching leaves and required ancestor headers, counts only commands, and discards decorations orphaned by filtering.

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 == 'ancestors':
        return sorted(set(p['matches']) | {a for x in p['matches'] for a in p['ancestors'][x]})
    if action == 'command-count':
        return sum(x['kind']=='command' for x in p)
    if action == 'disabled-match':
        return [x for x in p if x['matches']]
    if action == 'group-header':
        return p['headers']
    if action == 'query-clear':
        return p['original']
    if action == 'owner-match':
        return p['direct_match'] or bool(p['descendant_matches'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ancestors contract', solve('ancestors', {'matches':['c'+str(N)],'ancestors':{'c'+str(N):['r','tools']}}), sorted(['c'+str(N),'r','tools']))
check('command-count contract', solve('command-count', [{'kind':'header'},{'kind':'command','id':N},{'kind':'separator'}]), 1)
check('disabled-match contract', solve('disabled-match', [{'matches':True,'enabled':False,'id':N},{'matches':False,'enabled':True,'id':N+1}]), [{'matches':True,'enabled':False,'id':N}])
check('group-header contract', solve('group-header', {'headers':['a','b'],'surviving_groups':['b','c'+str(N)]}), ['b'])
check('query-clear contract', solve('query-clear', {'original':list(range(N+3)),'filtered':[N]}), list(range(N+3)))
check('owner-match contract', solve('owner-match', {'direct_match':False,'descendant_matches':[N]}), True)
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 == 'ancestors':
        return sorted(set(p['matches']) | {a for x in p['matches'] for a in p['ancestors'][x]})
    if action == 'command-count':
        return sum(x['kind']=='command' for x in p)
    if action == 'disabled-match':
        return [x for x in p if x['matches']]
    if action == 'group-header':
        return p['surviving_groups']
    if action == 'query-clear':
        return p['original']
    if action == 'owner-match':
        return p['direct_match'] or bool(p['descendant_matches'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ancestors contract', solve('ancestors', {'matches':['c'+str(N)],'ancestors':{'c'+str(N):['r','tools']}}), sorted(['c'+str(N),'r','tools']))
check('command-count contract', solve('command-count', [{'kind':'header'},{'kind':'command','id':N},{'kind':'separator'}]), 1)
check('disabled-match contract', solve('disabled-match', [{'matches':True,'enabled':False,'id':N},{'matches':False,'enabled':True,'id':N+1}]), [{'matches':True,'enabled':False,'id':N}])
check('group-header contract', solve('group-header', {'headers':['a','b'],'surviving_groups':['b','c'+str(N)]}), ['b'])
check('query-clear contract', solve('query-clear', {'original':list(range(N+3)),'filtered':[N]}), list(range(N+3)))
check('owner-match contract', solve('owner-match', {'direct_match':False,'descendant_matches':[N]}), True)
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:
Filtered menu retains headings for groups with no surviving commands.

Menu filtering retains matching leaves and required ancestor headers, counts only commands, and discards decorations orphaned by filtering.

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 == 'ancestors':
        return sorted(set(p['matches']) | {a for x in p['matches'] for a in p['ancestors'][x]})
    if action == 'command-count':
        return sum(x['kind']=='command' for x in p)
    if action == 'disabled-match':
        return [x for x in p if x['matches']]
    if action == 'group-header':
        return [x for x in p['headers'] if x in p['surviving_groups']]
    if action == 'query-clear':
        return p['filtered']
    if action == 'owner-match':
        return p['direct_match'] or bool(p['descendant_matches'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ancestors contract', solve('ancestors', {'matches':['c'+str(N)],'ancestors':{'c'+str(N):['r','tools']}}), sorted(['c'+str(N),'r','tools']))
check('command-count contract', solve('command-count', [{'kind':'header'},{'kind':'command','id':N},{'kind':'separator'}]), 1)
check('disabled-match contract', solve('disabled-match', [{'matches':True,'enabled':False,'id':N},{'matches':False,'enabled':True,'id':N+1}]), [{'matches':True,'enabled':False,'id':N}])
check('group-header contract', solve('group-header', {'headers':['a','b'],'surviving_groups':['b','c'+str(N)]}), ['b'])
check('query-clear contract', solve('query-clear', {'original':list(range(N+3)),'filtered':[N]}), list(range(N+3)))
check('owner-match contract', solve('owner-match', {'direct_match':False,'descendant_matches':[N]}), True)
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 == 'ancestors':
        return sorted(set(p['matches']) | {a for x in p['matches'] for a in p['ancestors'][x]})
    if action == 'command-count':
        return sum(x['kind']=='command' for x in p)
    if action == 'disabled-match':
        return [x for x in p if x['matches']]
    if action == 'group-header':
        return [x for x in p['headers'] if x in p['surviving_groups']]
    if action == 'query-clear':
        return p['filtered']+p['original']
    if action == 'owner-match':
        return p['direct_match'] or bool(p['descendant_matches'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ancestors contract', solve('ancestors', {'matches':['c'+str(N)],'ancestors':{'c'+str(N):['r','tools']}}), sorted(['c'+str(N),'r','tools']))
check('command-count contract', solve('command-count', [{'kind':'header'},{'kind':'command','id':N},{'kind':'separator'}]), 1)
check('disabled-match contract', solve('disabled-match', [{'matches':True,'enabled':False,'id':N},{'matches':False,'enabled':True,'id':N+1}]), [{'matches':True,'enabled':False,'id':N}])
check('group-header contract', solve('group-header', {'headers':['a','b'],'surviving_groups':['b','c'+str(N)]}), ['b'])
check('query-clear contract', solve('query-clear', {'original':list(range(N+3)),'filtered':[N]}), list(range(N+3)))
check('owner-match contract', solve('owner-match', {'direct_match':False,'descendant_matches':[N]}), True)
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:
Clearing menu filter restores only the last filtered projection.

Menu filtering retains matching leaves and required ancestor headers, counts only commands, and discards decorations orphaned by filtering.

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 == 'ancestors':
        return sorted(set(p['matches']) | {a for x in p['matches'] for a in p['ancestors'][x]})
    if action == 'command-count':
        return sum(x['kind']=='command' for x in p)
    if action == 'disabled-match':
        return [x for x in p if x['matches']]
    if action == 'group-header':
        return [x for x in p['headers'] if x in p['surviving_groups']]
    if action == 'query-clear':
        return p['original']
    if action == 'owner-match':
        return p['direct_match']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ancestors contract', solve('ancestors', {'matches':['c'+str(N)],'ancestors':{'c'+str(N):['r','tools']}}), sorted(['c'+str(N),'r','tools']))
check('command-count contract', solve('command-count', [{'kind':'header'},{'kind':'command','id':N},{'kind':'separator'}]), 1)
check('disabled-match contract', solve('disabled-match', [{'matches':True,'enabled':False,'id':N},{'matches':False,'enabled':True,'id':N+1}]), [{'matches':True,'enabled':False,'id':N}])
check('group-header contract', solve('group-header', {'headers':['a','b'],'surviving_groups':['b','c'+str(N)]}), ['b'])
check('query-clear contract', solve('query-clear', {'original':list(range(N+3)),'filtered':[N]}), list(range(N+3)))
check('owner-match contract', solve('owner-match', {'direct_match':False,'descendant_matches':[N]}), True)
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 == 'ancestors':
        return sorted(set(p['matches']) | {a for x in p['matches'] for a in p['ancestors'][x]})
    if action == 'command-count':
        return sum(x['kind']=='command' for x in p)
    if action == 'disabled-match':
        return [x for x in p if x['matches']]
    if action == 'group-header':
        return [x for x in p['headers'] if x in p['surviving_groups']]
    if action == 'query-clear':
        return p['original']
    if action == 'owner-match':
        return p['direct_match'] and bool(p['descendant_matches'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ancestors contract', solve('ancestors', {'matches':['c'+str(N)],'ancestors':{'c'+str(N):['r','tools']}}), sorted(['c'+str(N),'r','tools']))
check('command-count contract', solve('command-count', [{'kind':'header'},{'kind':'command','id':N},{'kind':'separator'}]), 1)
check('disabled-match contract', solve('disabled-match', [{'matches':True,'enabled':False,'id':N},{'matches':False,'enabled':True,'id':N+1}]), [{'matches':True,'enabled':False,'id':N}])
check('group-header contract', solve('group-header', {'headers':['a','b'],'surviving_groups':['b','c'+str(N)]}), ['b'])
check('query-clear contract', solve('query-clear', {'original':list(range(N+3)),'filtered':[N]}), list(range(N+3)))
check('owner-match contract', solve('owner-match', {'direct_match':False,'descendant_matches':[N]}), True)
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:
Submenu owner disappears when only a descendant matches.

Menu filtering retains matching leaves and required ancestor headers, counts only commands, and discards decorations orphaned by filtering.

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 == 'reopen-action':
        return {'action':'navigate-document','path':p['path'],'context':p['context']}
    if action == 'owner-edge':
        return p['edges'][p['child']]
    if action == 'label':
        return p['labels'].get(p['id'],p['id'])
    if action == 'omitted-menu-levels':
        return [p['chain'][:i+1] for i in range(1,len(p['chain'])-1)]
    if action == 'duplicate-label':
        return [x['id'] for x in p]
    if action == 'jump':
        return p['chain'][:p['index']+1]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reopen-action contract', solve('reopen-action', {'path':['root','tools'],'context':N}), {'action':'reopen-menu','path':['root','tools'],'context':N})
check('owner-edge contract', solve('owner-edge', {'child':'child'+str(N),'edges':{'child'+str(N):'owner'},'root':'root'}), 'owner')
check('label contract', solve('label', {'id':'item'+str(N),'parent':'root','labels':{'item'+str(N):'Item','root':'Root'}}), 'Item')
check('omitted-menu-levels contract', solve('omitted-menu-levels', {'chain':['root','a','b','leaf'+str(N)]}), [['root','a'],['root','a','b']])
check('duplicate-label contract', solve('duplicate-label', [{'id':N,'label':'Same'},{'id':N+1,'label':'Same'}]), [N,N+1])
check('jump contract', solve('jump', {'chain':['r','a',str(N)],'index':1}), ['r','a'])
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 == 'reopen-action':
        return {'action':'execute-command','path':p['path'],'context':p['context']}
    if action == 'owner-edge':
        return p['edges'][p['child']]
    if action == 'label':
        return p['labels'].get(p['id'],p['id'])
    if action == 'omitted-menu-levels':
        return [p['chain'][:i+1] for i in range(1,len(p['chain'])-1)]
    if action == 'duplicate-label':
        return [x['id'] for x in p]
    if action == 'jump':
        return p['chain'][:p['index']+1]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reopen-action contract', solve('reopen-action', {'path':['root','tools'],'context':N}), {'action':'reopen-menu','path':['root','tools'],'context':N})
check('owner-edge contract', solve('owner-edge', {'child':'child'+str(N),'edges':{'child'+str(N):'owner'},'root':'root'}), 'owner')
check('label contract', solve('label', {'id':'item'+str(N),'parent':'root','labels':{'item'+str(N):'Item','root':'Root'}}), 'Item')
check('omitted-menu-levels contract', solve('omitted-menu-levels', {'chain':['root','a','b','leaf'+str(N)]}), [['root','a'],['root','a','b']])
check('duplicate-label contract', solve('duplicate-label', [{'id':N,'label':'Same'},{'id':N+1,'label':'Same'}]), [N,N+1])
check('jump contract', solve('jump', {'chain':['r','a',str(N)],'index':1}), ['r','a'])
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 ancestor breadcrumb dispatches a document action instead of reopening its menu.

Menu breadcrumb controls reopen menu ancestors with captured context. Overflow entries retain complete menu paths; owner edges and displayed labels are separate.

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 == 'reopen-action':
        return {'action':'reopen-menu','path':p['path'],'context':p['context']}
    if action == 'owner-edge':
        return p['child']
    if action == 'label':
        return p['labels'].get(p['id'],p['id'])
    if action == 'omitted-menu-levels':
        return [p['chain'][:i+1] for i in range(1,len(p['chain'])-1)]
    if action == 'duplicate-label':
        return [x['id'] for x in p]
    if action == 'jump':
        return p['chain'][:p['index']+1]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reopen-action contract', solve('reopen-action', {'path':['root','tools'],'context':N}), {'action':'reopen-menu','path':['root','tools'],'context':N})
check('owner-edge contract', solve('owner-edge', {'child':'child'+str(N),'edges':{'child'+str(N):'owner'},'root':'root'}), 'owner')
check('label contract', solve('label', {'id':'item'+str(N),'parent':'root','labels':{'item'+str(N):'Item','root':'Root'}}), 'Item')
check('omitted-menu-levels contract', solve('omitted-menu-levels', {'chain':['root','a','b','leaf'+str(N)]}), [['root','a'],['root','a','b']])
check('duplicate-label contract', solve('duplicate-label', [{'id':N,'label':'Same'},{'id':N+1,'label':'Same'}]), [N,N+1])
check('jump contract', solve('jump', {'chain':['r','a',str(N)],'index':1}), ['r','a'])
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 == 'reopen-action':
        return {'action':'reopen-menu','path':p['path'],'context':p['context']}
    if action == 'owner-edge':
        return p['root']
    if action == 'label':
        return p['labels'].get(p['id'],p['id'])
    if action == 'omitted-menu-levels':
        return [p['chain'][:i+1] for i in range(1,len(p['chain'])-1)]
    if action == 'duplicate-label':
        return [x['id'] for x in p]
    if action == 'jump':
        return p['chain'][:p['index']+1]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reopen-action contract', solve('reopen-action', {'path':['root','tools'],'context':N}), {'action':'reopen-menu','path':['root','tools'],'context':N})
check('owner-edge contract', solve('owner-edge', {'child':'child'+str(N),'edges':{'child'+str(N):'owner'},'root':'root'}), 'owner')
check('label contract', solve('label', {'id':'item'+str(N),'parent':'root','labels':{'item'+str(N):'Item','root':'Root'}}), 'Item')
check('omitted-menu-levels contract', solve('omitted-menu-levels', {'chain':['root','a','b','leaf'+str(N)]}), [['root','a'],['root','a','b']])
check('duplicate-label contract', solve('duplicate-label', [{'id':N,'label':'Same'},{'id':N+1,'label':'Same'}]), [N,N+1])
check('jump contract', solve('jump', {'chain':['r','a',str(N)],'index':1}), ['r','a'])
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 ancestor popup identifies the child definition instead of its owning menu row.

Menu breadcrumb controls reopen menu ancestors with captured context. Overflow entries retain complete menu paths; owner edges and displayed labels are separate.

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 == 'reopen-action':
        return {'action':'reopen-menu','path':p['path'],'context':p['context']}
    if action == 'owner-edge':
        return p['edges'][p['child']]
    if action == 'label':
        return p['id']
    if action == 'omitted-menu-levels':
        return [p['chain'][:i+1] for i in range(1,len(p['chain'])-1)]
    if action == 'duplicate-label':
        return [x['id'] for x in p]
    if action == 'jump':
        return p['chain'][:p['index']+1]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reopen-action contract', solve('reopen-action', {'path':['root','tools'],'context':N}), {'action':'reopen-menu','path':['root','tools'],'context':N})
check('owner-edge contract', solve('owner-edge', {'child':'child'+str(N),'edges':{'child'+str(N):'owner'},'root':'root'}), 'owner')
check('label contract', solve('label', {'id':'item'+str(N),'parent':'root','labels':{'item'+str(N):'Item','root':'Root'}}), 'Item')
check('omitted-menu-levels contract', solve('omitted-menu-levels', {'chain':['root','a','b','leaf'+str(N)]}), [['root','a'],['root','a','b']])
check('duplicate-label contract', solve('duplicate-label', [{'id':N,'label':'Same'},{'id':N+1,'label':'Same'}]), [N,N+1])
check('jump contract', solve('jump', {'chain':['r','a',str(N)],'index':1}), ['r','a'])
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 == 'reopen-action':
        return {'action':'reopen-menu','path':p['path'],'context':p['context']}
    if action == 'owner-edge':
        return p['edges'][p['child']]
    if action == 'label':
        return p['labels'].get(p['parent'],p['id'])
    if action == 'omitted-menu-levels':
        return [p['chain'][:i+1] for i in range(1,len(p['chain'])-1)]
    if action == 'duplicate-label':
        return [x['id'] for x in p]
    if action == 'jump':
        return p['chain'][:p['index']+1]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reopen-action contract', solve('reopen-action', {'path':['root','tools'],'context':N}), {'action':'reopen-menu','path':['root','tools'],'context':N})
check('owner-edge contract', solve('owner-edge', {'child':'child'+str(N),'edges':{'child'+str(N):'owner'},'root':'root'}), 'owner')
check('label contract', solve('label', {'id':'item'+str(N),'parent':'root','labels':{'item'+str(N):'Item','root':'Root'}}), 'Item')
check('omitted-menu-levels contract', solve('omitted-menu-levels', {'chain':['root','a','b','leaf'+str(N)]}), [['root','a'],['root','a','b']])
check('duplicate-label contract', solve('duplicate-label', [{'id':N,'label':'Same'},{'id':N+1,'label':'Same'}]), [N,N+1])
check('jump contract', solve('jump', {'chain':['r','a',str(N)],'index':1}), ['r','a'])
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:
Breadcrumb command uses its parent label as its own display text.

Menu breadcrumb controls reopen menu ancestors with captured context. Overflow entries retain complete menu paths; owner edges and displayed labels are separate.

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 == 'reopen-action':
        return {'action':'reopen-menu','path':p['path'],'context':p['context']}
    if action == 'owner-edge':
        return p['edges'][p['child']]
    if action == 'label':
        return p['labels'].get(p['id'],p['id'])
    if action == 'omitted-menu-levels':
        return [[x] for x in p['chain'][1:-1]]
    if action == 'duplicate-label':
        return [x['id'] for x in p]
    if action == 'jump':
        return p['chain'][:p['index']+1]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reopen-action contract', solve('reopen-action', {'path':['root','tools'],'context':N}), {'action':'reopen-menu','path':['root','tools'],'context':N})
check('owner-edge contract', solve('owner-edge', {'child':'child'+str(N),'edges':{'child'+str(N):'owner'},'root':'root'}), 'owner')
check('label contract', solve('label', {'id':'item'+str(N),'parent':'root','labels':{'item'+str(N):'Item','root':'Root'}}), 'Item')
check('omitted-menu-levels contract', solve('omitted-menu-levels', {'chain':['root','a','b','leaf'+str(N)]}), [['root','a'],['root','a','b']])
check('duplicate-label contract', solve('duplicate-label', [{'id':N,'label':'Same'},{'id':N+1,'label':'Same'}]), [N,N+1])
check('jump contract', solve('jump', {'chain':['r','a',str(N)],'index':1}), ['r','a'])
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 == 'reopen-action':
        return {'action':'reopen-menu','path':p['path'],'context':p['context']}
    if action == 'owner-edge':
        return p['edges'][p['child']]
    if action == 'label':
        return p['labels'].get(p['id'],p['id'])
    if action == 'omitted-menu-levels':
        return [p['chain'][1:-1]]
    if action == 'duplicate-label':
        return [x['id'] for x in p]
    if action == 'jump':
        return p['chain'][:p['index']+1]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reopen-action contract', solve('reopen-action', {'path':['root','tools'],'context':N}), {'action':'reopen-menu','path':['root','tools'],'context':N})
check('owner-edge contract', solve('owner-edge', {'child':'child'+str(N),'edges':{'child'+str(N):'owner'},'root':'root'}), 'owner')
check('label contract', solve('label', {'id':'item'+str(N),'parent':'root','labels':{'item'+str(N):'Item','root':'Root'}}), 'Item')
check('omitted-menu-levels contract', solve('omitted-menu-levels', {'chain':['root','a','b','leaf'+str(N)]}), [['root','a'],['root','a','b']])
check('duplicate-label contract', solve('duplicate-label', [{'id':N,'label':'Same'},{'id':N+1,'label':'Same'}]), [N,N+1])
check('jump contract', solve('jump', {'chain':['r','a',str(N)],'index':1}), ['r','a'])
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:
Breadcrumb overflow menu loses full reopen paths for omitted menu levels.

Menu breadcrumb controls reopen menu ancestors with captured context. Overflow entries retain complete menu paths; owner edges and displayed labels are separate.

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 == 'reopen-action':
        return {'action':'reopen-menu','path':p['path'],'context':p['context']}
    if action == 'owner-edge':
        return p['edges'][p['child']]
    if action == 'label':
        return p['labels'].get(p['id'],p['id'])
    if action == 'omitted-menu-levels':
        return [p['chain'][:i+1] for i in range(1,len(p['chain'])-1)]
    if action == 'duplicate-label':
        return list(dict.fromkeys(x['label'] for x in p))
    if action == 'jump':
        return p['chain'][:p['index']+1]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reopen-action contract', solve('reopen-action', {'path':['root','tools'],'context':N}), {'action':'reopen-menu','path':['root','tools'],'context':N})
check('owner-edge contract', solve('owner-edge', {'child':'child'+str(N),'edges':{'child'+str(N):'owner'},'root':'root'}), 'owner')
check('label contract', solve('label', {'id':'item'+str(N),'parent':'root','labels':{'item'+str(N):'Item','root':'Root'}}), 'Item')
check('omitted-menu-levels contract', solve('omitted-menu-levels', {'chain':['root','a','b','leaf'+str(N)]}), [['root','a'],['root','a','b']])
check('duplicate-label contract', solve('duplicate-label', [{'id':N,'label':'Same'},{'id':N+1,'label':'Same'}]), [N,N+1])
check('jump contract', solve('jump', {'chain':['r','a',str(N)],'index':1}), ['r','a'])
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 == 'reopen-action':
        return {'action':'reopen-menu','path':p['path'],'context':p['context']}
    if action == 'owner-edge':
        return p['edges'][p['child']]
    if action == 'label':
        return p['labels'].get(p['id'],p['id'])
    if action == 'omitted-menu-levels':
        return [p['chain'][:i+1] for i in range(1,len(p['chain'])-1)]
    if action == 'duplicate-label':
        return list(dict.fromkeys(x['id'] for x in p if x['label']!=p[0]['label']))
    if action == 'jump':
        return p['chain'][:p['index']+1]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reopen-action contract', solve('reopen-action', {'path':['root','tools'],'context':N}), {'action':'reopen-menu','path':['root','tools'],'context':N})
check('owner-edge contract', solve('owner-edge', {'child':'child'+str(N),'edges':{'child'+str(N):'owner'},'root':'root'}), 'owner')
check('label contract', solve('label', {'id':'item'+str(N),'parent':'root','labels':{'item'+str(N):'Item','root':'Root'}}), 'Item')
check('omitted-menu-levels contract', solve('omitted-menu-levels', {'chain':['root','a','b','leaf'+str(N)]}), [['root','a'],['root','a','b']])
check('duplicate-label contract', solve('duplicate-label', [{'id':N,'label':'Same'},{'id':N+1,'label':'Same'}]), [N,N+1])
check('jump contract', solve('jump', {'chain':['r','a',str(N)],'index':1}), ['r','a'])
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:
Identical breadcrumb labels collapse distinct ancestor menu IDs.

Menu breadcrumb controls reopen menu ancestors with captured context. Overflow entries retain complete menu paths; owner edges and displayed labels are separate.

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 == 'reopen-action':
        return {'action':'reopen-menu','path':p['path'],'context':p['context']}
    if action == 'owner-edge':
        return p['edges'][p['child']]
    if action == 'label':
        return p['labels'].get(p['id'],p['id'])
    if action == 'omitted-menu-levels':
        return [p['chain'][:i+1] for i in range(1,len(p['chain'])-1)]
    if action == 'duplicate-label':
        return [x['id'] for x in p]
    if action == 'jump':
        return p['chain'][:p['index']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reopen-action contract', solve('reopen-action', {'path':['root','tools'],'context':N}), {'action':'reopen-menu','path':['root','tools'],'context':N})
check('owner-edge contract', solve('owner-edge', {'child':'child'+str(N),'edges':{'child'+str(N):'owner'},'root':'root'}), 'owner')
check('label contract', solve('label', {'id':'item'+str(N),'parent':'root','labels':{'item'+str(N):'Item','root':'Root'}}), 'Item')
check('omitted-menu-levels contract', solve('omitted-menu-levels', {'chain':['root','a','b','leaf'+str(N)]}), [['root','a'],['root','a','b']])
check('duplicate-label contract', solve('duplicate-label', [{'id':N,'label':'Same'},{'id':N+1,'label':'Same'}]), [N,N+1])
check('jump contract', solve('jump', {'chain':['r','a',str(N)],'index':1}), ['r','a'])
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 == 'reopen-action':
        return {'action':'reopen-menu','path':p['path'],'context':p['context']}
    if action == 'owner-edge':
        return p['edges'][p['child']]
    if action == 'label':
        return p['labels'].get(p['id'],p['id'])
    if action == 'omitted-menu-levels':
        return [p['chain'][:i+1] for i in range(1,len(p['chain'])-1)]
    if action == 'duplicate-label':
        return [x['id'] for x in p]
    if action == 'jump':
        return p['chain'][p['index']:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reopen-action contract', solve('reopen-action', {'path':['root','tools'],'context':N}), {'action':'reopen-menu','path':['root','tools'],'context':N})
check('owner-edge contract', solve('owner-edge', {'child':'child'+str(N),'edges':{'child'+str(N):'owner'},'root':'root'}), 'owner')
check('label contract', solve('label', {'id':'item'+str(N),'parent':'root','labels':{'item'+str(N):'Item','root':'Root'}}), 'Item')
check('omitted-menu-levels contract', solve('omitted-menu-levels', {'chain':['root','a','b','leaf'+str(N)]}), [['root','a'],['root','a','b']])
check('duplicate-label contract', solve('duplicate-label', [{'id':N,'label':'Same'},{'id':N+1,'label':'Same'}]), [N,N+1])
check('jump contract', solve('jump', {'chain':['r','a',str(N)],'index':1}), ['r','a'])
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:
Breadcrumb menu jump removes the target ancestor itself.

Menu breadcrumb controls reopen menu ancestors with captured context. Overflow entries retain complete menu paths; owner edges and displayed labels are separate.

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 == 'reserve-trigger':
        return p['capacity']
    if action == 'prefix-fit':
        return next((i for i in range(len(p['widths'])+1) if sum(p['widths'][:i+1])>p['capacity']),len(p['widths']))
    if action == 'suffix':
        return p['items'][p['fit']:]
    if action == 'group-atomic':
        return [g for g in p['groups'] if g['width']<=p['remaining']]
    if action == 'restore':
        return sorted(p,key=lambda x:x['source'])
    if action == 'trigger-visible':
        return bool(p['overflow'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)
check('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)
check('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))
check('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])
check('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])
check('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'reserve-trigger':
        return max(0,p['capacity']-1)
    if action == 'prefix-fit':
        return next((i for i in range(len(p['widths'])+1) if sum(p['widths'][:i+1])>p['capacity']),len(p['widths']))
    if action == 'suffix':
        return p['items'][p['fit']:]
    if action == 'group-atomic':
        return [g for g in p['groups'] if g['width']<=p['remaining']]
    if action == 'restore':
        return sorted(p,key=lambda x:x['source'])
    if action == 'trigger-visible':
        return bool(p['overflow'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)
check('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)
check('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))
check('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])
check('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])
check('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Overflow computation forgets actual overflow-trigger width.

A menu overflow container reserves its own trigger, preserves complete groups, and restores source order when room returns.

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 == 'reserve-trigger':
        return p['capacity']-p['trigger']
    if action == 'prefix-fit':
        return sum(w<=p['capacity'] for w in p['widths'])
    if action == 'suffix':
        return p['items'][p['fit']:]
    if action == 'group-atomic':
        return [g for g in p['groups'] if g['width']<=p['remaining']]
    if action == 'restore':
        return sorted(p,key=lambda x:x['source'])
    if action == 'trigger-visible':
        return bool(p['overflow'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)
check('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)
check('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))
check('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])
check('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])
check('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'reserve-trigger':
        return p['capacity']-p['trigger']
    if action == 'prefix-fit':
        return len(p['widths'])
    if action == 'suffix':
        return p['items'][p['fit']:]
    if action == 'group-atomic':
        return [g for g in p['groups'] if g['width']<=p['remaining']]
    if action == 'restore':
        return sorted(p,key=lambda x:x['source'])
    if action == 'trigger-visible':
        return bool(p['overflow'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)
check('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)
check('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))
check('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])
check('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])
check('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Overflow menu treats individually fitting items as jointly fitting.

A menu overflow container reserves its own trigger, preserves complete groups, and restores source order when room returns.

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 == 'reserve-trigger':
        return p['capacity']-p['trigger']
    if action == 'prefix-fit':
        return next((i for i in range(len(p['widths'])+1) if sum(p['widths'][:i+1])>p['capacity']),len(p['widths']))
    if action == 'suffix':
        return p['items'][:p['fit']]
    if action == 'group-atomic':
        return [g for g in p['groups'] if g['width']<=p['remaining']]
    if action == 'restore':
        return sorted(p,key=lambda x:x['source'])
    if action == 'trigger-visible':
        return bool(p['overflow'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)
check('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)
check('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))
check('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])
check('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])
check('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'reserve-trigger':
        return p['capacity']-p['trigger']
    if action == 'prefix-fit':
        return next((i for i in range(len(p['widths'])+1) if sum(p['widths'][:i+1])>p['capacity']),len(p['widths']))
    if action == 'suffix':
        return p['items'][p['fit']+1:]
    if action == 'group-atomic':
        return [g for g in p['groups'] if g['width']<=p['remaining']]
    if action == 'restore':
        return sorted(p,key=lambda x:x['source'])
    if action == 'trigger-visible':
        return bool(p['overflow'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)
check('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)
check('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))
check('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])
check('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])
check('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Overflow popup drops the first overflowed menu command.

A menu overflow container reserves its own trigger, preserves complete groups, and restores source order when room returns.

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 == 'reserve-trigger':
        return p['capacity']-p['trigger']
    if action == 'prefix-fit':
        return next((i for i in range(len(p['widths'])+1) if sum(p['widths'][:i+1])>p['capacity']),len(p['widths']))
    if action == 'suffix':
        return p['items'][p['fit']:]
    if action == 'group-atomic':
        return p['groups']
    if action == 'restore':
        return sorted(p,key=lambda x:x['source'])
    if action == 'trigger-visible':
        return bool(p['overflow'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)
check('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)
check('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))
check('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])
check('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])
check('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'reserve-trigger':
        return p['capacity']-p['trigger']
    if action == 'prefix-fit':
        return next((i for i in range(len(p['widths'])+1) if sum(p['widths'][:i+1])>p['capacity']),len(p['widths']))
    if action == 'suffix':
        return p['items'][p['fit']:]
    if action == 'group-atomic':
        return [g for g in p['groups'] if g['width']<p['remaining']]
    if action == 'restore':
        return sorted(p,key=lambda x:x['source'])
    if action == 'trigger-visible':
        return bool(p['overflow'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)
check('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)
check('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))
check('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])
check('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])
check('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Exactly fitting menu group is unnecessarily moved to overflow.

A menu overflow container reserves its own trigger, preserves complete groups, and restores source order when room returns.

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 == 'reserve-trigger':
        return p['capacity']-p['trigger']
    if action == 'prefix-fit':
        return next((i for i in range(len(p['widths'])+1) if sum(p['widths'][:i+1])>p['capacity']),len(p['widths']))
    if action == 'suffix':
        return p['items'][p['fit']:]
    if action == 'group-atomic':
        return [g for g in p['groups'] if g['width']<=p['remaining']]
    if action == 'restore':
        return p
    if action == 'trigger-visible':
        return bool(p['overflow'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)
check('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)
check('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))
check('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])
check('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])
check('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'reserve-trigger':
        return p['capacity']-p['trigger']
    if action == 'prefix-fit':
        return next((i for i in range(len(p['widths'])+1) if sum(p['widths'][:i+1])>p['capacity']),len(p['widths']))
    if action == 'suffix':
        return p['items'][p['fit']:]
    if action == 'group-atomic':
        return [g for g in p['groups'] if g['width']<=p['remaining']]
    if action == 'restore':
        return sorted(p,key=lambda x:x['label'])
    if action == 'trigger-visible':
        return bool(p['overflow'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)
check('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)
check('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))
check('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])
check('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])
check('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Restored overflow commands lose their original source order.

A menu overflow container reserves its own trigger, preserves complete groups, and restores source order when room returns.

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 == 'reserve-trigger':
        return p['capacity']-p['trigger']
    if action == 'prefix-fit':
        return next((i for i in range(len(p['widths'])+1) if sum(p['widths'][:i+1])>p['capacity']),len(p['widths']))
    if action == 'suffix':
        return p['items'][p['fit']:]
    if action == 'group-atomic':
        return [g for g in p['groups'] if g['width']<=p['remaining']]
    if action == 'restore':
        return sorted(p,key=lambda x:x['source'])
    if action == 'trigger-visible':
        return True
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)
check('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)
check('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))
check('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])
check('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])
check('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'reserve-trigger':
        return p['capacity']-p['trigger']
    if action == 'prefix-fit':
        return next((i for i in range(len(p['widths'])+1) if sum(p['widths'][:i+1])>p['capacity']),len(p['widths']))
    if action == 'suffix':
        return p['items'][p['fit']:]
    if action == 'group-atomic':
        return [g for g in p['groups'] if g['width']<=p['remaining']]
    if action == 'restore':
        return sorted(p,key=lambda x:x['source'])
    if action == 'trigger-visible':
        return p['capacity']<=len(p['main'])
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)
check('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)
check('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))
check('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])
check('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])
check('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Empty overflow popup leaves an unnecessary menu trigger.

A menu overflow container reserves its own trigger, preserves complete groups, and restores source order when room returns.

split: open-access