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

N = 1
observations = []
def solve(cases):
    def run(c):
        capacity,events=c
        queue=[]; admitted=set(); held=set(); out=[]; dropped=0
        def dispatch(event):
            phase,key=event
            out.append([phase,key])
            if phase=='down': held.add(key)
            else: held.discard(key)
        for kind,key in events:
            if kind=='down' and key not in admitted:
                if len(queue)>=capacity: dropped+=1
                else:
                    admitted.add(key)
                    queue.append(['down',key])
            elif kind=='up' and key in admitted:
                admitted.discard(key)
                while len(queue)>=capacity: dispatch(queue.pop(0))
                queue.insert(0,['up',key])
            elif kind=='tick' and queue: dispatch(queue.pop(0))
            elif kind=='flush':
                while queue: dispatch(queue.pop(0))
            elif kind=='reset':
                queue.clear(); admitted.clear()
                for k in sorted(held): out.append(['up',k])
                held.clear()
        return [out,queue,sorted(admitted),sorted(held),dropped]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bounded-keyboard-pump scenario 0', solve([[2, []]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 1', solve([[2, [['down', 'A'], ['down', 'B'], ['down', 'C']]]] * N), [[[], [['down', 'A'], ['down', 'B']], ['A', 'B'], [], 1]] * N)
