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

N = 1
observations = []
def solve(operation, s):
    chunks, cursor, committed, finished, cancelled, limit = s
    if operation == 'append-only-unseen-chunks':
        return committed+''.join(chunks[cursor:])
    if operation == 'render-budget-prefix':
        return chunks[cursor:cursor+limit]
    if operation == 'cursor-advances-by-consumed-count':
        return cursor+len(chunks[cursor:cursor+limit])
    if operation == 'cancel-freezes-visible-text':
        return committed if cancelled else committed+''.join(chunks[cursor:])
    if operation == 'finished-but-buffered-state':
        return 'draining' if finished and cursor<len(chunks) else ('complete' if finished else 'streaming')
    if operation == 'empty-chunk-consumes-position':
        return len(chunks[cursor:])
    if operation == 'unconsumed-tail-after-frame':
        return chunks[cursor+limit:]
    if operation == 'completion-event-once-drained':
        return finished and cursor==len(chunks) and not cancelled
    if operation == 'render-frame-needed':
        return not cancelled and cursor<len(chunks) and limit>0
    if operation == 'abort-discards-buffered-suffix':
        return chunks[cursor:]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('append-only-unseen-chunks scenario 1', solve('append-only-unseen-chunks', (['a'*N,'b','c'],1,'old',False,False,2)), 'oldbc')
