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 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' and x[2]]
    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 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 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:
Zero payload 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 zero-payload-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 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 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 [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][:0]
    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:
Cancel request intersection.

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 cancel-request-intersection 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):
    sizes, accepted, sent, cancelled, status, preview, attached = s
    if operation == 'accepted-progress-not-sent':
        return sum(sizes[i] for i in sent)
    if operation == 'remaining-local-parts':
        return [i for i in range(len(sizes)) if i not in accepted]
    if operation == 'cancel-overrides-upload-status':
        return 'cancelled' if cancelled else status
    if operation == 'preview-revoke-on-detach':
        return preview if not attached and preview is not None else None
    if operation == 'zero-size-part-completion':
        return len(accepted)==len(sizes)
    if operation == 'inflight-abort-handles':
        return [i for i in sent if i not in accepted] if cancelled else []
    if operation == 'retry-eligible-parts':
        return [i for i in range(len(sizes)) if i not in accepted] if status=='failed' and not cancelled else []
    if operation == 'sent-vs-accepted-indicator':
        return len(sent)-len(accepted)
    if operation == 'terminal-task-retention':
        return attached or status not in ('done','failed') and not cancelled
    if operation == 'preview-while-incomplete':
        return preview if attached else None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('accepted-progress-not-sent scenario 1', solve('accepted-progress-not-sent', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), N)
