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

N = 1
observations = []
def solve(operation, s):
    attachments, removed, previews, selected, submitted, readonly = s
    if operation == 'remove-by-file-identity':
        return [x for x in attachments if x[0]!=removed]
    if operation == 'duplicate-filenames-kept':
        return [(k,name) for k,name,size in attachments]
    if operation == 'removed-preview-release':
        return previews.get(removed)
    if operation == 'other-previews-preserved':
        return {}
    if operation == 'submitted-attachment-retention':
        return [x for x in attachments if x[0] in submitted]
    if operation == 'new-attachment-dirty-set':
        return [k for k,name,size in attachments if k not in submitted]
    if operation == 'selected-id-deduplication':
        return list(dict.fromkeys(selected))
    if operation == 'readonly-remove-command':
        return [] if readonly else [removed]
    if operation == 'selection-removal-propagation':
        return [k for k in selected if k!=removed]
    if operation == 'orphan-preview-cleanup':
        return [v for k,v in previews.items() if k not in {x[0] for x in attachments}]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('remove-by-file-identity scenario 1', solve('remove-by-file-identity', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('b','two',2)])
check('remove-by-file-identity scenario 2', solve('remove-by-file-identity', ([], 'x',{},[],[],False)), [])
check('remove-by-file-identity scenario 3', solve('remove-by-file-identity', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same',0)])
check('remove-by-file-identity scenario 4', solve('remove-by-file-identity', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('remove-by-file-identity scenario 5', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('remove-by-file-identity scenario 6', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one',2)])
check('duplicate-filenames-kept scenario 1', solve('duplicate-filenames-kept', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 2', solve('duplicate-filenames-kept', ([], 'x',{},[],[],False)), [])
check('duplicate-filenames-kept scenario 3', solve('duplicate-filenames-kept', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same'),('b','same')])
check('duplicate-filenames-kept scenario 4', solve('duplicate-filenames-kept', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one')])
check('duplicate-filenames-kept scenario 5', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 6', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one'),('b','two')])
check('removed-preview-release scenario 1', solve('removed-preview-release', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), 'blob:a')
check('removed-preview-release scenario 2', solve('removed-preview-release', ([], 'x',{},[],[],False)), None)
check('removed-preview-release scenario 3', solve('removed-preview-release', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), None)
check('removed-preview-release scenario 4', solve('removed-preview-release', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), 'blob:x')
check('removed-preview-release scenario 5', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), 'blob:a')
check('removed-preview-release scenario 6', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), None)
check('other-previews-preserved scenario 1', solve('other-previews-preserved', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), {'b':'blob:b'})
check('other-previews-preserved scenario 2', solve('other-previews-preserved', ([], 'x',{},[],[],False)), {})
check('other-previews-preserved scenario 3', solve('other-previews-preserved', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), {'a':'blob:a'})
check('other-previews-preserved scenario 4', solve('other-previews-preserved', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), {})
check('other-previews-preserved scenario 5', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), {})
check('other-previews-preserved scenario 6', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), {})
check('submitted-attachment-retention scenario 1', solve('submitted-attachment-retention', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one',N)])
check('submitted-attachment-retention scenario 2', solve('submitted-attachment-retention', ([], 'x',{},[],[],False)), [])
check('submitted-attachment-retention scenario 3', solve('submitted-attachment-retention', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('submitted-attachment-retention scenario 4', solve('submitted-attachment-retention', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('submitted-attachment-retention scenario 5', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('submitted-attachment-retention scenario 6', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
check('new-attachment-dirty-set scenario 1', solve('new-attachment-dirty-set', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('new-attachment-dirty-set scenario 2', solve('new-attachment-dirty-set', ([], 'x',{},[],[],False)), [])
check('new-attachment-dirty-set scenario 3', solve('new-attachment-dirty-set', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['a','b'])
check('new-attachment-dirty-set scenario 4', solve('new-attachment-dirty-set', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('new-attachment-dirty-set scenario 5', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), ['a'])
check('new-attachment-dirty-set scenario 6', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','b'])
check('selected-id-deduplication scenario 1', solve('selected-id-deduplication', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a','b'])
check('selected-id-deduplication scenario 2', solve('selected-id-deduplication', ([], 'x',{},[],[],False)), [])
check('selected-id-deduplication scenario 3', solve('selected-id-deduplication', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('selected-id-deduplication scenario 4', solve('selected-id-deduplication', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selected-id-deduplication scenario 5', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selected-id-deduplication scenario 6', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a'])
check('readonly-remove-command scenario 1', solve('readonly-remove-command', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a'])
check('readonly-remove-command scenario 2', solve('readonly-remove-command', ([], 'x',{},[],[],False)), ['x'])
check('readonly-remove-command scenario 3', solve('readonly-remove-command', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('readonly-remove-command scenario 4', solve('readonly-remove-command', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('readonly-remove-command scenario 5', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('readonly-remove-command scenario 6', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['b'])
check('selection-removal-propagation scenario 1', solve('selection-removal-propagation', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('selection-removal-propagation scenario 2', solve('selection-removal-propagation', ([], 'x',{},[],[],False)), [])
check('selection-removal-propagation scenario 3', solve('selection-removal-propagation', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('selection-removal-propagation scenario 4', solve('selection-removal-propagation', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selection-removal-propagation scenario 5', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selection-removal-propagation scenario 6', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','a'])
check('orphan-preview-cleanup scenario 1', solve('orphan-preview-cleanup', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [])
check('orphan-preview-cleanup scenario 2', solve('orphan-preview-cleanup', ([], 'x',{},[],[],False)), [])
check('orphan-preview-cleanup scenario 3', solve('orphan-preview-cleanup', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('orphan-preview-cleanup scenario 4', solve('orphan-preview-cleanup', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['blob:x'])
check('orphan-preview-cleanup scenario 5', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('orphan-preview-cleanup scenario 6', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
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):
    attachments, removed, previews, selected, submitted, readonly = s
    if operation == 'remove-by-file-identity':
        return [x for x in attachments if x[0]!=removed]
    if operation == 'duplicate-filenames-kept':
        return [(k,name) for k,name,size in attachments]
    if operation == 'removed-preview-release':
        return previews.get(removed)
    if operation == 'other-previews-preserved':
        return previews
    if operation == 'submitted-attachment-retention':
        return [x for x in attachments if x[0] in submitted]
    if operation == 'new-attachment-dirty-set':
        return [k for k,name,size in attachments if k not in submitted]
    if operation == 'selected-id-deduplication':
        return list(dict.fromkeys(selected))
    if operation == 'readonly-remove-command':
        return [] if readonly else [removed]
    if operation == 'selection-removal-propagation':
        return [k for k in selected if k!=removed]
    if operation == 'orphan-preview-cleanup':
        return [v for k,v in previews.items() if k not in {x[0] for x in attachments}]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('remove-by-file-identity scenario 1', solve('remove-by-file-identity', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('b','two',2)])
check('remove-by-file-identity scenario 2', solve('remove-by-file-identity', ([], 'x',{},[],[],False)), [])
check('remove-by-file-identity scenario 3', solve('remove-by-file-identity', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same',0)])
check('remove-by-file-identity scenario 4', solve('remove-by-file-identity', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('remove-by-file-identity scenario 5', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('remove-by-file-identity scenario 6', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one',2)])
check('duplicate-filenames-kept scenario 1', solve('duplicate-filenames-kept', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 2', solve('duplicate-filenames-kept', ([], 'x',{},[],[],False)), [])
check('duplicate-filenames-kept scenario 3', solve('duplicate-filenames-kept', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same'),('b','same')])
check('duplicate-filenames-kept scenario 4', solve('duplicate-filenames-kept', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one')])
check('duplicate-filenames-kept scenario 5', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 6', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one'),('b','two')])
check('removed-preview-release scenario 1', solve('removed-preview-release', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), 'blob:a')
check('removed-preview-release scenario 2', solve('removed-preview-release', ([], 'x',{},[],[],False)), None)
check('removed-preview-release scenario 3', solve('removed-preview-release', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), None)
check('removed-preview-release scenario 4', solve('removed-preview-release', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), 'blob:x')
check('removed-preview-release scenario 5', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), 'blob:a')
check('removed-preview-release scenario 6', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), None)
check('other-previews-preserved scenario 1', solve('other-previews-preserved', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), {'b':'blob:b'})
check('other-previews-preserved scenario 2', solve('other-previews-preserved', ([], 'x',{},[],[],False)), {})
check('other-previews-preserved scenario 3', solve('other-previews-preserved', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), {'a':'blob:a'})
check('other-previews-preserved scenario 4', solve('other-previews-preserved', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), {})
check('other-previews-preserved scenario 5', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), {})
check('other-previews-preserved scenario 6', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), {})
check('submitted-attachment-retention scenario 1', solve('submitted-attachment-retention', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one',N)])
check('submitted-attachment-retention scenario 2', solve('submitted-attachment-retention', ([], 'x',{},[],[],False)), [])
check('submitted-attachment-retention scenario 3', solve('submitted-attachment-retention', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('submitted-attachment-retention scenario 4', solve('submitted-attachment-retention', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('submitted-attachment-retention scenario 5', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('submitted-attachment-retention scenario 6', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
check('new-attachment-dirty-set scenario 1', solve('new-attachment-dirty-set', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('new-attachment-dirty-set scenario 2', solve('new-attachment-dirty-set', ([], 'x',{},[],[],False)), [])
check('new-attachment-dirty-set scenario 3', solve('new-attachment-dirty-set', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['a','b'])
check('new-attachment-dirty-set scenario 4', solve('new-attachment-dirty-set', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('new-attachment-dirty-set scenario 5', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), ['a'])
check('new-attachment-dirty-set scenario 6', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','b'])
check('selected-id-deduplication scenario 1', solve('selected-id-deduplication', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a','b'])
check('selected-id-deduplication scenario 2', solve('selected-id-deduplication', ([], 'x',{},[],[],False)), [])
check('selected-id-deduplication scenario 3', solve('selected-id-deduplication', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('selected-id-deduplication scenario 4', solve('selected-id-deduplication', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selected-id-deduplication scenario 5', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selected-id-deduplication scenario 6', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a'])
check('readonly-remove-command scenario 1', solve('readonly-remove-command', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a'])
check('readonly-remove-command scenario 2', solve('readonly-remove-command', ([], 'x',{},[],[],False)), ['x'])
check('readonly-remove-command scenario 3', solve('readonly-remove-command', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('readonly-remove-command scenario 4', solve('readonly-remove-command', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('readonly-remove-command scenario 5', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('readonly-remove-command scenario 6', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['b'])
check('selection-removal-propagation scenario 1', solve('selection-removal-propagation', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('selection-removal-propagation scenario 2', solve('selection-removal-propagation', ([], 'x',{},[],[],False)), [])
check('selection-removal-propagation scenario 3', solve('selection-removal-propagation', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('selection-removal-propagation scenario 4', solve('selection-removal-propagation', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selection-removal-propagation scenario 5', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selection-removal-propagation scenario 6', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','a'])
check('orphan-preview-cleanup scenario 1', solve('orphan-preview-cleanup', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [])
check('orphan-preview-cleanup scenario 2', solve('orphan-preview-cleanup', ([], 'x',{},[],[],False)), [])
check('orphan-preview-cleanup scenario 3', solve('orphan-preview-cleanup', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('orphan-preview-cleanup scenario 4', solve('orphan-preview-cleanup', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['blob:x'])
check('orphan-preview-cleanup scenario 5', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('orphan-preview-cleanup scenario 6', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
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:
Other previews preserved.

Attachment identity differs from file name and byte count. Zero-byte and same-name files remain separate. Preview URLs and selected IDs are cleaned by attachment identity; submitted files and read-only commands have separate lifetimes. Operation other-previews-preserved 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):
    attachments, removed, previews, selected, submitted, readonly = s
    if operation == 'remove-by-file-identity':
        return [x for x in attachments if x[0]!=removed]
    if operation == 'duplicate-filenames-kept':
        return [(k,name) for k,name,size in attachments]
    if operation == 'removed-preview-release':
        return previews.get(removed)
    if operation == 'other-previews-preserved':
        return {k:v for k,v in previews.items() if k!=removed}
    if operation == 'submitted-attachment-retention':
        return attachments
    if operation == 'new-attachment-dirty-set':
        return [k for k,name,size in attachments if k not in submitted]
    if operation == 'selected-id-deduplication':
        return list(dict.fromkeys(selected))
    if operation == 'readonly-remove-command':
        return [] if readonly else [removed]
    if operation == 'selection-removal-propagation':
        return [k for k in selected if k!=removed]
    if operation == 'orphan-preview-cleanup':
        return [v for k,v in previews.items() if k not in {x[0] for x in attachments}]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('remove-by-file-identity scenario 1', solve('remove-by-file-identity', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('b','two',2)])
check('remove-by-file-identity scenario 2', solve('remove-by-file-identity', ([], 'x',{},[],[],False)), [])
check('remove-by-file-identity scenario 3', solve('remove-by-file-identity', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same',0)])
check('remove-by-file-identity scenario 4', solve('remove-by-file-identity', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('remove-by-file-identity scenario 5', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('remove-by-file-identity scenario 6', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one',2)])
check('duplicate-filenames-kept scenario 1', solve('duplicate-filenames-kept', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 2', solve('duplicate-filenames-kept', ([], 'x',{},[],[],False)), [])
check('duplicate-filenames-kept scenario 3', solve('duplicate-filenames-kept', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same'),('b','same')])
check('duplicate-filenames-kept scenario 4', solve('duplicate-filenames-kept', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one')])
check('duplicate-filenames-kept scenario 5', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 6', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one'),('b','two')])
check('removed-preview-release scenario 1', solve('removed-preview-release', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), 'blob:a')
check('removed-preview-release scenario 2', solve('removed-preview-release', ([], 'x',{},[],[],False)), None)
check('removed-preview-release scenario 3', solve('removed-preview-release', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), None)
check('removed-preview-release scenario 4', solve('removed-preview-release', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), 'blob:x')
check('removed-preview-release scenario 5', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), 'blob:a')
check('removed-preview-release scenario 6', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), None)
check('other-previews-preserved scenario 1', solve('other-previews-preserved', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), {'b':'blob:b'})
check('other-previews-preserved scenario 2', solve('other-previews-preserved', ([], 'x',{},[],[],False)), {})
check('other-previews-preserved scenario 3', solve('other-previews-preserved', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), {'a':'blob:a'})
check('other-previews-preserved scenario 4', solve('other-previews-preserved', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), {})
check('other-previews-preserved scenario 5', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), {})
check('other-previews-preserved scenario 6', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), {})
check('submitted-attachment-retention scenario 1', solve('submitted-attachment-retention', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one',N)])
check('submitted-attachment-retention scenario 2', solve('submitted-attachment-retention', ([], 'x',{},[],[],False)), [])
check('submitted-attachment-retention scenario 3', solve('submitted-attachment-retention', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('submitted-attachment-retention scenario 4', solve('submitted-attachment-retention', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('submitted-attachment-retention scenario 5', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('submitted-attachment-retention scenario 6', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
check('new-attachment-dirty-set scenario 1', solve('new-attachment-dirty-set', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('new-attachment-dirty-set scenario 2', solve('new-attachment-dirty-set', ([], 'x',{},[],[],False)), [])
check('new-attachment-dirty-set scenario 3', solve('new-attachment-dirty-set', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['a','b'])
check('new-attachment-dirty-set scenario 4', solve('new-attachment-dirty-set', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('new-attachment-dirty-set scenario 5', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), ['a'])
check('new-attachment-dirty-set scenario 6', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','b'])
check('selected-id-deduplication scenario 1', solve('selected-id-deduplication', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a','b'])
check('selected-id-deduplication scenario 2', solve('selected-id-deduplication', ([], 'x',{},[],[],False)), [])
check('selected-id-deduplication scenario 3', solve('selected-id-deduplication', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('selected-id-deduplication scenario 4', solve('selected-id-deduplication', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selected-id-deduplication scenario 5', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selected-id-deduplication scenario 6', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a'])
check('readonly-remove-command scenario 1', solve('readonly-remove-command', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a'])
check('readonly-remove-command scenario 2', solve('readonly-remove-command', ([], 'x',{},[],[],False)), ['x'])
check('readonly-remove-command scenario 3', solve('readonly-remove-command', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('readonly-remove-command scenario 4', solve('readonly-remove-command', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('readonly-remove-command scenario 5', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('readonly-remove-command scenario 6', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['b'])
check('selection-removal-propagation scenario 1', solve('selection-removal-propagation', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('selection-removal-propagation scenario 2', solve('selection-removal-propagation', ([], 'x',{},[],[],False)), [])
check('selection-removal-propagation scenario 3', solve('selection-removal-propagation', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('selection-removal-propagation scenario 4', solve('selection-removal-propagation', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selection-removal-propagation scenario 5', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selection-removal-propagation scenario 6', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','a'])
check('orphan-preview-cleanup scenario 1', solve('orphan-preview-cleanup', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [])
check('orphan-preview-cleanup scenario 2', solve('orphan-preview-cleanup', ([], 'x',{},[],[],False)), [])
check('orphan-preview-cleanup scenario 3', solve('orphan-preview-cleanup', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('orphan-preview-cleanup scenario 4', solve('orphan-preview-cleanup', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['blob:x'])
check('orphan-preview-cleanup scenario 5', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('orphan-preview-cleanup scenario 6', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
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):
    attachments, removed, previews, selected, submitted, readonly = s
    if operation == 'remove-by-file-identity':
        return [x for x in attachments if x[0]!=removed]
    if operation == 'duplicate-filenames-kept':
        return [(k,name) for k,name,size in attachments]
    if operation == 'removed-preview-release':
        return previews.get(removed)
    if operation == 'other-previews-preserved':
        return {k:v for k,v in previews.items() if k!=removed}
    if operation == 'submitted-attachment-retention':
        return [x for x in attachments if x[0] not in submitted]
    if operation == 'new-attachment-dirty-set':
        return [k for k,name,size in attachments if k not in submitted]
    if operation == 'selected-id-deduplication':
        return list(dict.fromkeys(selected))
    if operation == 'readonly-remove-command':
        return [] if readonly else [removed]
    if operation == 'selection-removal-propagation':
        return [k for k in selected if k!=removed]
    if operation == 'orphan-preview-cleanup':
        return [v for k,v in previews.items() if k not in {x[0] for x in attachments}]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('remove-by-file-identity scenario 1', solve('remove-by-file-identity', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('b','two',2)])
check('remove-by-file-identity scenario 2', solve('remove-by-file-identity', ([], 'x',{},[],[],False)), [])
check('remove-by-file-identity scenario 3', solve('remove-by-file-identity', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same',0)])
check('remove-by-file-identity scenario 4', solve('remove-by-file-identity', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('remove-by-file-identity scenario 5', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('remove-by-file-identity scenario 6', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one',2)])
check('duplicate-filenames-kept scenario 1', solve('duplicate-filenames-kept', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 2', solve('duplicate-filenames-kept', ([], 'x',{},[],[],False)), [])
check('duplicate-filenames-kept scenario 3', solve('duplicate-filenames-kept', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same'),('b','same')])
check('duplicate-filenames-kept scenario 4', solve('duplicate-filenames-kept', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one')])
check('duplicate-filenames-kept scenario 5', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 6', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one'),('b','two')])
check('removed-preview-release scenario 1', solve('removed-preview-release', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), 'blob:a')
check('removed-preview-release scenario 2', solve('removed-preview-release', ([], 'x',{},[],[],False)), None)
check('removed-preview-release scenario 3', solve('removed-preview-release', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), None)
check('removed-preview-release scenario 4', solve('removed-preview-release', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), 'blob:x')
check('removed-preview-release scenario 5', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), 'blob:a')
check('removed-preview-release scenario 6', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), None)
check('other-previews-preserved scenario 1', solve('other-previews-preserved', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), {'b':'blob:b'})
check('other-previews-preserved scenario 2', solve('other-previews-preserved', ([], 'x',{},[],[],False)), {})
check('other-previews-preserved scenario 3', solve('other-previews-preserved', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), {'a':'blob:a'})
check('other-previews-preserved scenario 4', solve('other-previews-preserved', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), {})
check('other-previews-preserved scenario 5', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), {})
check('other-previews-preserved scenario 6', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), {})
check('submitted-attachment-retention scenario 1', solve('submitted-attachment-retention', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one',N)])
check('submitted-attachment-retention scenario 2', solve('submitted-attachment-retention', ([], 'x',{},[],[],False)), [])
check('submitted-attachment-retention scenario 3', solve('submitted-attachment-retention', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('submitted-attachment-retention scenario 4', solve('submitted-attachment-retention', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('submitted-attachment-retention scenario 5', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('submitted-attachment-retention scenario 6', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
check('new-attachment-dirty-set scenario 1', solve('new-attachment-dirty-set', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('new-attachment-dirty-set scenario 2', solve('new-attachment-dirty-set', ([], 'x',{},[],[],False)), [])
check('new-attachment-dirty-set scenario 3', solve('new-attachment-dirty-set', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['a','b'])
check('new-attachment-dirty-set scenario 4', solve('new-attachment-dirty-set', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('new-attachment-dirty-set scenario 5', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), ['a'])
check('new-attachment-dirty-set scenario 6', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','b'])
check('selected-id-deduplication scenario 1', solve('selected-id-deduplication', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a','b'])
check('selected-id-deduplication scenario 2', solve('selected-id-deduplication', ([], 'x',{},[],[],False)), [])
check('selected-id-deduplication scenario 3', solve('selected-id-deduplication', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('selected-id-deduplication scenario 4', solve('selected-id-deduplication', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selected-id-deduplication scenario 5', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selected-id-deduplication scenario 6', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a'])
check('readonly-remove-command scenario 1', solve('readonly-remove-command', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a'])
check('readonly-remove-command scenario 2', solve('readonly-remove-command', ([], 'x',{},[],[],False)), ['x'])
check('readonly-remove-command scenario 3', solve('readonly-remove-command', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('readonly-remove-command scenario 4', solve('readonly-remove-command', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('readonly-remove-command scenario 5', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('readonly-remove-command scenario 6', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['b'])
check('selection-removal-propagation scenario 1', solve('selection-removal-propagation', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('selection-removal-propagation scenario 2', solve('selection-removal-propagation', ([], 'x',{},[],[],False)), [])
check('selection-removal-propagation scenario 3', solve('selection-removal-propagation', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('selection-removal-propagation scenario 4', solve('selection-removal-propagation', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selection-removal-propagation scenario 5', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selection-removal-propagation scenario 6', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','a'])
check('orphan-preview-cleanup scenario 1', solve('orphan-preview-cleanup', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [])
check('orphan-preview-cleanup scenario 2', solve('orphan-preview-cleanup', ([], 'x',{},[],[],False)), [])
check('orphan-preview-cleanup scenario 3', solve('orphan-preview-cleanup', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('orphan-preview-cleanup scenario 4', solve('orphan-preview-cleanup', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['blob:x'])
check('orphan-preview-cleanup scenario 5', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('orphan-preview-cleanup scenario 6', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
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:
Submitted attachment retention.

Attachment identity differs from file name and byte count. Zero-byte and same-name files remain separate. Preview URLs and selected IDs are cleaned by attachment identity; submitted files and read-only commands have separate lifetimes. Operation submitted-attachment-retention has the six explicit input/output oracles below.

split: open-access


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

N = 1
observations = []
def solve(operation, s):
    attachments, removed, previews, selected, submitted, readonly = s
    if operation == 'remove-by-file-identity':
        return [x for x in attachments if x[0]!=removed]
    if operation == 'duplicate-filenames-kept':
        return [(k,name) for k,name,size in attachments]
    if operation == 'removed-preview-release':
        return previews.get(removed)
    if operation == 'other-previews-preserved':
        return {k:v for k,v in previews.items() if k!=removed}
    if operation == 'submitted-attachment-retention':
        return [x for x in attachments if x[0] in submitted]
    if operation == 'new-attachment-dirty-set':
        return [k for k,name,size in attachments]
    if operation == 'selected-id-deduplication':
        return list(dict.fromkeys(selected))
    if operation == 'readonly-remove-command':
        return [] if readonly else [removed]
    if operation == 'selection-removal-propagation':
        return [k for k in selected if k!=removed]
    if operation == 'orphan-preview-cleanup':
        return [v for k,v in previews.items() if k not in {x[0] for x in attachments}]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('remove-by-file-identity scenario 1', solve('remove-by-file-identity', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('b','two',2)])
check('remove-by-file-identity scenario 2', solve('remove-by-file-identity', ([], 'x',{},[],[],False)), [])
check('remove-by-file-identity scenario 3', solve('remove-by-file-identity', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same',0)])
check('remove-by-file-identity scenario 4', solve('remove-by-file-identity', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('remove-by-file-identity scenario 5', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('remove-by-file-identity scenario 6', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one',2)])
check('duplicate-filenames-kept scenario 1', solve('duplicate-filenames-kept', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 2', solve('duplicate-filenames-kept', ([], 'x',{},[],[],False)), [])
check('duplicate-filenames-kept scenario 3', solve('duplicate-filenames-kept', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same'),('b','same')])
check('duplicate-filenames-kept scenario 4', solve('duplicate-filenames-kept', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one')])
check('duplicate-filenames-kept scenario 5', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 6', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one'),('b','two')])
check('removed-preview-release scenario 1', solve('removed-preview-release', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), 'blob:a')
check('removed-preview-release scenario 2', solve('removed-preview-release', ([], 'x',{},[],[],False)), None)
check('removed-preview-release scenario 3', solve('removed-preview-release', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), None)
check('removed-preview-release scenario 4', solve('removed-preview-release', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), 'blob:x')
check('removed-preview-release scenario 5', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), 'blob:a')
check('removed-preview-release scenario 6', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), None)
check('other-previews-preserved scenario 1', solve('other-previews-preserved', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), {'b':'blob:b'})
check('other-previews-preserved scenario 2', solve('other-previews-preserved', ([], 'x',{},[],[],False)), {})
check('other-previews-preserved scenario 3', solve('other-previews-preserved', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), {'a':'blob:a'})
check('other-previews-preserved scenario 4', solve('other-previews-preserved', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), {})
check('other-previews-preserved scenario 5', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), {})
check('other-previews-preserved scenario 6', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), {})
check('submitted-attachment-retention scenario 1', solve('submitted-attachment-retention', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one',N)])
check('submitted-attachment-retention scenario 2', solve('submitted-attachment-retention', ([], 'x',{},[],[],False)), [])
check('submitted-attachment-retention scenario 3', solve('submitted-attachment-retention', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('submitted-attachment-retention scenario 4', solve('submitted-attachment-retention', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('submitted-attachment-retention scenario 5', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('submitted-attachment-retention scenario 6', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
check('new-attachment-dirty-set scenario 1', solve('new-attachment-dirty-set', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('new-attachment-dirty-set scenario 2', solve('new-attachment-dirty-set', ([], 'x',{},[],[],False)), [])
check('new-attachment-dirty-set scenario 3', solve('new-attachment-dirty-set', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['a','b'])
check('new-attachment-dirty-set scenario 4', solve('new-attachment-dirty-set', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('new-attachment-dirty-set scenario 5', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), ['a'])
check('new-attachment-dirty-set scenario 6', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','b'])
check('selected-id-deduplication scenario 1', solve('selected-id-deduplication', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a','b'])
check('selected-id-deduplication scenario 2', solve('selected-id-deduplication', ([], 'x',{},[],[],False)), [])
check('selected-id-deduplication scenario 3', solve('selected-id-deduplication', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('selected-id-deduplication scenario 4', solve('selected-id-deduplication', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selected-id-deduplication scenario 5', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selected-id-deduplication scenario 6', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a'])
check('readonly-remove-command scenario 1', solve('readonly-remove-command', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a'])
check('readonly-remove-command scenario 2', solve('readonly-remove-command', ([], 'x',{},[],[],False)), ['x'])
check('readonly-remove-command scenario 3', solve('readonly-remove-command', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('readonly-remove-command scenario 4', solve('readonly-remove-command', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('readonly-remove-command scenario 5', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('readonly-remove-command scenario 6', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['b'])
check('selection-removal-propagation scenario 1', solve('selection-removal-propagation', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('selection-removal-propagation scenario 2', solve('selection-removal-propagation', ([], 'x',{},[],[],False)), [])
check('selection-removal-propagation scenario 3', solve('selection-removal-propagation', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('selection-removal-propagation scenario 4', solve('selection-removal-propagation', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selection-removal-propagation scenario 5', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selection-removal-propagation scenario 6', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','a'])
check('orphan-preview-cleanup scenario 1', solve('orphan-preview-cleanup', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [])
check('orphan-preview-cleanup scenario 2', solve('orphan-preview-cleanup', ([], 'x',{},[],[],False)), [])
check('orphan-preview-cleanup scenario 3', solve('orphan-preview-cleanup', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('orphan-preview-cleanup scenario 4', solve('orphan-preview-cleanup', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['blob:x'])
check('orphan-preview-cleanup scenario 5', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('orphan-preview-cleanup scenario 6', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
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):
    attachments, removed, previews, selected, submitted, readonly = s
    if operation == 'remove-by-file-identity':
        return [x for x in attachments if x[0]!=removed]
    if operation == 'duplicate-filenames-kept':
        return [(k,name) for k,name,size in attachments]
    if operation == 'removed-preview-release':
        return previews.get(removed)
    if operation == 'other-previews-preserved':
        return {k:v for k,v in previews.items() if k!=removed}
    if operation == 'submitted-attachment-retention':
        return [x for x in attachments if x[0] in submitted]
    if operation == 'new-attachment-dirty-set':
        return [k for k,name,size in attachments if size and k not in submitted]
    if operation == 'selected-id-deduplication':
        return list(dict.fromkeys(selected))
    if operation == 'readonly-remove-command':
        return [] if readonly else [removed]
    if operation == 'selection-removal-propagation':
        return [k for k in selected if k!=removed]
    if operation == 'orphan-preview-cleanup':
        return [v for k,v in previews.items() if k not in {x[0] for x in attachments}]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('remove-by-file-identity scenario 1', solve('remove-by-file-identity', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('b','two',2)])
check('remove-by-file-identity scenario 2', solve('remove-by-file-identity', ([], 'x',{},[],[],False)), [])
check('remove-by-file-identity scenario 3', solve('remove-by-file-identity', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same',0)])
check('remove-by-file-identity scenario 4', solve('remove-by-file-identity', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('remove-by-file-identity scenario 5', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('remove-by-file-identity scenario 6', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one',2)])
check('duplicate-filenames-kept scenario 1', solve('duplicate-filenames-kept', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 2', solve('duplicate-filenames-kept', ([], 'x',{},[],[],False)), [])
check('duplicate-filenames-kept scenario 3', solve('duplicate-filenames-kept', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same'),('b','same')])
check('duplicate-filenames-kept scenario 4', solve('duplicate-filenames-kept', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one')])
check('duplicate-filenames-kept scenario 5', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 6', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one'),('b','two')])
check('removed-preview-release scenario 1', solve('removed-preview-release', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), 'blob:a')
check('removed-preview-release scenario 2', solve('removed-preview-release', ([], 'x',{},[],[],False)), None)
check('removed-preview-release scenario 3', solve('removed-preview-release', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), None)
check('removed-preview-release scenario 4', solve('removed-preview-release', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), 'blob:x')
check('removed-preview-release scenario 5', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), 'blob:a')
check('removed-preview-release scenario 6', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), None)
check('other-previews-preserved scenario 1', solve('other-previews-preserved', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), {'b':'blob:b'})
check('other-previews-preserved scenario 2', solve('other-previews-preserved', ([], 'x',{},[],[],False)), {})
check('other-previews-preserved scenario 3', solve('other-previews-preserved', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), {'a':'blob:a'})
check('other-previews-preserved scenario 4', solve('other-previews-preserved', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), {})
check('other-previews-preserved scenario 5', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), {})
check('other-previews-preserved scenario 6', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), {})
check('submitted-attachment-retention scenario 1', solve('submitted-attachment-retention', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one',N)])
check('submitted-attachment-retention scenario 2', solve('submitted-attachment-retention', ([], 'x',{},[],[],False)), [])
check('submitted-attachment-retention scenario 3', solve('submitted-attachment-retention', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('submitted-attachment-retention scenario 4', solve('submitted-attachment-retention', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('submitted-attachment-retention scenario 5', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('submitted-attachment-retention scenario 6', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
check('new-attachment-dirty-set scenario 1', solve('new-attachment-dirty-set', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('new-attachment-dirty-set scenario 2', solve('new-attachment-dirty-set', ([], 'x',{},[],[],False)), [])
check('new-attachment-dirty-set scenario 3', solve('new-attachment-dirty-set', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['a','b'])
check('new-attachment-dirty-set scenario 4', solve('new-attachment-dirty-set', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('new-attachment-dirty-set scenario 5', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), ['a'])
check('new-attachment-dirty-set scenario 6', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','b'])
check('selected-id-deduplication scenario 1', solve('selected-id-deduplication', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a','b'])
check('selected-id-deduplication scenario 2', solve('selected-id-deduplication', ([], 'x',{},[],[],False)), [])
check('selected-id-deduplication scenario 3', solve('selected-id-deduplication', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('selected-id-deduplication scenario 4', solve('selected-id-deduplication', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selected-id-deduplication scenario 5', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selected-id-deduplication scenario 6', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a'])
check('readonly-remove-command scenario 1', solve('readonly-remove-command', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a'])
check('readonly-remove-command scenario 2', solve('readonly-remove-command', ([], 'x',{},[],[],False)), ['x'])
check('readonly-remove-command scenario 3', solve('readonly-remove-command', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('readonly-remove-command scenario 4', solve('readonly-remove-command', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('readonly-remove-command scenario 5', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('readonly-remove-command scenario 6', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['b'])
check('selection-removal-propagation scenario 1', solve('selection-removal-propagation', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('selection-removal-propagation scenario 2', solve('selection-removal-propagation', ([], 'x',{},[],[],False)), [])
check('selection-removal-propagation scenario 3', solve('selection-removal-propagation', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('selection-removal-propagation scenario 4', solve('selection-removal-propagation', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selection-removal-propagation scenario 5', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selection-removal-propagation scenario 6', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','a'])
check('orphan-preview-cleanup scenario 1', solve('orphan-preview-cleanup', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [])
check('orphan-preview-cleanup scenario 2', solve('orphan-preview-cleanup', ([], 'x',{},[],[],False)), [])
check('orphan-preview-cleanup scenario 3', solve('orphan-preview-cleanup', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('orphan-preview-cleanup scenario 4', solve('orphan-preview-cleanup', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['blob:x'])
check('orphan-preview-cleanup scenario 5', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('orphan-preview-cleanup scenario 6', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
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:
New attachment dirty set.

Attachment identity differs from file name and byte count. Zero-byte and same-name files remain separate. Preview URLs and selected IDs are cleaned by attachment identity; submitted files and read-only commands have separate lifetimes. Operation new-attachment-dirty-set 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):
    attachments, removed, previews, selected, submitted, readonly = s
    if operation == 'remove-by-file-identity':
        return [x for x in attachments if x[0]!=removed]
    if operation == 'duplicate-filenames-kept':
        return [(k,name) for k,name,size in attachments]
    if operation == 'removed-preview-release':
        return previews.get(removed)
    if operation == 'other-previews-preserved':
        return {k:v for k,v in previews.items() if k!=removed}
    if operation == 'submitted-attachment-retention':
        return [x for x in attachments if x[0] in submitted]
    if operation == 'new-attachment-dirty-set':
        return [k for k,name,size in attachments if k not in submitted]
    if operation == 'selected-id-deduplication':
        return selected
    if operation == 'readonly-remove-command':
        return [] if readonly else [removed]
    if operation == 'selection-removal-propagation':
        return [k for k in selected if k!=removed]
    if operation == 'orphan-preview-cleanup':
        return [v for k,v in previews.items() if k not in {x[0] for x in attachments}]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('remove-by-file-identity scenario 1', solve('remove-by-file-identity', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('b','two',2)])
check('remove-by-file-identity scenario 2', solve('remove-by-file-identity', ([], 'x',{},[],[],False)), [])
check('remove-by-file-identity scenario 3', solve('remove-by-file-identity', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same',0)])
check('remove-by-file-identity scenario 4', solve('remove-by-file-identity', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('remove-by-file-identity scenario 5', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('remove-by-file-identity scenario 6', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one',2)])
check('duplicate-filenames-kept scenario 1', solve('duplicate-filenames-kept', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 2', solve('duplicate-filenames-kept', ([], 'x',{},[],[],False)), [])
check('duplicate-filenames-kept scenario 3', solve('duplicate-filenames-kept', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same'),('b','same')])
check('duplicate-filenames-kept scenario 4', solve('duplicate-filenames-kept', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one')])
check('duplicate-filenames-kept scenario 5', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 6', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one'),('b','two')])
check('removed-preview-release scenario 1', solve('removed-preview-release', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), 'blob:a')
check('removed-preview-release scenario 2', solve('removed-preview-release', ([], 'x',{},[],[],False)), None)
check('removed-preview-release scenario 3', solve('removed-preview-release', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), None)
check('removed-preview-release scenario 4', solve('removed-preview-release', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), 'blob:x')
check('removed-preview-release scenario 5', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), 'blob:a')
check('removed-preview-release scenario 6', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), None)
check('other-previews-preserved scenario 1', solve('other-previews-preserved', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), {'b':'blob:b'})
check('other-previews-preserved scenario 2', solve('other-previews-preserved', ([], 'x',{},[],[],False)), {})
check('other-previews-preserved scenario 3', solve('other-previews-preserved', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), {'a':'blob:a'})
check('other-previews-preserved scenario 4', solve('other-previews-preserved', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), {})
check('other-previews-preserved scenario 5', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), {})
check('other-previews-preserved scenario 6', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), {})
check('submitted-attachment-retention scenario 1', solve('submitted-attachment-retention', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one',N)])
check('submitted-attachment-retention scenario 2', solve('submitted-attachment-retention', ([], 'x',{},[],[],False)), [])
check('submitted-attachment-retention scenario 3', solve('submitted-attachment-retention', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('submitted-attachment-retention scenario 4', solve('submitted-attachment-retention', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('submitted-attachment-retention scenario 5', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('submitted-attachment-retention scenario 6', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
check('new-attachment-dirty-set scenario 1', solve('new-attachment-dirty-set', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('new-attachment-dirty-set scenario 2', solve('new-attachment-dirty-set', ([], 'x',{},[],[],False)), [])
check('new-attachment-dirty-set scenario 3', solve('new-attachment-dirty-set', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['a','b'])
check('new-attachment-dirty-set scenario 4', solve('new-attachment-dirty-set', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('new-attachment-dirty-set scenario 5', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), ['a'])
check('new-attachment-dirty-set scenario 6', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','b'])
check('selected-id-deduplication scenario 1', solve('selected-id-deduplication', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a','b'])
check('selected-id-deduplication scenario 2', solve('selected-id-deduplication', ([], 'x',{},[],[],False)), [])
check('selected-id-deduplication scenario 3', solve('selected-id-deduplication', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('selected-id-deduplication scenario 4', solve('selected-id-deduplication', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selected-id-deduplication scenario 5', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selected-id-deduplication scenario 6', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a'])
check('readonly-remove-command scenario 1', solve('readonly-remove-command', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a'])
check('readonly-remove-command scenario 2', solve('readonly-remove-command', ([], 'x',{},[],[],False)), ['x'])
check('readonly-remove-command scenario 3', solve('readonly-remove-command', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('readonly-remove-command scenario 4', solve('readonly-remove-command', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('readonly-remove-command scenario 5', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('readonly-remove-command scenario 6', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['b'])
check('selection-removal-propagation scenario 1', solve('selection-removal-propagation', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('selection-removal-propagation scenario 2', solve('selection-removal-propagation', ([], 'x',{},[],[],False)), [])
check('selection-removal-propagation scenario 3', solve('selection-removal-propagation', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('selection-removal-propagation scenario 4', solve('selection-removal-propagation', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selection-removal-propagation scenario 5', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selection-removal-propagation scenario 6', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','a'])
check('orphan-preview-cleanup scenario 1', solve('orphan-preview-cleanup', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [])
check('orphan-preview-cleanup scenario 2', solve('orphan-preview-cleanup', ([], 'x',{},[],[],False)), [])
check('orphan-preview-cleanup scenario 3', solve('orphan-preview-cleanup', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('orphan-preview-cleanup scenario 4', solve('orphan-preview-cleanup', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['blob:x'])
check('orphan-preview-cleanup scenario 5', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('orphan-preview-cleanup scenario 6', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
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):
    attachments, removed, previews, selected, submitted, readonly = s
    if operation == 'remove-by-file-identity':
        return [x for x in attachments if x[0]!=removed]
    if operation == 'duplicate-filenames-kept':
        return [(k,name) for k,name,size in attachments]
    if operation == 'removed-preview-release':
        return previews.get(removed)
    if operation == 'other-previews-preserved':
        return {k:v for k,v in previews.items() if k!=removed}
    if operation == 'submitted-attachment-retention':
        return [x for x in attachments if x[0] in submitted]
    if operation == 'new-attachment-dirty-set':
        return [k for k,name,size in attachments if k not in submitted]
    if operation == 'selected-id-deduplication':
        return sorted(set(selected),reverse=True)
    if operation == 'readonly-remove-command':
        return [] if readonly else [removed]
    if operation == 'selection-removal-propagation':
        return [k for k in selected if k!=removed]
    if operation == 'orphan-preview-cleanup':
        return [v for k,v in previews.items() if k not in {x[0] for x in attachments}]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('remove-by-file-identity scenario 1', solve('remove-by-file-identity', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('b','two',2)])
check('remove-by-file-identity scenario 2', solve('remove-by-file-identity', ([], 'x',{},[],[],False)), [])
check('remove-by-file-identity scenario 3', solve('remove-by-file-identity', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same',0)])
check('remove-by-file-identity scenario 4', solve('remove-by-file-identity', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('remove-by-file-identity scenario 5', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('remove-by-file-identity scenario 6', solve('remove-by-file-identity', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one',2)])
check('duplicate-filenames-kept scenario 1', solve('duplicate-filenames-kept', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 2', solve('duplicate-filenames-kept', ([], 'x',{},[],[],False)), [])
check('duplicate-filenames-kept scenario 3', solve('duplicate-filenames-kept', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [('a','same'),('b','same')])
check('duplicate-filenames-kept scenario 4', solve('duplicate-filenames-kept', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one')])
check('duplicate-filenames-kept scenario 5', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('a','one'),('b','two')])
check('duplicate-filenames-kept scenario 6', solve('duplicate-filenames-kept', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [('a','one'),('b','two')])
check('removed-preview-release scenario 1', solve('removed-preview-release', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), 'blob:a')
check('removed-preview-release scenario 2', solve('removed-preview-release', ([], 'x',{},[],[],False)), None)
check('removed-preview-release scenario 3', solve('removed-preview-release', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), None)
check('removed-preview-release scenario 4', solve('removed-preview-release', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), 'blob:x')
check('removed-preview-release scenario 5', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), 'blob:a')
check('removed-preview-release scenario 6', solve('removed-preview-release', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), None)
check('other-previews-preserved scenario 1', solve('other-previews-preserved', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), {'b':'blob:b'})
check('other-previews-preserved scenario 2', solve('other-previews-preserved', ([], 'x',{},[],[],False)), {})
check('other-previews-preserved scenario 3', solve('other-previews-preserved', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), {'a':'blob:a'})
check('other-previews-preserved scenario 4', solve('other-previews-preserved', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), {})
check('other-previews-preserved scenario 5', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), {})
check('other-previews-preserved scenario 6', solve('other-previews-preserved', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), {})
check('submitted-attachment-retention scenario 1', solve('submitted-attachment-retention', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [('a','one',N)])
check('submitted-attachment-retention scenario 2', solve('submitted-attachment-retention', ([], 'x',{},[],[],False)), [])
check('submitted-attachment-retention scenario 3', solve('submitted-attachment-retention', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('submitted-attachment-retention scenario 4', solve('submitted-attachment-retention', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [('a','one',2)])
check('submitted-attachment-retention scenario 5', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [('b','two',3)])
check('submitted-attachment-retention scenario 6', solve('submitted-attachment-retention', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
check('new-attachment-dirty-set scenario 1', solve('new-attachment-dirty-set', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('new-attachment-dirty-set scenario 2', solve('new-attachment-dirty-set', ([], 'x',{},[],[],False)), [])
check('new-attachment-dirty-set scenario 3', solve('new-attachment-dirty-set', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['a','b'])
check('new-attachment-dirty-set scenario 4', solve('new-attachment-dirty-set', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('new-attachment-dirty-set scenario 5', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), ['a'])
check('new-attachment-dirty-set scenario 6', solve('new-attachment-dirty-set', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','b'])
check('selected-id-deduplication scenario 1', solve('selected-id-deduplication', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a','b'])
check('selected-id-deduplication scenario 2', solve('selected-id-deduplication', ([], 'x',{},[],[],False)), [])
check('selected-id-deduplication scenario 3', solve('selected-id-deduplication', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('selected-id-deduplication scenario 4', solve('selected-id-deduplication', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selected-id-deduplication scenario 5', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selected-id-deduplication scenario 6', solve('selected-id-deduplication', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a'])
check('readonly-remove-command scenario 1', solve('readonly-remove-command', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['a'])
check('readonly-remove-command scenario 2', solve('readonly-remove-command', ([], 'x',{},[],[],False)), ['x'])
check('readonly-remove-command scenario 3', solve('readonly-remove-command', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), ['b'])
check('readonly-remove-command scenario 4', solve('readonly-remove-command', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), [])
check('readonly-remove-command scenario 5', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('readonly-remove-command scenario 6', solve('readonly-remove-command', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['b'])
check('selection-removal-propagation scenario 1', solve('selection-removal-propagation', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), ['b'])
check('selection-removal-propagation scenario 2', solve('selection-removal-propagation', ([], 'x',{},[],[],False)), [])
check('selection-removal-propagation scenario 3', solve('selection-removal-propagation', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('selection-removal-propagation scenario 4', solve('selection-removal-propagation', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['a'])
check('selection-removal-propagation scenario 5', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('selection-removal-propagation scenario 6', solve('selection-removal-propagation', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), ['a','a'])
check('orphan-preview-cleanup scenario 1', solve('orphan-preview-cleanup', ([('a','one',N),('b','two',2)],'a',{'a':'blob:a','b':'blob:b'},['a','b'],['a'],False)), [])
check('orphan-preview-cleanup scenario 2', solve('orphan-preview-cleanup', ([], 'x',{},[],[],False)), [])
check('orphan-preview-cleanup scenario 3', solve('orphan-preview-cleanup', ([('a','same',0),('b','same',3)],'b',{'a':'blob:a'},['b'],[],False)), [])
check('orphan-preview-cleanup scenario 4', solve('orphan-preview-cleanup', ([('a','one',2)],'x',{'x':'blob:x'},['a'],['a'],True)), ['blob:x'])
check('orphan-preview-cleanup scenario 5', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'a',{'a':'blob:a'},[],['b'],True)), [])
check('orphan-preview-cleanup scenario 6', solve('orphan-preview-cleanup', ([('a','one',2),('b','two',3)],'b',{},['a','a'],[],False)), [])
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:
Selected id deduplication.

Attachment identity differs from file name and byte count. Zero-byte and same-name files remain separate. Preview URLs and selected IDs are cleaned by attachment identity; submitted files and read-only commands have separate lifetimes. Operation selected-id-deduplication has the six explicit input/output oracles below.

split: open-access