broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, phase, code, completed, attempted, rejected, original):
    return {'request': request, 'decision': [phase, original, attempted, completed, code if code is not None else 'none', code is not None, completed[-1] if completed else None, phase in ('parse','policy'), sorted(completed), rejected or phase == 'parse']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'parse', 'invalid-target', ['/a'], 'bad%', True, '/a'), {'request': '/requests/' + str(N) + '/0', 'decision': ['parse', '/a', 'bad%', ['/a'], 'invalid-target', True, '/a', True, ['/a'], True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'policy', 'blocked', ['/a', '/b'], '/c', True, '/a'), {'request': '/requests/' + str(N) + '/1', 'decision': ['policy', '/a', '/c', ['/a', '/b'], 'blocked', True, '/b', True, ['/a', '/b'], True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 'dispatch', 'closed', ['/a'], '/b', False, '/a'), {'request': '/requests/' + str(N) + '/2', 'decision': ['dispatch', '/a', '/b', ['/a'], 'closed', True, '/a', False, ['/a'], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 'response', 'body-error', [], '/x', False, '/x'), {'request': '/requests/' + str(N) + '/3', 'decision': ['response', '/x', '/x', [], 'body-error', True, None, False, [], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'complete', None, ['/a', '/b'], '/b', False, '/a'), {'request': '/requests/' + str(N) + '/4', 'decision': ['complete', '/a', '/b', ['/a', '/b'], 'none', False, '/b', False, ['/a', '/b'], False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 'policy', 'blocked', [], '/x', True, '/x'), {'request': '/requests/' + str(N) + '/5', 'decision': ['policy', '/x', '/x', [], 'blocked', True, None, True, [], True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 'parse', 'invalid-target', ['/z', '/a'], 'bad%', False, '/z'), {'request': '/requests/' + str(N) + '/6', 'decision': ['parse', '/z', 'bad%', ['/z', '/a'], 'invalid-target', True, '/a', True, ['/z', '/a'], True]})
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
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, phase, code, completed, attempted, rejected, original):
    return {'request': request, 'decision': [phase, original, attempted, completed, code if code is not None else 'none', code is not None, completed[-1] if completed else None, phase in ('parse','policy'), list(reversed(completed)), rejected or phase == 'parse']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'parse', 'invalid-target', ['/a'], 'bad%', True, '/a'), {'request': '/requests/' + str(N) + '/0', 'decision': ['parse', '/a', 'bad%', ['/a'], 'invalid-target', True, '/a', True, ['/a'], True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'policy', 'blocked', ['/a', '/b'], '/c', True, '/a'), {'request': '/requests/' + str(N) + '/1', 'decision': ['policy', '/a', '/c', ['/a', '/b'], 'blocked', True, '/b', True, ['/a', '/b'], True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 'dispatch', 'closed', ['/a'], '/b', False, '/a'), {'request': '/requests/' + str(N) + '/2', 'decision': ['dispatch', '/a', '/b', ['/a'], 'closed', True, '/a', False, ['/a'], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 'response', 'body-error', [], '/x', False, '/x'), {'request': '/requests/' + str(N) + '/3', 'decision': ['response', '/x', '/x', [], 'body-error', True, None, False, [], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'complete', None, ['/a', '/b'], '/b', False, '/a'), {'request': '/requests/' + str(N) + '/4', 'decision': ['complete', '/a', '/b', ['/a', '/b'], 'none', False, '/b', False, ['/a', '/b'], False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 'policy', 'blocked', [], '/x', True, '/x'), {'request': '/requests/' + str(N) + '/5', 'decision': ['policy', '/x', '/x', [], 'blocked', True, None, True, [], True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 'parse', 'invalid-target', ['/z', '/a'], 'bad%', False, '/z'), {'request': '/requests/' + str(N) + '/6', 'decision': ['parse', '/z', 'bad%', ['/z', '/a'], 'invalid-target', True, '/a', True, ['/z', '/a'], True]})
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:
Report redirect failures with the failing phase and completed request context: the completed hop path order branch emits an incorrect decision.

Report redirect failures with the failing phase and completed request context. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, phase, code, completed, attempted, rejected, original):
    return {'request': request, 'decision': [phase, original, attempted, completed, code if code is not None else 'none', code is not None, completed[-1] if completed else None, phase in ('parse','policy'), completed, phase == 'parse']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'parse', 'invalid-target', ['/a'], 'bad%', True, '/a'), {'request': '/requests/' + str(N) + '/0', 'decision': ['parse', '/a', 'bad%', ['/a'], 'invalid-target', True, '/a', True, ['/a'], True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'policy', 'blocked', ['/a', '/b'], '/c', True, '/a'), {'request': '/requests/' + str(N) + '/1', 'decision': ['policy', '/a', '/c', ['/a', '/b'], 'blocked', True, '/b', True, ['/a', '/b'], True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 'dispatch', 'closed', ['/a'], '/b', False, '/a'), {'request': '/requests/' + str(N) + '/2', 'decision': ['dispatch', '/a', '/b', ['/a'], 'closed', True, '/a', False, ['/a'], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 'response', 'body-error', [], '/x', False, '/x'), {'request': '/requests/' + str(N) + '/3', 'decision': ['response', '/x', '/x', [], 'body-error', True, None, False, [], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'complete', None, ['/a', '/b'], '/b', False, '/a'), {'request': '/requests/' + str(N) + '/4', 'decision': ['complete', '/a', '/b', ['/a', '/b'], 'none', False, '/b', False, ['/a', '/b'], False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 'policy', 'blocked', [], '/x', True, '/x'), {'request': '/requests/' + str(N) + '/5', 'decision': ['policy', '/x', '/x', [], 'blocked', True, None, True, [], True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 'parse', 'invalid-target', ['/z', '/a'], 'bad%', False, '/z'), {'request': '/requests/' + str(N) + '/6', 'decision': ['parse', '/z', 'bad%', ['/z', '/a'], 'invalid-target', True, '/a', True, ['/z', '/a'], True]})
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
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, phase, code, completed, attempted, rejected, original):
    return {'request': request, 'decision': [phase, original, attempted, completed, code if code is not None else 'none', code is not None, completed[-1] if completed else None, phase in ('parse','policy'), completed, phase != 'complete']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'parse', 'invalid-target', ['/a'], 'bad%', True, '/a'), {'request': '/requests/' + str(N) + '/0', 'decision': ['parse', '/a', 'bad%', ['/a'], 'invalid-target', True, '/a', True, ['/a'], True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'policy', 'blocked', ['/a', '/b'], '/c', True, '/a'), {'request': '/requests/' + str(N) + '/1', 'decision': ['policy', '/a', '/c', ['/a', '/b'], 'blocked', True, '/b', True, ['/a', '/b'], True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 'dispatch', 'closed', ['/a'], '/b', False, '/a'), {'request': '/requests/' + str(N) + '/2', 'decision': ['dispatch', '/a', '/b', ['/a'], 'closed', True, '/a', False, ['/a'], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 'response', 'body-error', [], '/x', False, '/x'), {'request': '/requests/' + str(N) + '/3', 'decision': ['response', '/x', '/x', [], 'body-error', True, None, False, [], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'complete', None, ['/a', '/b'], '/b', False, '/a'), {'request': '/requests/' + str(N) + '/4', 'decision': ['complete', '/a', '/b', ['/a', '/b'], 'none', False, '/b', False, ['/a', '/b'], False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 'policy', 'blocked', [], '/x', True, '/x'), {'request': '/requests/' + str(N) + '/5', 'decision': ['policy', '/x', '/x', [], 'blocked', True, None, True, [], True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 'parse', 'invalid-target', ['/z', '/a'], 'bad%', False, '/z'), {'request': '/requests/' + str(N) + '/6', 'decision': ['parse', '/z', 'bad%', ['/z', '/a'], 'invalid-target', True, '/a', True, ['/z', '/a'], True]})
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:
Report redirect failures with the failing phase and completed request context: the unsent target flag branch emits an incorrect decision.

Report redirect failures with the failing phase and completed request context. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


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

N = 1
observations = []
def solve(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = live
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live[:1])
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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:
Body mutation after the first attempt changes replay bytes

Events open(list of integer bytes, starting index), mutate(index,byte), read(count), retry, close. Opening freezes bytes and origin. Reads advance within the frozen representation. Retry rewinds to origin. Reads after close return closed; retry after close returns closed. Output read chunks or status markers.

split: open-access


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

N = 1
observations = []
def solve(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = 0
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = max(0,e[2]-1)
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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:
Retry rewinds into a prefix preceding the request body

Events open(list of integer bytes, starting index), mutate(index,byte), read(count), retry, close. Opening freezes bytes and origin. Reads advance within the frozen representation. Retry rewinds to origin. Reads after close return closed; retry after close returns closed. Output read chunks or status markers.

split: open-access


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

N = 1
observations = []
def solve(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = 0
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = len(body)
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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:
Initial upload ignores the captured stream origin

Events open(list of integer bytes, starting index), mutate(index,byte), read(count), retry, close. Opening freezes bytes and origin. Reads advance within the frozen representation. Retry rewinds to origin. Reads after close return closed; retry after close returns closed. Output read chunks or status markers.

split: open-access


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

N = 1
observations = []
def solve(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = True
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = len(body)==0
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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:
Opening a new empty body retains the previous closed state

Events open(list of integer bytes, starting index), mutate(index,byte), read(count), retry, close. Opening freezes bytes and origin. Reads advance within the frozen representation. Retry rewinds to origin. Reads after close return closed; retry after close returns closed. Output read chunks or status markers.

split: open-access


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

N = 1
observations = []
def solve(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[:e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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:
Subsequent upload reads resend a prefix or exceed requested size

Events open(list of integer bytes, starting index), mutate(index,byte), read(count), retry, close. Opening freezes bytes and origin. Reads advance within the frozen representation. Retry rewinds to origin. Reads after close return closed; retry after close returns closed. Output read chunks or status markers.

split: open-access


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

N = 1
observations = []
def solve(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos = len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += 1
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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:
Upload cursor counts reads rather than bytes already consumed

Events open(list of integer bytes, starting index), mutate(index,byte), read(count), retry, close. Opening freezes bytes and origin. Reads advance within the frozen representation. Retry rewinds to origin. Reads after close return closed; retry after close returns closed. Output read chunks or status markers.

split: open-access


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

N = 1
observations = []
def solve(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = False
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = pos==len(body)
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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:
A partially consumed body remains readable after cancellation closes it

Events open(list of integer bytes, starting index), mutate(index,byte), read(count), retry, close. Opening freezes bytes and origin. Reads advance within the frozen representation. Retry rewinds to origin. Reads after close return closed; retry after close returns closed. Output read chunks or status markers.

split: open-access


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

N = 1
observations = []
def solve(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append([])
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed' if pos == len(body) else [])
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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:
Closed upload reads are mistaken for successful EOF

Events open(list of integer bytes, starting index), mutate(index,byte), read(count), retry, close. Opening freezes bytes and origin. Reads advance within the frozen representation. Retry rewinds to origin. Reads after close return closed; retry after close returns closed. Output read chunks or status markers.

split: open-access


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

N = 1
observations = []
def solve(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = 0
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed')
                continue
            pos = max(origin,pos)
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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:
Retry preserves an already consumed cursor

Events open(list of integer bytes, starting index), mutate(index,byte), read(count), retry, close. Opening freezes bytes and origin. Reads advance within the frozen representation. Retry rewinds to origin. Reads after close return closed; retry after close returns closed. Output read chunks or status markers.

split: open-access


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

N = 1
observations = []
def solve(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('rewound')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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(events):
    body = (); live = []; origin = 0; pos = 0; closed = True; out = []
    for e in events:
        if e[0] == 'open':
            live = list(e[1])
            body = tuple(live)
            origin = e[2]
            pos = origin
            closed = False
        elif e[0] == 'mutate':
            live[e[1]] = e[2]
        elif e[0] == 'close':
            closed = True
        elif e[0] == 'read':
            if closed:
                out.append('closed')
                continue
            chunk = list(body[pos:pos+e[1]])
            pos += len(chunk)
            out.append(chunk)
        elif e[0] == 'retry':
            if closed:
                out.append('closed' if pos == len(body) else 'rewound')
                continue
            pos = origin
            out.append('rewound')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],1),('read',1),('retry',),('read',2)]), [[N+1],'rewound',[N+1,N+2]])
check('2', solve([('open',[N,N+1,N+2],0),('read',2),('read',1),('read',1)]), [[N,N+1],[N+2],[]])
check('3', solve([('open',[N,N+1],0),('mutate',0,99),('retry',),('read',2)]), ['rewound',[N,N+1]])
check('4', solve([('open',[],0),('read',0),('retry',),('read',1)]), [[],'rewound',[]])
check('5', solve([('open',[N,N+1],0),('close',),('read',1),('retry',)]), ['closed','closed'])
check('6', solve([('open',[N],0),('read',1),('close',),('read',1),('retry',),('open',[N+2],0),('read',1)]), [[N],'closed','closed',[N+2]])
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:
A retry reports rewind success for a released body

Events open(list of integer bytes, starting index), mutate(index,byte), read(count), retry, close. Opening freezes bytes and origin. Reads advance within the frozen representation. Retry rewinds to origin. Reads after close return closed; retry after close returns closed. Output read chunks or status markers.

split: open-access


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

N = 1
observations = []
def solve(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 1
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = consumed
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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:
A fresh one-shot body inherits consumption from the previous request

Events open, send(nonnegative bytes), fail(known_unprocessed bool), retry, succeed. State tracks whether any bytes were emitted by a one-shot stream. A failure known unprocessed does not restore consumed stream bytes. Only an open stream with zero consumed bytes may retry. Terminal success closes the logical request. Output one decision per retry and terminal success.

split: open-access


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

N = 1
observations = []
def solve(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed = e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1] if e[1] > 1 else 0
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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:
A later zero-byte send hides earlier consumption

Events open, send(nonnegative bytes), fail(known_unprocessed bool), retry, succeed. State tracks whether any bytes were emitted by a one-shot stream. A failure known unprocessed does not restore consumed stream bytes. Only an open stream with zero consumed bytes may retry. Terminal success closes the logical request. Output one decision per retry and terminal success.

split: open-access


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

N = 1
observations = []
def solve(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed > 1:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed < 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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:
A one-byte consumed body is admitted for replay

Events open, send(nonnegative bytes), fail(known_unprocessed bool), retry, succeed. State tracks whether any bytes were emitted by a one-shot stream. A failure known unprocessed does not restore consumed stream bytes. Only an open stream with zero consumed bytes may retry. Terminal success closes the logical request. Output one decision per retry and terminal success.

split: open-access


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

N = 1
observations = []
def solve(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = True
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = consumed == 0
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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:
Opening a new body manufactures retry eligibility before a failure

Events open, send(nonnegative bytes), fail(known_unprocessed bool), retry, succeed. State tracks whether any bytes were emitted by a one-shot stream. A failure known unprocessed does not restore consumed stream bytes. Only an open stream with zero consumed bytes may retry. Terminal success closes the logical request. Output one decision per retry and terminal success.

split: open-access


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

N = 1
observations = []
def solve(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = True
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = terminal
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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:
Reopening after a completed transaction retains terminal state

Events open, send(nonnegative bytes), fail(known_unprocessed bool), retry, succeed. State tracks whether any bytes were emitted by a one-shot stream. A failure known unprocessed does not restore consumed stream bytes. Only an open stream with zero consumed bytes may retry. Terminal success closes the logical request. Output one decision per retry and terminal success.

split: open-access


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

N = 1
observations = []
def solve(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = False
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = not e[1]
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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:
Known-unprocessed transport failures are dropped from retry state

Events open, send(nonnegative bytes), fail(known_unprocessed bool), retry, succeed. State tracks whether any bytes were emitted by a one-shot stream. A failure known unprocessed does not restore consumed stream bytes. Only an open stream with zero consumed bytes may retry. Terminal success closes the logical request. Output one decision per retry and terminal success.

split: open-access


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

N = 1
observations = []
def solve(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened and failed:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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:
Retry proceeds before a request body was opened

Events open, send(nonnegative bytes), fail(known_unprocessed bool), retry, succeed. State tracks whether any bytes were emitted by a one-shot stream. A failure known unprocessed does not restore consumed stream bytes. Only an open stream with zero consumed bytes may retry. Terminal success closes the logical request. Output one decision per retry and terminal success.

split: open-access


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

N = 1
observations = []
def solve(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed and consumed != 0:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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:
Repeated retry commands create attempts without another failure

Events open, send(nonnegative bytes), fail(known_unprocessed bool), retry, succeed. State tracks whether any bytes were emitted by a one-shot stream. A failure known unprocessed does not restore consumed stream bytes. Only an open stream with zero consumed bytes may retry. Terminal success closes the logical request. Output one decision per retry and terminal success.

split: open-access


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

N = 1
observations = []
def solve(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = True
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = consumed == 0
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = True
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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:
A successful retry admission leaves its failure token reusable

Events open, send(nonnegative bytes), fail(known_unprocessed bool), retry, succeed. State tracks whether any bytes were emitted by a one-shot stream. A failure known unprocessed does not restore consumed stream bytes. Only an open stream with zero consumed bytes may retry. Terminal success closes the logical request. Output one decision per retry and terminal success.

split: open-access


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

N = 1
observations = []
def solve(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = False
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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(events):
    opened = False; consumed = 0; failed = False; terminal = False; out = []
    for e in events:
        if e[0] == 'open':
            opened = True
            consumed = 0
            failed = False
            terminal = False
        elif e[0] == 'send' and opened and not terminal:
            consumed += e[1]
        elif e[0] == 'fail' and opened and not terminal:
            failed = True
        elif e[0] == 'retry':
            if terminal:
                out.append('terminal')
            elif not opened:
                out.append('no-body')
            elif not failed:
                out.append('no-failure')
            elif consumed != 0:
                out.append('unreplayable')
            else:
                out.append('retry')
                failed = False
        elif e[0] == 'succeed' and opened and not terminal:
            terminal = consumed != 0
            out.append('success')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('retry',)]), ['no-body'])
check('2', solve([('open',),('retry',),('fail',True),('retry',),('retry',)]), ['no-failure','retry','no-failure'])
check('3', solve([('open',),('send',1),('send',0),('fail',True),('retry',)]), ['unreplayable'])
check('4', solve([('open',),('send',N),('fail',False),('retry',),('open',),('fail',False),('retry',)]), ['unreplayable','retry'])
check('5', solve([('open',),('succeed',),('retry',),('open',),('fail',True),('retry',)]), ['success','terminal','retry'])
check('6', solve([('open',),('send',0),('fail',False),('retry',),('succeed',),('retry',)]), ['retry','success','terminal'])
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:
A successful empty upload permits another retry

Events open, send(nonnegative bytes), fail(known_unprocessed bool), retry, succeed. State tracks whether any bytes were emitted by a one-shot stream. A failure known unprocessed does not restore consumed stream bytes. Only an open stream with zero consumed bytes may retry. Terminal success closes the logical request. Output one decision per retry and terminal success.

split: open-access