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

N = 1
observations = []
def solve(events):
    version=0; desired=None; state='idle'; out=[]
    for e in events:
        if e[0]=='begin':
            version=e[1]; desired=e[2]; state='ready'
        elif e[0]=='sent':
            if state=='ready': state='sent'
        elif e[0]=='lost':
            if state=='sent': state='uncertain'
        elif e[0]=='inspect':
            if state!='uncertain': out.append('ignored'); continue
            if e[1]==version+1 and e[2]==desired:
                state='done'; out.append('committed')
            elif e[1]==version:
                state='retry'; out.append('retryable')
            else: state='conflict'; out.append('conflict')
        elif e[0]=='retry':
            if state=='idle': out.append('denied'); continue
            out.append(['send',version,desired]); state='ready'
        elif e[0]=='ack':
            if state=='sent': state='done'; out.append(['success',e[1]])
            else: out.append('ignored')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N+1),('retry',),('retry',),('sent',),('ack',N+9)]), ['retryable',['send',N,N+9],'denied',['success',N+9]])
check('2', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+9),('retry',),('inspect',N,N)]), ['committed','denied','ignored'])
check('3', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+8),('retry',),('inspect',N,N)]), ['conflict','denied','ignored'])
check('4', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+2,N+9),('retry',)]), ['conflict','denied'])
check('5', solve([('begin',N,N+9),('lost',),('inspect',N,N),('ack',N)]), ['ignored','ignored'])
check('6', solve([('begin',N,N+9),('sent',),('lost',),('ack',N),('inspect',N-1,N),('retry',)]), ['ignored','conflict','denied'])
check('7', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N),('retry',),('ack',N)]), ['retryable',['send',N,N+9],'ignored'])
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):
    version=0; desired=None; state='idle'; out=[]
    for e in events:
        if e[0]=='begin':
            version=e[1]; desired=e[2]; state='ready'
        elif e[0]=='sent':
            if state=='ready': state='sent'
        elif e[0]=='lost':
            if state=='sent': state='uncertain'
        elif e[0]=='inspect':
            if state!='uncertain': out.append('ignored'); continue
            if e[1]==version+1 and e[2]==desired:
                state='done'; out.append('committed')
            elif e[1]==version:
                state='retry'; out.append('retryable')
            else: state='conflict'; out.append('conflict')
        elif e[0]=='retry':
            if state=='done': out.append('denied'); continue
            out.append(['send',version,desired]); state='ready'
        elif e[0]=='ack':
            if state=='sent': state='done'; out.append(['success',e[1]])
            else: out.append('ignored')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N+1),('retry',),('retry',),('sent',),('ack',N+9)]), ['retryable',['send',N,N+9],'denied',['success',N+9]])
check('2', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+9),('retry',),('inspect',N,N)]), ['committed','denied','ignored'])
check('3', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+8),('retry',),('inspect',N,N)]), ['conflict','denied','ignored'])
check('4', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+2,N+9),('retry',)]), ['conflict','denied'])
check('5', solve([('begin',N,N+9),('lost',),('inspect',N,N),('ack',N)]), ['ignored','ignored'])
check('6', solve([('begin',N,N+9),('sent',),('lost',),('ack',N),('inspect',N-1,N),('retry',)]), ['ignored','conflict','denied'])
check('7', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N),('retry',),('ack',N)]), ['retryable',['send',N,N+9],'ignored'])
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 gate violates retry transition semantics

begin(version,desired) creates a pending conditional write. sent records that it may have reached the server; lost means response absent. inspect(version,value) after loss reconciles: desired value at version+1 is committed, unchanged original version permits retry, any other state conflicts. retry only from retry state retains original precondition and desired body. ack(value) succeeds only for an active sent request. Return decisions and outgoing retry preconditions.

split: open-access


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

N = 1
observations = []
def solve(events):
    version=0; desired=None; state='idle'; out=[]
    for e in events:
        if e[0]=='begin':
            version=e[1]; desired=e[2]; state='ready'
        elif e[0]=='sent':
            if state=='ready': state='sent'
        elif e[0]=='lost':
            if state=='sent': state='uncertain'
        elif e[0]=='inspect':
            if state!='uncertain': out.append('ignored'); continue
            if e[1]==version+1 and e[2]==desired:
                state='done'; out.append('committed')
            elif e[1]==version:
                state='retry'; out.append('retryable')
            else: state='conflict'; out.append('conflict')
        elif e[0]=='retry':
            if state!='retry': out.append('denied'); continue
            out.append(['send',version+1,desired]); state='ready'
        elif e[0]=='ack':
            if state=='sent': state='done'; out.append(['success',e[1]])
            else: out.append('ignored')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N+1),('retry',),('retry',),('sent',),('ack',N+9)]), ['retryable',['send',N,N+9],'denied',['success',N+9]])
