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

N = 1
observations = []
def solve(operation, s):
    commands, cancelled, acknowledged, online, limit = s
    if operation == 'cancel-preserves-other-commands':
        return [x for x in commands if x[0] not in cancelled]
    if operation == 'ack-removes-by-identity':
        return [x for x in commands if x[0] not in acknowledged]
    if operation == 'offline-send-suppression':
        return commands[:limit] if online else []
    if operation == 'effective-backlog':
        return sum(x[0] not in acknowledged and x[0] not in cancelled for x in commands)
    if operation == 'create-before-edit-order':
        return [x[0] for x in reversed(commands)]
    if operation == 'destructive-command-warning':
        return [x[0] for x in commands if x[1]=='delete' and x[0] not in cancelled]
    if operation == 'unsent-tail-retention':
        return commands[limit:] if online else commands
    if operation == 'acknowledged-prefix-barrier':
        return next((i for i,x in enumerate(commands) if x[0] not in acknowledged),len(commands))
    if operation == 'zero-payload-retention':
        return [x[2] for x in commands if x[1]=='edit']
    if operation == 'cancel-request-intersection':
        return [x[0] for x in commands if x[0] in cancelled]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cancel-preserves-other-commands scenario 1', solve('cancel-preserves-other-commands', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('c','delete',0)])