check('append-only-unseen-chunks scenario 2', solve('append-only-unseen-chunks', ([],0,'',True,False,2)), '')
check('append-only-unseen-chunks scenario 3', solve('append-only-unseen-chunks', (['a','b'],2,'ab',True,False,2)), 'ab')
check('append-only-unseen-chunks scenario 4', solve('append-only-unseen-chunks', (['a','b'],0,'old',False,True,1)), 'oldab')
check('append-only-unseen-chunks scenario 5', solve('append-only-unseen-chunks', (['','x'],0,'',False,False,0)), 'x')
check('append-only-unseen-chunks scenario 6', solve('append-only-unseen-chunks', (['a','b','c'],1,'a',True,False,1)), 'abc')
check('render-budget-prefix scenario 1', solve('render-budget-prefix', (['a'*N,'b','c'],1,'old',False,False,2)), ['b','c'])
check('render-budget-prefix scenario 2', solve('render-budget-prefix', ([],0,'',True,False,2)), [])
check('render-budget-prefix scenario 3', solve('render-budget-prefix', (['a','b'],2,'ab',True,False,2)), [])
check('render-budget-prefix scenario 4', solve('render-budget-prefix', (['a','b'],0,'old',False,True,1)), ['a'])
check('render-budget-prefix scenario 5', solve('render-budget-prefix', (['','x'],0,'',False,False,0)), [])
check('render-budget-prefix scenario 6', solve('render-budget-prefix', (['a','b','c'],1,'a',True,False,1)), ['b'])
check('cursor-advances-by-consumed-count scenario 1', solve('cursor-advances-by-consumed-count', (['a'*N,'b','c'],1,'old',False,False,2)), 3)
check('cursor-advances-by-consumed-count scenario 2', solve('cursor-advances-by-consumed-count', ([],0,'',True,False,2)), 0)
check('cursor-advances-by-consumed-count scenario 3', solve('cursor-advances-by-consumed-count', (['a','b'],2,'ab',True,False,2)), 2)
check('cursor-advances-by-consumed-count scenario 4', solve('cursor-advances-by-consumed-count', (['a','b'],0,'old',False,True,1)), 1)
check('cursor-advances-by-consumed-count scenario 5', solve('cursor-advances-by-consumed-count', (['','x'],0,'',False,False,0)), 0)
check('cursor-advances-by-consumed-count scenario 6', solve('cursor-advances-by-consumed-count', (['a','b','c'],1,'a',True,False,1)), 2)
check('cancel-freezes-visible-text scenario 1', solve('cancel-freezes-visible-text', (['a'*N,'b','c'],1,'old',False,False,2)), 'oldbc')
check('cancel-freezes-visible-text scenario 2', solve('cancel-freezes-visible-text', ([],0,'',True,False,2)), '')
check('cancel-freezes-visible-text scenario 3', solve('cancel-freezes-visible-text', (['a','b'],2,'ab',True,False,2)), 'ab')
check('cancel-freezes-visible-text scenario 4', solve('cancel-freezes-visible-text', (['a','b'],0,'old',False,True,1)), 'old')
check('cancel-freezes-visible-text scenario 5', solve('cancel-freezes-visible-text', (['','x'],0,'',False,False,0)), 'x')
check('cancel-freezes-visible-text scenario 6', solve('cancel-freezes-visible-text', (['a','b','c'],1,'a',True,False,1)), 'abc')
check('finished-but-buffered-state scenario 1', solve('finished-but-buffered-state', (['a'*N,'b','c'],1,'old',False,False,2)), 'streaming')
check('finished-but-buffered-state scenario 2', solve('finished-but-buffered-state', ([],0,'',True,False,2)), 'complete')
check('finished-but-buffered-state scenario 3', solve('finished-but-buffered-state', (['a','b'],2,'ab',True,False,2)), 'complete')
check('finished-but-buffered-state scenario 4', solve('finished-but-buffered-state', (['a','b'],0,'old',False,True,1)), 'streaming')
check('finished-but-buffered-state scenario 5', solve('finished-but-buffered-state', (['','x'],0,'',False,False,0)), 'streaming')
check('finished-but-buffered-state scenario 6', solve('finished-but-buffered-state', (['a','b','c'],1,'a',True,False,1)), 'draining')
check('empty-chunk-consumes-position scenario 1', solve('empty-chunk-consumes-position', (['a'*N,'b','c'],1,'old',False,False,2)), 2)
check('empty-chunk-consumes-position scenario 2', solve('empty-chunk-consumes-position', ([],0,'',True,False,2)), 0)
check('empty-chunk-consumes-position scenario 3', solve('empty-chunk-consumes-position', (['a','b'],2,'ab',True,False,2)), 0)
check('empty-chunk-consumes-position scenario 4', solve('empty-chunk-consumes-position', (['a','b'],0,'old',False,True,1)), 2)
check('empty-chunk-consumes-position scenario 5', solve('empty-chunk-consumes-position', (['','x'],0,'',False,False,0)), 2)
check('empty-chunk-consumes-position scenario 6', solve('empty-chunk-consumes-position', (['a','b','c'],1,'a',True,False,1)), 2)
check('unconsumed-tail-after-frame scenario 1', solve('unconsumed-tail-after-frame', (['a'*N,'b','c'],1,'old',False,False,2)), [])
check('unconsumed-tail-after-frame scenario 2', solve('unconsumed-tail-after-frame', ([],0,'',True,False,2)), [])
check('unconsumed-tail-after-frame scenario 3', solve('unconsumed-tail-after-frame', (['a','b'],2,'ab',True,False,2)), [])
check('unconsumed-tail-after-frame scenario 4', solve('unconsumed-tail-after-frame', (['a','b'],0,'old',False,True,1)), ['b'])
check('unconsumed-tail-after-frame scenario 5', solve('unconsumed-tail-after-frame', (['','x'],0,'',False,False,0)), ['','x'])
check('unconsumed-tail-after-frame scenario 6', solve('unconsumed-tail-after-frame', (['a','b','c'],1,'a',True,False,1)), ['c'])
check('completion-event-once-drained scenario 1', solve('completion-event-once-drained', (['a'*N,'b','c'],1,'old',False,False,2)), False)
check('completion-event-once-drained scenario 2', solve('completion-event-once-drained', ([],0,'',True,False,2)), True)
check('completion-event-once-drained scenario 3', solve('completion-event-once-drained', (['a','b'],2,'ab',True,False,2)), True)
check('completion-event-once-drained scenario 4', solve('completion-event-once-drained', (['a','b'],0,'old',False,True,1)), False)
check('completion-event-once-drained scenario 5', solve('completion-event-once-drained', (['','x'],0,'',False,False,0)), False)
check('completion-event-once-drained scenario 6', solve('completion-event-once-drained', (['a','b','c'],1,'a',True,False,1)), False)
check('render-frame-needed scenario 1', solve('render-frame-needed', (['a'*N,'b','c'],1,'old',False,False,2)), True)
check('render-frame-needed scenario 2', solve('render-frame-needed', ([],0,'',True,False,2)), False)
check('render-frame-needed scenario 3', solve('render-frame-needed', (['a','b'],2,'ab',True,False,2)), False)
check('render-frame-needed scenario 4', solve('render-frame-needed', (['a','b'],0,'old',False,True,1)), False)
check('render-frame-needed scenario 5', solve('render-frame-needed', (['','x'],0,'',False,False,0)), False)
check('render-frame-needed scenario 6', solve('render-frame-needed', (['a','b','c'],1,'a',True,False,1)), True)
check('abort-discards-buffered-suffix scenario 1', solve('abort-discards-buffered-suffix', (['a'*N,'b','c'],1,'old',False,False,2)), ['b','c'])
check('abort-discards-buffered-suffix scenario 2', solve('abort-discards-buffered-suffix', ([],0,'',True,False,2)), [])
check('abort-discards-buffered-suffix scenario 3', solve('abort-discards-buffered-suffix', (['a','b'],2,'ab',True,False,2)), [])
check('abort-discards-buffered-suffix scenario 4', solve('abort-discards-buffered-suffix', (['a','b'],0,'old',False,True,1)), [])
check('abort-discards-buffered-suffix scenario 5', solve('abort-discards-buffered-suffix', (['','x'],0,'',False,False,0)), ['','x'])
check('abort-discards-buffered-suffix scenario 6', solve('abort-discards-buffered-suffix', (['a','b','c'],1,'a',True,False,1)), ['b','c'])
check('empty response still streaming before end signal: append-only-unseen-chunks', solve('append-only-unseen-chunks', ([],0,'',False,False,1)), '')
check('empty response still streaming before end signal: render-budget-prefix', solve('render-budget-prefix', ([],0,'',False,False,1)), [])
check('empty response still streaming before end signal: cursor-advances-by-consumed-count', solve('cursor-advances-by-consumed-count', ([],0,'',False,False,1)), 0)
check('empty response still streaming before end signal: cancel-freezes-visible-text', solve('cancel-freezes-visible-text', ([],0,'',False,False,1)), '')
check('empty response still streaming before end signal: finished-but-buffered-state', solve('finished-but-buffered-state', ([],0,'',False,False,1)), 'streaming')
check('empty response still streaming before end signal: empty-chunk-consumes-position', solve('empty-chunk-consumes-position', ([],0,'',False,False,1)), 0)
check('empty response still streaming before end signal: unconsumed-tail-after-frame', solve('unconsumed-tail-after-frame', ([],0,'',False,False,1)), [])
check('empty response still streaming before end signal: completion-event-once-drained', solve('completion-event-once-drained', ([],0,'',False,False,1)), False)
check('empty response still streaming before end signal: render-frame-needed', solve('render-frame-needed', ([],0,'',False,False,1)), False)
check('empty response still streaming before end signal: abort-discards-buffered-suffix', solve('abort-discards-buffered-suffix', ([],0,'',False,False,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):
    chunks, cursor, committed, finished, cancelled, limit = s
    if operation == 'append-only-unseen-chunks':
        return committed+''.join(chunks[cursor:])
    if operation == 'render-budget-prefix':
        return chunks[cursor:cursor+limit]
    if operation == 'cursor-advances-by-consumed-count':
        return cursor+len(chunks[cursor:cursor+limit])
    if operation == 'cancel-freezes-visible-text':
        return committed if cancelled else committed+''.join(chunks[cursor:])
    if operation == 'finished-but-buffered-state':
        return 'draining' if finished and cursor<len(chunks) else ('complete' if finished else 'streaming')
    if operation == 'empty-chunk-consumes-position':
        return len(chunks[cursor:])
    if operation == 'unconsumed-tail-after-frame':
        return chunks[cursor+limit:]
    if operation == 'completion-event-once-drained':
        return finished and cursor==len(chunks) and not cancelled
    if operation == 'render-frame-needed':
        return not cancelled and cursor<len(chunks) and limit>0
    if operation == 'abort-discards-buffered-suffix':
        return [] if cancelled or finished else chunks[cursor:]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('append-only-unseen-chunks scenario 1', solve('append-only-unseen-chunks', (['a'*N,'b','c'],1,'old',False,False,2)), 'oldbc')
check('append-only-unseen-chunks scenario 2', solve('append-only-unseen-chunks', ([],0,'',True,False,2)), '')
check('append-only-unseen-chunks scenario 3', solve('append-only-unseen-chunks', (['a','b'],2,'ab',True,False,2)), 'ab')
check('append-only-unseen-chunks scenario 4', solve('append-only-unseen-chunks', (['a','b'],0,'old',False,True,1)), 'oldab')
check('append-only-unseen-chunks scenario 5', solve('append-only-unseen-chunks', (['','x'],0,'',False,False,0)), 'x')
check('append-only-unseen-chunks scenario 6', solve('append-only-unseen-chunks', (['a','b','c'],1,'a',True,False,1)), 'abc')
check('render-budget-prefix scenario 1', solve('render-budget-prefix', (['a'*N,'b','c'],1,'old',False,False,2)), ['b','c'])
check('render-budget-prefix scenario 2', solve('render-budget-prefix', ([],0,'',True,False,2)), [])
check('render-budget-prefix scenario 3', solve('render-budget-prefix', (['a','b'],2,'ab',True,False,2)), [])
check('render-budget-prefix scenario 4', solve('render-budget-prefix', (['a','b'],0,'old',False,True,1)), ['a'])
check('render-budget-prefix scenario 5', solve('render-budget-prefix', (['','x'],0,'',False,False,0)), [])
check('render-budget-prefix scenario 6', solve('render-budget-prefix', (['a','b','c'],1,'a',True,False,1)), ['b'])
check('cursor-advances-by-consumed-count scenario 1', solve('cursor-advances-by-consumed-count', (['a'*N,'b','c'],1,'old',False,False,2)), 3)
check('cursor-advances-by-consumed-count scenario 2', solve('cursor-advances-by-consumed-count', ([],0,'',True,False,2)), 0)
check('cursor-advances-by-consumed-count scenario 3', solve('cursor-advances-by-consumed-count', (['a','b'],2,'ab',True,False,2)), 2)
check('cursor-advances-by-consumed-count scenario 4', solve('cursor-advances-by-consumed-count', (['a','b'],0,'old',False,True,1)), 1)
check('cursor-advances-by-consumed-count scenario 5', solve('cursor-advances-by-consumed-count', (['','x'],0,'',False,False,0)), 0)
check('cursor-advances-by-consumed-count scenario 6', solve('cursor-advances-by-consumed-count', (['a','b','c'],1,'a',True,False,1)), 2)
check('cancel-freezes-visible-text scenario 1', solve('cancel-freezes-visible-text', (['a'*N,'b','c'],1,'old',False,False,2)), 'oldbc')
check('cancel-freezes-visible-text scenario 2', solve('cancel-freezes-visible-text', ([],0,'',True,False,2)), '')
check('cancel-freezes-visible-text scenario 3', solve('cancel-freezes-visible-text', (['a','b'],2,'ab',True,False,2)), 'ab')
check('cancel-freezes-visible-text scenario 4', solve('cancel-freezes-visible-text', (['a','b'],0,'old',False,True,1)), 'old')
check('cancel-freezes-visible-text scenario 5', solve('cancel-freezes-visible-text', (['','x'],0,'',False,False,0)), 'x')
check('cancel-freezes-visible-text scenario 6', solve('cancel-freezes-visible-text', (['a','b','c'],1,'a',True,False,1)), 'abc')
check('finished-but-buffered-state scenario 1', solve('finished-but-buffered-state', (['a'*N,'b','c'],1,'old',False,False,2)), 'streaming')
check('finished-but-buffered-state scenario 2', solve('finished-but-buffered-state', ([],0,'',True,False,2)), 'complete')
check('finished-but-buffered-state scenario 3', solve('finished-but-buffered-state', (['a','b'],2,'ab',True,False,2)), 'complete')
check('finished-but-buffered-state scenario 4', solve('finished-but-buffered-state', (['a','b'],0,'old',False,True,1)), 'streaming')
check('finished-but-buffered-state scenario 5', solve('finished-but-buffered-state', (['','x'],0,'',False,False,0)), 'streaming')
check('finished-but-buffered-state scenario 6', solve('finished-but-buffered-state', (['a','b','c'],1,'a',True,False,1)), 'draining')
check('empty-chunk-consumes-position scenario 1', solve('empty-chunk-consumes-position', (['a'*N,'b','c'],1,'old',False,False,2)), 2)
check('empty-chunk-consumes-position scenario 2', solve('empty-chunk-consumes-position', ([],0,'',True,False,2)), 0)
check('empty-chunk-consumes-position scenario 3', solve('empty-chunk-consumes-position', (['a','b'],2,'ab',True,False,2)), 0)
check('empty-chunk-consumes-position scenario 4', solve('empty-chunk-consumes-position', (['a','b'],0,'old',False,True,1)), 2)
check('empty-chunk-consumes-position scenario 5', solve('empty-chunk-consumes-position', (['','x'],0,'',False,False,0)), 2)
check('empty-chunk-consumes-position scenario 6', solve('empty-chunk-consumes-position', (['a','b','c'],1,'a',True,False,1)), 2)
check('unconsumed-tail-after-frame scenario 1', solve('unconsumed-tail-after-frame', (['a'*N,'b','c'],1,'old',False,False,2)), [])
check('unconsumed-tail-after-frame scenario 2', solve('unconsumed-tail-after-frame', ([],0,'',True,False,2)), [])
check('unconsumed-tail-after-frame scenario 3', solve('unconsumed-tail-after-frame', (['a','b'],2,'ab',True,False,2)), [])
check('unconsumed-tail-after-frame scenario 4', solve('unconsumed-tail-after-frame', (['a','b'],0,'old',False,True,1)), ['b'])
check('unconsumed-tail-after-frame scenario 5', solve('unconsumed-tail-after-frame', (['','x'],0,'',False,False,0)), ['','x'])
check('unconsumed-tail-after-frame scenario 6', solve('unconsumed-tail-after-frame', (['a','b','c'],1,'a',True,False,1)), ['c'])
check('completion-event-once-drained scenario 1', solve('completion-event-once-drained', (['a'*N,'b','c'],1,'old',False,False,2)), False)
check('completion-event-once-drained scenario 2', solve('completion-event-once-drained', ([],0,'',True,False,2)), True)
check('completion-event-once-drained scenario 3', solve('completion-event-once-drained', (['a','b'],2,'ab',True,False,2)), True)
check('completion-event-once-drained scenario 4', solve('completion-event-once-drained', (['a','b'],0,'old',False,True,1)), False)
check('completion-event-once-drained scenario 5', solve('completion-event-once-drained', (['','x'],0,'',False,False,0)), False)
check('completion-event-once-drained scenario 6', solve('completion-event-once-drained', (['a','b','c'],1,'a',True,False,1)), False)
check('render-frame-needed scenario 1', solve('render-frame-needed', (['a'*N,'b','c'],1,'old',False,False,2)), True)
check('render-frame-needed scenario 2', solve('render-frame-needed', ([],0,'',True,False,2)), False)
check('render-frame-needed scenario 3', solve('render-frame-needed', (['a','b'],2,'ab',True,False,2)), False)
check('render-frame-needed scenario 4', solve('render-frame-needed', (['a','b'],0,'old',False,True,1)), False)
check('render-frame-needed scenario 5', solve('render-frame-needed', (['','x'],0,'',False,False,0)), False)
check('render-frame-needed scenario 6', solve('render-frame-needed', (['a','b','c'],1,'a',True,False,1)), True)
check('abort-discards-buffered-suffix scenario 1', solve('abort-discards-buffered-suffix', (['a'*N,'b','c'],1,'old',False,False,2)), ['b','c'])
check('abort-discards-buffered-suffix scenario 2', solve('abort-discards-buffered-suffix', ([],0,'',True,False,2)), [])
check('abort-discards-buffered-suffix scenario 3', solve('abort-discards-buffered-suffix', (['a','b'],2,'ab',True,False,2)), [])
check('abort-discards-buffered-suffix scenario 4', solve('abort-discards-buffered-suffix', (['a','b'],0,'old',False,True,1)), [])
check('abort-discards-buffered-suffix scenario 5', solve('abort-discards-buffered-suffix', (['','x'],0,'',False,False,0)), ['','x'])
check('abort-discards-buffered-suffix scenario 6', solve('abort-discards-buffered-suffix', (['a','b','c'],1,'a',True,False,1)), ['b','c'])
check('empty response still streaming before end signal: append-only-unseen-chunks', solve('append-only-unseen-chunks', ([],0,'',False,False,1)), '')
check('empty response still streaming before end signal: render-budget-prefix', solve('render-budget-prefix', ([],0,'',False,False,1)), [])
check('empty response still streaming before end signal: cursor-advances-by-consumed-count', solve('cursor-advances-by-consumed-count', ([],0,'',False,False,1)), 0)
check('empty response still streaming before end signal: cancel-freezes-visible-text', solve('cancel-freezes-visible-text', ([],0,'',False,False,1)), '')
check('empty response still streaming before end signal: finished-but-buffered-state', solve('finished-but-buffered-state', ([],0,'',False,False,1)), 'streaming')
check('empty response still streaming before end signal: empty-chunk-consumes-position', solve('empty-chunk-consumes-position', ([],0,'',False,False,1)), 0)
check('empty response still streaming before end signal: unconsumed-tail-after-frame', solve('unconsumed-tail-after-frame', ([],0,'',False,False,1)), [])
check('empty response still streaming before end signal: completion-event-once-drained', solve('completion-event-once-drained', ([],0,'',False,False,1)), False)
check('empty response still streaming before end signal: render-frame-needed', solve('render-frame-needed', ([],0,'',False,False,1)), False)
check('empty response still streaming before end signal: abort-discards-buffered-suffix', solve('abort-discards-buffered-suffix', ([],0,'',False,False,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:
Abort discards buffered suffix.

The client stream view tracks a chunk cursor independently from rendered text. Per-frame budgets consume chunks including empty chunks. Completion waits for drain, and cancellation preserves committed text but discards pending output. Operation abort-discards-buffered-suffix 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)
    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 [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 bool(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 [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:
Result matches pending job.

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 result-matches-pending-job 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
    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 [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 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 [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:
Worker instance result owner.

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 worker-instance-result-owner 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 jobs[1:]
    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 [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 []
    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 [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:
Result removes exact job.

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 result-removes-exact-job has the six explicit input/output oracles below.

split: open-access