check('2', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+9),('retry',),('inspect',N,N)]), ['committed','denied','ignored'])
check('3', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+8),('retry',),('inspect',N,N)]), ['conflict','denied','ignored'])
check('4', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+2,N+9),('retry',)]), ['conflict','denied'])
check('5', solve([('begin',N,N+9),('lost',),('inspect',N,N),('ack',N)]), ['ignored','ignored'])
check('6', solve([('begin',N,N+9),('sent',),('lost',),('ack',N),('inspect',N-1,N),('retry',)]), ['ignored','conflict','denied'])
check('7', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N),('retry',),('ack',N)]), ['retryable',['send',N,N+9],'ignored'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(events):
    version=0; desired=None; state='idle'; out=[]
    for e in events:
        if e[0]=='begin':
            version=e[1]; desired=e[2]; state='ready'
        elif e[0]=='sent':
            if state=='ready': state='sent'
        elif e[0]=='lost':
            if state=='sent': state='uncertain'
        elif e[0]=='inspect':
            if state!='uncertain': out.append('ignored'); continue
            if e[1]==version+1 and e[2]==desired:
                state='done'; out.append('committed')
            elif e[1]==version:
                state='retry'; out.append('retryable')
            else: state='conflict'; out.append('conflict')
        elif e[0]=='retry':
            if state!='retry': out.append('denied'); continue
            out.append(['send',None,desired]); state='ready'
        elif e[0]=='ack':
            if state=='sent': state='done'; out.append(['success',e[1]])
            else: out.append('ignored')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N+1),('retry',),('retry',),('sent',),('ack',N+9)]), ['retryable',['send',N,N+9],'denied',['success',N+9]])
check('2', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+9),('retry',),('inspect',N,N)]), ['committed','denied','ignored'])
check('3', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+8),('retry',),('inspect',N,N)]), ['conflict','denied','ignored'])
check('4', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+2,N+9),('retry',)]), ['conflict','denied'])
check('5', solve([('begin',N,N+9),('lost',),('inspect',N,N),('ack',N)]), ['ignored','ignored'])
check('6', solve([('begin',N,N+9),('sent',),('lost',),('ack',N),('inspect',N-1,N),('retry',)]), ['ignored','conflict','denied'])
check('7', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N),('retry',),('ack',N)]), ['retryable',['send',N,N+9],'ignored'])
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 condition violates retry transition semantics

begin(version,desired) creates a pending conditional write. sent records that it may have reached the server; lost means response absent. inspect(version,value) after loss reconciles: desired value at version+1 is committed, unchanged original version permits retry, any other state conflicts. retry only from retry state retains original precondition and desired body. ack(value) succeeds only for an active sent request. Return decisions and outgoing retry preconditions.

split: open-access


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

N = 1
observations = []
def solve(events):
    version=0; desired=None; state='idle'; out=[]
    for e in events:
        if e[0]=='begin':
            version=e[1]; desired=e[2]; state='ready'
        elif e[0]=='sent':
            if state=='ready': state='sent'
        elif e[0]=='lost':
            if state=='sent': state='uncertain'
        elif e[0]=='inspect':
            if state!='uncertain': out.append('ignored'); continue
            if e[1]==version+1 and e[2]==desired:
                state='done'; out.append('committed')
            elif e[1]==version:
                state='retry'; out.append('retryable')
            else: state='conflict'; out.append('conflict')
        elif e[0]=='retry':
            if state!='retry': out.append('denied'); continue
            out.append(['send',version,desired]); state='retry'
        elif e[0]=='ack':
            if state=='sent': state='done'; out.append(['success',e[1]])
            else: out.append('ignored')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N+1),('retry',),('retry',),('sent',),('ack',N+9)]), ['retryable',['send',N,N+9],'denied',['success',N+9]])