check('accepted-progress-not-sent scenario 2', solve('accepted-progress-not-sent', ([],[],[],False,'done',None,False)), 0)
check('accepted-progress-not-sent scenario 3', solve('accepted-progress-not-sent', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 2)
check('accepted-progress-not-sent scenario 4', solve('accepted-progress-not-sent', ([2,3],[],[0],True,'uploading','blob:c',False)), 0)
check('accepted-progress-not-sent scenario 5', solve('accepted-progress-not-sent', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 3)
check('accepted-progress-not-sent scenario 6', solve('accepted-progress-not-sent', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 5)
check('remaining-local-parts scenario 1', solve('remaining-local-parts', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), [1,2])
check('remaining-local-parts scenario 2', solve('remaining-local-parts', ([],[],[],False,'done',None,False)), [])
check('remaining-local-parts scenario 3', solve('remaining-local-parts', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), [])
check('remaining-local-parts scenario 4', solve('remaining-local-parts', ([2,3],[],[0],True,'uploading','blob:c',False)), [0,1])
check('remaining-local-parts scenario 5', solve('remaining-local-parts', ([2,3],[1],[0,1],False,'failed','blob:d',True)), [0])
check('remaining-local-parts scenario 6', solve('remaining-local-parts', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), [])
check('cancel-overrides-upload-status scenario 1', solve('cancel-overrides-upload-status', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), 'uploading')
check('cancel-overrides-upload-status scenario 2', solve('cancel-overrides-upload-status', ([],[],[],False,'done',None,False)), 'done')
check('cancel-overrides-upload-status scenario 3', solve('cancel-overrides-upload-status', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 'done')
check('cancel-overrides-upload-status scenario 4', solve('cancel-overrides-upload-status', ([2,3],[],[0],True,'uploading','blob:c',False)), 'cancelled')
check('cancel-overrides-upload-status scenario 5', solve('cancel-overrides-upload-status', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 'failed')
check('cancel-overrides-upload-status scenario 6', solve('cancel-overrides-upload-status', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 'done')
check('preview-revoke-on-detach scenario 1', solve('preview-revoke-on-detach', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), None)
check('preview-revoke-on-detach scenario 2', solve('preview-revoke-on-detach', ([],[],[],False,'done',None,False)), None)
check('preview-revoke-on-detach scenario 3', solve('preview-revoke-on-detach', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), None)
check('preview-revoke-on-detach scenario 4', solve('preview-revoke-on-detach', ([2,3],[],[0],True,'uploading','blob:c',False)), 'blob:c')
check('preview-revoke-on-detach scenario 5', solve('preview-revoke-on-detach', ([2,3],[1],[0,1],False,'failed','blob:d',True)), None)
check('preview-revoke-on-detach scenario 6', solve('preview-revoke-on-detach', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 'blob:e')
check('zero-size-part-completion scenario 1', solve('zero-size-part-completion', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), False)
check('zero-size-part-completion scenario 2', solve('zero-size-part-completion', ([],[],[],False,'done',None,False)), True)
check('zero-size-part-completion scenario 3', solve('zero-size-part-completion', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), True)
check('zero-size-part-completion scenario 4', solve('zero-size-part-completion', ([2,3],[],[0],True,'uploading','blob:c',False)), False)
check('zero-size-part-completion scenario 5', solve('zero-size-part-completion', ([2,3],[1],[0,1],False,'failed','blob:d',True)), False)
check('zero-size-part-completion scenario 6', solve('zero-size-part-completion', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), True)
check('inflight-abort-handles scenario 1', solve('inflight-abort-handles', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), [])
check('inflight-abort-handles scenario 2', solve('inflight-abort-handles', ([],[],[],False,'done',None,False)), [])
check('inflight-abort-handles scenario 3', solve('inflight-abort-handles', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), [])
check('inflight-abort-handles scenario 4', solve('inflight-abort-handles', ([2,3],[],[0],True,'uploading','blob:c',False)), [0])
check('inflight-abort-handles scenario 5', solve('inflight-abort-handles', ([2,3],[1],[0,1],False,'failed','blob:d',True)), [])
check('inflight-abort-handles scenario 6', solve('inflight-abort-handles', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), [])
check('retry-eligible-parts scenario 1', solve('retry-eligible-parts', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), [])
check('retry-eligible-parts scenario 2', solve('retry-eligible-parts', ([],[],[],False,'done',None,False)), [])
check('retry-eligible-parts scenario 3', solve('retry-eligible-parts', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), [])
check('retry-eligible-parts scenario 4', solve('retry-eligible-parts', ([2,3],[],[0],True,'uploading','blob:c',False)), [])
check('retry-eligible-parts scenario 5', solve('retry-eligible-parts', ([2,3],[1],[0,1],False,'failed','blob:d',True)), [0])
check('retry-eligible-parts scenario 6', solve('retry-eligible-parts', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), [])
check('sent-vs-accepted-indicator scenario 1', solve('sent-vs-accepted-indicator', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), 1)
check('sent-vs-accepted-indicator scenario 2', solve('sent-vs-accepted-indicator', ([],[],[],False,'done',None,False)), 0)
check('sent-vs-accepted-indicator scenario 3', solve('sent-vs-accepted-indicator', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 0)
check('sent-vs-accepted-indicator scenario 4', solve('sent-vs-accepted-indicator', ([2,3],[],[0],True,'uploading','blob:c',False)), 1)
check('sent-vs-accepted-indicator scenario 5', solve('sent-vs-accepted-indicator', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 1)
check('sent-vs-accepted-indicator scenario 6', solve('sent-vs-accepted-indicator', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 0)
check('terminal-task-retention scenario 1', solve('terminal-task-retention', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), True)
check('terminal-task-retention scenario 2', solve('terminal-task-retention', ([],[],[],False,'done',None,False)), False)
check('terminal-task-retention scenario 3', solve('terminal-task-retention', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), True)
check('terminal-task-retention scenario 4', solve('terminal-task-retention', ([2,3],[],[0],True,'uploading','blob:c',False)), False)
check('terminal-task-retention scenario 5', solve('terminal-task-retention', ([2,3],[1],[0,1],False,'failed','blob:d',True)), True)
check('terminal-task-retention scenario 6', solve('terminal-task-retention', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), False)
check('preview-while-incomplete scenario 1', solve('preview-while-incomplete', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), 'blob:a')
check('preview-while-incomplete scenario 2', solve('preview-while-incomplete', ([],[],[],False,'done',None,False)), None)
check('preview-while-incomplete scenario 3', solve('preview-while-incomplete', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 'blob:b')
check('preview-while-incomplete scenario 4', solve('preview-while-incomplete', ([2,3],[],[0],True,'uploading','blob:c',False)), None)
check('preview-while-incomplete scenario 5', solve('preview-while-incomplete', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 'blob:d')
check('preview-while-incomplete scenario 6', solve('preview-while-incomplete', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), None)
check('cancel after one accepted and two inflight parts: accepted-progress-not-sent', solve('accepted-progress-not-sent', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 2)
check('cancel after one accepted and two inflight parts: remaining-local-parts', solve('remaining-local-parts', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), [1,2])
check('cancel after one accepted and two inflight parts: cancel-overrides-upload-status', solve('cancel-overrides-upload-status', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 'cancelled')
check('cancel after one accepted and two inflight parts: preview-revoke-on-detach', solve('preview-revoke-on-detach', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 'blob:z')
check('cancel after one accepted and two inflight parts: zero-size-part-completion', solve('zero-size-part-completion', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), False)
check('cancel after one accepted and two inflight parts: inflight-abort-handles', solve('inflight-abort-handles', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), [1,2])
check('cancel after one accepted and two inflight parts: retry-eligible-parts', solve('retry-eligible-parts', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), [])
check('cancel after one accepted and two inflight parts: sent-vs-accepted-indicator', solve('sent-vs-accepted-indicator', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 2)
check('cancel after one accepted and two inflight parts: terminal-task-retention', solve('terminal-task-retention', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), False)
check('cancel after one accepted and two inflight parts: preview-while-incomplete', solve('preview-while-incomplete', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), None)
check('background upload survives detached preview: accepted-progress-not-sent', solve('accepted-progress-not-sent', ([N],[],[],False,'uploading',None,False)), 0)
check('background upload survives detached preview: remaining-local-parts', solve('remaining-local-parts', ([N],[],[],False,'uploading',None,False)), [0])
check('background upload survives detached preview: cancel-overrides-upload-status', solve('cancel-overrides-upload-status', ([N],[],[],False,'uploading',None,False)), 'uploading')
check('background upload survives detached preview: preview-revoke-on-detach', solve('preview-revoke-on-detach', ([N],[],[],False,'uploading',None,False)), None)
check('background upload survives detached preview: zero-size-part-completion', solve('zero-size-part-completion', ([N],[],[],False,'uploading',None,False)), False)
check('background upload survives detached preview: inflight-abort-handles', solve('inflight-abort-handles', ([N],[],[],False,'uploading',None,False)), [])
check('background upload survives detached preview: retry-eligible-parts', solve('retry-eligible-parts', ([N],[],[],False,'uploading',None,False)), [])
check('background upload survives detached preview: sent-vs-accepted-indicator', solve('sent-vs-accepted-indicator', ([N],[],[],False,'uploading',None,False)), 0)
check('background upload survives detached preview: terminal-task-retention', solve('terminal-task-retention', ([N],[],[],False,'uploading',None,False)), True)
check('background upload survives detached preview: preview-while-incomplete', solve('preview-while-incomplete', ([N],[],[],False,'uploading',None,False)), None)
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):
    sizes, accepted, sent, cancelled, status, preview, attached = s
    if operation == 'accepted-progress-not-sent':
        return len(accepted)
    if operation == 'remaining-local-parts':
        return [i for i in range(len(sizes)) if i not in accepted]
    if operation == 'cancel-overrides-upload-status':
        return 'cancelled' if cancelled else status
    if operation == 'preview-revoke-on-detach':
        return preview if not attached and preview is not None else None
    if operation == 'zero-size-part-completion':
        return len(accepted)==len(sizes)
    if operation == 'inflight-abort-handles':
        return [i for i in sent if i not in accepted] if cancelled else []
    if operation == 'retry-eligible-parts':
        return [i for i in range(len(sizes)) if i not in accepted] if status=='failed' and not cancelled else []
    if operation == 'sent-vs-accepted-indicator':
        return len(sent)-len(accepted)
    if operation == 'terminal-task-retention':
        return attached or status not in ('done','failed') and not cancelled
    if operation == 'preview-while-incomplete':
        return preview if attached else None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('accepted-progress-not-sent scenario 1', solve('accepted-progress-not-sent', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), N)
check('accepted-progress-not-sent scenario 2', solve('accepted-progress-not-sent', ([],[],[],False,'done',None,False)), 0)
check('accepted-progress-not-sent scenario 3', solve('accepted-progress-not-sent', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 2)
check('accepted-progress-not-sent scenario 4', solve('accepted-progress-not-sent', ([2,3],[],[0],True,'uploading','blob:c',False)), 0)
check('accepted-progress-not-sent scenario 5', solve('accepted-progress-not-sent', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 3)
check('accepted-progress-not-sent scenario 6', solve('accepted-progress-not-sent', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 5)
check('remaining-local-parts scenario 1', solve('remaining-local-parts', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), [1,2])
check('remaining-local-parts scenario 2', solve('remaining-local-parts', ([],[],[],False,'done',None,False)), [])
check('remaining-local-parts scenario 3', solve('remaining-local-parts', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), [])
check('remaining-local-parts scenario 4', solve('remaining-local-parts', ([2,3],[],[0],True,'uploading','blob:c',False)), [0,1])
check('remaining-local-parts scenario 5', solve('remaining-local-parts', ([2,3],[1],[0,1],False,'failed','blob:d',True)), [0])
check('remaining-local-parts scenario 6', solve('remaining-local-parts', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), [])
check('cancel-overrides-upload-status scenario 1', solve('cancel-overrides-upload-status', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), 'uploading')
check('cancel-overrides-upload-status scenario 2', solve('cancel-overrides-upload-status', ([],[],[],False,'done',None,False)), 'done')
check('cancel-overrides-upload-status scenario 3', solve('cancel-overrides-upload-status', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 'done')
check('cancel-overrides-upload-status scenario 4', solve('cancel-overrides-upload-status', ([2,3],[],[0],True,'uploading','blob:c',False)), 'cancelled')
check('cancel-overrides-upload-status scenario 5', solve('cancel-overrides-upload-status', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 'failed')
check('cancel-overrides-upload-status scenario 6', solve('cancel-overrides-upload-status', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 'done')
check('preview-revoke-on-detach scenario 1', solve('preview-revoke-on-detach', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), None)
check('preview-revoke-on-detach scenario 2', solve('preview-revoke-on-detach', ([],[],[],False,'done',None,False)), None)
check('preview-revoke-on-detach scenario 3', solve('preview-revoke-on-detach', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), None)
check('preview-revoke-on-detach scenario 4', solve('preview-revoke-on-detach', ([2,3],[],[0],True,'uploading','blob:c',False)), 'blob:c')
check('preview-revoke-on-detach scenario 5', solve('preview-revoke-on-detach', ([2,3],[1],[0,1],False,'failed','blob:d',True)), None)
check('preview-revoke-on-detach scenario 6', solve('preview-revoke-on-detach', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 'blob:e')
check('zero-size-part-completion scenario 1', solve('zero-size-part-completion', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), False)
check('zero-size-part-completion scenario 2', solve('zero-size-part-completion', ([],[],[],False,'done',None,False)), True)
check('zero-size-part-completion scenario 3', solve('zero-size-part-completion', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), True)
check('zero-size-part-completion scenario 4', solve('zero-size-part-completion', ([2,3],[],[0],True,'uploading','blob:c',False)), False)
check('zero-size-part-completion scenario 5', solve('zero-size-part-completion', ([2,3],[1],[0,1],False,'failed','blob:d',True)), False)
check('zero-size-part-completion scenario 6', solve('zero-size-part-completion', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), True)
check('inflight-abort-handles scenario 1', solve('inflight-abort-handles', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), [])
check('inflight-abort-handles scenario 2', solve('inflight-abort-handles', ([],[],[],False,'done',None,False)), [])
check('inflight-abort-handles scenario 3', solve('inflight-abort-handles', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), [])
check('inflight-abort-handles scenario 4', solve('inflight-abort-handles', ([2,3],[],[0],True,'uploading','blob:c',False)), [0])
check('inflight-abort-handles scenario 5', solve('inflight-abort-handles', ([2,3],[1],[0,1],False,'failed','blob:d',True)), [])
check('inflight-abort-handles scenario 6', solve('inflight-abort-handles', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), [])
check('retry-eligible-parts scenario 1', solve('retry-eligible-parts', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), [])
check('retry-eligible-parts scenario 2', solve('retry-eligible-parts', ([],[],[],False,'done',None,False)), [])
check('retry-eligible-parts scenario 3', solve('retry-eligible-parts', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), [])
check('retry-eligible-parts scenario 4', solve('retry-eligible-parts', ([2,3],[],[0],True,'uploading','blob:c',False)), [])
check('retry-eligible-parts scenario 5', solve('retry-eligible-parts', ([2,3],[1],[0,1],False,'failed','blob:d',True)), [0])
check('retry-eligible-parts scenario 6', solve('retry-eligible-parts', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), [])
check('sent-vs-accepted-indicator scenario 1', solve('sent-vs-accepted-indicator', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), 1)
check('sent-vs-accepted-indicator scenario 2', solve('sent-vs-accepted-indicator', ([],[],[],False,'done',None,False)), 0)
check('sent-vs-accepted-indicator scenario 3', solve('sent-vs-accepted-indicator', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 0)
check('sent-vs-accepted-indicator scenario 4', solve('sent-vs-accepted-indicator', ([2,3],[],[0],True,'uploading','blob:c',False)), 1)
check('sent-vs-accepted-indicator scenario 5', solve('sent-vs-accepted-indicator', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 1)
check('sent-vs-accepted-indicator scenario 6', solve('sent-vs-accepted-indicator', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 0)
check('terminal-task-retention scenario 1', solve('terminal-task-retention', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), True)
check('terminal-task-retention scenario 2', solve('terminal-task-retention', ([],[],[],False,'done',None,False)), False)
check('terminal-task-retention scenario 3', solve('terminal-task-retention', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), True)
check('terminal-task-retention scenario 4', solve('terminal-task-retention', ([2,3],[],[0],True,'uploading','blob:c',False)), False)
check('terminal-task-retention scenario 5', solve('terminal-task-retention', ([2,3],[1],[0,1],False,'failed','blob:d',True)), True)
check('terminal-task-retention scenario 6', solve('terminal-task-retention', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), False)
check('preview-while-incomplete scenario 1', solve('preview-while-incomplete', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), 'blob:a')
check('preview-while-incomplete scenario 2', solve('preview-while-incomplete', ([],[],[],False,'done',None,False)), None)
check('preview-while-incomplete scenario 3', solve('preview-while-incomplete', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 'blob:b')
check('preview-while-incomplete scenario 4', solve('preview-while-incomplete', ([2,3],[],[0],True,'uploading','blob:c',False)), None)
check('preview-while-incomplete scenario 5', solve('preview-while-incomplete', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 'blob:d')
check('preview-while-incomplete scenario 6', solve('preview-while-incomplete', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), None)
check('cancel after one accepted and two inflight parts: accepted-progress-not-sent', solve('accepted-progress-not-sent', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 2)
check('cancel after one accepted and two inflight parts: remaining-local-parts', solve('remaining-local-parts', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), [1,2])
check('cancel after one accepted and two inflight parts: cancel-overrides-upload-status', solve('cancel-overrides-upload-status', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 'cancelled')
check('cancel after one accepted and two inflight parts: preview-revoke-on-detach', solve('preview-revoke-on-detach', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 'blob:z')
check('cancel after one accepted and two inflight parts: zero-size-part-completion', solve('zero-size-part-completion', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), False)
check('cancel after one accepted and two inflight parts: inflight-abort-handles', solve('inflight-abort-handles', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), [1,2])
check('cancel after one accepted and two inflight parts: retry-eligible-parts', solve('retry-eligible-parts', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), [])
check('cancel after one accepted and two inflight parts: sent-vs-accepted-indicator', solve('sent-vs-accepted-indicator', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 2)
check('cancel after one accepted and two inflight parts: terminal-task-retention', solve('terminal-task-retention', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), False)
check('cancel after one accepted and two inflight parts: preview-while-incomplete', solve('preview-while-incomplete', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), None)
check('background upload survives detached preview: accepted-progress-not-sent', solve('accepted-progress-not-sent', ([N],[],[],False,'uploading',None,False)), 0)
check('background upload survives detached preview: remaining-local-parts', solve('remaining-local-parts', ([N],[],[],False,'uploading',None,False)), [0])
check('background upload survives detached preview: cancel-overrides-upload-status', solve('cancel-overrides-upload-status', ([N],[],[],False,'uploading',None,False)), 'uploading')
check('background upload survives detached preview: preview-revoke-on-detach', solve('preview-revoke-on-detach', ([N],[],[],False,'uploading',None,False)), None)
check('background upload survives detached preview: zero-size-part-completion', solve('zero-size-part-completion', ([N],[],[],False,'uploading',None,False)), False)
check('background upload survives detached preview: inflight-abort-handles', solve('inflight-abort-handles', ([N],[],[],False,'uploading',None,False)), [])
check('background upload survives detached preview: retry-eligible-parts', solve('retry-eligible-parts', ([N],[],[],False,'uploading',None,False)), [])
check('background upload survives detached preview: sent-vs-accepted-indicator', solve('sent-vs-accepted-indicator', ([N],[],[],False,'uploading',None,False)), 0)
check('background upload survives detached preview: terminal-task-retention', solve('terminal-task-retention', ([N],[],[],False,'uploading',None,False)), True)
check('background upload survives detached preview: preview-while-incomplete', solve('preview-while-incomplete', ([N],[],[],False,'uploading',None,False)), None)
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:
Accepted progress not sent.

This local upload view tracks parts and blob preview ownership, not a wire protocol. Accepted parts alone advance durable progress; cancellation aborts unaccepted sends; zero-byte parts still require acknowledgment; detached previews are released. Operation accepted-progress-not-sent 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):
    sizes, accepted, sent, cancelled, status, preview, attached = s
    if operation == 'accepted-progress-not-sent':
        return sum(sizes[i] for i in accepted)
    if operation == 'remaining-local-parts':
        return [i for i in range(len(sizes)) if i not in sent]
    if operation == 'cancel-overrides-upload-status':
        return 'cancelled' if cancelled else status
    if operation == 'preview-revoke-on-detach':
        return preview if not attached and preview is not None else None
    if operation == 'zero-size-part-completion':
        return len(accepted)==len(sizes)
    if operation == 'inflight-abort-handles':
        return [i for i in sent if i not in accepted] if cancelled else []
    if operation == 'retry-eligible-parts':
        return [i for i in range(len(sizes)) if i not in accepted] if status=='failed' and not cancelled else []
    if operation == 'sent-vs-accepted-indicator':
        return len(sent)-len(accepted)
    if operation == 'terminal-task-retention':
        return attached or status not in ('done','failed') and not cancelled
    if operation == 'preview-while-incomplete':
        return preview if attached else None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('accepted-progress-not-sent scenario 1', solve('accepted-progress-not-sent', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), N)
check('accepted-progress-not-sent scenario 2', solve('accepted-progress-not-sent', ([],[],[],False,'done',None,False)), 0)
check('accepted-progress-not-sent scenario 3', solve('accepted-progress-not-sent', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 2)
check('accepted-progress-not-sent scenario 4', solve('accepted-progress-not-sent', ([2,3],[],[0],True,'uploading','blob:c',False)), 0)
check('accepted-progress-not-sent scenario 5', solve('accepted-progress-not-sent', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 3)
check('accepted-progress-not-sent scenario 6', solve('accepted-progress-not-sent', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 5)
check('remaining-local-parts scenario 1', solve('remaining-local-parts', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), [1,2])
check('remaining-local-parts scenario 2', solve('remaining-local-parts', ([],[],[],False,'done',None,False)), [])
check('remaining-local-parts scenario 3', solve('remaining-local-parts', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), [])
check('remaining-local-parts scenario 4', solve('remaining-local-parts', ([2,3],[],[0],True,'uploading','blob:c',False)), [0,1])
check('remaining-local-parts scenario 5', solve('remaining-local-parts', ([2,3],[1],[0,1],False,'failed','blob:d',True)), [0])
check('remaining-local-parts scenario 6', solve('remaining-local-parts', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), [])
check('cancel-overrides-upload-status scenario 1', solve('cancel-overrides-upload-status', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), 'uploading')
check('cancel-overrides-upload-status scenario 2', solve('cancel-overrides-upload-status', ([],[],[],False,'done',None,False)), 'done')
check('cancel-overrides-upload-status scenario 3', solve('cancel-overrides-upload-status', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 'done')
check('cancel-overrides-upload-status scenario 4', solve('cancel-overrides-upload-status', ([2,3],[],[0],True,'uploading','blob:c',False)), 'cancelled')
check('cancel-overrides-upload-status scenario 5', solve('cancel-overrides-upload-status', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 'failed')
check('cancel-overrides-upload-status scenario 6', solve('cancel-overrides-upload-status', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 'done')
check('preview-revoke-on-detach scenario 1', solve('preview-revoke-on-detach', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), None)
check('preview-revoke-on-detach scenario 2', solve('preview-revoke-on-detach', ([],[],[],False,'done',None,False)), None)
check('preview-revoke-on-detach scenario 3', solve('preview-revoke-on-detach', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), None)
check('preview-revoke-on-detach scenario 4', solve('preview-revoke-on-detach', ([2,3],[],[0],True,'uploading','blob:c',False)), 'blob:c')
check('preview-revoke-on-detach scenario 5', solve('preview-revoke-on-detach', ([2,3],[1],[0,1],False,'failed','blob:d',True)), None)
check('preview-revoke-on-detach scenario 6', solve('preview-revoke-on-detach', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 'blob:e')
check('zero-size-part-completion scenario 1', solve('zero-size-part-completion', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), False)
check('zero-size-part-completion scenario 2', solve('zero-size-part-completion', ([],[],[],False,'done',None,False)), True)
check('zero-size-part-completion scenario 3', solve('zero-size-part-completion', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), True)
check('zero-size-part-completion scenario 4', solve('zero-size-part-completion', ([2,3],[],[0],True,'uploading','blob:c',False)), False)
check('zero-size-part-completion scenario 5', solve('zero-size-part-completion', ([2,3],[1],[0,1],False,'failed','blob:d',True)), False)
check('zero-size-part-completion scenario 6', solve('zero-size-part-completion', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), True)
check('inflight-abort-handles scenario 1', solve('inflight-abort-handles', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), [])
check('inflight-abort-handles scenario 2', solve('inflight-abort-handles', ([],[],[],False,'done',None,False)), [])
check('inflight-abort-handles scenario 3', solve('inflight-abort-handles', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), [])
check('inflight-abort-handles scenario 4', solve('inflight-abort-handles', ([2,3],[],[0],True,'uploading','blob:c',False)), [0])
check('inflight-abort-handles scenario 5', solve('inflight-abort-handles', ([2,3],[1],[0,1],False,'failed','blob:d',True)), [])
check('inflight-abort-handles scenario 6', solve('inflight-abort-handles', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), [])
check('retry-eligible-parts scenario 1', solve('retry-eligible-parts', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), [])
check('retry-eligible-parts scenario 2', solve('retry-eligible-parts', ([],[],[],False,'done',None,False)), [])
check('retry-eligible-parts scenario 3', solve('retry-eligible-parts', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), [])
check('retry-eligible-parts scenario 4', solve('retry-eligible-parts', ([2,3],[],[0],True,'uploading','blob:c',False)), [])
check('retry-eligible-parts scenario 5', solve('retry-eligible-parts', ([2,3],[1],[0,1],False,'failed','blob:d',True)), [0])
check('retry-eligible-parts scenario 6', solve('retry-eligible-parts', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), [])
check('sent-vs-accepted-indicator scenario 1', solve('sent-vs-accepted-indicator', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), 1)
check('sent-vs-accepted-indicator scenario 2', solve('sent-vs-accepted-indicator', ([],[],[],False,'done',None,False)), 0)
check('sent-vs-accepted-indicator scenario 3', solve('sent-vs-accepted-indicator', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 0)
check('sent-vs-accepted-indicator scenario 4', solve('sent-vs-accepted-indicator', ([2,3],[],[0],True,'uploading','blob:c',False)), 1)
check('sent-vs-accepted-indicator scenario 5', solve('sent-vs-accepted-indicator', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 1)
check('sent-vs-accepted-indicator scenario 6', solve('sent-vs-accepted-indicator', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 0)
check('terminal-task-retention scenario 1', solve('terminal-task-retention', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), True)
check('terminal-task-retention scenario 2', solve('terminal-task-retention', ([],[],[],False,'done',None,False)), False)
check('terminal-task-retention scenario 3', solve('terminal-task-retention', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), True)
check('terminal-task-retention scenario 4', solve('terminal-task-retention', ([2,3],[],[0],True,'uploading','blob:c',False)), False)
check('terminal-task-retention scenario 5', solve('terminal-task-retention', ([2,3],[1],[0,1],False,'failed','blob:d',True)), True)
check('terminal-task-retention scenario 6', solve('terminal-task-retention', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), False)
check('preview-while-incomplete scenario 1', solve('preview-while-incomplete', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), 'blob:a')
check('preview-while-incomplete scenario 2', solve('preview-while-incomplete', ([],[],[],False,'done',None,False)), None)
check('preview-while-incomplete scenario 3', solve('preview-while-incomplete', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 'blob:b')
check('preview-while-incomplete scenario 4', solve('preview-while-incomplete', ([2,3],[],[0],True,'uploading','blob:c',False)), None)
check('preview-while-incomplete scenario 5', solve('preview-while-incomplete', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 'blob:d')
check('preview-while-incomplete scenario 6', solve('preview-while-incomplete', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), None)
check('cancel after one accepted and two inflight parts: accepted-progress-not-sent', solve('accepted-progress-not-sent', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 2)
check('cancel after one accepted and two inflight parts: remaining-local-parts', solve('remaining-local-parts', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), [1,2])
check('cancel after one accepted and two inflight parts: cancel-overrides-upload-status', solve('cancel-overrides-upload-status', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 'cancelled')
check('cancel after one accepted and two inflight parts: preview-revoke-on-detach', solve('preview-revoke-on-detach', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 'blob:z')
check('cancel after one accepted and two inflight parts: zero-size-part-completion', solve('zero-size-part-completion', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), False)
check('cancel after one accepted and two inflight parts: inflight-abort-handles', solve('inflight-abort-handles', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), [1,2])
check('cancel after one accepted and two inflight parts: retry-eligible-parts', solve('retry-eligible-parts', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), [])
check('cancel after one accepted and two inflight parts: sent-vs-accepted-indicator', solve('sent-vs-accepted-indicator', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 2)
check('cancel after one accepted and two inflight parts: terminal-task-retention', solve('terminal-task-retention', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), False)
check('cancel after one accepted and two inflight parts: preview-while-incomplete', solve('preview-while-incomplete', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), None)
check('background upload survives detached preview: accepted-progress-not-sent', solve('accepted-progress-not-sent', ([N],[],[],False,'uploading',None,False)), 0)
check('background upload survives detached preview: remaining-local-parts', solve('remaining-local-parts', ([N],[],[],False,'uploading',None,False)), [0])
check('background upload survives detached preview: cancel-overrides-upload-status', solve('cancel-overrides-upload-status', ([N],[],[],False,'uploading',None,False)), 'uploading')
check('background upload survives detached preview: preview-revoke-on-detach', solve('preview-revoke-on-detach', ([N],[],[],False,'uploading',None,False)), None)
check('background upload survives detached preview: zero-size-part-completion', solve('zero-size-part-completion', ([N],[],[],False,'uploading',None,False)), False)
check('background upload survives detached preview: inflight-abort-handles', solve('inflight-abort-handles', ([N],[],[],False,'uploading',None,False)), [])
check('background upload survives detached preview: retry-eligible-parts', solve('retry-eligible-parts', ([N],[],[],False,'uploading',None,False)), [])
check('background upload survives detached preview: sent-vs-accepted-indicator', solve('sent-vs-accepted-indicator', ([N],[],[],False,'uploading',None,False)), 0)
check('background upload survives detached preview: terminal-task-retention', solve('terminal-task-retention', ([N],[],[],False,'uploading',None,False)), True)
check('background upload survives detached preview: preview-while-incomplete', solve('preview-while-incomplete', ([N],[],[],False,'uploading',None,False)), None)
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):
    sizes, accepted, sent, cancelled, status, preview, attached = s
    if operation == 'accepted-progress-not-sent':
        return sum(sizes[i] for i in accepted)
    if operation == 'remaining-local-parts':
        return list(range(len(accepted),len(sizes)))
    if operation == 'cancel-overrides-upload-status':
        return 'cancelled' if cancelled else status
    if operation == 'preview-revoke-on-detach':
        return preview if not attached and preview is not None else None
    if operation == 'zero-size-part-completion':
        return len(accepted)==len(sizes)
    if operation == 'inflight-abort-handles':
        return [i for i in sent if i not in accepted] if cancelled else []
    if operation == 'retry-eligible-parts':
        return [i for i in range(len(sizes)) if i not in accepted] if status=='failed' and not cancelled else []
    if operation == 'sent-vs-accepted-indicator':
        return len(sent)-len(accepted)
    if operation == 'terminal-task-retention':
        return attached or status not in ('done','failed') and not cancelled
    if operation == 'preview-while-incomplete':
        return preview if attached else None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('accepted-progress-not-sent scenario 1', solve('accepted-progress-not-sent', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), N)
check('accepted-progress-not-sent scenario 2', solve('accepted-progress-not-sent', ([],[],[],False,'done',None,False)), 0)
check('accepted-progress-not-sent scenario 3', solve('accepted-progress-not-sent', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 2)
check('accepted-progress-not-sent scenario 4', solve('accepted-progress-not-sent', ([2,3],[],[0],True,'uploading','blob:c',False)), 0)
check('accepted-progress-not-sent scenario 5', solve('accepted-progress-not-sent', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 3)
check('accepted-progress-not-sent scenario 6', solve('accepted-progress-not-sent', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 5)
check('remaining-local-parts scenario 1', solve('remaining-local-parts', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), [1,2])
check('remaining-local-parts scenario 2', solve('remaining-local-parts', ([],[],[],False,'done',None,False)), [])
check('remaining-local-parts scenario 3', solve('remaining-local-parts', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), [])
check('remaining-local-parts scenario 4', solve('remaining-local-parts', ([2,3],[],[0],True,'uploading','blob:c',False)), [0,1])
check('remaining-local-parts scenario 5', solve('remaining-local-parts', ([2,3],[1],[0,1],False,'failed','blob:d',True)), [0])
check('remaining-local-parts scenario 6', solve('remaining-local-parts', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), [])
check('cancel-overrides-upload-status scenario 1', solve('cancel-overrides-upload-status', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), 'uploading')
check('cancel-overrides-upload-status scenario 2', solve('cancel-overrides-upload-status', ([],[],[],False,'done',None,False)), 'done')
check('cancel-overrides-upload-status scenario 3', solve('cancel-overrides-upload-status', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 'done')
check('cancel-overrides-upload-status scenario 4', solve('cancel-overrides-upload-status', ([2,3],[],[0],True,'uploading','blob:c',False)), 'cancelled')
check('cancel-overrides-upload-status scenario 5', solve('cancel-overrides-upload-status', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 'failed')
check('cancel-overrides-upload-status scenario 6', solve('cancel-overrides-upload-status', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 'done')
check('preview-revoke-on-detach scenario 1', solve('preview-revoke-on-detach', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), None)
check('preview-revoke-on-detach scenario 2', solve('preview-revoke-on-detach', ([],[],[],False,'done',None,False)), None)
check('preview-revoke-on-detach scenario 3', solve('preview-revoke-on-detach', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), None)
check('preview-revoke-on-detach scenario 4', solve('preview-revoke-on-detach', ([2,3],[],[0],True,'uploading','blob:c',False)), 'blob:c')
check('preview-revoke-on-detach scenario 5', solve('preview-revoke-on-detach', ([2,3],[1],[0,1],False,'failed','blob:d',True)), None)
check('preview-revoke-on-detach scenario 6', solve('preview-revoke-on-detach', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 'blob:e')
check('zero-size-part-completion scenario 1', solve('zero-size-part-completion', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), False)
check('zero-size-part-completion scenario 2', solve('zero-size-part-completion', ([],[],[],False,'done',None,False)), True)
check('zero-size-part-completion scenario 3', solve('zero-size-part-completion', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), True)
check('zero-size-part-completion scenario 4', solve('zero-size-part-completion', ([2,3],[],[0],True,'uploading','blob:c',False)), False)
check('zero-size-part-completion scenario 5', solve('zero-size-part-completion', ([2,3],[1],[0,1],False,'failed','blob:d',True)), False)
check('zero-size-part-completion scenario 6', solve('zero-size-part-completion', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), True)
check('inflight-abort-handles scenario 1', solve('inflight-abort-handles', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), [])
check('inflight-abort-handles scenario 2', solve('inflight-abort-handles', ([],[],[],False,'done',None,False)), [])
check('inflight-abort-handles scenario 3', solve('inflight-abort-handles', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), [])
check('inflight-abort-handles scenario 4', solve('inflight-abort-handles', ([2,3],[],[0],True,'uploading','blob:c',False)), [0])
check('inflight-abort-handles scenario 5', solve('inflight-abort-handles', ([2,3],[1],[0,1],False,'failed','blob:d',True)), [])
check('inflight-abort-handles scenario 6', solve('inflight-abort-handles', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), [])
check('retry-eligible-parts scenario 1', solve('retry-eligible-parts', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), [])
check('retry-eligible-parts scenario 2', solve('retry-eligible-parts', ([],[],[],False,'done',None,False)), [])
check('retry-eligible-parts scenario 3', solve('retry-eligible-parts', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), [])
check('retry-eligible-parts scenario 4', solve('retry-eligible-parts', ([2,3],[],[0],True,'uploading','blob:c',False)), [])
check('retry-eligible-parts scenario 5', solve('retry-eligible-parts', ([2,3],[1],[0,1],False,'failed','blob:d',True)), [0])
check('retry-eligible-parts scenario 6', solve('retry-eligible-parts', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), [])
check('sent-vs-accepted-indicator scenario 1', solve('sent-vs-accepted-indicator', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), 1)
check('sent-vs-accepted-indicator scenario 2', solve('sent-vs-accepted-indicator', ([],[],[],False,'done',None,False)), 0)
check('sent-vs-accepted-indicator scenario 3', solve('sent-vs-accepted-indicator', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 0)
check('sent-vs-accepted-indicator scenario 4', solve('sent-vs-accepted-indicator', ([2,3],[],[0],True,'uploading','blob:c',False)), 1)
check('sent-vs-accepted-indicator scenario 5', solve('sent-vs-accepted-indicator', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 1)
check('sent-vs-accepted-indicator scenario 6', solve('sent-vs-accepted-indicator', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), 0)
check('terminal-task-retention scenario 1', solve('terminal-task-retention', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), True)
check('terminal-task-retention scenario 2', solve('terminal-task-retention', ([],[],[],False,'done',None,False)), False)
check('terminal-task-retention scenario 3', solve('terminal-task-retention', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), True)
check('terminal-task-retention scenario 4', solve('terminal-task-retention', ([2,3],[],[0],True,'uploading','blob:c',False)), False)
check('terminal-task-retention scenario 5', solve('terminal-task-retention', ([2,3],[1],[0,1],False,'failed','blob:d',True)), True)
check('terminal-task-retention scenario 6', solve('terminal-task-retention', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), False)
check('preview-while-incomplete scenario 1', solve('preview-while-incomplete', ([N,2,3],[0],[0,1],False,'uploading','blob:a',True)), 'blob:a')
check('preview-while-incomplete scenario 2', solve('preview-while-incomplete', ([],[],[],False,'done',None,False)), None)
check('preview-while-incomplete scenario 3', solve('preview-while-incomplete', ([2,0],[0,1],[0,1],False,'done','blob:b',True)), 'blob:b')
check('preview-while-incomplete scenario 4', solve('preview-while-incomplete', ([2,3],[],[0],True,'uploading','blob:c',False)), None)
check('preview-while-incomplete scenario 5', solve('preview-while-incomplete', ([2,3],[1],[0,1],False,'failed','blob:d',True)), 'blob:d')
check('preview-while-incomplete scenario 6', solve('preview-while-incomplete', ([2,3],[0,1],[0,1],False,'done','blob:e',False)), None)
check('cancel after one accepted and two inflight parts: accepted-progress-not-sent', solve('accepted-progress-not-sent', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 2)
check('cancel after one accepted and two inflight parts: remaining-local-parts', solve('remaining-local-parts', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), [1,2])
check('cancel after one accepted and two inflight parts: cancel-overrides-upload-status', solve('cancel-overrides-upload-status', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 'cancelled')
check('cancel after one accepted and two inflight parts: preview-revoke-on-detach', solve('preview-revoke-on-detach', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 'blob:z')
check('cancel after one accepted and two inflight parts: zero-size-part-completion', solve('zero-size-part-completion', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), False)
check('cancel after one accepted and two inflight parts: inflight-abort-handles', solve('inflight-abort-handles', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), [1,2])
check('cancel after one accepted and two inflight parts: retry-eligible-parts', solve('retry-eligible-parts', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), [])
check('cancel after one accepted and two inflight parts: sent-vs-accepted-indicator', solve('sent-vs-accepted-indicator', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), 2)
check('cancel after one accepted and two inflight parts: terminal-task-retention', solve('terminal-task-retention', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), False)
check('cancel after one accepted and two inflight parts: preview-while-incomplete', solve('preview-while-incomplete', ([2,3,4],[0],[0,1,2],True,'uploading','blob:z',False)), None)
check('background upload survives detached preview: accepted-progress-not-sent', solve('accepted-progress-not-sent', ([N],[],[],False,'uploading',None,False)), 0)
check('background upload survives detached preview: remaining-local-parts', solve('remaining-local-parts', ([N],[],[],False,'uploading',None,False)), [0])
check('background upload survives detached preview: cancel-overrides-upload-status', solve('cancel-overrides-upload-status', ([N],[],[],False,'uploading',None,False)), 'uploading')
check('background upload survives detached preview: preview-revoke-on-detach', solve('preview-revoke-on-detach', ([N],[],[],False,'uploading',None,False)), None)
check('background upload survives detached preview: zero-size-part-completion', solve('zero-size-part-completion', ([N],[],[],False,'uploading',None,False)), False)
check('background upload survives detached preview: inflight-abort-handles', solve('inflight-abort-handles', ([N],[],[],False,'uploading',None,False)), [])
check('background upload survives detached preview: retry-eligible-parts', solve('retry-eligible-parts', ([N],[],[],False,'uploading',None,False)), [])
check('background upload survives detached preview: sent-vs-accepted-indicator', solve('sent-vs-accepted-indicator', ([N],[],[],False,'uploading',None,False)), 0)
check('background upload survives detached preview: terminal-task-retention', solve('terminal-task-retention', ([N],[],[],False,'uploading',None,False)), True)
check('background upload survives detached preview: preview-while-incomplete', solve('preview-while-incomplete', ([N],[],[],False,'uploading',None,False)), None)
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:
Remaining local parts.

This local upload view tracks parts and blob preview ownership, not a wire protocol. Accepted parts alone advance durable progress; cancellation aborts unaccepted sends; zero-byte parts still require acknowledgment; detached previews are released. Operation remaining-local-parts has the six explicit input/output oracles below.

split: open-access