check('cancel-preserves-other-commands scenario 2', solve('cancel-preserves-other-commands', ([],[],[],True,2)), [])
check('cancel-preserves-other-commands scenario 3', solve('cancel-preserves-other-commands', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('cancel-preserves-other-commands scenario 4', solve('cancel-preserves-other-commands', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('cancel-preserves-other-commands scenario 5', solve('cancel-preserves-other-commands', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('b','create',N)])
check('cancel-preserves-other-commands scenario 6', solve('cancel-preserves-other-commands', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('ack-removes-by-identity scenario 1', solve('ack-removes-by-identity', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('b','edit',2),('c','delete',0)])
check('ack-removes-by-identity scenario 2', solve('ack-removes-by-identity', ([],[],[],True,2)), [])
check('ack-removes-by-identity scenario 3', solve('ack-removes-by-identity', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('ack-removes-by-identity scenario 4', solve('ack-removes-by-identity', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('ack-removes-by-identity scenario 5', solve('ack-removes-by-identity', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('ack-removes-by-identity scenario 6', solve('ack-removes-by-identity', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('c','edit',3)])
check('offline-send-suppression scenario 1', solve('offline-send-suppression', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('b','edit',2)])
check('offline-send-suppression scenario 2', solve('offline-send-suppression', ([],[],[],True,2)), [])
check('offline-send-suppression scenario 3', solve('offline-send-suppression', ([('a','edit',0)],[],[],False,1)), [])
check('offline-send-suppression scenario 4', solve('offline-send-suppression', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1)])
check('offline-send-suppression scenario 5', solve('offline-send-suppression', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('offline-send-suppression scenario 6', solve('offline-send-suppression', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('effective-backlog scenario 1', solve('effective-backlog', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('effective-backlog scenario 2', solve('effective-backlog', ([],[],[],True,2)), 0)
check('effective-backlog scenario 3', solve('effective-backlog', ([('a','edit',0)],[],[],False,1)), 1)
check('effective-backlog scenario 4', solve('effective-backlog', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 2)
check('effective-backlog scenario 5', solve('effective-backlog', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 1)
check('effective-backlog scenario 6', solve('effective-backlog', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 2)
check('create-before-edit-order scenario 1', solve('create-before-edit-order', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['a','b','c'])
check('create-before-edit-order scenario 2', solve('create-before-edit-order', ([],[],[],True,2)), [])
check('create-before-edit-order scenario 3', solve('create-before-edit-order', ([('a','edit',0)],[],[],False,1)), ['a'])
check('create-before-edit-order scenario 4', solve('create-before-edit-order', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), ['a','b'])
check('create-before-edit-order scenario 5', solve('create-before-edit-order', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a','b'])
check('create-before-edit-order scenario 6', solve('create-before-edit-order', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), ['a','b','c'])
check('destructive-command-warning scenario 1', solve('destructive-command-warning', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['c'])
check('destructive-command-warning scenario 2', solve('destructive-command-warning', ([],[],[],True,2)), [])
check('destructive-command-warning scenario 3', solve('destructive-command-warning', ([('a','edit',0)],[],[],False,1)), [])
check('destructive-command-warning scenario 4', solve('destructive-command-warning', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('destructive-command-warning scenario 5', solve('destructive-command-warning', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('destructive-command-warning scenario 6', solve('destructive-command-warning', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('unsent-tail-retention scenario 1', solve('unsent-tail-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('c','delete',0)])
check('unsent-tail-retention scenario 2', solve('unsent-tail-retention', ([],[],[],True,2)), [])
check('unsent-tail-retention scenario 3', solve('unsent-tail-retention', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('unsent-tail-retention scenario 4', solve('unsent-tail-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('b','edit',2)])
check('unsent-tail-retention scenario 5', solve('unsent-tail-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('unsent-tail-retention scenario 6', solve('unsent-tail-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('acknowledged-prefix-barrier scenario 1', solve('acknowledged-prefix-barrier', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('acknowledged-prefix-barrier scenario 2', solve('acknowledged-prefix-barrier', ([],[],[],True,2)), 0)
check('acknowledged-prefix-barrier scenario 3', solve('acknowledged-prefix-barrier', ([('a','edit',0)],[],[],False,1)), 0)
check('acknowledged-prefix-barrier scenario 4', solve('acknowledged-prefix-barrier', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 0)
check('acknowledged-prefix-barrier scenario 5', solve('acknowledged-prefix-barrier', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 0)
check('acknowledged-prefix-barrier scenario 6', solve('acknowledged-prefix-barrier', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 0)
check('zero-payload-retention scenario 1', solve('zero-payload-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [2])
check('zero-payload-retention scenario 2', solve('zero-payload-retention', ([],[],[],True,2)), [])
check('zero-payload-retention scenario 3', solve('zero-payload-retention', ([('a','edit',0)],[],[],False,1)), [0])
check('zero-payload-retention scenario 4', solve('zero-payload-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [1,2])
check('zero-payload-retention scenario 5', solve('zero-payload-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('zero-payload-retention scenario 6', solve('zero-payload-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [2,3])
check('cancel-request-intersection scenario 1', solve('cancel-request-intersection', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['b'])
check('cancel-request-intersection scenario 2', solve('cancel-request-intersection', ([],[],[],True,2)), [])
check('cancel-request-intersection scenario 3', solve('cancel-request-intersection', ([('a','edit',0)],[],[],False,1)), [])
check('cancel-request-intersection scenario 4', solve('cancel-request-intersection', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('cancel-request-intersection scenario 5', solve('cancel-request-intersection', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a'])
check('cancel-request-intersection scenario 6', solve('cancel-request-intersection', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
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(operation, s):
    commands, cancelled, acknowledged, online, limit = s
    if operation == 'cancel-preserves-other-commands':
        return [x for x in commands if x[0] not in cancelled]
    if operation == 'ack-removes-by-identity':
        return [x for x in commands if x[0] not in acknowledged]
    if operation == 'offline-send-suppression':
        return commands[:limit] if online else []
    if operation == 'effective-backlog':
        return sum(x[0] not in acknowledged and x[0] not in cancelled for x in commands)
    if operation == 'create-before-edit-order':
        return sorted((x[0] for x in commands),reverse=True)
    if operation == 'destructive-command-warning':
        return [x[0] for x in commands if x[1]=='delete' and x[0] not in cancelled]
    if operation == 'unsent-tail-retention':
        return commands[limit:] if online else commands
    if operation == 'acknowledged-prefix-barrier':
        return next((i for i,x in enumerate(commands) if x[0] not in acknowledged),len(commands))
    if operation == 'zero-payload-retention':
        return [x[2] for x in commands if x[1]=='edit']
    if operation == 'cancel-request-intersection':
        return [x[0] for x in commands if x[0] in cancelled]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cancel-preserves-other-commands scenario 1', solve('cancel-preserves-other-commands', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('c','delete',0)])
check('cancel-preserves-other-commands scenario 2', solve('cancel-preserves-other-commands', ([],[],[],True,2)), [])
check('cancel-preserves-other-commands scenario 3', solve('cancel-preserves-other-commands', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('cancel-preserves-other-commands scenario 4', solve('cancel-preserves-other-commands', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('cancel-preserves-other-commands scenario 5', solve('cancel-preserves-other-commands', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('b','create',N)])
check('cancel-preserves-other-commands scenario 6', solve('cancel-preserves-other-commands', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('ack-removes-by-identity scenario 1', solve('ack-removes-by-identity', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('b','edit',2),('c','delete',0)])
check('ack-removes-by-identity scenario 2', solve('ack-removes-by-identity', ([],[],[],True,2)), [])
check('ack-removes-by-identity scenario 3', solve('ack-removes-by-identity', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('ack-removes-by-identity scenario 4', solve('ack-removes-by-identity', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('ack-removes-by-identity scenario 5', solve('ack-removes-by-identity', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('ack-removes-by-identity scenario 6', solve('ack-removes-by-identity', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('c','edit',3)])
check('offline-send-suppression scenario 1', solve('offline-send-suppression', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('b','edit',2)])
check('offline-send-suppression scenario 2', solve('offline-send-suppression', ([],[],[],True,2)), [])
check('offline-send-suppression scenario 3', solve('offline-send-suppression', ([('a','edit',0)],[],[],False,1)), [])
check('offline-send-suppression scenario 4', solve('offline-send-suppression', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1)])
check('offline-send-suppression scenario 5', solve('offline-send-suppression', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('offline-send-suppression scenario 6', solve('offline-send-suppression', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('effective-backlog scenario 1', solve('effective-backlog', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('effective-backlog scenario 2', solve('effective-backlog', ([],[],[],True,2)), 0)
check('effective-backlog scenario 3', solve('effective-backlog', ([('a','edit',0)],[],[],False,1)), 1)
check('effective-backlog scenario 4', solve('effective-backlog', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 2)
check('effective-backlog scenario 5', solve('effective-backlog', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 1)
check('effective-backlog scenario 6', solve('effective-backlog', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 2)
check('create-before-edit-order scenario 1', solve('create-before-edit-order', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['a','b','c'])
check('create-before-edit-order scenario 2', solve('create-before-edit-order', ([],[],[],True,2)), [])
check('create-before-edit-order scenario 3', solve('create-before-edit-order', ([('a','edit',0)],[],[],False,1)), ['a'])
check('create-before-edit-order scenario 4', solve('create-before-edit-order', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), ['a','b'])
check('create-before-edit-order scenario 5', solve('create-before-edit-order', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a','b'])
check('create-before-edit-order scenario 6', solve('create-before-edit-order', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), ['a','b','c'])
check('destructive-command-warning scenario 1', solve('destructive-command-warning', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['c'])
check('destructive-command-warning scenario 2', solve('destructive-command-warning', ([],[],[],True,2)), [])
check('destructive-command-warning scenario 3', solve('destructive-command-warning', ([('a','edit',0)],[],[],False,1)), [])
check('destructive-command-warning scenario 4', solve('destructive-command-warning', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('destructive-command-warning scenario 5', solve('destructive-command-warning', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('destructive-command-warning scenario 6', solve('destructive-command-warning', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('unsent-tail-retention scenario 1', solve('unsent-tail-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('c','delete',0)])
check('unsent-tail-retention scenario 2', solve('unsent-tail-retention', ([],[],[],True,2)), [])
check('unsent-tail-retention scenario 3', solve('unsent-tail-retention', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('unsent-tail-retention scenario 4', solve('unsent-tail-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('b','edit',2)])
check('unsent-tail-retention scenario 5', solve('unsent-tail-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('unsent-tail-retention scenario 6', solve('unsent-tail-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('acknowledged-prefix-barrier scenario 1', solve('acknowledged-prefix-barrier', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('acknowledged-prefix-barrier scenario 2', solve('acknowledged-prefix-barrier', ([],[],[],True,2)), 0)
check('acknowledged-prefix-barrier scenario 3', solve('acknowledged-prefix-barrier', ([('a','edit',0)],[],[],False,1)), 0)
check('acknowledged-prefix-barrier scenario 4', solve('acknowledged-prefix-barrier', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 0)
check('acknowledged-prefix-barrier scenario 5', solve('acknowledged-prefix-barrier', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 0)
check('acknowledged-prefix-barrier scenario 6', solve('acknowledged-prefix-barrier', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 0)
check('zero-payload-retention scenario 1', solve('zero-payload-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [2])
check('zero-payload-retention scenario 2', solve('zero-payload-retention', ([],[],[],True,2)), [])
check('zero-payload-retention scenario 3', solve('zero-payload-retention', ([('a','edit',0)],[],[],False,1)), [0])
check('zero-payload-retention scenario 4', solve('zero-payload-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [1,2])
check('zero-payload-retention scenario 5', solve('zero-payload-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('zero-payload-retention scenario 6', solve('zero-payload-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [2,3])
check('cancel-request-intersection scenario 1', solve('cancel-request-intersection', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['b'])
check('cancel-request-intersection scenario 2', solve('cancel-request-intersection', ([],[],[],True,2)), [])
check('cancel-request-intersection scenario 3', solve('cancel-request-intersection', ([('a','edit',0)],[],[],False,1)), [])
check('cancel-request-intersection scenario 4', solve('cancel-request-intersection', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('cancel-request-intersection scenario 5', solve('cancel-request-intersection', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a'])
check('cancel-request-intersection scenario 6', solve('cancel-request-intersection', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
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:
Create before edit order.

The client outbox is an ordered UI mutation log; commands use identity, not payload truthiness. Cancellation/acknowledgment remove only matching commands, offline mode retains unsent work, and a zero send budget sends nothing. Operation create-before-edit-order has the six explicit input/output oracles below.

split: open-access


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

N = 1
observations = []
def solve(operation, s):
    commands, cancelled, acknowledged, online, limit = s
    if operation == 'cancel-preserves-other-commands':
        return [x for x in commands if x[0] not in cancelled]
    if operation == 'ack-removes-by-identity':
        return [x for x in commands if x[0] not in acknowledged]
    if operation == 'offline-send-suppression':
        return commands[:limit] if online else []
    if operation == 'effective-backlog':
        return sum(x[0] not in acknowledged and x[0] not in cancelled for x in commands)
    if operation == 'create-before-edit-order':
        return [x[0] for x in commands]
    if operation == 'destructive-command-warning':
        return [x[0] for x in commands if x[1]=='delete']
    if operation == 'unsent-tail-retention':
        return commands[limit:] if online else commands
    if operation == 'acknowledged-prefix-barrier':
        return next((i for i,x in enumerate(commands) if x[0] not in acknowledged),len(commands))
    if operation == 'zero-payload-retention':
        return [x[2] for x in commands if x[1]=='edit']
    if operation == 'cancel-request-intersection':
        return [x[0] for x in commands if x[0] in cancelled]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cancel-preserves-other-commands scenario 1', solve('cancel-preserves-other-commands', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('c','delete',0)])
check('cancel-preserves-other-commands scenario 2', solve('cancel-preserves-other-commands', ([],[],[],True,2)), [])
check('cancel-preserves-other-commands scenario 3', solve('cancel-preserves-other-commands', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('cancel-preserves-other-commands scenario 4', solve('cancel-preserves-other-commands', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('cancel-preserves-other-commands scenario 5', solve('cancel-preserves-other-commands', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('b','create',N)])
check('cancel-preserves-other-commands scenario 6', solve('cancel-preserves-other-commands', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('ack-removes-by-identity scenario 1', solve('ack-removes-by-identity', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('b','edit',2),('c','delete',0)])
check('ack-removes-by-identity scenario 2', solve('ack-removes-by-identity', ([],[],[],True,2)), [])
check('ack-removes-by-identity scenario 3', solve('ack-removes-by-identity', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('ack-removes-by-identity scenario 4', solve('ack-removes-by-identity', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('ack-removes-by-identity scenario 5', solve('ack-removes-by-identity', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('ack-removes-by-identity scenario 6', solve('ack-removes-by-identity', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('c','edit',3)])
check('offline-send-suppression scenario 1', solve('offline-send-suppression', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('b','edit',2)])
check('offline-send-suppression scenario 2', solve('offline-send-suppression', ([],[],[],True,2)), [])
check('offline-send-suppression scenario 3', solve('offline-send-suppression', ([('a','edit',0)],[],[],False,1)), [])
check('offline-send-suppression scenario 4', solve('offline-send-suppression', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1)])
check('offline-send-suppression scenario 5', solve('offline-send-suppression', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('offline-send-suppression scenario 6', solve('offline-send-suppression', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('effective-backlog scenario 1', solve('effective-backlog', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('effective-backlog scenario 2', solve('effective-backlog', ([],[],[],True,2)), 0)
check('effective-backlog scenario 3', solve('effective-backlog', ([('a','edit',0)],[],[],False,1)), 1)
check('effective-backlog scenario 4', solve('effective-backlog', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 2)
check('effective-backlog scenario 5', solve('effective-backlog', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 1)
check('effective-backlog scenario 6', solve('effective-backlog', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 2)
check('create-before-edit-order scenario 1', solve('create-before-edit-order', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['a','b','c'])
check('create-before-edit-order scenario 2', solve('create-before-edit-order', ([],[],[],True,2)), [])
check('create-before-edit-order scenario 3', solve('create-before-edit-order', ([('a','edit',0)],[],[],False,1)), ['a'])
check('create-before-edit-order scenario 4', solve('create-before-edit-order', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), ['a','b'])
check('create-before-edit-order scenario 5', solve('create-before-edit-order', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a','b'])
check('create-before-edit-order scenario 6', solve('create-before-edit-order', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), ['a','b','c'])
check('destructive-command-warning scenario 1', solve('destructive-command-warning', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['c'])
check('destructive-command-warning scenario 2', solve('destructive-command-warning', ([],[],[],True,2)), [])
check('destructive-command-warning scenario 3', solve('destructive-command-warning', ([('a','edit',0)],[],[],False,1)), [])
check('destructive-command-warning scenario 4', solve('destructive-command-warning', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('destructive-command-warning scenario 5', solve('destructive-command-warning', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('destructive-command-warning scenario 6', solve('destructive-command-warning', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('unsent-tail-retention scenario 1', solve('unsent-tail-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('c','delete',0)])
check('unsent-tail-retention scenario 2', solve('unsent-tail-retention', ([],[],[],True,2)), [])
check('unsent-tail-retention scenario 3', solve('unsent-tail-retention', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('unsent-tail-retention scenario 4', solve('unsent-tail-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('b','edit',2)])
check('unsent-tail-retention scenario 5', solve('unsent-tail-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('unsent-tail-retention scenario 6', solve('unsent-tail-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('acknowledged-prefix-barrier scenario 1', solve('acknowledged-prefix-barrier', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('acknowledged-prefix-barrier scenario 2', solve('acknowledged-prefix-barrier', ([],[],[],True,2)), 0)
check('acknowledged-prefix-barrier scenario 3', solve('acknowledged-prefix-barrier', ([('a','edit',0)],[],[],False,1)), 0)
check('acknowledged-prefix-barrier scenario 4', solve('acknowledged-prefix-barrier', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 0)
check('acknowledged-prefix-barrier scenario 5', solve('acknowledged-prefix-barrier', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 0)
check('acknowledged-prefix-barrier scenario 6', solve('acknowledged-prefix-barrier', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 0)
check('zero-payload-retention scenario 1', solve('zero-payload-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [2])
check('zero-payload-retention scenario 2', solve('zero-payload-retention', ([],[],[],True,2)), [])
check('zero-payload-retention scenario 3', solve('zero-payload-retention', ([('a','edit',0)],[],[],False,1)), [0])
check('zero-payload-retention scenario 4', solve('zero-payload-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [1,2])
check('zero-payload-retention scenario 5', solve('zero-payload-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('zero-payload-retention scenario 6', solve('zero-payload-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [2,3])
check('cancel-request-intersection scenario 1', solve('cancel-request-intersection', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['b'])
check('cancel-request-intersection scenario 2', solve('cancel-request-intersection', ([],[],[],True,2)), [])
check('cancel-request-intersection scenario 3', solve('cancel-request-intersection', ([('a','edit',0)],[],[],False,1)), [])
check('cancel-request-intersection scenario 4', solve('cancel-request-intersection', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('cancel-request-intersection scenario 5', solve('cancel-request-intersection', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a'])
check('cancel-request-intersection scenario 6', solve('cancel-request-intersection', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
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(operation, s):
    commands, cancelled, acknowledged, online, limit = s
    if operation == 'cancel-preserves-other-commands':
        return [x for x in commands if x[0] not in cancelled]
    if operation == 'ack-removes-by-identity':
        return [x for x in commands if x[0] not in acknowledged]
    if operation == 'offline-send-suppression':
        return commands[:limit] if online else []
    if operation == 'effective-backlog':
        return sum(x[0] not in acknowledged and x[0] not in cancelled for x in commands)
    if operation == 'create-before-edit-order':
        return [x[0] for x in commands]
    if operation == 'destructive-command-warning':
        return []
    if operation == 'unsent-tail-retention':
        return commands[limit:] if online else commands
    if operation == 'acknowledged-prefix-barrier':
        return next((i for i,x in enumerate(commands) if x[0] not in acknowledged),len(commands))
    if operation == 'zero-payload-retention':
        return [x[2] for x in commands if x[1]=='edit']
    if operation == 'cancel-request-intersection':
        return [x[0] for x in commands if x[0] in cancelled]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cancel-preserves-other-commands scenario 1', solve('cancel-preserves-other-commands', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('c','delete',0)])
check('cancel-preserves-other-commands scenario 2', solve('cancel-preserves-other-commands', ([],[],[],True,2)), [])
check('cancel-preserves-other-commands scenario 3', solve('cancel-preserves-other-commands', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('cancel-preserves-other-commands scenario 4', solve('cancel-preserves-other-commands', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('cancel-preserves-other-commands scenario 5', solve('cancel-preserves-other-commands', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('b','create',N)])
check('cancel-preserves-other-commands scenario 6', solve('cancel-preserves-other-commands', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('ack-removes-by-identity scenario 1', solve('ack-removes-by-identity', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('b','edit',2),('c','delete',0)])
check('ack-removes-by-identity scenario 2', solve('ack-removes-by-identity', ([],[],[],True,2)), [])
check('ack-removes-by-identity scenario 3', solve('ack-removes-by-identity', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('ack-removes-by-identity scenario 4', solve('ack-removes-by-identity', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('ack-removes-by-identity scenario 5', solve('ack-removes-by-identity', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('ack-removes-by-identity scenario 6', solve('ack-removes-by-identity', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('c','edit',3)])
check('offline-send-suppression scenario 1', solve('offline-send-suppression', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('b','edit',2)])
check('offline-send-suppression scenario 2', solve('offline-send-suppression', ([],[],[],True,2)), [])
check('offline-send-suppression scenario 3', solve('offline-send-suppression', ([('a','edit',0)],[],[],False,1)), [])
check('offline-send-suppression scenario 4', solve('offline-send-suppression', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1)])
check('offline-send-suppression scenario 5', solve('offline-send-suppression', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('offline-send-suppression scenario 6', solve('offline-send-suppression', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('effective-backlog scenario 1', solve('effective-backlog', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('effective-backlog scenario 2', solve('effective-backlog', ([],[],[],True,2)), 0)
check('effective-backlog scenario 3', solve('effective-backlog', ([('a','edit',0)],[],[],False,1)), 1)
check('effective-backlog scenario 4', solve('effective-backlog', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 2)
check('effective-backlog scenario 5', solve('effective-backlog', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 1)
check('effective-backlog scenario 6', solve('effective-backlog', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 2)
check('create-before-edit-order scenario 1', solve('create-before-edit-order', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['a','b','c'])
check('create-before-edit-order scenario 2', solve('create-before-edit-order', ([],[],[],True,2)), [])
check('create-before-edit-order scenario 3', solve('create-before-edit-order', ([('a','edit',0)],[],[],False,1)), ['a'])
check('create-before-edit-order scenario 4', solve('create-before-edit-order', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), ['a','b'])
check('create-before-edit-order scenario 5', solve('create-before-edit-order', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a','b'])
check('create-before-edit-order scenario 6', solve('create-before-edit-order', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), ['a','b','c'])
check('destructive-command-warning scenario 1', solve('destructive-command-warning', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['c'])
check('destructive-command-warning scenario 2', solve('destructive-command-warning', ([],[],[],True,2)), [])
check('destructive-command-warning scenario 3', solve('destructive-command-warning', ([('a','edit',0)],[],[],False,1)), [])
check('destructive-command-warning scenario 4', solve('destructive-command-warning', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('destructive-command-warning scenario 5', solve('destructive-command-warning', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('destructive-command-warning scenario 6', solve('destructive-command-warning', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('unsent-tail-retention scenario 1', solve('unsent-tail-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('c','delete',0)])
check('unsent-tail-retention scenario 2', solve('unsent-tail-retention', ([],[],[],True,2)), [])
check('unsent-tail-retention scenario 3', solve('unsent-tail-retention', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('unsent-tail-retention scenario 4', solve('unsent-tail-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('b','edit',2)])
check('unsent-tail-retention scenario 5', solve('unsent-tail-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('unsent-tail-retention scenario 6', solve('unsent-tail-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('acknowledged-prefix-barrier scenario 1', solve('acknowledged-prefix-barrier', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('acknowledged-prefix-barrier scenario 2', solve('acknowledged-prefix-barrier', ([],[],[],True,2)), 0)
check('acknowledged-prefix-barrier scenario 3', solve('acknowledged-prefix-barrier', ([('a','edit',0)],[],[],False,1)), 0)
check('acknowledged-prefix-barrier scenario 4', solve('acknowledged-prefix-barrier', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 0)
check('acknowledged-prefix-barrier scenario 5', solve('acknowledged-prefix-barrier', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 0)
check('acknowledged-prefix-barrier scenario 6', solve('acknowledged-prefix-barrier', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 0)
check('zero-payload-retention scenario 1', solve('zero-payload-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [2])
check('zero-payload-retention scenario 2', solve('zero-payload-retention', ([],[],[],True,2)), [])
check('zero-payload-retention scenario 3', solve('zero-payload-retention', ([('a','edit',0)],[],[],False,1)), [0])
check('zero-payload-retention scenario 4', solve('zero-payload-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [1,2])
check('zero-payload-retention scenario 5', solve('zero-payload-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('zero-payload-retention scenario 6', solve('zero-payload-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [2,3])
check('cancel-request-intersection scenario 1', solve('cancel-request-intersection', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['b'])
check('cancel-request-intersection scenario 2', solve('cancel-request-intersection', ([],[],[],True,2)), [])
check('cancel-request-intersection scenario 3', solve('cancel-request-intersection', ([('a','edit',0)],[],[],False,1)), [])
check('cancel-request-intersection scenario 4', solve('cancel-request-intersection', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('cancel-request-intersection scenario 5', solve('cancel-request-intersection', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a'])
check('cancel-request-intersection scenario 6', solve('cancel-request-intersection', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
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:
Destructive command warning.

The client outbox is an ordered UI mutation log; commands use identity, not payload truthiness. Cancellation/acknowledgment remove only matching commands, offline mode retains unsent work, and a zero send budget sends nothing. Operation destructive-command-warning has the six explicit input/output oracles below.

split: open-access


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

N = 1
observations = []
def solve(operation, s):
    commands, cancelled, acknowledged, online, limit = s
    if operation == 'cancel-preserves-other-commands':
        return [x for x in commands if x[0] not in cancelled]
    if operation == 'ack-removes-by-identity':
        return [x for x in commands if x[0] not in acknowledged]
    if operation == 'offline-send-suppression':
        return commands[:limit] if online else []
    if operation == 'effective-backlog':
        return sum(x[0] not in acknowledged and x[0] not in cancelled for x in commands)
    if operation == 'create-before-edit-order':
        return [x[0] for x in commands]
    if operation == 'destructive-command-warning':
        return [x[0] for x in commands if x[1]=='delete' and x[0] not in cancelled]
    if operation == 'unsent-tail-retention':
        return commands[limit:]
    if operation == 'acknowledged-prefix-barrier':
        return next((i for i,x in enumerate(commands) if x[0] not in acknowledged),len(commands))
    if operation == 'zero-payload-retention':
        return [x[2] for x in commands if x[1]=='edit']
    if operation == 'cancel-request-intersection':
        return [x[0] for x in commands if x[0] in cancelled]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cancel-preserves-other-commands scenario 1', solve('cancel-preserves-other-commands', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('c','delete',0)])
check('cancel-preserves-other-commands scenario 2', solve('cancel-preserves-other-commands', ([],[],[],True,2)), [])
check('cancel-preserves-other-commands scenario 3', solve('cancel-preserves-other-commands', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('cancel-preserves-other-commands scenario 4', solve('cancel-preserves-other-commands', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('cancel-preserves-other-commands scenario 5', solve('cancel-preserves-other-commands', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('b','create',N)])
check('cancel-preserves-other-commands scenario 6', solve('cancel-preserves-other-commands', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('ack-removes-by-identity scenario 1', solve('ack-removes-by-identity', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('b','edit',2),('c','delete',0)])
check('ack-removes-by-identity scenario 2', solve('ack-removes-by-identity', ([],[],[],True,2)), [])
check('ack-removes-by-identity scenario 3', solve('ack-removes-by-identity', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('ack-removes-by-identity scenario 4', solve('ack-removes-by-identity', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('ack-removes-by-identity scenario 5', solve('ack-removes-by-identity', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('ack-removes-by-identity scenario 6', solve('ack-removes-by-identity', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('c','edit',3)])
check('offline-send-suppression scenario 1', solve('offline-send-suppression', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('b','edit',2)])
check('offline-send-suppression scenario 2', solve('offline-send-suppression', ([],[],[],True,2)), [])
check('offline-send-suppression scenario 3', solve('offline-send-suppression', ([('a','edit',0)],[],[],False,1)), [])
check('offline-send-suppression scenario 4', solve('offline-send-suppression', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1)])
check('offline-send-suppression scenario 5', solve('offline-send-suppression', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('offline-send-suppression scenario 6', solve('offline-send-suppression', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('effective-backlog scenario 1', solve('effective-backlog', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('effective-backlog scenario 2', solve('effective-backlog', ([],[],[],True,2)), 0)
check('effective-backlog scenario 3', solve('effective-backlog', ([('a','edit',0)],[],[],False,1)), 1)
check('effective-backlog scenario 4', solve('effective-backlog', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 2)
check('effective-backlog scenario 5', solve('effective-backlog', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 1)
check('effective-backlog scenario 6', solve('effective-backlog', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 2)
check('create-before-edit-order scenario 1', solve('create-before-edit-order', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['a','b','c'])
check('create-before-edit-order scenario 2', solve('create-before-edit-order', ([],[],[],True,2)), [])
check('create-before-edit-order scenario 3', solve('create-before-edit-order', ([('a','edit',0)],[],[],False,1)), ['a'])
check('create-before-edit-order scenario 4', solve('create-before-edit-order', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), ['a','b'])
check('create-before-edit-order scenario 5', solve('create-before-edit-order', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a','b'])
check('create-before-edit-order scenario 6', solve('create-before-edit-order', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), ['a','b','c'])
check('destructive-command-warning scenario 1', solve('destructive-command-warning', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['c'])
check('destructive-command-warning scenario 2', solve('destructive-command-warning', ([],[],[],True,2)), [])
check('destructive-command-warning scenario 3', solve('destructive-command-warning', ([('a','edit',0)],[],[],False,1)), [])
check('destructive-command-warning scenario 4', solve('destructive-command-warning', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('destructive-command-warning scenario 5', solve('destructive-command-warning', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('destructive-command-warning scenario 6', solve('destructive-command-warning', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('unsent-tail-retention scenario 1', solve('unsent-tail-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('c','delete',0)])
check('unsent-tail-retention scenario 2', solve('unsent-tail-retention', ([],[],[],True,2)), [])
check('unsent-tail-retention scenario 3', solve('unsent-tail-retention', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('unsent-tail-retention scenario 4', solve('unsent-tail-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('b','edit',2)])
check('unsent-tail-retention scenario 5', solve('unsent-tail-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('unsent-tail-retention scenario 6', solve('unsent-tail-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('acknowledged-prefix-barrier scenario 1', solve('acknowledged-prefix-barrier', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('acknowledged-prefix-barrier scenario 2', solve('acknowledged-prefix-barrier', ([],[],[],True,2)), 0)
check('acknowledged-prefix-barrier scenario 3', solve('acknowledged-prefix-barrier', ([('a','edit',0)],[],[],False,1)), 0)
check('acknowledged-prefix-barrier scenario 4', solve('acknowledged-prefix-barrier', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 0)
check('acknowledged-prefix-barrier scenario 5', solve('acknowledged-prefix-barrier', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 0)
check('acknowledged-prefix-barrier scenario 6', solve('acknowledged-prefix-barrier', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 0)
check('zero-payload-retention scenario 1', solve('zero-payload-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [2])
check('zero-payload-retention scenario 2', solve('zero-payload-retention', ([],[],[],True,2)), [])
check('zero-payload-retention scenario 3', solve('zero-payload-retention', ([('a','edit',0)],[],[],False,1)), [0])
check('zero-payload-retention scenario 4', solve('zero-payload-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [1,2])
check('zero-payload-retention scenario 5', solve('zero-payload-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('zero-payload-retention scenario 6', solve('zero-payload-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [2,3])
check('cancel-request-intersection scenario 1', solve('cancel-request-intersection', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['b'])
check('cancel-request-intersection scenario 2', solve('cancel-request-intersection', ([],[],[],True,2)), [])
check('cancel-request-intersection scenario 3', solve('cancel-request-intersection', ([('a','edit',0)],[],[],False,1)), [])
check('cancel-request-intersection scenario 4', solve('cancel-request-intersection', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('cancel-request-intersection scenario 5', solve('cancel-request-intersection', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a'])
check('cancel-request-intersection scenario 6', solve('cancel-request-intersection', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
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(operation, s):
    commands, cancelled, acknowledged, online, limit = s
    if operation == 'cancel-preserves-other-commands':
        return [x for x in commands if x[0] not in cancelled]
    if operation == 'ack-removes-by-identity':
        return [x for x in commands if x[0] not in acknowledged]
    if operation == 'offline-send-suppression':
        return commands[:limit] if online else []
    if operation == 'effective-backlog':
        return sum(x[0] not in acknowledged and x[0] not in cancelled for x in commands)
    if operation == 'create-before-edit-order':
        return [x[0] for x in commands]
    if operation == 'destructive-command-warning':
        return [x[0] for x in commands if x[1]=='delete' and x[0] not in cancelled]
    if operation == 'unsent-tail-retention':
        return []
    if operation == 'acknowledged-prefix-barrier':
        return next((i for i,x in enumerate(commands) if x[0] not in acknowledged),len(commands))
    if operation == 'zero-payload-retention':
        return [x[2] for x in commands if x[1]=='edit']
    if operation == 'cancel-request-intersection':
        return [x[0] for x in commands if x[0] in cancelled]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cancel-preserves-other-commands scenario 1', solve('cancel-preserves-other-commands', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('c','delete',0)])
check('cancel-preserves-other-commands scenario 2', solve('cancel-preserves-other-commands', ([],[],[],True,2)), [])
check('cancel-preserves-other-commands scenario 3', solve('cancel-preserves-other-commands', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('cancel-preserves-other-commands scenario 4', solve('cancel-preserves-other-commands', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('cancel-preserves-other-commands scenario 5', solve('cancel-preserves-other-commands', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('b','create',N)])
check('cancel-preserves-other-commands scenario 6', solve('cancel-preserves-other-commands', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('ack-removes-by-identity scenario 1', solve('ack-removes-by-identity', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('b','edit',2),('c','delete',0)])
check('ack-removes-by-identity scenario 2', solve('ack-removes-by-identity', ([],[],[],True,2)), [])
check('ack-removes-by-identity scenario 3', solve('ack-removes-by-identity', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('ack-removes-by-identity scenario 4', solve('ack-removes-by-identity', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('ack-removes-by-identity scenario 5', solve('ack-removes-by-identity', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('ack-removes-by-identity scenario 6', solve('ack-removes-by-identity', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('c','edit',3)])
check('offline-send-suppression scenario 1', solve('offline-send-suppression', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('b','edit',2)])
check('offline-send-suppression scenario 2', solve('offline-send-suppression', ([],[],[],True,2)), [])
check('offline-send-suppression scenario 3', solve('offline-send-suppression', ([('a','edit',0)],[],[],False,1)), [])
check('offline-send-suppression scenario 4', solve('offline-send-suppression', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1)])
check('offline-send-suppression scenario 5', solve('offline-send-suppression', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('offline-send-suppression scenario 6', solve('offline-send-suppression', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('effective-backlog scenario 1', solve('effective-backlog', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('effective-backlog scenario 2', solve('effective-backlog', ([],[],[],True,2)), 0)
check('effective-backlog scenario 3', solve('effective-backlog', ([('a','edit',0)],[],[],False,1)), 1)
check('effective-backlog scenario 4', solve('effective-backlog', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 2)
check('effective-backlog scenario 5', solve('effective-backlog', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 1)
check('effective-backlog scenario 6', solve('effective-backlog', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 2)
check('create-before-edit-order scenario 1', solve('create-before-edit-order', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['a','b','c'])
check('create-before-edit-order scenario 2', solve('create-before-edit-order', ([],[],[],True,2)), [])
check('create-before-edit-order scenario 3', solve('create-before-edit-order', ([('a','edit',0)],[],[],False,1)), ['a'])
check('create-before-edit-order scenario 4', solve('create-before-edit-order', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), ['a','b'])
check('create-before-edit-order scenario 5', solve('create-before-edit-order', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a','b'])
check('create-before-edit-order scenario 6', solve('create-before-edit-order', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), ['a','b','c'])
check('destructive-command-warning scenario 1', solve('destructive-command-warning', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['c'])
check('destructive-command-warning scenario 2', solve('destructive-command-warning', ([],[],[],True,2)), [])
check('destructive-command-warning scenario 3', solve('destructive-command-warning', ([('a','edit',0)],[],[],False,1)), [])
check('destructive-command-warning scenario 4', solve('destructive-command-warning', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('destructive-command-warning scenario 5', solve('destructive-command-warning', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('destructive-command-warning scenario 6', solve('destructive-command-warning', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('unsent-tail-retention scenario 1', solve('unsent-tail-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('c','delete',0)])
check('unsent-tail-retention scenario 2', solve('unsent-tail-retention', ([],[],[],True,2)), [])
check('unsent-tail-retention scenario 3', solve('unsent-tail-retention', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('unsent-tail-retention scenario 4', solve('unsent-tail-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('b','edit',2)])
check('unsent-tail-retention scenario 5', solve('unsent-tail-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('unsent-tail-retention scenario 6', solve('unsent-tail-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('acknowledged-prefix-barrier scenario 1', solve('acknowledged-prefix-barrier', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('acknowledged-prefix-barrier scenario 2', solve('acknowledged-prefix-barrier', ([],[],[],True,2)), 0)
check('acknowledged-prefix-barrier scenario 3', solve('acknowledged-prefix-barrier', ([('a','edit',0)],[],[],False,1)), 0)
check('acknowledged-prefix-barrier scenario 4', solve('acknowledged-prefix-barrier', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 0)
check('acknowledged-prefix-barrier scenario 5', solve('acknowledged-prefix-barrier', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 0)
check('acknowledged-prefix-barrier scenario 6', solve('acknowledged-prefix-barrier', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 0)
check('zero-payload-retention scenario 1', solve('zero-payload-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [2])
check('zero-payload-retention scenario 2', solve('zero-payload-retention', ([],[],[],True,2)), [])
check('zero-payload-retention scenario 3', solve('zero-payload-retention', ([('a','edit',0)],[],[],False,1)), [0])
check('zero-payload-retention scenario 4', solve('zero-payload-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [1,2])
check('zero-payload-retention scenario 5', solve('zero-payload-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('zero-payload-retention scenario 6', solve('zero-payload-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [2,3])
check('cancel-request-intersection scenario 1', solve('cancel-request-intersection', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['b'])
check('cancel-request-intersection scenario 2', solve('cancel-request-intersection', ([],[],[],True,2)), [])
check('cancel-request-intersection scenario 3', solve('cancel-request-intersection', ([('a','edit',0)],[],[],False,1)), [])
check('cancel-request-intersection scenario 4', solve('cancel-request-intersection', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('cancel-request-intersection scenario 5', solve('cancel-request-intersection', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a'])
check('cancel-request-intersection scenario 6', solve('cancel-request-intersection', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
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:
Unsent tail retention.

The client outbox is an ordered UI mutation log; commands use identity, not payload truthiness. Cancellation/acknowledgment remove only matching commands, offline mode retains unsent work, and a zero send budget sends nothing. Operation unsent-tail-retention has the six explicit input/output oracles below.

split: open-access


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

N = 1
observations = []
def solve(operation, s):
    commands, cancelled, acknowledged, online, limit = s
    if operation == 'cancel-preserves-other-commands':
        return [x for x in commands if x[0] not in cancelled]
    if operation == 'ack-removes-by-identity':
        return [x for x in commands if x[0] not in acknowledged]
    if operation == 'offline-send-suppression':
        return commands[:limit] if online else []
    if operation == 'effective-backlog':
        return sum(x[0] not in acknowledged and x[0] not in cancelled for x in commands)
    if operation == 'create-before-edit-order':
        return [x[0] for x in commands]
    if operation == 'destructive-command-warning':
        return [x[0] for x in commands if x[1]=='delete' and x[0] not in cancelled]
    if operation == 'unsent-tail-retention':
        return commands[limit:] if online else commands
    if operation == 'acknowledged-prefix-barrier':
        return len(acknowledged)
    if operation == 'zero-payload-retention':
        return [x[2] for x in commands if x[1]=='edit']
    if operation == 'cancel-request-intersection':
        return [x[0] for x in commands if x[0] in cancelled]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cancel-preserves-other-commands scenario 1', solve('cancel-preserves-other-commands', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('c','delete',0)])
check('cancel-preserves-other-commands scenario 2', solve('cancel-preserves-other-commands', ([],[],[],True,2)), [])
check('cancel-preserves-other-commands scenario 3', solve('cancel-preserves-other-commands', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('cancel-preserves-other-commands scenario 4', solve('cancel-preserves-other-commands', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('cancel-preserves-other-commands scenario 5', solve('cancel-preserves-other-commands', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('b','create',N)])
check('cancel-preserves-other-commands scenario 6', solve('cancel-preserves-other-commands', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('ack-removes-by-identity scenario 1', solve('ack-removes-by-identity', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('b','edit',2),('c','delete',0)])
check('ack-removes-by-identity scenario 2', solve('ack-removes-by-identity', ([],[],[],True,2)), [])
check('ack-removes-by-identity scenario 3', solve('ack-removes-by-identity', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('ack-removes-by-identity scenario 4', solve('ack-removes-by-identity', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('ack-removes-by-identity scenario 5', solve('ack-removes-by-identity', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('ack-removes-by-identity scenario 6', solve('ack-removes-by-identity', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('c','edit',3)])
check('offline-send-suppression scenario 1', solve('offline-send-suppression', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('b','edit',2)])
check('offline-send-suppression scenario 2', solve('offline-send-suppression', ([],[],[],True,2)), [])
check('offline-send-suppression scenario 3', solve('offline-send-suppression', ([('a','edit',0)],[],[],False,1)), [])
check('offline-send-suppression scenario 4', solve('offline-send-suppression', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1)])
check('offline-send-suppression scenario 5', solve('offline-send-suppression', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('offline-send-suppression scenario 6', solve('offline-send-suppression', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('effective-backlog scenario 1', solve('effective-backlog', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('effective-backlog scenario 2', solve('effective-backlog', ([],[],[],True,2)), 0)
check('effective-backlog scenario 3', solve('effective-backlog', ([('a','edit',0)],[],[],False,1)), 1)
check('effective-backlog scenario 4', solve('effective-backlog', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 2)
check('effective-backlog scenario 5', solve('effective-backlog', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 1)
check('effective-backlog scenario 6', solve('effective-backlog', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 2)
check('create-before-edit-order scenario 1', solve('create-before-edit-order', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['a','b','c'])
check('create-before-edit-order scenario 2', solve('create-before-edit-order', ([],[],[],True,2)), [])
check('create-before-edit-order scenario 3', solve('create-before-edit-order', ([('a','edit',0)],[],[],False,1)), ['a'])
check('create-before-edit-order scenario 4', solve('create-before-edit-order', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), ['a','b'])
check('create-before-edit-order scenario 5', solve('create-before-edit-order', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a','b'])
check('create-before-edit-order scenario 6', solve('create-before-edit-order', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), ['a','b','c'])
check('destructive-command-warning scenario 1', solve('destructive-command-warning', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['c'])
check('destructive-command-warning scenario 2', solve('destructive-command-warning', ([],[],[],True,2)), [])
check('destructive-command-warning scenario 3', solve('destructive-command-warning', ([('a','edit',0)],[],[],False,1)), [])
check('destructive-command-warning scenario 4', solve('destructive-command-warning', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('destructive-command-warning scenario 5', solve('destructive-command-warning', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('destructive-command-warning scenario 6', solve('destructive-command-warning', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('unsent-tail-retention scenario 1', solve('unsent-tail-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('c','delete',0)])
check('unsent-tail-retention scenario 2', solve('unsent-tail-retention', ([],[],[],True,2)), [])
check('unsent-tail-retention scenario 3', solve('unsent-tail-retention', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('unsent-tail-retention scenario 4', solve('unsent-tail-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('b','edit',2)])
check('unsent-tail-retention scenario 5', solve('unsent-tail-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('unsent-tail-retention scenario 6', solve('unsent-tail-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('acknowledged-prefix-barrier scenario 1', solve('acknowledged-prefix-barrier', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('acknowledged-prefix-barrier scenario 2', solve('acknowledged-prefix-barrier', ([],[],[],True,2)), 0)
check('acknowledged-prefix-barrier scenario 3', solve('acknowledged-prefix-barrier', ([('a','edit',0)],[],[],False,1)), 0)
check('acknowledged-prefix-barrier scenario 4', solve('acknowledged-prefix-barrier', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 0)
check('acknowledged-prefix-barrier scenario 5', solve('acknowledged-prefix-barrier', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 0)
check('acknowledged-prefix-barrier scenario 6', solve('acknowledged-prefix-barrier', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 0)
check('zero-payload-retention scenario 1', solve('zero-payload-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [2])
check('zero-payload-retention scenario 2', solve('zero-payload-retention', ([],[],[],True,2)), [])
check('zero-payload-retention scenario 3', solve('zero-payload-retention', ([('a','edit',0)],[],[],False,1)), [0])
check('zero-payload-retention scenario 4', solve('zero-payload-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [1,2])
check('zero-payload-retention scenario 5', solve('zero-payload-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('zero-payload-retention scenario 6', solve('zero-payload-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [2,3])
check('cancel-request-intersection scenario 1', solve('cancel-request-intersection', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['b'])
check('cancel-request-intersection scenario 2', solve('cancel-request-intersection', ([],[],[],True,2)), [])
check('cancel-request-intersection scenario 3', solve('cancel-request-intersection', ([('a','edit',0)],[],[],False,1)), [])
check('cancel-request-intersection scenario 4', solve('cancel-request-intersection', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('cancel-request-intersection scenario 5', solve('cancel-request-intersection', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a'])
check('cancel-request-intersection scenario 6', solve('cancel-request-intersection', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
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(operation, s):
    commands, cancelled, acknowledged, online, limit = s
    if operation == 'cancel-preserves-other-commands':
        return [x for x in commands if x[0] not in cancelled]
    if operation == 'ack-removes-by-identity':
        return [x for x in commands if x[0] not in acknowledged]
    if operation == 'offline-send-suppression':
        return commands[:limit] if online else []
    if operation == 'effective-backlog':
        return sum(x[0] not in acknowledged and x[0] not in cancelled for x in commands)
    if operation == 'create-before-edit-order':
        return [x[0] for x in commands]
    if operation == 'destructive-command-warning':
        return [x[0] for x in commands if x[1]=='delete' and x[0] not in cancelled]
    if operation == 'unsent-tail-retention':
        return commands[limit:] if online else commands
    if operation == 'acknowledged-prefix-barrier':
        return sum(x[0] in acknowledged for x in commands)
    if operation == 'zero-payload-retention':
        return [x[2] for x in commands if x[1]=='edit']
    if operation == 'cancel-request-intersection':
        return [x[0] for x in commands if x[0] in cancelled]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cancel-preserves-other-commands scenario 1', solve('cancel-preserves-other-commands', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('c','delete',0)])
check('cancel-preserves-other-commands scenario 2', solve('cancel-preserves-other-commands', ([],[],[],True,2)), [])
check('cancel-preserves-other-commands scenario 3', solve('cancel-preserves-other-commands', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('cancel-preserves-other-commands scenario 4', solve('cancel-preserves-other-commands', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('cancel-preserves-other-commands scenario 5', solve('cancel-preserves-other-commands', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('b','create',N)])
check('cancel-preserves-other-commands scenario 6', solve('cancel-preserves-other-commands', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('ack-removes-by-identity scenario 1', solve('ack-removes-by-identity', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('b','edit',2),('c','delete',0)])
check('ack-removes-by-identity scenario 2', solve('ack-removes-by-identity', ([],[],[],True,2)), [])
check('ack-removes-by-identity scenario 3', solve('ack-removes-by-identity', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('ack-removes-by-identity scenario 4', solve('ack-removes-by-identity', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1),('b','edit',2)])
check('ack-removes-by-identity scenario 5', solve('ack-removes-by-identity', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('ack-removes-by-identity scenario 6', solve('ack-removes-by-identity', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('c','edit',3)])
check('offline-send-suppression scenario 1', solve('offline-send-suppression', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('a','create',N),('b','edit',2)])
check('offline-send-suppression scenario 2', solve('offline-send-suppression', ([],[],[],True,2)), [])
check('offline-send-suppression scenario 3', solve('offline-send-suppression', ([('a','edit',0)],[],[],False,1)), [])
check('offline-send-suppression scenario 4', solve('offline-send-suppression', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('a','edit',1)])
check('offline-send-suppression scenario 5', solve('offline-send-suppression', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('offline-send-suppression scenario 6', solve('offline-send-suppression', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [('a','create',1),('b','edit',2),('c','edit',3)])
check('effective-backlog scenario 1', solve('effective-backlog', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('effective-backlog scenario 2', solve('effective-backlog', ([],[],[],True,2)), 0)
check('effective-backlog scenario 3', solve('effective-backlog', ([('a','edit',0)],[],[],False,1)), 1)
check('effective-backlog scenario 4', solve('effective-backlog', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 2)
check('effective-backlog scenario 5', solve('effective-backlog', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 1)
check('effective-backlog scenario 6', solve('effective-backlog', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 2)
check('create-before-edit-order scenario 1', solve('create-before-edit-order', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['a','b','c'])
check('create-before-edit-order scenario 2', solve('create-before-edit-order', ([],[],[],True,2)), [])
check('create-before-edit-order scenario 3', solve('create-before-edit-order', ([('a','edit',0)],[],[],False,1)), ['a'])
check('create-before-edit-order scenario 4', solve('create-before-edit-order', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), ['a','b'])
check('create-before-edit-order scenario 5', solve('create-before-edit-order', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a','b'])
check('create-before-edit-order scenario 6', solve('create-before-edit-order', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), ['a','b','c'])
check('destructive-command-warning scenario 1', solve('destructive-command-warning', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['c'])
check('destructive-command-warning scenario 2', solve('destructive-command-warning', ([],[],[],True,2)), [])
check('destructive-command-warning scenario 3', solve('destructive-command-warning', ([('a','edit',0)],[],[],False,1)), [])
check('destructive-command-warning scenario 4', solve('destructive-command-warning', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('destructive-command-warning scenario 5', solve('destructive-command-warning', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('destructive-command-warning scenario 6', solve('destructive-command-warning', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('unsent-tail-retention scenario 1', solve('unsent-tail-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [('c','delete',0)])
check('unsent-tail-retention scenario 2', solve('unsent-tail-retention', ([],[],[],True,2)), [])
check('unsent-tail-retention scenario 3', solve('unsent-tail-retention', ([('a','edit',0)],[],[],False,1)), [('a','edit',0)])
check('unsent-tail-retention scenario 4', solve('unsent-tail-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [('b','edit',2)])
check('unsent-tail-retention scenario 5', solve('unsent-tail-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [('a','delete',0),('b','create',N)])
check('unsent-tail-retention scenario 6', solve('unsent-tail-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
check('acknowledged-prefix-barrier scenario 1', solve('acknowledged-prefix-barrier', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), 1)
check('acknowledged-prefix-barrier scenario 2', solve('acknowledged-prefix-barrier', ([],[],[],True,2)), 0)
check('acknowledged-prefix-barrier scenario 3', solve('acknowledged-prefix-barrier', ([('a','edit',0)],[],[],False,1)), 0)
check('acknowledged-prefix-barrier scenario 4', solve('acknowledged-prefix-barrier', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), 0)
check('acknowledged-prefix-barrier scenario 5', solve('acknowledged-prefix-barrier', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), 0)
check('acknowledged-prefix-barrier scenario 6', solve('acknowledged-prefix-barrier', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), 0)
check('zero-payload-retention scenario 1', solve('zero-payload-retention', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), [2])
check('zero-payload-retention scenario 2', solve('zero-payload-retention', ([],[],[],True,2)), [])
check('zero-payload-retention scenario 3', solve('zero-payload-retention', ([('a','edit',0)],[],[],False,1)), [0])
check('zero-payload-retention scenario 4', solve('zero-payload-retention', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [1,2])
check('zero-payload-retention scenario 5', solve('zero-payload-retention', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), [])
check('zero-payload-retention scenario 6', solve('zero-payload-retention', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [2,3])
check('cancel-request-intersection scenario 1', solve('cancel-request-intersection', ([('a','create',N),('b','edit',2),('c','delete',0)],['b'],['a'],True,2)), ['b'])
check('cancel-request-intersection scenario 2', solve('cancel-request-intersection', ([],[],[],True,2)), [])
check('cancel-request-intersection scenario 3', solve('cancel-request-intersection', ([('a','edit',0)],[],[],False,1)), [])
check('cancel-request-intersection scenario 4', solve('cancel-request-intersection', ([('a','edit',1),('b','edit',2)],['x'],[],True,1)), [])
check('cancel-request-intersection scenario 5', solve('cancel-request-intersection', ([('a','delete',0),('b','create',N)],['a'],['x'],True,0)), ['a'])
check('cancel-request-intersection scenario 6', solve('cancel-request-intersection', ([('a','create',1),('b','edit',2),('c','edit',3)],[],['b'],True,5)), [])
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:
Acknowledged prefix barrier.

The client outbox is an ordered UI mutation log; commands use identity, not payload truthiness. Cancellation/acknowledgment remove only matching commands, offline mode retains unsent work, and a zero send budget sends nothing. Operation acknowledged-prefix-barrier has the six explicit input/output oracles below.

split: open-access