check('2', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+9),('retry',),('inspect',N,N)]), ['committed','denied','ignored'])
check('3', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+8),('retry',),('inspect',N,N)]), ['conflict','denied','ignored'])
check('4', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+2,N+9),('retry',)]), ['conflict','denied'])
check('5', solve([('begin',N,N+9),('lost',),('inspect',N,N),('ack',N)]), ['ignored','ignored'])
check('6', solve([('begin',N,N+9),('sent',),('lost',),('ack',N),('inspect',N-1,N),('retry',)]), ['ignored','conflict','denied'])
check('7', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N),('retry',),('ack',N)]), ['retryable',['send',N,N+9],'ignored'])
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):
    version=0; desired=None; state='idle'; out=[]
    for e in events:
        if e[0]=='begin':
            version=e[1]; desired=e[2]; state='ready'
        elif e[0]=='sent':
            if state=='ready': state='sent'
        elif e[0]=='lost':
            if state=='sent': state='uncertain'
        elif e[0]=='inspect':
            if state!='uncertain': out.append('ignored'); continue
            if e[1]==version+1 and e[2]==desired:
                state='done'; out.append('committed')
            elif e[1]==version:
                state='retry'; out.append('retryable')
            else: state='conflict'; out.append('conflict')
        elif e[0]=='retry':
            if state!='retry': out.append('denied'); continue
            out.append(['send',version,desired]); state='sent'
        elif e[0]=='ack':
            if state=='sent': state='done'; out.append(['success',e[1]])
            else: out.append('ignored')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N+1),('retry',),('retry',),('sent',),('ack',N+9)]), ['retryable',['send',N,N+9],'denied',['success',N+9]])
check('2', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+9),('retry',),('inspect',N,N)]), ['committed','denied','ignored'])
check('3', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+8),('retry',),('inspect',N,N)]), ['conflict','denied','ignored'])
check('4', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+2,N+9),('retry',)]), ['conflict','denied'])
check('5', solve([('begin',N,N+9),('lost',),('inspect',N,N),('ack',N)]), ['ignored','ignored'])
check('6', solve([('begin',N,N+9),('sent',),('lost',),('ack',N),('inspect',N-1,N),('retry',)]), ['ignored','conflict','denied'])
check('7', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N),('retry',),('ack',N)]), ['retryable',['send',N,N+9],'ignored'])
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 consumed violates retry transition semantics

begin(version,desired) creates a pending conditional write. sent records that it may have reached the server; lost means response absent. inspect(version,value) after loss reconciles: desired value at version+1 is committed, unchanged original version permits retry, any other state conflicts. retry only from retry state retains original precondition and desired body. ack(value) succeeds only for an active sent request. Return decisions and outgoing retry preconditions.

split: open-access


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

N = 1
observations = []
def solve(events):
    version=0; desired=None; state='idle'; out=[]
    for e in events:
        if e[0]=='begin':
            version=e[1]; desired=e[2]; state='ready'
        elif e[0]=='sent':
            if state=='ready': state='sent'
        elif e[0]=='lost':
            if state=='sent': state='uncertain'
        elif e[0]=='inspect':
            if state!='uncertain': out.append('ignored'); continue
            if e[1]==version+1 and e[2]==desired:
                state='done'; out.append('committed')
            elif e[1]==version:
                state='retry'; out.append('retryable')
            else: state='conflict'; out.append('conflict')
        elif e[0]=='retry':
            if state!='retry': out.append('denied'); continue
            out.append(['send',version,desired]); state='ready'
        elif e[0]=='ack':
            if state!='idle': state='done'; out.append(['success',e[1]])
            else: out.append('ignored')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N+1),('retry',),('retry',),('sent',),('ack',N+9)]), ['retryable',['send',N,N+9],'denied',['success',N+9]])
check('2', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+9),('retry',),('inspect',N,N)]), ['committed','denied','ignored'])
check('3', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+8),('retry',),('inspect',N,N)]), ['conflict','denied','ignored'])
check('4', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+2,N+9),('retry',)]), ['conflict','denied'])
check('5', solve([('begin',N,N+9),('lost',),('inspect',N,N),('ack',N)]), ['ignored','ignored'])
check('6', solve([('begin',N,N+9),('sent',),('lost',),('ack',N),('inspect',N-1,N),('retry',)]), ['ignored','conflict','denied'])
check('7', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N),('retry',),('ack',N)]), ['retryable',['send',N,N+9],'ignored'])
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):
    version=0; desired=None; state='idle'; out=[]
    for e in events:
        if e[0]=='begin':
            version=e[1]; desired=e[2]; state='ready'
        elif e[0]=='sent':
            if state=='ready': state='sent'
        elif e[0]=='lost':
            if state=='sent': state='uncertain'
        elif e[0]=='inspect':
            if state!='uncertain': out.append('ignored'); continue
            if e[1]==version+1 and e[2]==desired:
                state='done'; out.append('committed')
            elif e[1]==version:
                state='retry'; out.append('retryable')
            else: state='conflict'; out.append('conflict')
        elif e[0]=='retry':
            if state!='retry': out.append('denied'); continue
            out.append(['send',version,desired]); state='ready'
        elif e[0]=='ack':
            if state in ('sent','uncertain'): state='done'; out.append(['success',e[1]])
            else: out.append('ignored')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N+1),('retry',),('retry',),('sent',),('ack',N+9)]), ['retryable',['send',N,N+9],'denied',['success',N+9]])
