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

N = 1
observations = []
def solve(operation, s):
    jobs, result_id, worker, source_worker, cancelled, buffers, transferred, mounted = s
    if operation == 'result-matches-pending-job':
        return result_id in dict(jobs) and result_id not in cancelled
    if operation == 'worker-instance-result-owner':
        return worker==source_worker and mounted
    if operation == 'result-removes-exact-job':
        return [(k,v) for k,v in jobs if k!=result_id]
    if operation == 'transferred-buffer-detachment':
        return [b for b in buffers if b not in transferred]
    if operation == 'unknown-result-no-settlement':
        return next(iter(dict(jobs).values()),None)
    if operation == 'cancelled-job-pruning':
        return [(k,v) for k,v in jobs if k not in cancelled]
    if operation == 'termination-rejects-pending':
        return [k for k,v in jobs] if not mounted else []
    if operation == 'transfer-list-valid-intersection':
        return [b for b in buffers if b in transferred]
    if operation == 'remaining-worker-load':
        return len(jobs)-int(result_id in dict(jobs))
    if operation == 'main-thread-readable-buffer-count':
        return len([b for b in buffers if b not in transferred])
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('result-matches-pending-job scenario 1', solve('result-matches-pending-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('result-matches-pending-job scenario 2', solve('result-matches-pending-job', ([], 'a','w1','w1',[],[],[],True)), False)
check('result-matches-pending-job scenario 3', solve('result-matches-pending-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), True)
check('result-matches-pending-job scenario 4', solve('result-matches-pending-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), False)
check('result-matches-pending-job scenario 5', solve('result-matches-pending-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), True)
check('result-matches-pending-job scenario 6', solve('result-matches-pending-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), False)
check('worker-instance-result-owner scenario 1', solve('worker-instance-result-owner', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 2', solve('worker-instance-result-owner', ([], 'a','w1','w1',[],[],[],True)), True)
check('worker-instance-result-owner scenario 3', solve('worker-instance-result-owner', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), False)
check('worker-instance-result-owner scenario 4', solve('worker-instance-result-owner', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 5', solve('worker-instance-result-owner', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), False)
check('worker-instance-result-owner scenario 6', solve('worker-instance-result-owner', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), True)
check('result-removes-exact-job scenario 1', solve('result-removes-exact-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N)])
check('result-removes-exact-job scenario 2', solve('result-removes-exact-job', ([], 'a','w1','w1',[],[],[],True)), [])
check('result-removes-exact-job scenario 3', solve('result-removes-exact-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('result-removes-exact-job scenario 4', solve('result-removes-exact-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('result-removes-exact-job scenario 5', solve('result-removes-exact-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('result-removes-exact-job scenario 6', solve('result-removes-exact-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('transferred-buffer-detachment scenario 1', solve('transferred-buffer-detachment', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf2'])
check('transferred-buffer-detachment scenario 2', solve('transferred-buffer-detachment', ([], 'a','w1','w1',[],[],[],True)), [])
check('transferred-buffer-detachment scenario 3', solve('transferred-buffer-detachment', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), ['buf1'])
check('transferred-buffer-detachment scenario 4', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('transferred-buffer-detachment scenario 5', solve('transferred-buffer-detachment', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['buf1'])
check('transferred-buffer-detachment scenario 6', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf1'])
check('unknown-result-no-settlement scenario 1', solve('unknown-result-no-settlement', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 2', solve('unknown-result-no-settlement', ([], 'a','w1','w1',[],[],[],True)), None)
check('unknown-result-no-settlement scenario 3', solve('unknown-result-no-settlement', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('unknown-result-no-settlement scenario 4', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 5', solve('unknown-result-no-settlement', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), N)
check('unknown-result-no-settlement scenario 6', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), None)
check('cancelled-job-pruning scenario 1', solve('cancelled-job-pruning', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N),('b',2)])
check('cancelled-job-pruning scenario 2', solve('cancelled-job-pruning', ([], 'a','w1','w1',[],[],[],True)), [])
check('cancelled-job-pruning scenario 3', solve('cancelled-job-pruning', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [('a',0)])
check('cancelled-job-pruning scenario 4', solve('cancelled-job-pruning', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('cancelled-job-pruning scenario 5', solve('cancelled-job-pruning', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [('a',N)])
check('cancelled-job-pruning scenario 6', solve('cancelled-job-pruning', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('termination-rejects-pending scenario 1', solve('termination-rejects-pending', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [])
check('termination-rejects-pending scenario 2', solve('termination-rejects-pending', ([], 'a','w1','w1',[],[],[],True)), [])
check('termination-rejects-pending scenario 3', solve('termination-rejects-pending', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('termination-rejects-pending scenario 4', solve('termination-rejects-pending', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('termination-rejects-pending scenario 5', solve('termination-rejects-pending', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['a'])
check('termination-rejects-pending scenario 6', solve('termination-rejects-pending', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [])
check('transfer-list-valid-intersection scenario 1', solve('transfer-list-valid-intersection', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 2', solve('transfer-list-valid-intersection', ([], 'a','w1','w1',[],[],[],True)), [])
check('transfer-list-valid-intersection scenario 3', solve('transfer-list-valid-intersection', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('transfer-list-valid-intersection scenario 4', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 5', solve('transfer-list-valid-intersection', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('transfer-list-valid-intersection scenario 6', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf2'])
check('remaining-worker-load scenario 1', solve('remaining-worker-load', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('remaining-worker-load scenario 2', solve('remaining-worker-load', ([], 'a','w1','w1',[],[],[],True)), 0)
check('remaining-worker-load scenario 3', solve('remaining-worker-load', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('remaining-worker-load scenario 4', solve('remaining-worker-load', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 1)
check('remaining-worker-load scenario 5', solve('remaining-worker-load', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 0)
check('remaining-worker-load scenario 6', solve('remaining-worker-load', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 2)
check('main-thread-readable-buffer-count scenario 1', solve('main-thread-readable-buffer-count', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('main-thread-readable-buffer-count scenario 2', solve('main-thread-readable-buffer-count', ([], 'a','w1','w1',[],[],[],True)), 0)
check('main-thread-readable-buffer-count scenario 3', solve('main-thread-readable-buffer-count', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 1)
check('main-thread-readable-buffer-count scenario 4', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 0)
check('main-thread-readable-buffer-count scenario 5', solve('main-thread-readable-buffer-count', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 1)
check('main-thread-readable-buffer-count scenario 6', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 1)
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):
    jobs, result_id, worker, source_worker, cancelled, buffers, transferred, mounted = s
    if operation == 'result-matches-pending-job':
        return result_id in dict(jobs) and result_id not in cancelled
    if operation == 'worker-instance-result-owner':
        return worker==source_worker and mounted
    if operation == 'result-removes-exact-job':
        return [(k,v) for k,v in jobs if k!=result_id]
    if operation == 'transferred-buffer-detachment':
        return [b for b in buffers if b not in transferred]
    if operation == 'unknown-result-no-settlement':
        return dict(jobs).get(result_id) or None
    if operation == 'cancelled-job-pruning':
        return [(k,v) for k,v in jobs if k not in cancelled]
    if operation == 'termination-rejects-pending':
        return [k for k,v in jobs] if not mounted else []
    if operation == 'transfer-list-valid-intersection':
        return [b for b in buffers if b in transferred]
    if operation == 'remaining-worker-load':
        return len(jobs)-int(result_id in dict(jobs))
    if operation == 'main-thread-readable-buffer-count':
        return len([b for b in buffers if b not in transferred])
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('result-matches-pending-job scenario 1', solve('result-matches-pending-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('result-matches-pending-job scenario 2', solve('result-matches-pending-job', ([], 'a','w1','w1',[],[],[],True)), False)
check('result-matches-pending-job scenario 3', solve('result-matches-pending-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), True)
check('result-matches-pending-job scenario 4', solve('result-matches-pending-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), False)
check('result-matches-pending-job scenario 5', solve('result-matches-pending-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), True)
check('result-matches-pending-job scenario 6', solve('result-matches-pending-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), False)
check('worker-instance-result-owner scenario 1', solve('worker-instance-result-owner', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 2', solve('worker-instance-result-owner', ([], 'a','w1','w1',[],[],[],True)), True)
check('worker-instance-result-owner scenario 3', solve('worker-instance-result-owner', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), False)
check('worker-instance-result-owner scenario 4', solve('worker-instance-result-owner', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 5', solve('worker-instance-result-owner', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), False)
check('worker-instance-result-owner scenario 6', solve('worker-instance-result-owner', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), True)
check('result-removes-exact-job scenario 1', solve('result-removes-exact-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N)])
check('result-removes-exact-job scenario 2', solve('result-removes-exact-job', ([], 'a','w1','w1',[],[],[],True)), [])
check('result-removes-exact-job scenario 3', solve('result-removes-exact-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('result-removes-exact-job scenario 4', solve('result-removes-exact-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('result-removes-exact-job scenario 5', solve('result-removes-exact-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('result-removes-exact-job scenario 6', solve('result-removes-exact-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('transferred-buffer-detachment scenario 1', solve('transferred-buffer-detachment', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf2'])
check('transferred-buffer-detachment scenario 2', solve('transferred-buffer-detachment', ([], 'a','w1','w1',[],[],[],True)), [])
check('transferred-buffer-detachment scenario 3', solve('transferred-buffer-detachment', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), ['buf1'])
check('transferred-buffer-detachment scenario 4', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('transferred-buffer-detachment scenario 5', solve('transferred-buffer-detachment', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['buf1'])
check('transferred-buffer-detachment scenario 6', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf1'])
check('unknown-result-no-settlement scenario 1', solve('unknown-result-no-settlement', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 2', solve('unknown-result-no-settlement', ([], 'a','w1','w1',[],[],[],True)), None)
check('unknown-result-no-settlement scenario 3', solve('unknown-result-no-settlement', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('unknown-result-no-settlement scenario 4', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 5', solve('unknown-result-no-settlement', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), N)
check('unknown-result-no-settlement scenario 6', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), None)
check('cancelled-job-pruning scenario 1', solve('cancelled-job-pruning', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N),('b',2)])
check('cancelled-job-pruning scenario 2', solve('cancelled-job-pruning', ([], 'a','w1','w1',[],[],[],True)), [])
check('cancelled-job-pruning scenario 3', solve('cancelled-job-pruning', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [('a',0)])
check('cancelled-job-pruning scenario 4', solve('cancelled-job-pruning', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('cancelled-job-pruning scenario 5', solve('cancelled-job-pruning', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [('a',N)])
check('cancelled-job-pruning scenario 6', solve('cancelled-job-pruning', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('termination-rejects-pending scenario 1', solve('termination-rejects-pending', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [])
check('termination-rejects-pending scenario 2', solve('termination-rejects-pending', ([], 'a','w1','w1',[],[],[],True)), [])
check('termination-rejects-pending scenario 3', solve('termination-rejects-pending', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('termination-rejects-pending scenario 4', solve('termination-rejects-pending', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('termination-rejects-pending scenario 5', solve('termination-rejects-pending', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['a'])
check('termination-rejects-pending scenario 6', solve('termination-rejects-pending', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [])
check('transfer-list-valid-intersection scenario 1', solve('transfer-list-valid-intersection', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 2', solve('transfer-list-valid-intersection', ([], 'a','w1','w1',[],[],[],True)), [])
check('transfer-list-valid-intersection scenario 3', solve('transfer-list-valid-intersection', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('transfer-list-valid-intersection scenario 4', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 5', solve('transfer-list-valid-intersection', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('transfer-list-valid-intersection scenario 6', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf2'])
check('remaining-worker-load scenario 1', solve('remaining-worker-load', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('remaining-worker-load scenario 2', solve('remaining-worker-load', ([], 'a','w1','w1',[],[],[],True)), 0)
check('remaining-worker-load scenario 3', solve('remaining-worker-load', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('remaining-worker-load scenario 4', solve('remaining-worker-load', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 1)
check('remaining-worker-load scenario 5', solve('remaining-worker-load', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 0)
check('remaining-worker-load scenario 6', solve('remaining-worker-load', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 2)
check('main-thread-readable-buffer-count scenario 1', solve('main-thread-readable-buffer-count', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('main-thread-readable-buffer-count scenario 2', solve('main-thread-readable-buffer-count', ([], 'a','w1','w1',[],[],[],True)), 0)
check('main-thread-readable-buffer-count scenario 3', solve('main-thread-readable-buffer-count', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 1)
check('main-thread-readable-buffer-count scenario 4', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 0)
check('main-thread-readable-buffer-count scenario 5', solve('main-thread-readable-buffer-count', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 1)
check('main-thread-readable-buffer-count scenario 6', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 1)
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:
Unknown result no settlement.

A UI worker client binds replies to both a pending job ID and worker instance. Transfer detaches only listed buffers from the main thread, unknown replies settle nothing, and unmount rejects every still-pending job. Operation unknown-result-no-settlement 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):
    jobs, result_id, worker, source_worker, cancelled, buffers, transferred, mounted = s
    if operation == 'result-matches-pending-job':
        return result_id in dict(jobs) and result_id not in cancelled
    if operation == 'worker-instance-result-owner':
        return worker==source_worker and mounted
    if operation == 'result-removes-exact-job':
        return [(k,v) for k,v in jobs if k!=result_id]
    if operation == 'transferred-buffer-detachment':
        return [b for b in buffers if b not in transferred]
    if operation == 'unknown-result-no-settlement':
        return None if result_id not in dict(jobs) else dict(jobs)[result_id]
    if operation == 'cancelled-job-pruning':
        return jobs
    if operation == 'termination-rejects-pending':
        return [k for k,v in jobs] if not mounted else []
    if operation == 'transfer-list-valid-intersection':
        return [b for b in buffers if b in transferred]
    if operation == 'remaining-worker-load':
        return len(jobs)-int(result_id in dict(jobs))
    if operation == 'main-thread-readable-buffer-count':
        return len([b for b in buffers if b not in transferred])
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('result-matches-pending-job scenario 1', solve('result-matches-pending-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('result-matches-pending-job scenario 2', solve('result-matches-pending-job', ([], 'a','w1','w1',[],[],[],True)), False)
check('result-matches-pending-job scenario 3', solve('result-matches-pending-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), True)
check('result-matches-pending-job scenario 4', solve('result-matches-pending-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), False)
check('result-matches-pending-job scenario 5', solve('result-matches-pending-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), True)
check('result-matches-pending-job scenario 6', solve('result-matches-pending-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), False)
check('worker-instance-result-owner scenario 1', solve('worker-instance-result-owner', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 2', solve('worker-instance-result-owner', ([], 'a','w1','w1',[],[],[],True)), True)
check('worker-instance-result-owner scenario 3', solve('worker-instance-result-owner', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), False)
check('worker-instance-result-owner scenario 4', solve('worker-instance-result-owner', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 5', solve('worker-instance-result-owner', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), False)
check('worker-instance-result-owner scenario 6', solve('worker-instance-result-owner', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), True)
check('result-removes-exact-job scenario 1', solve('result-removes-exact-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N)])
check('result-removes-exact-job scenario 2', solve('result-removes-exact-job', ([], 'a','w1','w1',[],[],[],True)), [])
check('result-removes-exact-job scenario 3', solve('result-removes-exact-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('result-removes-exact-job scenario 4', solve('result-removes-exact-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('result-removes-exact-job scenario 5', solve('result-removes-exact-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('result-removes-exact-job scenario 6', solve('result-removes-exact-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('transferred-buffer-detachment scenario 1', solve('transferred-buffer-detachment', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf2'])
check('transferred-buffer-detachment scenario 2', solve('transferred-buffer-detachment', ([], 'a','w1','w1',[],[],[],True)), [])
check('transferred-buffer-detachment scenario 3', solve('transferred-buffer-detachment', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), ['buf1'])
check('transferred-buffer-detachment scenario 4', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('transferred-buffer-detachment scenario 5', solve('transferred-buffer-detachment', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['buf1'])
check('transferred-buffer-detachment scenario 6', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf1'])
check('unknown-result-no-settlement scenario 1', solve('unknown-result-no-settlement', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 2', solve('unknown-result-no-settlement', ([], 'a','w1','w1',[],[],[],True)), None)
check('unknown-result-no-settlement scenario 3', solve('unknown-result-no-settlement', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('unknown-result-no-settlement scenario 4', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 5', solve('unknown-result-no-settlement', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), N)
check('unknown-result-no-settlement scenario 6', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), None)
check('cancelled-job-pruning scenario 1', solve('cancelled-job-pruning', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N),('b',2)])
check('cancelled-job-pruning scenario 2', solve('cancelled-job-pruning', ([], 'a','w1','w1',[],[],[],True)), [])
check('cancelled-job-pruning scenario 3', solve('cancelled-job-pruning', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [('a',0)])
check('cancelled-job-pruning scenario 4', solve('cancelled-job-pruning', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('cancelled-job-pruning scenario 5', solve('cancelled-job-pruning', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [('a',N)])
check('cancelled-job-pruning scenario 6', solve('cancelled-job-pruning', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('termination-rejects-pending scenario 1', solve('termination-rejects-pending', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [])
check('termination-rejects-pending scenario 2', solve('termination-rejects-pending', ([], 'a','w1','w1',[],[],[],True)), [])
check('termination-rejects-pending scenario 3', solve('termination-rejects-pending', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('termination-rejects-pending scenario 4', solve('termination-rejects-pending', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('termination-rejects-pending scenario 5', solve('termination-rejects-pending', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['a'])
check('termination-rejects-pending scenario 6', solve('termination-rejects-pending', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [])
check('transfer-list-valid-intersection scenario 1', solve('transfer-list-valid-intersection', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 2', solve('transfer-list-valid-intersection', ([], 'a','w1','w1',[],[],[],True)), [])
check('transfer-list-valid-intersection scenario 3', solve('transfer-list-valid-intersection', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('transfer-list-valid-intersection scenario 4', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 5', solve('transfer-list-valid-intersection', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('transfer-list-valid-intersection scenario 6', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf2'])
check('remaining-worker-load scenario 1', solve('remaining-worker-load', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('remaining-worker-load scenario 2', solve('remaining-worker-load', ([], 'a','w1','w1',[],[],[],True)), 0)
check('remaining-worker-load scenario 3', solve('remaining-worker-load', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('remaining-worker-load scenario 4', solve('remaining-worker-load', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 1)
check('remaining-worker-load scenario 5', solve('remaining-worker-load', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 0)
check('remaining-worker-load scenario 6', solve('remaining-worker-load', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 2)
check('main-thread-readable-buffer-count scenario 1', solve('main-thread-readable-buffer-count', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('main-thread-readable-buffer-count scenario 2', solve('main-thread-readable-buffer-count', ([], 'a','w1','w1',[],[],[],True)), 0)
check('main-thread-readable-buffer-count scenario 3', solve('main-thread-readable-buffer-count', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 1)
check('main-thread-readable-buffer-count scenario 4', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 0)
check('main-thread-readable-buffer-count scenario 5', solve('main-thread-readable-buffer-count', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 1)
check('main-thread-readable-buffer-count scenario 6', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 1)
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):
    jobs, result_id, worker, source_worker, cancelled, buffers, transferred, mounted = s
    if operation == 'result-matches-pending-job':
        return result_id in dict(jobs) and result_id not in cancelled
    if operation == 'worker-instance-result-owner':
        return worker==source_worker and mounted
    if operation == 'result-removes-exact-job':
        return [(k,v) for k,v in jobs if k!=result_id]
    if operation == 'transferred-buffer-detachment':
        return [b for b in buffers if b not in transferred]
    if operation == 'unknown-result-no-settlement':
        return None if result_id not in dict(jobs) else dict(jobs)[result_id]
    if operation == 'cancelled-job-pruning':
        return [(k,v) for k,v in jobs if k!=result_id]
    if operation == 'termination-rejects-pending':
        return [k for k,v in jobs] if not mounted else []
    if operation == 'transfer-list-valid-intersection':
        return [b for b in buffers if b in transferred]
    if operation == 'remaining-worker-load':
        return len(jobs)-int(result_id in dict(jobs))
    if operation == 'main-thread-readable-buffer-count':
        return len([b for b in buffers if b not in transferred])
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('result-matches-pending-job scenario 1', solve('result-matches-pending-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('result-matches-pending-job scenario 2', solve('result-matches-pending-job', ([], 'a','w1','w1',[],[],[],True)), False)
check('result-matches-pending-job scenario 3', solve('result-matches-pending-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), True)
check('result-matches-pending-job scenario 4', solve('result-matches-pending-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), False)
check('result-matches-pending-job scenario 5', solve('result-matches-pending-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), True)
check('result-matches-pending-job scenario 6', solve('result-matches-pending-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), False)
check('worker-instance-result-owner scenario 1', solve('worker-instance-result-owner', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 2', solve('worker-instance-result-owner', ([], 'a','w1','w1',[],[],[],True)), True)
check('worker-instance-result-owner scenario 3', solve('worker-instance-result-owner', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), False)
check('worker-instance-result-owner scenario 4', solve('worker-instance-result-owner', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 5', solve('worker-instance-result-owner', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), False)
check('worker-instance-result-owner scenario 6', solve('worker-instance-result-owner', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), True)
check('result-removes-exact-job scenario 1', solve('result-removes-exact-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N)])
check('result-removes-exact-job scenario 2', solve('result-removes-exact-job', ([], 'a','w1','w1',[],[],[],True)), [])
check('result-removes-exact-job scenario 3', solve('result-removes-exact-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('result-removes-exact-job scenario 4', solve('result-removes-exact-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('result-removes-exact-job scenario 5', solve('result-removes-exact-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('result-removes-exact-job scenario 6', solve('result-removes-exact-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('transferred-buffer-detachment scenario 1', solve('transferred-buffer-detachment', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf2'])
check('transferred-buffer-detachment scenario 2', solve('transferred-buffer-detachment', ([], 'a','w1','w1',[],[],[],True)), [])
check('transferred-buffer-detachment scenario 3', solve('transferred-buffer-detachment', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), ['buf1'])
check('transferred-buffer-detachment scenario 4', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('transferred-buffer-detachment scenario 5', solve('transferred-buffer-detachment', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['buf1'])
check('transferred-buffer-detachment scenario 6', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf1'])
check('unknown-result-no-settlement scenario 1', solve('unknown-result-no-settlement', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 2', solve('unknown-result-no-settlement', ([], 'a','w1','w1',[],[],[],True)), None)
check('unknown-result-no-settlement scenario 3', solve('unknown-result-no-settlement', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('unknown-result-no-settlement scenario 4', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 5', solve('unknown-result-no-settlement', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), N)
check('unknown-result-no-settlement scenario 6', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), None)
check('cancelled-job-pruning scenario 1', solve('cancelled-job-pruning', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N),('b',2)])
check('cancelled-job-pruning scenario 2', solve('cancelled-job-pruning', ([], 'a','w1','w1',[],[],[],True)), [])
check('cancelled-job-pruning scenario 3', solve('cancelled-job-pruning', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [('a',0)])
check('cancelled-job-pruning scenario 4', solve('cancelled-job-pruning', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('cancelled-job-pruning scenario 5', solve('cancelled-job-pruning', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [('a',N)])
check('cancelled-job-pruning scenario 6', solve('cancelled-job-pruning', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('termination-rejects-pending scenario 1', solve('termination-rejects-pending', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [])
check('termination-rejects-pending scenario 2', solve('termination-rejects-pending', ([], 'a','w1','w1',[],[],[],True)), [])
check('termination-rejects-pending scenario 3', solve('termination-rejects-pending', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('termination-rejects-pending scenario 4', solve('termination-rejects-pending', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('termination-rejects-pending scenario 5', solve('termination-rejects-pending', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['a'])
check('termination-rejects-pending scenario 6', solve('termination-rejects-pending', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [])
check('transfer-list-valid-intersection scenario 1', solve('transfer-list-valid-intersection', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 2', solve('transfer-list-valid-intersection', ([], 'a','w1','w1',[],[],[],True)), [])
check('transfer-list-valid-intersection scenario 3', solve('transfer-list-valid-intersection', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('transfer-list-valid-intersection scenario 4', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 5', solve('transfer-list-valid-intersection', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('transfer-list-valid-intersection scenario 6', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf2'])
check('remaining-worker-load scenario 1', solve('remaining-worker-load', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('remaining-worker-load scenario 2', solve('remaining-worker-load', ([], 'a','w1','w1',[],[],[],True)), 0)
check('remaining-worker-load scenario 3', solve('remaining-worker-load', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('remaining-worker-load scenario 4', solve('remaining-worker-load', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 1)
check('remaining-worker-load scenario 5', solve('remaining-worker-load', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 0)
check('remaining-worker-load scenario 6', solve('remaining-worker-load', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 2)
check('main-thread-readable-buffer-count scenario 1', solve('main-thread-readable-buffer-count', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('main-thread-readable-buffer-count scenario 2', solve('main-thread-readable-buffer-count', ([], 'a','w1','w1',[],[],[],True)), 0)
check('main-thread-readable-buffer-count scenario 3', solve('main-thread-readable-buffer-count', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 1)
check('main-thread-readable-buffer-count scenario 4', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 0)
check('main-thread-readable-buffer-count scenario 5', solve('main-thread-readable-buffer-count', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 1)
check('main-thread-readable-buffer-count scenario 6', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 1)
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:
Cancelled job pruning.

A UI worker client binds replies to both a pending job ID and worker instance. Transfer detaches only listed buffers from the main thread, unknown replies settle nothing, and unmount rejects every still-pending job. Operation cancelled-job-pruning 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):
    jobs, result_id, worker, source_worker, cancelled, buffers, transferred, mounted = s
    if operation == 'result-matches-pending-job':
        return result_id in dict(jobs) and result_id not in cancelled
    if operation == 'worker-instance-result-owner':
        return worker==source_worker and mounted
    if operation == 'result-removes-exact-job':
        return [(k,v) for k,v in jobs if k!=result_id]
    if operation == 'transferred-buffer-detachment':
        return [b for b in buffers if b not in transferred]
    if operation == 'unknown-result-no-settlement':
        return None if result_id not in dict(jobs) else dict(jobs)[result_id]
    if operation == 'cancelled-job-pruning':
        return [(k,v) for k,v in jobs if k not in cancelled]
    if operation == 'termination-rejects-pending':
        return []
    if operation == 'transfer-list-valid-intersection':
        return [b for b in buffers if b in transferred]
    if operation == 'remaining-worker-load':
        return len(jobs)-int(result_id in dict(jobs))
    if operation == 'main-thread-readable-buffer-count':
        return len([b for b in buffers if b not in transferred])
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('result-matches-pending-job scenario 1', solve('result-matches-pending-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('result-matches-pending-job scenario 2', solve('result-matches-pending-job', ([], 'a','w1','w1',[],[],[],True)), False)
check('result-matches-pending-job scenario 3', solve('result-matches-pending-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), True)
check('result-matches-pending-job scenario 4', solve('result-matches-pending-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), False)
check('result-matches-pending-job scenario 5', solve('result-matches-pending-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), True)
check('result-matches-pending-job scenario 6', solve('result-matches-pending-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), False)
check('worker-instance-result-owner scenario 1', solve('worker-instance-result-owner', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 2', solve('worker-instance-result-owner', ([], 'a','w1','w1',[],[],[],True)), True)
check('worker-instance-result-owner scenario 3', solve('worker-instance-result-owner', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), False)
check('worker-instance-result-owner scenario 4', solve('worker-instance-result-owner', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 5', solve('worker-instance-result-owner', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), False)
check('worker-instance-result-owner scenario 6', solve('worker-instance-result-owner', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), True)
check('result-removes-exact-job scenario 1', solve('result-removes-exact-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N)])
check('result-removes-exact-job scenario 2', solve('result-removes-exact-job', ([], 'a','w1','w1',[],[],[],True)), [])
check('result-removes-exact-job scenario 3', solve('result-removes-exact-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('result-removes-exact-job scenario 4', solve('result-removes-exact-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('result-removes-exact-job scenario 5', solve('result-removes-exact-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('result-removes-exact-job scenario 6', solve('result-removes-exact-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('transferred-buffer-detachment scenario 1', solve('transferred-buffer-detachment', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf2'])
check('transferred-buffer-detachment scenario 2', solve('transferred-buffer-detachment', ([], 'a','w1','w1',[],[],[],True)), [])
check('transferred-buffer-detachment scenario 3', solve('transferred-buffer-detachment', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), ['buf1'])
check('transferred-buffer-detachment scenario 4', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('transferred-buffer-detachment scenario 5', solve('transferred-buffer-detachment', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['buf1'])
check('transferred-buffer-detachment scenario 6', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf1'])
check('unknown-result-no-settlement scenario 1', solve('unknown-result-no-settlement', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 2', solve('unknown-result-no-settlement', ([], 'a','w1','w1',[],[],[],True)), None)
check('unknown-result-no-settlement scenario 3', solve('unknown-result-no-settlement', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('unknown-result-no-settlement scenario 4', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 5', solve('unknown-result-no-settlement', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), N)
check('unknown-result-no-settlement scenario 6', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), None)
check('cancelled-job-pruning scenario 1', solve('cancelled-job-pruning', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N),('b',2)])
check('cancelled-job-pruning scenario 2', solve('cancelled-job-pruning', ([], 'a','w1','w1',[],[],[],True)), [])
check('cancelled-job-pruning scenario 3', solve('cancelled-job-pruning', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [('a',0)])
check('cancelled-job-pruning scenario 4', solve('cancelled-job-pruning', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('cancelled-job-pruning scenario 5', solve('cancelled-job-pruning', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [('a',N)])
check('cancelled-job-pruning scenario 6', solve('cancelled-job-pruning', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('termination-rejects-pending scenario 1', solve('termination-rejects-pending', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [])
check('termination-rejects-pending scenario 2', solve('termination-rejects-pending', ([], 'a','w1','w1',[],[],[],True)), [])
check('termination-rejects-pending scenario 3', solve('termination-rejects-pending', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('termination-rejects-pending scenario 4', solve('termination-rejects-pending', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('termination-rejects-pending scenario 5', solve('termination-rejects-pending', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['a'])
check('termination-rejects-pending scenario 6', solve('termination-rejects-pending', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [])
check('transfer-list-valid-intersection scenario 1', solve('transfer-list-valid-intersection', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 2', solve('transfer-list-valid-intersection', ([], 'a','w1','w1',[],[],[],True)), [])
check('transfer-list-valid-intersection scenario 3', solve('transfer-list-valid-intersection', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('transfer-list-valid-intersection scenario 4', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 5', solve('transfer-list-valid-intersection', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('transfer-list-valid-intersection scenario 6', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf2'])
check('remaining-worker-load scenario 1', solve('remaining-worker-load', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('remaining-worker-load scenario 2', solve('remaining-worker-load', ([], 'a','w1','w1',[],[],[],True)), 0)
check('remaining-worker-load scenario 3', solve('remaining-worker-load', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('remaining-worker-load scenario 4', solve('remaining-worker-load', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 1)
check('remaining-worker-load scenario 5', solve('remaining-worker-load', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 0)
check('remaining-worker-load scenario 6', solve('remaining-worker-load', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 2)
check('main-thread-readable-buffer-count scenario 1', solve('main-thread-readable-buffer-count', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('main-thread-readable-buffer-count scenario 2', solve('main-thread-readable-buffer-count', ([], 'a','w1','w1',[],[],[],True)), 0)
check('main-thread-readable-buffer-count scenario 3', solve('main-thread-readable-buffer-count', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 1)
check('main-thread-readable-buffer-count scenario 4', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 0)
check('main-thread-readable-buffer-count scenario 5', solve('main-thread-readable-buffer-count', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 1)
check('main-thread-readable-buffer-count scenario 6', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 1)
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):
    jobs, result_id, worker, source_worker, cancelled, buffers, transferred, mounted = s
    if operation == 'result-matches-pending-job':
        return result_id in dict(jobs) and result_id not in cancelled
    if operation == 'worker-instance-result-owner':
        return worker==source_worker and mounted
    if operation == 'result-removes-exact-job':
        return [(k,v) for k,v in jobs if k!=result_id]
    if operation == 'transferred-buffer-detachment':
        return [b for b in buffers if b not in transferred]
    if operation == 'unknown-result-no-settlement':
        return None if result_id not in dict(jobs) else dict(jobs)[result_id]
    if operation == 'cancelled-job-pruning':
        return [(k,v) for k,v in jobs if k not in cancelled]
    if operation == 'termination-rejects-pending':
        return [k for k,v in jobs]
    if operation == 'transfer-list-valid-intersection':
        return [b for b in buffers if b in transferred]
    if operation == 'remaining-worker-load':
        return len(jobs)-int(result_id in dict(jobs))
    if operation == 'main-thread-readable-buffer-count':
        return len([b for b in buffers if b not in transferred])
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('result-matches-pending-job scenario 1', solve('result-matches-pending-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('result-matches-pending-job scenario 2', solve('result-matches-pending-job', ([], 'a','w1','w1',[],[],[],True)), False)
check('result-matches-pending-job scenario 3', solve('result-matches-pending-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), True)
check('result-matches-pending-job scenario 4', solve('result-matches-pending-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), False)
check('result-matches-pending-job scenario 5', solve('result-matches-pending-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), True)
check('result-matches-pending-job scenario 6', solve('result-matches-pending-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), False)
check('worker-instance-result-owner scenario 1', solve('worker-instance-result-owner', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 2', solve('worker-instance-result-owner', ([], 'a','w1','w1',[],[],[],True)), True)
check('worker-instance-result-owner scenario 3', solve('worker-instance-result-owner', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), False)
check('worker-instance-result-owner scenario 4', solve('worker-instance-result-owner', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 5', solve('worker-instance-result-owner', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), False)
check('worker-instance-result-owner scenario 6', solve('worker-instance-result-owner', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), True)
check('result-removes-exact-job scenario 1', solve('result-removes-exact-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N)])
check('result-removes-exact-job scenario 2', solve('result-removes-exact-job', ([], 'a','w1','w1',[],[],[],True)), [])
check('result-removes-exact-job scenario 3', solve('result-removes-exact-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('result-removes-exact-job scenario 4', solve('result-removes-exact-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('result-removes-exact-job scenario 5', solve('result-removes-exact-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('result-removes-exact-job scenario 6', solve('result-removes-exact-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('transferred-buffer-detachment scenario 1', solve('transferred-buffer-detachment', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf2'])
check('transferred-buffer-detachment scenario 2', solve('transferred-buffer-detachment', ([], 'a','w1','w1',[],[],[],True)), [])
check('transferred-buffer-detachment scenario 3', solve('transferred-buffer-detachment', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), ['buf1'])
check('transferred-buffer-detachment scenario 4', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('transferred-buffer-detachment scenario 5', solve('transferred-buffer-detachment', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['buf1'])
check('transferred-buffer-detachment scenario 6', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf1'])
check('unknown-result-no-settlement scenario 1', solve('unknown-result-no-settlement', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 2', solve('unknown-result-no-settlement', ([], 'a','w1','w1',[],[],[],True)), None)
check('unknown-result-no-settlement scenario 3', solve('unknown-result-no-settlement', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('unknown-result-no-settlement scenario 4', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 5', solve('unknown-result-no-settlement', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), N)
check('unknown-result-no-settlement scenario 6', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), None)
check('cancelled-job-pruning scenario 1', solve('cancelled-job-pruning', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N),('b',2)])
check('cancelled-job-pruning scenario 2', solve('cancelled-job-pruning', ([], 'a','w1','w1',[],[],[],True)), [])
check('cancelled-job-pruning scenario 3', solve('cancelled-job-pruning', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [('a',0)])
check('cancelled-job-pruning scenario 4', solve('cancelled-job-pruning', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('cancelled-job-pruning scenario 5', solve('cancelled-job-pruning', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [('a',N)])
check('cancelled-job-pruning scenario 6', solve('cancelled-job-pruning', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('termination-rejects-pending scenario 1', solve('termination-rejects-pending', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [])
check('termination-rejects-pending scenario 2', solve('termination-rejects-pending', ([], 'a','w1','w1',[],[],[],True)), [])
check('termination-rejects-pending scenario 3', solve('termination-rejects-pending', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('termination-rejects-pending scenario 4', solve('termination-rejects-pending', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('termination-rejects-pending scenario 5', solve('termination-rejects-pending', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['a'])
check('termination-rejects-pending scenario 6', solve('termination-rejects-pending', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [])
check('transfer-list-valid-intersection scenario 1', solve('transfer-list-valid-intersection', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 2', solve('transfer-list-valid-intersection', ([], 'a','w1','w1',[],[],[],True)), [])
check('transfer-list-valid-intersection scenario 3', solve('transfer-list-valid-intersection', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('transfer-list-valid-intersection scenario 4', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 5', solve('transfer-list-valid-intersection', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('transfer-list-valid-intersection scenario 6', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf2'])
check('remaining-worker-load scenario 1', solve('remaining-worker-load', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('remaining-worker-load scenario 2', solve('remaining-worker-load', ([], 'a','w1','w1',[],[],[],True)), 0)
check('remaining-worker-load scenario 3', solve('remaining-worker-load', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('remaining-worker-load scenario 4', solve('remaining-worker-load', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 1)
check('remaining-worker-load scenario 5', solve('remaining-worker-load', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 0)
check('remaining-worker-load scenario 6', solve('remaining-worker-load', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 2)
check('main-thread-readable-buffer-count scenario 1', solve('main-thread-readable-buffer-count', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('main-thread-readable-buffer-count scenario 2', solve('main-thread-readable-buffer-count', ([], 'a','w1','w1',[],[],[],True)), 0)
check('main-thread-readable-buffer-count scenario 3', solve('main-thread-readable-buffer-count', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 1)
check('main-thread-readable-buffer-count scenario 4', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 0)
check('main-thread-readable-buffer-count scenario 5', solve('main-thread-readable-buffer-count', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 1)
check('main-thread-readable-buffer-count scenario 6', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 1)
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:
Termination rejects pending.

A UI worker client binds replies to both a pending job ID and worker instance. Transfer detaches only listed buffers from the main thread, unknown replies settle nothing, and unmount rejects every still-pending job. Operation termination-rejects-pending 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):
    jobs, result_id, worker, source_worker, cancelled, buffers, transferred, mounted = s
    if operation == 'result-matches-pending-job':
        return result_id in dict(jobs) and result_id not in cancelled
    if operation == 'worker-instance-result-owner':
        return worker==source_worker and mounted
    if operation == 'result-removes-exact-job':
        return [(k,v) for k,v in jobs if k!=result_id]
    if operation == 'transferred-buffer-detachment':
        return [b for b in buffers if b not in transferred]
    if operation == 'unknown-result-no-settlement':
        return None if result_id not in dict(jobs) else dict(jobs)[result_id]
    if operation == 'cancelled-job-pruning':
        return [(k,v) for k,v in jobs if k not in cancelled]
    if operation == 'termination-rejects-pending':
        return [k for k,v in jobs] if not mounted else []
    if operation == 'transfer-list-valid-intersection':
        return transferred+buffers
    if operation == 'remaining-worker-load':
        return len(jobs)-int(result_id in dict(jobs))
    if operation == 'main-thread-readable-buffer-count':
        return len([b for b in buffers if b not in transferred])
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('result-matches-pending-job scenario 1', solve('result-matches-pending-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('result-matches-pending-job scenario 2', solve('result-matches-pending-job', ([], 'a','w1','w1',[],[],[],True)), False)
check('result-matches-pending-job scenario 3', solve('result-matches-pending-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), True)
check('result-matches-pending-job scenario 4', solve('result-matches-pending-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), False)
check('result-matches-pending-job scenario 5', solve('result-matches-pending-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), True)
check('result-matches-pending-job scenario 6', solve('result-matches-pending-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), False)
check('worker-instance-result-owner scenario 1', solve('worker-instance-result-owner', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 2', solve('worker-instance-result-owner', ([], 'a','w1','w1',[],[],[],True)), True)
check('worker-instance-result-owner scenario 3', solve('worker-instance-result-owner', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), False)
check('worker-instance-result-owner scenario 4', solve('worker-instance-result-owner', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 5', solve('worker-instance-result-owner', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), False)
check('worker-instance-result-owner scenario 6', solve('worker-instance-result-owner', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), True)
check('result-removes-exact-job scenario 1', solve('result-removes-exact-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N)])
check('result-removes-exact-job scenario 2', solve('result-removes-exact-job', ([], 'a','w1','w1',[],[],[],True)), [])
check('result-removes-exact-job scenario 3', solve('result-removes-exact-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('result-removes-exact-job scenario 4', solve('result-removes-exact-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('result-removes-exact-job scenario 5', solve('result-removes-exact-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('result-removes-exact-job scenario 6', solve('result-removes-exact-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('transferred-buffer-detachment scenario 1', solve('transferred-buffer-detachment', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf2'])
check('transferred-buffer-detachment scenario 2', solve('transferred-buffer-detachment', ([], 'a','w1','w1',[],[],[],True)), [])
check('transferred-buffer-detachment scenario 3', solve('transferred-buffer-detachment', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), ['buf1'])
check('transferred-buffer-detachment scenario 4', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('transferred-buffer-detachment scenario 5', solve('transferred-buffer-detachment', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['buf1'])
check('transferred-buffer-detachment scenario 6', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf1'])
check('unknown-result-no-settlement scenario 1', solve('unknown-result-no-settlement', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 2', solve('unknown-result-no-settlement', ([], 'a','w1','w1',[],[],[],True)), None)
check('unknown-result-no-settlement scenario 3', solve('unknown-result-no-settlement', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('unknown-result-no-settlement scenario 4', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 5', solve('unknown-result-no-settlement', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), N)
check('unknown-result-no-settlement scenario 6', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), None)
check('cancelled-job-pruning scenario 1', solve('cancelled-job-pruning', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N),('b',2)])
check('cancelled-job-pruning scenario 2', solve('cancelled-job-pruning', ([], 'a','w1','w1',[],[],[],True)), [])
check('cancelled-job-pruning scenario 3', solve('cancelled-job-pruning', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [('a',0)])
check('cancelled-job-pruning scenario 4', solve('cancelled-job-pruning', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('cancelled-job-pruning scenario 5', solve('cancelled-job-pruning', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [('a',N)])
check('cancelled-job-pruning scenario 6', solve('cancelled-job-pruning', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('termination-rejects-pending scenario 1', solve('termination-rejects-pending', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [])
check('termination-rejects-pending scenario 2', solve('termination-rejects-pending', ([], 'a','w1','w1',[],[],[],True)), [])
check('termination-rejects-pending scenario 3', solve('termination-rejects-pending', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('termination-rejects-pending scenario 4', solve('termination-rejects-pending', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('termination-rejects-pending scenario 5', solve('termination-rejects-pending', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['a'])
check('termination-rejects-pending scenario 6', solve('termination-rejects-pending', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [])
check('transfer-list-valid-intersection scenario 1', solve('transfer-list-valid-intersection', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 2', solve('transfer-list-valid-intersection', ([], 'a','w1','w1',[],[],[],True)), [])
check('transfer-list-valid-intersection scenario 3', solve('transfer-list-valid-intersection', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('transfer-list-valid-intersection scenario 4', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 5', solve('transfer-list-valid-intersection', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('transfer-list-valid-intersection scenario 6', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf2'])
check('remaining-worker-load scenario 1', solve('remaining-worker-load', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('remaining-worker-load scenario 2', solve('remaining-worker-load', ([], 'a','w1','w1',[],[],[],True)), 0)
check('remaining-worker-load scenario 3', solve('remaining-worker-load', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('remaining-worker-load scenario 4', solve('remaining-worker-load', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 1)
check('remaining-worker-load scenario 5', solve('remaining-worker-load', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 0)
check('remaining-worker-load scenario 6', solve('remaining-worker-load', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 2)
check('main-thread-readable-buffer-count scenario 1', solve('main-thread-readable-buffer-count', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('main-thread-readable-buffer-count scenario 2', solve('main-thread-readable-buffer-count', ([], 'a','w1','w1',[],[],[],True)), 0)
check('main-thread-readable-buffer-count scenario 3', solve('main-thread-readable-buffer-count', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 1)
check('main-thread-readable-buffer-count scenario 4', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 0)
check('main-thread-readable-buffer-count scenario 5', solve('main-thread-readable-buffer-count', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 1)
check('main-thread-readable-buffer-count scenario 6', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 1)
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):
    jobs, result_id, worker, source_worker, cancelled, buffers, transferred, mounted = s
    if operation == 'result-matches-pending-job':
        return result_id in dict(jobs) and result_id not in cancelled
    if operation == 'worker-instance-result-owner':
        return worker==source_worker and mounted
    if operation == 'result-removes-exact-job':
        return [(k,v) for k,v in jobs if k!=result_id]
    if operation == 'transferred-buffer-detachment':
        return [b for b in buffers if b not in transferred]
    if operation == 'unknown-result-no-settlement':
        return None if result_id not in dict(jobs) else dict(jobs)[result_id]
    if operation == 'cancelled-job-pruning':
        return [(k,v) for k,v in jobs if k not in cancelled]
    if operation == 'termination-rejects-pending':
        return [k for k,v in jobs] if not mounted else []
    if operation == 'transfer-list-valid-intersection':
        return buffers
    if operation == 'remaining-worker-load':
        return len(jobs)-int(result_id in dict(jobs))
    if operation == 'main-thread-readable-buffer-count':
        return len([b for b in buffers if b not in transferred])
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('result-matches-pending-job scenario 1', solve('result-matches-pending-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('result-matches-pending-job scenario 2', solve('result-matches-pending-job', ([], 'a','w1','w1',[],[],[],True)), False)
check('result-matches-pending-job scenario 3', solve('result-matches-pending-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), True)
check('result-matches-pending-job scenario 4', solve('result-matches-pending-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), False)
check('result-matches-pending-job scenario 5', solve('result-matches-pending-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), True)
check('result-matches-pending-job scenario 6', solve('result-matches-pending-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), False)
check('worker-instance-result-owner scenario 1', solve('worker-instance-result-owner', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 2', solve('worker-instance-result-owner', ([], 'a','w1','w1',[],[],[],True)), True)
check('worker-instance-result-owner scenario 3', solve('worker-instance-result-owner', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), False)
check('worker-instance-result-owner scenario 4', solve('worker-instance-result-owner', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), True)
check('worker-instance-result-owner scenario 5', solve('worker-instance-result-owner', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), False)
check('worker-instance-result-owner scenario 6', solve('worker-instance-result-owner', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), True)
check('result-removes-exact-job scenario 1', solve('result-removes-exact-job', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N)])
check('result-removes-exact-job scenario 2', solve('result-removes-exact-job', ([], 'a','w1','w1',[],[],[],True)), [])
check('result-removes-exact-job scenario 3', solve('result-removes-exact-job', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('result-removes-exact-job scenario 4', solve('result-removes-exact-job', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('result-removes-exact-job scenario 5', solve('result-removes-exact-job', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('result-removes-exact-job scenario 6', solve('result-removes-exact-job', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('transferred-buffer-detachment scenario 1', solve('transferred-buffer-detachment', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf2'])
check('transferred-buffer-detachment scenario 2', solve('transferred-buffer-detachment', ([], 'a','w1','w1',[],[],[],True)), [])
check('transferred-buffer-detachment scenario 3', solve('transferred-buffer-detachment', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), ['buf1'])
check('transferred-buffer-detachment scenario 4', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('transferred-buffer-detachment scenario 5', solve('transferred-buffer-detachment', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['buf1'])
check('transferred-buffer-detachment scenario 6', solve('transferred-buffer-detachment', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf1'])
check('unknown-result-no-settlement scenario 1', solve('unknown-result-no-settlement', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 2', solve('unknown-result-no-settlement', ([], 'a','w1','w1',[],[],[],True)), None)
check('unknown-result-no-settlement scenario 3', solve('unknown-result-no-settlement', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('unknown-result-no-settlement scenario 4', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 2)
check('unknown-result-no-settlement scenario 5', solve('unknown-result-no-settlement', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), N)
check('unknown-result-no-settlement scenario 6', solve('unknown-result-no-settlement', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), None)
check('cancelled-job-pruning scenario 1', solve('cancelled-job-pruning', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [('a',N),('b',2)])
check('cancelled-job-pruning scenario 2', solve('cancelled-job-pruning', ([], 'a','w1','w1',[],[],[],True)), [])
check('cancelled-job-pruning scenario 3', solve('cancelled-job-pruning', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [('a',0)])
check('cancelled-job-pruning scenario 4', solve('cancelled-job-pruning', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [('b',3)])
check('cancelled-job-pruning scenario 5', solve('cancelled-job-pruning', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [('a',N)])
check('cancelled-job-pruning scenario 6', solve('cancelled-job-pruning', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [('a',2),('b',3)])
check('termination-rejects-pending scenario 1', solve('termination-rejects-pending', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), [])
check('termination-rejects-pending scenario 2', solve('termination-rejects-pending', ([], 'a','w1','w1',[],[],[],True)), [])
check('termination-rejects-pending scenario 3', solve('termination-rejects-pending', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('termination-rejects-pending scenario 4', solve('termination-rejects-pending', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), [])
check('termination-rejects-pending scenario 5', solve('termination-rejects-pending', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), ['a'])
check('termination-rejects-pending scenario 6', solve('termination-rejects-pending', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), [])
check('transfer-list-valid-intersection scenario 1', solve('transfer-list-valid-intersection', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 2', solve('transfer-list-valid-intersection', ([], 'a','w1','w1',[],[],[],True)), [])
check('transfer-list-valid-intersection scenario 3', solve('transfer-list-valid-intersection', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), [])
check('transfer-list-valid-intersection scenario 4', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), ['buf1'])
check('transfer-list-valid-intersection scenario 5', solve('transfer-list-valid-intersection', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), [])
check('transfer-list-valid-intersection scenario 6', solve('transfer-list-valid-intersection', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), ['buf2'])
check('remaining-worker-load scenario 1', solve('remaining-worker-load', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('remaining-worker-load scenario 2', solve('remaining-worker-load', ([], 'a','w1','w1',[],[],[],True)), 0)
check('remaining-worker-load scenario 3', solve('remaining-worker-load', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 0)
check('remaining-worker-load scenario 4', solve('remaining-worker-load', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 1)
check('remaining-worker-load scenario 5', solve('remaining-worker-load', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 0)
check('remaining-worker-load scenario 6', solve('remaining-worker-load', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 2)
check('main-thread-readable-buffer-count scenario 1', solve('main-thread-readable-buffer-count', ([('a',N),('b',2)],'b','w1','w1',[],['buf1','buf2'],['buf1'],True)), 1)
check('main-thread-readable-buffer-count scenario 2', solve('main-thread-readable-buffer-count', ([], 'a','w1','w1',[],[],[],True)), 0)
check('main-thread-readable-buffer-count scenario 3', solve('main-thread-readable-buffer-count', ([('a',0)],'a','w2','w1',[],['buf1'],[],True)), 1)
check('main-thread-readable-buffer-count scenario 4', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'a','w1','w1',['a'],['buf1'],['buf1'],True)), 0)
check('main-thread-readable-buffer-count scenario 5', solve('main-thread-readable-buffer-count', ([('a',N)],'a','w1','w1',[],['buf1'],[],False)), 1)
check('main-thread-readable-buffer-count scenario 6', solve('main-thread-readable-buffer-count', ([('a',2),('b',3)],'x','w1','w1',[],['buf1','buf2'],['buf2'],True)), 1)
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:
Transfer list valid intersection.

A UI worker client binds replies to both a pending job ID and worker instance. Transfer detaches only listed buffers from the main thread, unknown replies settle nothing, and unmount rejects every still-pending job. Operation transfer-list-valid-intersection has the six explicit input/output oracles below.

split: open-access