check('bounded-keyboard-pump scenario 2', solve([[2, [['down', 'A'], ['down', 'B'], ['up', 'A']]]] * N), [[[['down', 'A']], [['down', 'B'], ['up', 'A']], ['B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 3', solve([[2, [['down', 'A'], ['down', 'B'], ['tick', '']]]] * N), [[[['down', 'A']], [['down', 'B']], ['A', 'B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 4', solve([[2, [['down', 'A'], ['down', 'B'], ['flush', '']]]] * N), [[[['down', 'A'], ['down', 'B']], [], ['A', 'B'], ['A', 'B'], 0]] * N)
check('bounded-keyboard-pump scenario 5', solve([[2, [['down', 'A'], ['down', 'B'], ['reset', '']]]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 6', solve([[2, [['down', 'A'], ['tick', ''], ['down', 'B'], ['reset', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 7', solve([[1, [['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 8', solve([[2, [['down', 'A'], ['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 9', solve([[2, [['up', 'A']]]] * N), [[[], [], [], [], 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        capacity,events=c
        queue=[]; admitted=set(); held=set(); out=[]; dropped=0
        def dispatch(event):
            phase,key=event
            out.append([phase,key])
            if phase=='down': held.add(key)
            else: held.discard(key)
        for kind,key in events:
            if kind=='down' and key not in admitted:
                if len(queue)>=capacity: dropped+=1
                else:
                    admitted.add(key)
                    queue.append(['down',key])
            elif kind=='up' and key in admitted:
                admitted.discard(key)
                while len(queue)>=capacity: dispatch(queue.pop(0))
                queue.append(['down',key])
            elif kind=='tick' and queue: dispatch(queue.pop(0))
            elif kind=='flush':
                while queue: dispatch(queue.pop(0))
            elif kind=='reset':
                queue.clear(); admitted.clear()
                for k in sorted(held): out.append(['up',k])
                held.clear()
        return [out,queue,sorted(admitted),sorted(held),dropped]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bounded-keyboard-pump scenario 0', solve([[2, []]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 1', solve([[2, [['down', 'A'], ['down', 'B'], ['down', 'C']]]] * N), [[[], [['down', 'A'], ['down', 'B']], ['A', 'B'], [], 1]] * N)
check('bounded-keyboard-pump scenario 2', solve([[2, [['down', 'A'], ['down', 'B'], ['up', 'A']]]] * N), [[[['down', 'A']], [['down', 'B'], ['up', 'A']], ['B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 3', solve([[2, [['down', 'A'], ['down', 'B'], ['tick', '']]]] * N), [[[['down', 'A']], [['down', 'B']], ['A', 'B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 4', solve([[2, [['down', 'A'], ['down', 'B'], ['flush', '']]]] * N), [[[['down', 'A'], ['down', 'B']], [], ['A', 'B'], ['A', 'B'], 0]] * N)
check('bounded-keyboard-pump scenario 5', solve([[2, [['down', 'A'], ['down', 'B'], ['reset', '']]]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 6', solve([[2, [['down', 'A'], ['tick', ''], ['down', 'B'], ['reset', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 7', solve([[1, [['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 8', solve([[2, [['down', 'A'], ['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 9', solve([[2, [['up', 'A']]]] * N), [[[], [], [], [], 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The event trace violates the queued release rule and produces incorrect keyboard state or command output.

Case [capacity,events], positive capacity; events [kind,key]. Down admitted only once per physical key and only when queue has capacity; overflow drops down. Up for an admitted key must be retained: dispatch oldest queued events until a slot exists, then queue the up. Tick dispatches one queued event; flush dispatches all. Reset discards pending queue and emits sorted synthetic ups for actually dispatched held keys. Return emitted edges,queue,admitted keys,delivered-held keys,dropped downs. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        capacity,events=c
        queue=[]; admitted=set(); held=set(); out=[]; dropped=0
        def dispatch(event):
            phase,key=event
            out.append([phase,key])
            if phase=='down': held.add(key)
            else: held.discard(key)
        for kind,key in events:
            if kind=='down' and key not in admitted:
                if len(queue)>=capacity: dropped+=1
                else:
                    admitted.add(key)
                    queue.append(['down',key])
            elif kind=='up' and key in admitted:
                admitted.discard(key)
                while len(queue)>=capacity: dispatch(queue.pop(0))
                queue.append(['up',key])
            elif kind=='tick' and queue: dispatch(queue.pop())
            elif kind=='flush':
                while queue: dispatch(queue.pop(0))
            elif kind=='reset':
                queue.clear(); admitted.clear()
                for k in sorted(held): out.append(['up',k])
                held.clear()
        return [out,queue,sorted(admitted),sorted(held),dropped]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bounded-keyboard-pump scenario 0', solve([[2, []]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 1', solve([[2, [['down', 'A'], ['down', 'B'], ['down', 'C']]]] * N), [[[], [['down', 'A'], ['down', 'B']], ['A', 'B'], [], 1]] * N)
check('bounded-keyboard-pump scenario 2', solve([[2, [['down', 'A'], ['down', 'B'], ['up', 'A']]]] * N), [[[['down', 'A']], [['down', 'B'], ['up', 'A']], ['B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 3', solve([[2, [['down', 'A'], ['down', 'B'], ['tick', '']]]] * N), [[[['down', 'A']], [['down', 'B']], ['A', 'B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 4', solve([[2, [['down', 'A'], ['down', 'B'], ['flush', '']]]] * N), [[[['down', 'A'], ['down', 'B']], [], ['A', 'B'], ['A', 'B'], 0]] * N)
check('bounded-keyboard-pump scenario 5', solve([[2, [['down', 'A'], ['down', 'B'], ['reset', '']]]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 6', solve([[2, [['down', 'A'], ['tick', ''], ['down', 'B'], ['reset', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 7', solve([[1, [['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 8', solve([[2, [['down', 'A'], ['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 9', solve([[2, [['up', 'A']]]] * N), [[[], [], [], [], 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(cases):
    def run(c):
        capacity,events=c
        queue=[]; admitted=set(); held=set(); out=[]; dropped=0
        def dispatch(event):
            phase,key=event
            out.append([phase,key])
            if phase=='down': held.add(key)
            else: held.discard(key)
        for kind,key in events:
            if kind=='down' and key not in admitted:
                if len(queue)>=capacity: dropped+=1
                else:
                    admitted.add(key)
                    queue.append(['down',key])
            elif kind=='up' and key in admitted:
                admitted.discard(key)
                while len(queue)>=capacity: dispatch(queue.pop(0))
                queue.append(['up',key])
            elif kind=='tick' and queue: dispatch(queue[0])
            elif kind=='flush':
                while queue: dispatch(queue.pop(0))
            elif kind=='reset':
                queue.clear(); admitted.clear()
                for k in sorted(held): out.append(['up',k])
                held.clear()
        return [out,queue,sorted(admitted),sorted(held),dropped]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bounded-keyboard-pump scenario 0', solve([[2, []]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 1', solve([[2, [['down', 'A'], ['down', 'B'], ['down', 'C']]]] * N), [[[], [['down', 'A'], ['down', 'B']], ['A', 'B'], [], 1]] * N)
check('bounded-keyboard-pump scenario 2', solve([[2, [['down', 'A'], ['down', 'B'], ['up', 'A']]]] * N), [[[['down', 'A']], [['down', 'B'], ['up', 'A']], ['B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 3', solve([[2, [['down', 'A'], ['down', 'B'], ['tick', '']]]] * N), [[[['down', 'A']], [['down', 'B']], ['A', 'B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 4', solve([[2, [['down', 'A'], ['down', 'B'], ['flush', '']]]] * N), [[[['down', 'A'], ['down', 'B']], [], ['A', 'B'], ['A', 'B'], 0]] * N)
check('bounded-keyboard-pump scenario 5', solve([[2, [['down', 'A'], ['down', 'B'], ['reset', '']]]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 6', solve([[2, [['down', 'A'], ['tick', ''], ['down', 'B'], ['reset', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 7', solve([[1, [['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 8', solve([[2, [['down', 'A'], ['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 9', solve([[2, [['up', 'A']]]] * N), [[[], [], [], [], 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The event trace violates the tick order rule and produces incorrect keyboard state or command output.

Case [capacity,events], positive capacity; events [kind,key]. Down admitted only once per physical key and only when queue has capacity; overflow drops down. Up for an admitted key must be retained: dispatch oldest queued events until a slot exists, then queue the up. Tick dispatches one queued event; flush dispatches all. Reset discards pending queue and emits sorted synthetic ups for actually dispatched held keys. Return emitted edges,queue,admitted keys,delivered-held keys,dropped downs. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        capacity,events=c
        queue=[]; admitted=set(); held=set(); out=[]; dropped=0
        def dispatch(event):
            phase,key=event
            out.append([phase,key])
            if phase=='down': held.add(key)
            else: held.discard(key)
        for kind,key in events:
            if kind=='down' and key not in admitted:
                if len(queue)>=capacity: dropped+=1
                else:
                    admitted.add(key)
                    queue.append(['down',key])
            elif kind=='up' and key in admitted:
                admitted.discard(key)
                while len(queue)>=capacity: dispatch(queue.pop(0))
                queue.append(['up',key])
            elif kind=='tick' and queue: dispatch(queue.pop(0))
            elif kind=='flush':
                while queue: dispatch(queue.pop())
            elif kind=='reset':
                queue.clear(); admitted.clear()
                for k in sorted(held): out.append(['up',k])
                held.clear()
        return [out,queue,sorted(admitted),sorted(held),dropped]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bounded-keyboard-pump scenario 0', solve([[2, []]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 1', solve([[2, [['down', 'A'], ['down', 'B'], ['down', 'C']]]] * N), [[[], [['down', 'A'], ['down', 'B']], ['A', 'B'], [], 1]] * N)
check('bounded-keyboard-pump scenario 2', solve([[2, [['down', 'A'], ['down', 'B'], ['up', 'A']]]] * N), [[[['down', 'A']], [['down', 'B'], ['up', 'A']], ['B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 3', solve([[2, [['down', 'A'], ['down', 'B'], ['tick', '']]]] * N), [[[['down', 'A']], [['down', 'B']], ['A', 'B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 4', solve([[2, [['down', 'A'], ['down', 'B'], ['flush', '']]]] * N), [[[['down', 'A'], ['down', 'B']], [], ['A', 'B'], ['A', 'B'], 0]] * N)
check('bounded-keyboard-pump scenario 5', solve([[2, [['down', 'A'], ['down', 'B'], ['reset', '']]]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 6', solve([[2, [['down', 'A'], ['tick', ''], ['down', 'B'], ['reset', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 7', solve([[1, [['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 8', solve([[2, [['down', 'A'], ['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 9', solve([[2, [['up', 'A']]]] * N), [[[], [], [], [], 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        capacity,events=c
        queue=[]; admitted=set(); held=set(); out=[]; dropped=0
        def dispatch(event):
            phase,key=event
            out.append([phase,key])
            if phase=='down': held.add(key)
            else: held.discard(key)
        for kind,key in events:
            if kind=='down' and key not in admitted:
                if len(queue)>=capacity: dropped+=1
                else:
                    admitted.add(key)
                    queue.append(['down',key])
            elif kind=='up' and key in admitted:
                admitted.discard(key)
                while len(queue)>=capacity: dispatch(queue.pop(0))
                queue.append(['up',key])
            elif kind=='tick' and queue: dispatch(queue.pop(0))
            elif kind=='flush':
                if queue: dispatch(queue.pop(0))
            elif kind=='reset':
                queue.clear(); admitted.clear()
                for k in sorted(held): out.append(['up',k])
                held.clear()
        return [out,queue,sorted(admitted),sorted(held),dropped]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bounded-keyboard-pump scenario 0', solve([[2, []]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 1', solve([[2, [['down', 'A'], ['down', 'B'], ['down', 'C']]]] * N), [[[], [['down', 'A'], ['down', 'B']], ['A', 'B'], [], 1]] * N)
check('bounded-keyboard-pump scenario 2', solve([[2, [['down', 'A'], ['down', 'B'], ['up', 'A']]]] * N), [[[['down', 'A']], [['down', 'B'], ['up', 'A']], ['B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 3', solve([[2, [['down', 'A'], ['down', 'B'], ['tick', '']]]] * N), [[[['down', 'A']], [['down', 'B']], ['A', 'B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 4', solve([[2, [['down', 'A'], ['down', 'B'], ['flush', '']]]] * N), [[[['down', 'A'], ['down', 'B']], [], ['A', 'B'], ['A', 'B'], 0]] * N)
check('bounded-keyboard-pump scenario 5', solve([[2, [['down', 'A'], ['down', 'B'], ['reset', '']]]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 6', solve([[2, [['down', 'A'], ['tick', ''], ['down', 'B'], ['reset', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 7', solve([[1, [['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 8', solve([[2, [['down', 'A'], ['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 9', solve([[2, [['up', 'A']]]] * N), [[[], [], [], [], 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The event trace violates the flush order rule and produces incorrect keyboard state or command output.

Case [capacity,events], positive capacity; events [kind,key]. Down admitted only once per physical key and only when queue has capacity; overflow drops down. Up for an admitted key must be retained: dispatch oldest queued events until a slot exists, then queue the up. Tick dispatches one queued event; flush dispatches all. Reset discards pending queue and emits sorted synthetic ups for actually dispatched held keys. Return emitted edges,queue,admitted keys,delivered-held keys,dropped downs. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        capacity,events=c
        queue=[]; admitted=set(); held=set(); out=[]; dropped=0
        def dispatch(event):
            phase,key=event
            out.append([phase,key])
            if phase=='down': held.add(key)
            else: held.discard(key)
        for kind,key in events:
            if kind=='down' and key not in admitted:
                if len(queue)>=capacity: dropped+=1
                else:
                    admitted.add(key)
                    queue.append(['down',key])
            elif kind=='up' and key in admitted:
                admitted.discard(key)
                while len(queue)>=capacity: dispatch(queue.pop(0))
                queue.append(['up',key])
            elif kind=='tick' and queue: dispatch(queue.pop(0))
            elif kind=='flush':
                while queue: dispatch(queue.pop(0))
            elif kind=='reset':
                queue.clear()
                for k in sorted(held): out.append(['up',k])
                held.clear()
        return [out,queue,sorted(admitted),sorted(held),dropped]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bounded-keyboard-pump scenario 0', solve([[2, []]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 1', solve([[2, [['down', 'A'], ['down', 'B'], ['down', 'C']]]] * N), [[[], [['down', 'A'], ['down', 'B']], ['A', 'B'], [], 1]] * N)
check('bounded-keyboard-pump scenario 2', solve([[2, [['down', 'A'], ['down', 'B'], ['up', 'A']]]] * N), [[[['down', 'A']], [['down', 'B'], ['up', 'A']], ['B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 3', solve([[2, [['down', 'A'], ['down', 'B'], ['tick', '']]]] * N), [[[['down', 'A']], [['down', 'B']], ['A', 'B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 4', solve([[2, [['down', 'A'], ['down', 'B'], ['flush', '']]]] * N), [[[['down', 'A'], ['down', 'B']], [], ['A', 'B'], ['A', 'B'], 0]] * N)
check('bounded-keyboard-pump scenario 5', solve([[2, [['down', 'A'], ['down', 'B'], ['reset', '']]]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 6', solve([[2, [['down', 'A'], ['tick', ''], ['down', 'B'], ['reset', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 7', solve([[1, [['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 8', solve([[2, [['down', 'A'], ['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 9', solve([[2, [['up', 'A']]]] * N), [[[], [], [], [], 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        capacity,events=c
        queue=[]; admitted=set(); held=set(); out=[]; dropped=0
        def dispatch(event):
            phase,key=event
            out.append([phase,key])
            if phase=='down': held.add(key)
            else: held.discard(key)
        for kind,key in events:
            if kind=='down' and key not in admitted:
                if len(queue)>=capacity: dropped+=1
                else:
                    admitted.add(key)
                    queue.append(['down',key])
            elif kind=='up' and key in admitted:
                admitted.discard(key)
                while len(queue)>=capacity: dispatch(queue.pop(0))
                queue.append(['up',key])
            elif kind=='tick' and queue: dispatch(queue.pop(0))
            elif kind=='flush':
                while queue: dispatch(queue.pop(0))
            elif kind=='reset':
                admitted.clear()
                for k in sorted(held): out.append(['up',k])
                held.clear()
        return [out,queue,sorted(admitted),sorted(held),dropped]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bounded-keyboard-pump scenario 0', solve([[2, []]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 1', solve([[2, [['down', 'A'], ['down', 'B'], ['down', 'C']]]] * N), [[[], [['down', 'A'], ['down', 'B']], ['A', 'B'], [], 1]] * N)
check('bounded-keyboard-pump scenario 2', solve([[2, [['down', 'A'], ['down', 'B'], ['up', 'A']]]] * N), [[[['down', 'A']], [['down', 'B'], ['up', 'A']], ['B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 3', solve([[2, [['down', 'A'], ['down', 'B'], ['tick', '']]]] * N), [[[['down', 'A']], [['down', 'B']], ['A', 'B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 4', solve([[2, [['down', 'A'], ['down', 'B'], ['flush', '']]]] * N), [[[['down', 'A'], ['down', 'B']], [], ['A', 'B'], ['A', 'B'], 0]] * N)
check('bounded-keyboard-pump scenario 5', solve([[2, [['down', 'A'], ['down', 'B'], ['reset', '']]]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 6', solve([[2, [['down', 'A'], ['tick', ''], ['down', 'B'], ['reset', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 7', solve([[1, [['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 8', solve([[2, [['down', 'A'], ['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 9', solve([[2, [['up', 'A']]]] * N), [[[], [], [], [], 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The event trace violates the reset pending rule and produces incorrect keyboard state or command output.

Case [capacity,events], positive capacity; events [kind,key]. Down admitted only once per physical key and only when queue has capacity; overflow drops down. Up for an admitted key must be retained: dispatch oldest queued events until a slot exists, then queue the up. Tick dispatches one queued event; flush dispatches all. Reset discards pending queue and emits sorted synthetic ups for actually dispatched held keys. Return emitted edges,queue,admitted keys,delivered-held keys,dropped downs. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        capacity,events=c
        queue=[]; admitted=set(); held=set(); out=[]; dropped=0
        def dispatch(event):
            phase,key=event
            out.append([phase,key])
            if phase=='down': held.add(key)
            else: held.discard(key)
        for kind,key in events:
            if kind=='down' and key not in admitted:
                if len(queue)>=capacity: dropped+=1
                else:
                    admitted.add(key)
                    queue.append(['down',key])
            elif kind=='up' and key in admitted:
                admitted.discard(key)
                while len(queue)>=capacity: dispatch(queue.pop(0))
                queue.append(['up',key])
            elif kind=='tick' and queue: dispatch(queue.pop(0))
            elif kind=='flush':
                while queue: dispatch(queue.pop(0))
            elif kind=='reset':
                queue.clear(); admitted.clear()
                for k in sorted(admitted): out.append(['up',k])
                held.clear()
        return [out,queue,sorted(admitted),sorted(held),dropped]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bounded-keyboard-pump scenario 0', solve([[2, []]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 1', solve([[2, [['down', 'A'], ['down', 'B'], ['down', 'C']]]] * N), [[[], [['down', 'A'], ['down', 'B']], ['A', 'B'], [], 1]] * N)
check('bounded-keyboard-pump scenario 2', solve([[2, [['down', 'A'], ['down', 'B'], ['up', 'A']]]] * N), [[[['down', 'A']], [['down', 'B'], ['up', 'A']], ['B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 3', solve([[2, [['down', 'A'], ['down', 'B'], ['tick', '']]]] * N), [[[['down', 'A']], [['down', 'B']], ['A', 'B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 4', solve([[2, [['down', 'A'], ['down', 'B'], ['flush', '']]]] * N), [[[['down', 'A'], ['down', 'B']], [], ['A', 'B'], ['A', 'B'], 0]] * N)
check('bounded-keyboard-pump scenario 5', solve([[2, [['down', 'A'], ['down', 'B'], ['reset', '']]]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 6', solve([[2, [['down', 'A'], ['tick', ''], ['down', 'B'], ['reset', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 7', solve([[1, [['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 8', solve([[2, [['down', 'A'], ['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 9', solve([[2, [['up', 'A']]]] * N), [[[], [], [], [], 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        capacity,events=c
        queue=[]; admitted=set(); held=set(); out=[]; dropped=0
        def dispatch(event):
            phase,key=event
            out.append([phase,key])
            if phase=='down': held.add(key)
            else: held.discard(key)
        for kind,key in events:
            if kind=='down' and key not in admitted:
                if len(queue)>=capacity: dropped+=1
                else:
                    admitted.add(key)
                    queue.append(['down',key])
            elif kind=='up' and key in admitted:
                admitted.discard(key)
                while len(queue)>=capacity: dispatch(queue.pop(0))
                queue.append(['up',key])
            elif kind=='tick' and queue: dispatch(queue.pop(0))
            elif kind=='flush':
                while queue: dispatch(queue.pop(0))
            elif kind=='reset':
                queue.clear(); admitted.clear()
                for k in sorted(held): out.append(['down',k])
                held.clear()
        return [out,queue,sorted(admitted),sorted(held),dropped]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bounded-keyboard-pump scenario 0', solve([[2, []]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 1', solve([[2, [['down', 'A'], ['down', 'B'], ['down', 'C']]]] * N), [[[], [['down', 'A'], ['down', 'B']], ['A', 'B'], [], 1]] * N)
check('bounded-keyboard-pump scenario 2', solve([[2, [['down', 'A'], ['down', 'B'], ['up', 'A']]]] * N), [[[['down', 'A']], [['down', 'B'], ['up', 'A']], ['B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 3', solve([[2, [['down', 'A'], ['down', 'B'], ['tick', '']]]] * N), [[[['down', 'A']], [['down', 'B']], ['A', 'B'], ['A'], 0]] * N)
check('bounded-keyboard-pump scenario 4', solve([[2, [['down', 'A'], ['down', 'B'], ['flush', '']]]] * N), [[[['down', 'A'], ['down', 'B']], [], ['A', 'B'], ['A', 'B'], 0]] * N)
check('bounded-keyboard-pump scenario 5', solve([[2, [['down', 'A'], ['down', 'B'], ['reset', '']]]] * N), [[[], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 6', solve([[2, [['down', 'A'], ['tick', ''], ['down', 'B'], ['reset', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 7', solve([[1, [['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 8', solve([[2, [['down', 'A'], ['down', 'A'], ['up', 'A'], ['flush', '']]]] * N), [[[['down', 'A'], ['up', 'A']], [], [], [], 0]] * N)
check('bounded-keyboard-pump scenario 9', solve([[2, [['up', 'A']]]] * N), [[[], [], [], [], 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The event trace violates the reset synth release rule and produces incorrect keyboard state or command output.

Case [capacity,events], positive capacity; events [kind,key]. Down admitted only once per physical key and only when queue has capacity; overflow drops down. Up for an admitted key must be retained: dispatch oldest queued events until a slot exists, then queue the up. Tick dispatches one queued event; flush dispatches all. Reset discards pending queue and emits sorted synthetic ups for actually dispatched held keys. Return emitted edges,queue,admitted keys,delivered-held keys,dropped downs. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

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 == 'encode':
        return '/'.join(p)
    if action == 'ancestor-availability':
        return all(x['available'] for x in p['owners']) and p['command_available']
    if action == 'parent':
        return p[:-1]
    if action == 'descendant':
        return p['candidate'][:len(p['root'])]==p['root'] and len(p['candidate'])>len(p['root'])
    if action == 'resolve':
        return next((x['command'] for x in p['rows'] if x['path']==p['path']),None)
    if action == 'reroot':
        return [p['new']]+p['path'][1:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encode contract', solve('encode', ['r~'+str(N),'a/b']), 'r~0'+str(N)+'/a~1b')
check('ancestor-availability contract', solve('ancestor-availability', {'owners':[{'available':True,'id':N},{'available':False,'id':N+1}],'command_available':True}), False)
check('parent contract', solve('parent', ['r','a','b'+str(N)]), ['r','a'])
check('descendant contract', solve('descendant', {'root':['r','a'],'candidate':['r','b',str(N)]}), False)
check('resolve contract', solve('resolve', {'rows':[{'path':['r','a',str(N)],'command':'wrong'},{'path':['r','b',str(N)],'command':'right'}],'path':['r','b',str(N)]}), 'right')
check('reroot contract', solve('reroot', {'new':'new'+str(N),'path':['old','tools','run']}), ['new'+str(N),'tools','run'])
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 == 'encode':
        return '/'.join(x.replace('/','~1') for x in p)
    if action == 'ancestor-availability':
        return all(x['available'] for x in p['owners']) and p['command_available']
    if action == 'parent':
        return p[:-1]
    if action == 'descendant':
        return p['candidate'][:len(p['root'])]==p['root'] and len(p['candidate'])>len(p['root'])
    if action == 'resolve':
        return next((x['command'] for x in p['rows'] if x['path']==p['path']),None)
    if action == 'reroot':
        return [p['new']]+p['path'][1:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encode contract', solve('encode', ['r~'+str(N),'a/b']), 'r~0'+str(N)+'/a~1b')
check('ancestor-availability contract', solve('ancestor-availability', {'owners':[{'available':True,'id':N},{'available':False,'id':N+1}],'command_available':True}), False)
check('parent contract', solve('parent', ['r','a','b'+str(N)]), ['r','a'])
check('descendant contract', solve('descendant', {'root':['r','a'],'candidate':['r','b',str(N)]}), False)
check('resolve contract', solve('resolve', {'rows':[{'path':['r','a',str(N)],'command':'wrong'},{'path':['r','b',str(N)],'command':'right'}],'path':['r','b',str(N)]}), 'right')
check('reroot contract', solve('reroot', {'new':'new'+str(N),'path':['old','tools','run']}), ['new'+str(N),'tools','run'])
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 IDs containing separators alias other commands.

Stable menu paths retain ancestry and available owners; separator encoding is unambiguous and resolution is exact.

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 == 'encode':
        return '/'.join(x.replace('~','~0').replace('/','~1') for x in p)
    if action == 'ancestor-availability':
        return p['command_available']
    if action == 'parent':
        return p[:-1]
    if action == 'descendant':
        return p['candidate'][:len(p['root'])]==p['root'] and len(p['candidate'])>len(p['root'])
    if action == 'resolve':
        return next((x['command'] for x in p['rows'] if x['path']==p['path']),None)
    if action == 'reroot':
        return [p['new']]+p['path'][1:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encode contract', solve('encode', ['r~'+str(N),'a/b']), 'r~0'+str(N)+'/a~1b')
check('ancestor-availability contract', solve('ancestor-availability', {'owners':[{'available':True,'id':N},{'available':False,'id':N+1}],'command_available':True}), False)
check('parent contract', solve('parent', ['r','a','b'+str(N)]), ['r','a'])
check('descendant contract', solve('descendant', {'root':['r','a'],'candidate':['r','b',str(N)]}), False)
check('resolve contract', solve('resolve', {'rows':[{'path':['r','a',str(N)],'command':'wrong'},{'path':['r','b',str(N)],'command':'right'}],'path':['r','b',str(N)]}), 'right')
check('reroot contract', solve('reroot', {'new':'new'+str(N),'path':['old','tools','run']}), ['new'+str(N),'tools','run'])
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 == 'encode':
        return '/'.join(x.replace('~','~0').replace('/','~1') for x in p)
    if action == 'ancestor-availability':
        return any(x['available'] for x in p['owners']) and p['command_available']
    if action == 'parent':
        return p[:-1]
    if action == 'descendant':
        return p['candidate'][:len(p['root'])]==p['root'] and len(p['candidate'])>len(p['root'])
    if action == 'resolve':
        return next((x['command'] for x in p['rows'] if x['path']==p['path']),None)
    if action == 'reroot':
        return [p['new']]+p['path'][1:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encode contract', solve('encode', ['r~'+str(N),'a/b']), 'r~0'+str(N)+'/a~1b')
check('ancestor-availability contract', solve('ancestor-availability', {'owners':[{'available':True,'id':N},{'available':False,'id':N+1}],'command_available':True}), False)
check('parent contract', solve('parent', ['r','a','b'+str(N)]), ['r','a'])
check('descendant contract', solve('descendant', {'root':['r','a'],'candidate':['r','b',str(N)]}), False)
check('resolve contract', solve('resolve', {'rows':[{'path':['r','a',str(N)],'command':'wrong'},{'path':['r','b',str(N)],'command':'right'}],'path':['r','b',str(N)]}), 'right')
check('reroot contract', solve('reroot', {'new':'new'+str(N),'path':['old','tools','run']}), ['new'+str(N),'tools','run'])
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:
Deep menu command remains addressable through an unavailable ancestor.

Stable menu paths retain ancestry and available owners; separator encoding is unambiguous and resolution is exact.

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 == 'encode':
        return '/'.join(x.replace('~','~0').replace('/','~1') for x in p)
    if action == 'ancestor-availability':
        return all(x['available'] for x in p['owners']) and p['command_available']
    if action == 'parent':
        return p[1:]
    if action == 'descendant':
        return p['candidate'][:len(p['root'])]==p['root'] and len(p['candidate'])>len(p['root'])
    if action == 'resolve':
        return next((x['command'] for x in p['rows'] if x['path']==p['path']),None)
    if action == 'reroot':
        return [p['new']]+p['path'][1:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encode contract', solve('encode', ['r~'+str(N),'a/b']), 'r~0'+str(N)+'/a~1b')
check('ancestor-availability contract', solve('ancestor-availability', {'owners':[{'available':True,'id':N},{'available':False,'id':N+1}],'command_available':True}), False)
check('parent contract', solve('parent', ['r','a','b'+str(N)]), ['r','a'])
check('descendant contract', solve('descendant', {'root':['r','a'],'candidate':['r','b',str(N)]}), False)
check('resolve contract', solve('resolve', {'rows':[{'path':['r','a',str(N)],'command':'wrong'},{'path':['r','b',str(N)],'command':'right'}],'path':['r','b',str(N)]}), 'right')
check('reroot contract', solve('reroot', {'new':'new'+str(N),'path':['old','tools','run']}), ['new'+str(N),'tools','run'])
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 == 'encode':
        return '/'.join(x.replace('~','~0').replace('/','~1') for x in p)
    if action == 'ancestor-availability':
        return all(x['available'] for x in p['owners']) and p['command_available']
    if action == 'parent':
        return p[:1]
    if action == 'descendant':
        return p['candidate'][:len(p['root'])]==p['root'] and len(p['candidate'])>len(p['root'])
    if action == 'resolve':
        return next((x['command'] for x in p['rows'] if x['path']==p['path']),None)
    if action == 'reroot':
        return [p['new']]+p['path'][1:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encode contract', solve('encode', ['r~'+str(N),'a/b']), 'r~0'+str(N)+'/a~1b')
check('ancestor-availability contract', solve('ancestor-availability', {'owners':[{'available':True,'id':N},{'available':False,'id':N+1}],'command_available':True}), False)
check('parent contract', solve('parent', ['r','a','b'+str(N)]), ['r','a'])
check('descendant contract', solve('descendant', {'root':['r','a'],'candidate':['r','b',str(N)]}), False)
check('resolve contract', solve('resolve', {'rows':[{'path':['r','a',str(N)],'command':'wrong'},{'path':['r','b',str(N)],'command':'right'}],'path':['r','b',str(N)]}), 'right')
check('reroot contract', solve('reroot', {'new':'new'+str(N),'path':['old','tools','run']}), ['new'+str(N),'tools','run'])
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:
Containing menu address drops the root instead of leaf.

Stable menu paths retain ancestry and available owners; separator encoding is unambiguous and resolution is exact.

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 == 'encode':
        return '/'.join(x.replace('~','~0').replace('/','~1') for x in p)
    if action == 'ancestor-availability':
        return all(x['available'] for x in p['owners']) and p['command_available']
    if action == 'parent':
        return p[:-1]
    if action == 'descendant':
        return p['candidate'][0]==p['root'][0]
    if action == 'resolve':
        return next((x['command'] for x in p['rows'] if x['path']==p['path']),None)
    if action == 'reroot':
        return [p['new']]+p['path'][1:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encode contract', solve('encode', ['r~'+str(N),'a/b']), 'r~0'+str(N)+'/a~1b')
check('ancestor-availability contract', solve('ancestor-availability', {'owners':[{'available':True,'id':N},{'available':False,'id':N+1}],'command_available':True}), False)
check('parent contract', solve('parent', ['r','a','b'+str(N)]), ['r','a'])
check('descendant contract', solve('descendant', {'root':['r','a'],'candidate':['r','b',str(N)]}), False)
check('resolve contract', solve('resolve', {'rows':[{'path':['r','a',str(N)],'command':'wrong'},{'path':['r','b',str(N)],'command':'right'}],'path':['r','b',str(N)]}), 'right')
check('reroot contract', solve('reroot', {'new':'new'+str(N),'path':['old','tools','run']}), ['new'+str(N),'tools','run'])
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 == 'encode':
        return '/'.join(x.replace('~','~0').replace('/','~1') for x in p)
    if action == 'ancestor-availability':
        return all(x['available'] for x in p['owners']) and p['command_available']
    if action == 'parent':
        return p[:-1]
    if action == 'descendant':
        return p['candidate'][:1]==p['root'][:1]
    if action == 'resolve':
        return next((x['command'] for x in p['rows'] if x['path']==p['path']),None)
    if action == 'reroot':
        return [p['new']]+p['path'][1:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encode contract', solve('encode', ['r~'+str(N),'a/b']), 'r~0'+str(N)+'/a~1b')
check('ancestor-availability contract', solve('ancestor-availability', {'owners':[{'available':True,'id':N},{'available':False,'id':N+1}],'command_available':True}), False)
check('parent contract', solve('parent', ['r','a','b'+str(N)]), ['r','a'])
check('descendant contract', solve('descendant', {'root':['r','a'],'candidate':['r','b',str(N)]}), False)
check('resolve contract', solve('resolve', {'rows':[{'path':['r','a',str(N)],'command':'wrong'},{'path':['r','b',str(N)],'command':'right'}],'path':['r','b',str(N)]}), 'right')
check('reroot contract', solve('reroot', {'new':'new'+str(N),'path':['old','tools','run']}), ['new'+str(N),'tools','run'])
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:
Sibling commands are mistaken for submenu descendants.

Stable menu paths retain ancestry and available owners; separator encoding is unambiguous and resolution is exact.

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 == 'encode':
        return '/'.join(x.replace('~','~0').replace('/','~1') for x in p)
    if action == 'ancestor-availability':
        return all(x['available'] for x in p['owners']) and p['command_available']
    if action == 'parent':
        return p[:-1]
    if action == 'descendant':
        return p['candidate'][:len(p['root'])]==p['root'] and len(p['candidate'])>len(p['root'])
    if action == 'resolve':
        return next((x['command'] for x in p['rows'] if x['path'][-1]==p['path'][-1]),None)
    if action == 'reroot':
        return [p['new']]+p['path'][1:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encode contract', solve('encode', ['r~'+str(N),'a/b']), 'r~0'+str(N)+'/a~1b')
check('ancestor-availability contract', solve('ancestor-availability', {'owners':[{'available':True,'id':N},{'available':False,'id':N+1}],'command_available':True}), False)
check('parent contract', solve('parent', ['r','a','b'+str(N)]), ['r','a'])
check('descendant contract', solve('descendant', {'root':['r','a'],'candidate':['r','b',str(N)]}), False)
check('resolve contract', solve('resolve', {'rows':[{'path':['r','a',str(N)],'command':'wrong'},{'path':['r','b',str(N)],'command':'right'}],'path':['r','b',str(N)]}), 'right')
check('reroot contract', solve('reroot', {'new':'new'+str(N),'path':['old','tools','run']}), ['new'+str(N),'tools','run'])
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 == 'encode':
        return '/'.join(x.replace('~','~0').replace('/','~1') for x in p)
    if action == 'ancestor-availability':
        return all(x['available'] for x in p['owners']) and p['command_available']
    if action == 'parent':
        return p[:-1]
    if action == 'descendant':
        return p['candidate'][:len(p['root'])]==p['root'] and len(p['candidate'])>len(p['root'])
    if action == 'resolve':
        return next((x['command'] for x in p['rows'] if x['path'][0]==p['path'][0]),None)
    if action == 'reroot':
        return [p['new']]+p['path'][1:]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encode contract', solve('encode', ['r~'+str(N),'a/b']), 'r~0'+str(N)+'/a~1b')
check('ancestor-availability contract', solve('ancestor-availability', {'owners':[{'available':True,'id':N},{'available':False,'id':N+1}],'command_available':True}), False)
check('parent contract', solve('parent', ['r','a','b'+str(N)]), ['r','a'])
check('descendant contract', solve('descendant', {'root':['r','a'],'candidate':['r','b',str(N)]}), False)
check('resolve contract', solve('resolve', {'rows':[{'path':['r','a',str(N)],'command':'wrong'},{'path':['r','b',str(N)],'command':'right'}],'path':['r','b',str(N)]}), 'right')
check('reroot contract', solve('reroot', {'new':'new'+str(N),'path':['old','tools','run']}), ['new'+str(N),'tools','run'])
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Repeated local IDs route to the wrong menu branch.

Stable menu paths retain ancestry and available owners; separator encoding is unambiguous and resolution is exact.

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 == 'encode':
        return '/'.join(x.replace('~','~0').replace('/','~1') for x in p)
    if action == 'ancestor-availability':
        return all(x['available'] for x in p['owners']) and p['command_available']
    if action == 'parent':
        return p[:-1]
    if action == 'descendant':
        return p['candidate'][:len(p['root'])]==p['root'] and len(p['candidate'])>len(p['root'])
    if action == 'resolve':
        return next((x['command'] for x in p['rows'] if x['path']==p['path']),None)
    if action == 'reroot':
        return p['path']+[p['new']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encode contract', solve('encode', ['r~'+str(N),'a/b']), 'r~0'+str(N)+'/a~1b')
check('ancestor-availability contract', solve('ancestor-availability', {'owners':[{'available':True,'id':N},{'available':False,'id':N+1}],'command_available':True}), False)
check('parent contract', solve('parent', ['r','a','b'+str(N)]), ['r','a'])
check('descendant contract', solve('descendant', {'root':['r','a'],'candidate':['r','b',str(N)]}), False)
check('resolve contract', solve('resolve', {'rows':[{'path':['r','a',str(N)],'command':'wrong'},{'path':['r','b',str(N)],'command':'right'}],'path':['r','b',str(N)]}), 'right')
check('reroot contract', solve('reroot', {'new':'new'+str(N),'path':['old','tools','run']}), ['new'+str(N),'tools','run'])
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 == 'encode':
        return '/'.join(x.replace('~','~0').replace('/','~1') for x in p)
    if action == 'ancestor-availability':
        return all(x['available'] for x in p['owners']) and p['command_available']
    if action == 'parent':
        return p[:-1]
    if action == 'descendant':
        return p['candidate'][:len(p['root'])]==p['root'] and len(p['candidate'])>len(p['root'])
    if action == 'resolve':
        return next((x['command'] for x in p['rows'] if x['path']==p['path']),None)
    if action == 'reroot':
        return [p['new']]+p['path']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('encode contract', solve('encode', ['r~'+str(N),'a/b']), 'r~0'+str(N)+'/a~1b')
check('ancestor-availability contract', solve('ancestor-availability', {'owners':[{'available':True,'id':N},{'available':False,'id':N+1}],'command_available':True}), False)
check('parent contract', solve('parent', ['r','a','b'+str(N)]), ['r','a'])
check('descendant contract', solve('descendant', {'root':['r','a'],'candidate':['r','b',str(N)]}), False)
check('resolve contract', solve('resolve', {'rows':[{'path':['r','a',str(N)],'command':'wrong'},{'path':['r','b',str(N)],'command':'right'}],'path':['r','b',str(N)]}), 'right')
check('reroot contract', solve('reroot', {'new':'new'+str(N),'path':['old','tools','run']}), ['new'+str(N),'tools','run'])
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:
Relocating a menu namespace duplicates its old root.

Stable menu paths retain ancestry and available owners; separator encoding is unambiguous and resolution is exact.

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 == 'replace':
        return p['chain']+[p['item']]
    if action == 'close':
        return p['chain'][:p['depth']]
    if action == 'remove-owner':
        return p['chain'][:p['chain'].index(p['owner'])] if p['owner'] in p['chain'] else p['chain']
    if action == 'same-owner':
        return p['chain'] if p['chain'][p['depth']]==p['item'] else p['chain'][:p['depth']]+[p['item']]
    if action == 'parent-token':
        return p['tokens'][p['depth']-1]
    if action == 'owner-depth':
        return p['chain'].index(p['owner']) if p['owner'] in p['chain'] else None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replace contract', solve('replace', {'chain':['r','a','old'],'depth':1,'item':'b'+str(N)}), ['r','b'+str(N)])
check('close contract', solve('close', {'chain':['r','a',str(N)],'depth':2}), ['r','a'])
check('remove-owner contract', solve('remove-owner', {'chain':['r','a','b',str(N)],'owner':'a'}), ['r'])
check('same-owner contract', solve('same-owner', {'chain':['r','a',str(N)],'depth':1,'item':'a'}), ['r','a',str(N)])
check('parent-token contract', solve('parent-token', {'tokens':['root','parent'+str(N),'child'],'depth':2}), 'parent'+str(N))
check('owner-depth contract', solve('owner-depth', {'chain':['r','a'+str(N),'b','c'],'owner':'a'+str(N)}), 1)
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 == 'replace':
        return p['chain'][:p['depth']+1]+[p['item']]
    if action == 'close':
        return p['chain'][:p['depth']]
    if action == 'remove-owner':
        return p['chain'][:p['chain'].index(p['owner'])] if p['owner'] in p['chain'] else p['chain']
    if action == 'same-owner':
        return p['chain'] if p['chain'][p['depth']]==p['item'] else p['chain'][:p['depth']]+[p['item']]
    if action == 'parent-token':
        return p['tokens'][p['depth']-1]
    if action == 'owner-depth':
        return p['chain'].index(p['owner']) if p['owner'] in p['chain'] else None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replace contract', solve('replace', {'chain':['r','a','old'],'depth':1,'item':'b'+str(N)}), ['r','b'+str(N)])
check('close contract', solve('close', {'chain':['r','a',str(N)],'depth':2}), ['r','a'])
check('remove-owner contract', solve('remove-owner', {'chain':['r','a','b',str(N)],'owner':'a'}), ['r'])
check('same-owner contract', solve('same-owner', {'chain':['r','a',str(N)],'depth':1,'item':'a'}), ['r','a',str(N)])
check('parent-token contract', solve('parent-token', {'tokens':['root','parent'+str(N),'child'],'depth':2}), 'parent'+str(N))
check('owner-depth contract', solve('owner-depth', {'chain':['r','a'+str(N),'b','c'],'owner':'a'+str(N)}), 1)
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:
Replacing a submenu retains a stale descendant cascade.

An opened cascade is an ordered branch; replacing a depth discards deeper descendants.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'replace':
        return p['chain'][:p['depth']]+[p['item']]
    if action == 'close':
        return []
    if action == 'remove-owner':
        return p['chain'][:p['chain'].index(p['owner'])] if p['owner'] in p['chain'] else p['chain']
    if action == 'same-owner':
        return p['chain'] if p['chain'][p['depth']]==p['item'] else p['chain'][:p['depth']]+[p['item']]
    if action == 'parent-token':
        return p['tokens'][p['depth']-1]
    if action == 'owner-depth':
        return p['chain'].index(p['owner']) if p['owner'] in p['chain'] else None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replace contract', solve('replace', {'chain':['r','a','old'],'depth':1,'item':'b'+str(N)}), ['r','b'+str(N)])
check('close contract', solve('close', {'chain':['r','a',str(N)],'depth':2}), ['r','a'])
check('remove-owner contract', solve('remove-owner', {'chain':['r','a','b',str(N)],'owner':'a'}), ['r'])
check('same-owner contract', solve('same-owner', {'chain':['r','a',str(N)],'depth':1,'item':'a'}), ['r','a',str(N)])
check('parent-token contract', solve('parent-token', {'tokens':['root','parent'+str(N),'child'],'depth':2}), 'parent'+str(N))
check('owner-depth contract', solve('owner-depth', {'chain':['r','a'+str(N),'b','c'],'owner':'a'+str(N)}), 1)
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 == 'replace':
        return p['chain'][:p['depth']]+[p['item']]
    if action == 'close':
        return p['chain'][:p['depth']+1]
    if action == 'remove-owner':
        return p['chain'][:p['chain'].index(p['owner'])] if p['owner'] in p['chain'] else p['chain']
    if action == 'same-owner':
        return p['chain'] if p['chain'][p['depth']]==p['item'] else p['chain'][:p['depth']]+[p['item']]
    if action == 'parent-token':
        return p['tokens'][p['depth']-1]
    if action == 'owner-depth':
        return p['chain'].index(p['owner']) if p['owner'] in p['chain'] else None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replace contract', solve('replace', {'chain':['r','a','old'],'depth':1,'item':'b'+str(N)}), ['r','b'+str(N)])
check('close contract', solve('close', {'chain':['r','a',str(N)],'depth':2}), ['r','a'])
check('remove-owner contract', solve('remove-owner', {'chain':['r','a','b',str(N)],'owner':'a'}), ['r'])
check('same-owner contract', solve('same-owner', {'chain':['r','a',str(N)],'depth':1,'item':'a'}), ['r','a',str(N)])
check('parent-token contract', solve('parent-token', {'tokens':['root','parent'+str(N),'child'],'depth':2}), 'parent'+str(N))
check('owner-depth contract', solve('owner-depth', {'chain':['r','a'+str(N),'b','c'],'owner':'a'+str(N)}), 1)
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:
Closing a submenu destroys its owning menu.

An opened cascade is an ordered branch; replacing a depth discards deeper descendants.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'replace':
        return p['chain'][:p['depth']]+[p['item']]
    if action == 'close':
        return p['chain'][:p['depth']]
    if action == 'remove-owner':
        return [x for x in p['chain'] if x!=p['owner']]
    if action == 'same-owner':
        return p['chain'] if p['chain'][p['depth']]==p['item'] else p['chain'][:p['depth']]+[p['item']]
    if action == 'parent-token':
        return p['tokens'][p['depth']-1]
    if action == 'owner-depth':
        return p['chain'].index(p['owner']) if p['owner'] in p['chain'] else None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replace contract', solve('replace', {'chain':['r','a','old'],'depth':1,'item':'b'+str(N)}), ['r','b'+str(N)])
check('close contract', solve('close', {'chain':['r','a',str(N)],'depth':2}), ['r','a'])
check('remove-owner contract', solve('remove-owner', {'chain':['r','a','b',str(N)],'owner':'a'}), ['r'])
check('same-owner contract', solve('same-owner', {'chain':['r','a',str(N)],'depth':1,'item':'a'}), ['r','a',str(N)])
check('parent-token contract', solve('parent-token', {'tokens':['root','parent'+str(N),'child'],'depth':2}), 'parent'+str(N))
check('owner-depth contract', solve('owner-depth', {'chain':['r','a'+str(N),'b','c'],'owner':'a'+str(N)}), 1)
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 == 'replace':
        return p['chain'][:p['depth']]+[p['item']]
    if action == 'close':
        return p['chain'][:p['depth']]
    if action == 'remove-owner':
        return p['chain'][:-1]
    if action == 'same-owner':
        return p['chain'] if p['chain'][p['depth']]==p['item'] else p['chain'][:p['depth']]+[p['item']]
    if action == 'parent-token':
        return p['tokens'][p['depth']-1]
    if action == 'owner-depth':
        return p['chain'].index(p['owner']) if p['owner'] in p['chain'] else None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replace contract', solve('replace', {'chain':['r','a','old'],'depth':1,'item':'b'+str(N)}), ['r','b'+str(N)])
check('close contract', solve('close', {'chain':['r','a',str(N)],'depth':2}), ['r','a'])
check('remove-owner contract', solve('remove-owner', {'chain':['r','a','b',str(N)],'owner':'a'}), ['r'])
check('same-owner contract', solve('same-owner', {'chain':['r','a',str(N)],'depth':1,'item':'a'}), ['r','a',str(N)])
check('parent-token contract', solve('parent-token', {'tokens':['root','parent'+str(N),'child'],'depth':2}), 'parent'+str(N))
check('owner-depth contract', solve('owner-depth', {'chain':['r','a'+str(N),'b','c'],'owner':'a'+str(N)}), 1)
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Removing a menu owner leaves orphaned grandchildren.

An opened cascade is an ordered branch; replacing a depth discards deeper descendants.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'replace':
        return p['chain'][:p['depth']]+[p['item']]
    if action == 'close':
        return p['chain'][:p['depth']]
    if action == 'remove-owner':
        return p['chain'][:p['chain'].index(p['owner'])] if p['owner'] in p['chain'] else p['chain']
    if action == 'same-owner':
        return p['chain'][:p['depth']]+[p['item']]
    if action == 'parent-token':
        return p['tokens'][p['depth']-1]
    if action == 'owner-depth':
        return p['chain'].index(p['owner']) if p['owner'] in p['chain'] else None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replace contract', solve('replace', {'chain':['r','a','old'],'depth':1,'item':'b'+str(N)}), ['r','b'+str(N)])
check('close contract', solve('close', {'chain':['r','a',str(N)],'depth':2}), ['r','a'])
check('remove-owner contract', solve('remove-owner', {'chain':['r','a','b',str(N)],'owner':'a'}), ['r'])
check('same-owner contract', solve('same-owner', {'chain':['r','a',str(N)],'depth':1,'item':'a'}), ['r','a',str(N)])
check('parent-token contract', solve('parent-token', {'tokens':['root','parent'+str(N),'child'],'depth':2}), 'parent'+str(N))
check('owner-depth contract', solve('owner-depth', {'chain':['r','a'+str(N),'b','c'],'owner':'a'+str(N)}), 1)
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 == 'replace':
        return p['chain'][:p['depth']]+[p['item']]
    if action == 'close':
        return p['chain'][:p['depth']]
    if action == 'remove-owner':
        return p['chain'][:p['chain'].index(p['owner'])] if p['owner'] in p['chain'] else p['chain']
    if action == 'same-owner':
        return p['chain'][:p['depth']+1]
    if action == 'parent-token':
        return p['tokens'][p['depth']-1]
    if action == 'owner-depth':
        return p['chain'].index(p['owner']) if p['owner'] in p['chain'] else None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replace contract', solve('replace', {'chain':['r','a','old'],'depth':1,'item':'b'+str(N)}), ['r','b'+str(N)])
check('close contract', solve('close', {'chain':['r','a',str(N)],'depth':2}), ['r','a'])
check('remove-owner contract', solve('remove-owner', {'chain':['r','a','b',str(N)],'owner':'a'}), ['r'])
check('same-owner contract', solve('same-owner', {'chain':['r','a',str(N)],'depth':1,'item':'a'}), ['r','a',str(N)])
check('parent-token contract', solve('parent-token', {'tokens':['root','parent'+str(N),'child'],'depth':2}), 'parent'+str(N))
check('owner-depth contract', solve('owner-depth', {'chain':['r','a'+str(N),'b','c'],'owner':'a'+str(N)}), 1)
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:
Reentering an existing submenu destroys deeper open state.

An opened cascade is an ordered branch; replacing a depth discards deeper descendants.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'replace':
        return p['chain'][:p['depth']]+[p['item']]
    if action == 'close':
        return p['chain'][:p['depth']]
    if action == 'remove-owner':
        return p['chain'][:p['chain'].index(p['owner'])] if p['owner'] in p['chain'] else p['chain']
    if action == 'same-owner':
        return p['chain'] if p['chain'][p['depth']]==p['item'] else p['chain'][:p['depth']]+[p['item']]
    if action == 'parent-token':
        return p['tokens'][p['depth']]
    if action == 'owner-depth':
        return p['chain'].index(p['owner']) if p['owner'] in p['chain'] else None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replace contract', solve('replace', {'chain':['r','a','old'],'depth':1,'item':'b'+str(N)}), ['r','b'+str(N)])
check('close contract', solve('close', {'chain':['r','a',str(N)],'depth':2}), ['r','a'])
check('remove-owner contract', solve('remove-owner', {'chain':['r','a','b',str(N)],'owner':'a'}), ['r'])
check('same-owner contract', solve('same-owner', {'chain':['r','a',str(N)],'depth':1,'item':'a'}), ['r','a',str(N)])
check('parent-token contract', solve('parent-token', {'tokens':['root','parent'+str(N),'child'],'depth':2}), 'parent'+str(N))
check('owner-depth contract', solve('owner-depth', {'chain':['r','a'+str(N),'b','c'],'owner':'a'+str(N)}), 1)
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 == 'replace':
        return p['chain'][:p['depth']]+[p['item']]
    if action == 'close':
        return p['chain'][:p['depth']]
    if action == 'remove-owner':
        return p['chain'][:p['chain'].index(p['owner'])] if p['owner'] in p['chain'] else p['chain']
    if action == 'same-owner':
        return p['chain'] if p['chain'][p['depth']]==p['item'] else p['chain'][:p['depth']]+[p['item']]
    if action == 'parent-token':
        return p['tokens'][0]
    if action == 'owner-depth':
        return p['chain'].index(p['owner']) if p['owner'] in p['chain'] else None
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replace contract', solve('replace', {'chain':['r','a','old'],'depth':1,'item':'b'+str(N)}), ['r','b'+str(N)])
check('close contract', solve('close', {'chain':['r','a',str(N)],'depth':2}), ['r','a'])
check('remove-owner contract', solve('remove-owner', {'chain':['r','a','b',str(N)],'owner':'a'}), ['r'])
check('same-owner contract', solve('same-owner', {'chain':['r','a',str(N)],'depth':1,'item':'a'}), ['r','a',str(N)])
check('parent-token contract', solve('parent-token', {'tokens':['root','parent'+str(N),'child'],'depth':2}), 'parent'+str(N))
check('owner-depth contract', solve('owner-depth', {'chain':['r','a'+str(N),'b','c'],'owner':'a'+str(N)}), 1)
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:
A submenu subscribes to the wrong ancestor lifetime.

An opened cascade is an ordered branch; replacing a depth discards deeper descendants.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'replace':
        return p['chain'][:p['depth']]+[p['item']]
    if action == 'close':
        return p['chain'][:p['depth']]
    if action == 'remove-owner':
        return p['chain'][:p['chain'].index(p['owner'])] if p['owner'] in p['chain'] else p['chain']
    if action == 'same-owner':
        return p['chain'] if p['chain'][p['depth']]==p['item'] else p['chain'][:p['depth']]+[p['item']]
    if action == 'parent-token':
        return p['tokens'][p['depth']-1]
    if action == 'owner-depth':
        return len(p['chain'])-1
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replace contract', solve('replace', {'chain':['r','a','old'],'depth':1,'item':'b'+str(N)}), ['r','b'+str(N)])
check('close contract', solve('close', {'chain':['r','a',str(N)],'depth':2}), ['r','a'])
check('remove-owner contract', solve('remove-owner', {'chain':['r','a','b',str(N)],'owner':'a'}), ['r'])
check('same-owner contract', solve('same-owner', {'chain':['r','a',str(N)],'depth':1,'item':'a'}), ['r','a',str(N)])
check('parent-token contract', solve('parent-token', {'tokens':['root','parent'+str(N),'child'],'depth':2}), 'parent'+str(N))
check('owner-depth contract', solve('owner-depth', {'chain':['r','a'+str(N),'b','c'],'owner':'a'+str(N)}), 1)
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 == 'replace':
        return p['chain'][:p['depth']]+[p['item']]
    if action == 'close':
        return p['chain'][:p['depth']]
    if action == 'remove-owner':
        return p['chain'][:p['chain'].index(p['owner'])] if p['owner'] in p['chain'] else p['chain']
    if action == 'same-owner':
        return p['chain'] if p['chain'][p['depth']]==p['item'] else p['chain'][:p['depth']]+[p['item']]
    if action == 'parent-token':
        return p['tokens'][p['depth']-1]
    if action == 'owner-depth':
        return 0
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replace contract', solve('replace', {'chain':['r','a','old'],'depth':1,'item':'b'+str(N)}), ['r','b'+str(N)])
check('close contract', solve('close', {'chain':['r','a',str(N)],'depth':2}), ['r','a'])
check('remove-owner contract', solve('remove-owner', {'chain':['r','a','b',str(N)],'owner':'a'}), ['r'])
check('same-owner contract', solve('same-owner', {'chain':['r','a',str(N)],'depth':1,'item':'a'}), ['r','a',str(N)])
check('parent-token contract', solve('parent-token', {'tokens':['root','parent'+str(N),'child'],'depth':2}), 'parent'+str(N))
check('owner-depth contract', solve('owner-depth', {'chain':['r','a'+str(N),'b','c'],'owner':'a'+str(N)}), 1)
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 owner depth is inferred from cascade length.

An opened cascade is an ordered branch; replacing a depth discards deeper descendants.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'target':
        return p['hover']
    if action == 'point':
        return [p['client'][0]+p['scroll'][0],p['client'][1]+p['scroll'][1]]
    if action == 'revision':
        return p['snapshot']==p['current']
    if action == 'capabilities':
        return sorted(set(p['captured']) & set(p['current']))
    if action == 'objects':
        return list(p['captured'])
    if action == 'locale':
        return p['opened']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('target contract', solve('target', {'captured':'doc'+str(N),'hover':'other','active':'third'}), 'doc'+str(N))
check('point contract', solve('point', {'client':[N,2*N],'scroll':[3*N,4*N]}), [4*N,6*N])
check('revision contract', solve('revision', {'snapshot':N,'current':N+1}), False)
check('capabilities contract', solve('capabilities', {'captured':['read','delete'+str(N)],'current':['read','share']}), ['read'])
check('objects contract', solve('objects', {'captured':['a'+str(N),'b'],'current':['c']}), ['a'+str(N),'b'])
check('locale contract', solve('locale', {'opened':'locale'+str(N),'ambient':'other','default':'default'}), 'locale'+str(N))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'target':
        return p['active']
    if action == 'point':
        return [p['client'][0]+p['scroll'][0],p['client'][1]+p['scroll'][1]]
    if action == 'revision':
        return p['snapshot']==p['current']
    if action == 'capabilities':
        return sorted(set(p['captured']) & set(p['current']))
    if action == 'objects':
        return list(p['captured'])
    if action == 'locale':
        return p['opened']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('target contract', solve('target', {'captured':'doc'+str(N),'hover':'other','active':'third'}), 'doc'+str(N))
check('point contract', solve('point', {'client':[N,2*N],'scroll':[3*N,4*N]}), [4*N,6*N])
check('revision contract', solve('revision', {'snapshot':N,'current':N+1}), False)
check('capabilities contract', solve('capabilities', {'captured':['read','delete'+str(N)],'current':['read','share']}), ['read'])
check('objects contract', solve('objects', {'captured':['a'+str(N),'b'],'current':['c']}), ['a'+str(N),'b'])
check('locale contract', solve('locale', {'opened':'locale'+str(N),'ambient':'other','default':'default'}), 'locale'+str(N))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Context command re-reads the hovered document target.

A context-menu invocation snapshots target, document coordinates, revision, capabilities, document objects and parsing locale.

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 == 'target':
        return p['captured']
    if action == 'point':
        return p['client']
    if action == 'revision':
        return p['snapshot']==p['current']
    if action == 'capabilities':
        return sorted(set(p['captured']) & set(p['current']))
    if action == 'objects':
        return list(p['captured'])
    if action == 'locale':
        return p['opened']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('target contract', solve('target', {'captured':'doc'+str(N),'hover':'other','active':'third'}), 'doc'+str(N))
check('point contract', solve('point', {'client':[N,2*N],'scroll':[3*N,4*N]}), [4*N,6*N])
check('revision contract', solve('revision', {'snapshot':N,'current':N+1}), False)
check('capabilities contract', solve('capabilities', {'captured':['read','delete'+str(N)],'current':['read','share']}), ['read'])
check('objects contract', solve('objects', {'captured':['a'+str(N),'b'],'current':['c']}), ['a'+str(N),'b'])
check('locale contract', solve('locale', {'opened':'locale'+str(N),'ambient':'other','default':'default'}), 'locale'+str(N))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'target':
        return p['captured']
    if action == 'point':
        return [p['client'][0]+p['scroll'][0],p['client'][1]]
    if action == 'revision':
        return p['snapshot']==p['current']
    if action == 'capabilities':
        return sorted(set(p['captured']) & set(p['current']))
    if action == 'objects':
        return list(p['captured'])
    if action == 'locale':
        return p['opened']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('target contract', solve('target', {'captured':'doc'+str(N),'hover':'other','active':'third'}), 'doc'+str(N))
check('point contract', solve('point', {'client':[N,2*N],'scroll':[3*N,4*N]}), [4*N,6*N])
check('revision contract', solve('revision', {'snapshot':N,'current':N+1}), False)
check('capabilities contract', solve('capabilities', {'captured':['read','delete'+str(N)],'current':['read','share']}), ['read'])
check('objects contract', solve('objects', {'captured':['a'+str(N),'b'],'current':['c']}), ['a'+str(N),'b'])
check('locale contract', solve('locale', {'opened':'locale'+str(N),'ambient':'other','default':'default'}), 'locale'+str(N))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Context document position omits a scroll axis.

A context-menu invocation snapshots target, document coordinates, revision, capabilities, document objects and parsing locale.

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 == 'target':
        return p['captured']
    if action == 'point':
        return [p['client'][0]+p['scroll'][0],p['client'][1]+p['scroll'][1]]
    if action == 'revision':
        return True
    if action == 'capabilities':
        return sorted(set(p['captured']) & set(p['current']))
    if action == 'objects':
        return list(p['captured'])
    if action == 'locale':
        return p['opened']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('target contract', solve('target', {'captured':'doc'+str(N),'hover':'other','active':'third'}), 'doc'+str(N))
check('point contract', solve('point', {'client':[N,2*N],'scroll':[3*N,4*N]}), [4*N,6*N])
check('revision contract', solve('revision', {'snapshot':N,'current':N+1}), False)
check('capabilities contract', solve('capabilities', {'captured':['read','delete'+str(N)],'current':['read','share']}), ['read'])
check('objects contract', solve('objects', {'captured':['a'+str(N),'b'],'current':['c']}), ['a'+str(N),'b'])
check('locale contract', solve('locale', {'opened':'locale'+str(N),'ambient':'other','default':'default'}), 'locale'+str(N))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'target':
        return p['captured']
    if action == 'point':
        return [p['client'][0]+p['scroll'][0],p['client'][1]+p['scroll'][1]]
    if action == 'revision':
        return p['snapshot']<=p['current']
    if action == 'capabilities':
        return sorted(set(p['captured']) & set(p['current']))
    if action == 'objects':
        return list(p['captured'])
    if action == 'locale':
        return p['opened']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('target contract', solve('target', {'captured':'doc'+str(N),'hover':'other','active':'third'}), 'doc'+str(N))
check('point contract', solve('point', {'client':[N,2*N],'scroll':[3*N,4*N]}), [4*N,6*N])
check('revision contract', solve('revision', {'snapshot':N,'current':N+1}), False)
check('capabilities contract', solve('capabilities', {'captured':['read','delete'+str(N)],'current':['read','share']}), ['read'])
check('objects contract', solve('objects', {'captured':['a'+str(N),'b'],'current':['c']}), ['a'+str(N),'b'])
check('locale contract', solve('locale', {'opened':'locale'+str(N),'ambient':'other','default':'default'}), 'locale'+str(N))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Context command executes against an edited document revision.

A context-menu invocation snapshots target, document coordinates, revision, capabilities, document objects and parsing locale.

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 == 'target':
        return p['captured']
    if action == 'point':
        return [p['client'][0]+p['scroll'][0],p['client'][1]+p['scroll'][1]]
    if action == 'revision':
        return p['snapshot']==p['current']
    if action == 'capabilities':
        return p['captured']
    if action == 'objects':
        return list(p['captured'])
    if action == 'locale':
        return p['opened']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('target contract', solve('target', {'captured':'doc'+str(N),'hover':'other','active':'third'}), 'doc'+str(N))
check('point contract', solve('point', {'client':[N,2*N],'scroll':[3*N,4*N]}), [4*N,6*N])
check('revision contract', solve('revision', {'snapshot':N,'current':N+1}), False)
check('capabilities contract', solve('capabilities', {'captured':['read','delete'+str(N)],'current':['read','share']}), ['read'])
check('objects contract', solve('objects', {'captured':['a'+str(N),'b'],'current':['c']}), ['a'+str(N),'b'])
check('locale contract', solve('locale', {'opened':'locale'+str(N),'ambient':'other','default':'default'}), 'locale'+str(N))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'target':
        return p['captured']
    if action == 'point':
        return [p['client'][0]+p['scroll'][0],p['client'][1]+p['scroll'][1]]
    if action == 'revision':
        return p['snapshot']==p['current']
    if action == 'capabilities':
        return sorted(set(p['captured']) | set(p['current']))
    if action == 'objects':
        return list(p['captured'])
    if action == 'locale':
        return p['opened']
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('target contract', solve('target', {'captured':'doc'+str(N),'hover':'other','active':'third'}), 'doc'+str(N))
check('point contract', solve('point', {'client':[N,2*N],'scroll':[3*N,4*N]}), [4*N,6*N])
check('revision contract', solve('revision', {'snapshot':N,'current':N+1}), False)
check('capabilities contract', solve('capabilities', {'captured':['read','delete'+str(N)],'current':['read','share']}), ['read'])
check('objects contract', solve('objects', {'captured':['a'+str(N),'b'],'current':['c']}), ['a'+str(N),'b'])
check('locale contract', solve('locale', {'opened':'locale'+str(N),'ambient':'other','default':'default'}), 'locale'+str(N))
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Context menu retains revoked command capabilities.

A context-menu invocation snapshots target, document coordinates, revision, capabilities, document objects and parsing locale.

split: open-access