check('2', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+9),('retry',),('inspect',N,N)]), ['committed','denied','ignored'])
check('3', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+1,N+8),('retry',),('inspect',N,N)]), ['conflict','denied','ignored'])
check('4', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N+2,N+9),('retry',)]), ['conflict','denied'])
check('5', solve([('begin',N,N+9),('lost',),('inspect',N,N),('ack',N)]), ['ignored','ignored'])
check('6', solve([('begin',N,N+9),('sent',),('lost',),('ack',N),('inspect',N-1,N),('retry',)]), ['ignored','conflict','denied'])
check('7', solve([('begin',N,N+9),('sent',),('lost',),('inspect',N,N),('retry',),('ack',N)]), ['retryable',['send',N,N+9],'ignored'])
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:
Ack gate violates retry transition semantics

begin(version,desired) creates a pending conditional write. sent records that it may have reached the server; lost means response absent. inspect(version,value) after loss reconciles: desired value at version+1 is committed, unchanged original version permits retry, any other state conflicts. retry only from retry state retains original precondition and desired body. ack(value) succeeds only for an active sent request. Return decisions and outgoing retry preconditions.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[2]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]+1; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Ordinary config violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[1]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]+1; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Refresh config violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=generation; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=1; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Begin generation violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if False: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('retry'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Network wait violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary<0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary<=1: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Network budget violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary=0; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=2; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Network charge violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if False: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('auth-exhausted'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Coalesce violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh<0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh<=1: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Refresh budget violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh=0; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=2; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Refresh charge violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=2; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Refresh generation violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=False
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=refresh>0
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Refresh pending violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]>generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]<generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Refresh match violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal and not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=False; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Refresh single delivery violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access


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

N = 1
observations = []
def solve(events):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=True; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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):
    ordinary=0; refresh=0; generation=0; waiting=False; terminal=True; out=[]
    for e in events:
        if e[0]=='begin': ordinary=e[1]; refresh=e[2]; generation=0; waiting=False; terminal=False
        elif e[0]=='success': terminal=True; waiting=False
        elif e[0]=='network':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('waiting'); continue
            if ordinary==0: out.append('exhausted'); continue
            ordinary-=1; out.append('retry')
        elif e[0]=='challenge':
            if terminal: out.append('terminal'); continue
            if waiting: out.append('coalesced'); continue
            if refresh==0: out.append('auth-exhausted'); continue
            refresh-=1; generation+=1; waiting=True
            out.append(['refresh',generation])
        elif e[0]=='refreshed':
            if terminal or not waiting or e[1]!=generation: out.append('stale'); continue
            waiting=ordinary>0; out.append('auth-replay')
    return [out,ordinary,refresh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,0])
check('1', solve([('begin',2,1),('network',),('challenge',),('network',),('challenge',),('refreshed',1),('refreshed',1),('network',),('network',),('challenge',)]), [['retry',['refresh',1],'waiting','coalesced','auth-replay','stale','retry','exhausted','auth-exhausted'],0,0])
check('2', solve([('begin',0,2),('challenge',),('refreshed',1),('challenge',),('refreshed',1),('refreshed',3),('refreshed',2)]), [[['refresh',1],'auth-replay',['refresh',2],'stale','stale','auth-replay'],0,0])
check('3', solve([('begin',N,1),('challenge',),('success',),('refreshed',1),('network',),('challenge',)]), [[['refresh',1],'stale','terminal','terminal'],N,0])
check('4', solve([('begin',0,0),('network',),('challenge',)]), [['exhausted','auth-exhausted'],0,0])
check('5', solve([('begin',1,1),('challenge',),('begin',0,1),('challenge',),('refreshed',1)]), [[['refresh',1],['refresh',1],'auth-replay'],0,0])
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:
Refresh completion violates retry transition semantics

begin(ordinary retries,refresh allowance) starts a request. network_failure spends ordinary allowance, challenge spends refresh allowance only if no refresh in flight, refreshed(generation) completes only current refresh generation and records auth replay. While refreshing network failures wait. success terminates both budgets; late refresh is ignored. No credentials are represented.

split: open-access