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

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

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

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

prompt:
Cancel overrides upload status.

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

split: open-access


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

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

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

prompt:
Preview revoke on detach.

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

split: open-access


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

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

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

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

prompt:
Zero size part completion.

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

split: open-access