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

N = 1
observations = []
def solve(events):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<=300: result=['success',e[3]]
            elif e[2] in (429,503): token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<400: result=['success',e[3]]
            elif e[2] in (429,503): token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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:
Success upper violates retry transition semantics

begin resets generation and final result. launch creates next active generation; response(generation,status,payload) accepts only current active attempt. A 2xx result completes immediately, retryable statuses 429/503 leave logical request pending with a retry token, other statuses terminally fail. retry consumes token to launch next attempt. cancel wins if no final result. Once final, every later event except begin is ignored. Return result and number of attempts launched.

split: open-access


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

N = 1
observations = []
def solve(events):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 100<=e[2]<300: result=['success',e[3]]
            elif e[2] in (429,503): token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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)

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):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if e[2]<300: result=['success',e[3]]
            elif e[2] in (429,503): token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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:
Success lower violates retry transition semantics

begin resets generation and final result. launch creates next active generation; response(generation,status,payload) accepts only current active attempt. A 2xx result completes immediately, retryable statuses 429/503 leave logical request pending with a retry token, other statuses terminally fail. retry consumes token to launch next attempt. cancel wins if no final result. Once final, every later event except begin is ignored. Return result and number of attempts launched.

split: open-access


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

N = 1
observations = []
def solve(events):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<300: result=['success',e[2]]
            elif e[2] in (429,503): token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<300: result=['success',generation]
            elif e[2] in (429,503): token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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:
Success payload violates retry transition semantics

begin resets generation and final result. launch creates next active generation; response(generation,status,payload) accepts only current active attempt. A 2xx result completes immediately, retryable statuses 429/503 leave logical request pending with a retry token, other statuses terminally fail. retry consumes token to launch next attempt. cancel wins if no final result. Once final, every later event except begin is ignored. Return result and number of attempts launched.

split: open-access


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

N = 1
observations = []
def solve(events):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<300: result=['success',e[3]]
            elif e[2]>=500: token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<300: result=['success',e[3]]
            elif e[2]==503: token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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:
Retry statuses violates retry transition semantics

begin resets generation and final result. launch creates next active generation; response(generation,status,payload) accepts only current active attempt. A 2xx result completes immediately, retryable statuses 429/503 leave logical request pending with a retry token, other statuses terminally fail. retry consumes token to launch next attempt. cancel wins if no final result. Once final, every later event except begin is ignored. Return result and number of attempts launched.

split: open-access


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

N = 1
observations = []
def solve(events):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<300: result=['success',e[3]]
            elif e[2] in (429,503): token=True
            else: result=['failure',e[3]]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<300: result=['success',e[3]]
            elif e[2] in (429,503): token=True
            else: result=['failure',500]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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:
Failure status violates retry transition semantics

begin resets generation and final result. launch creates next active generation; response(generation,status,payload) accepts only current active attempt. A 2xx result completes immediately, retryable statuses 429/503 leave logical request pending with a retry token, other statuses terminally fail. retry consumes token to launch next attempt. cancel wins if no final result. Once final, every later event except begin is ignored. Return result and number of attempts launched.

split: open-access


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

N = 1
observations = []
def solve(events):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<300: result=['success',e[3]]
            elif e[2] in (429,503): token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<300: result=['success',e[3]]
            elif e[2] in (429,503): token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if not token and active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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:
Retry token gate violates retry transition semantics

begin resets generation and final result. launch creates next active generation; response(generation,status,payload) accepts only current active attempt. A 2xx result completes immediately, retryable statuses 429/503 leave logical request pending with a retry token, other statuses terminally fail. retry consumes token to launch next attempt. cancel wins if no final result. Once final, every later event except begin is ignored. Return result and number of attempts launched.

split: open-access


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

N = 1
observations = []
def solve(events):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<300: result=['success',e[3]]
            elif e[2] in (429,503): token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation=1; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<300: result=['success',e[3]]
            elif e[2] in (429,503): token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation+=2; active=True
        elif e[0]=='cancel':
            result=['cancelled',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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:
Retry generation violates retry transition semantics

begin resets generation and final result. launch creates next active generation; response(generation,status,payload) accepts only current active attempt. A 2xx result completes immediately, retryable statuses 429/503 leave logical request pending with a retry token, other statuses terminally fail. retry consumes token to launch next attempt. cancel wins if no final result. Once final, every later event except begin is ignored. Return result and number of attempts launched.

split: open-access


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

N = 1
observations = []
def solve(events):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<300: result=['success',e[3]]
            elif e[2] in (429,503): token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=None; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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):
    generation=0; active=False; token=False; result=None
    for e in events:
        if e[0]=='begin': generation=0; active=False; token=False; result=None; continue
        if result is not None: continue
        if e[0]=='launch':
            if active or generation!=0: continue
            generation+=1; active=True
        elif e[0]=='response':
            if not active or e[1]!=generation: continue
            active=False
            if 200<=e[2]<300: result=['success',e[3]]
            elif e[2] in (429,503): token=True
            else: result=['failure',e[2]]
        elif e[0]=='retry':
            if not token or active: continue
            token=False; generation+=1; active=True
        elif e[0]=='cancel':
            result=['failure',None]; active=False; token=False
    return [result,generation]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [None,0])
check('1', solve([('begin',),('launch',),('response',1,200,N),('cancel',),('launch',)]), [['success',N],1])
check('2', solve([('begin',),('launch',),('response',1,503,0),('launch',),('retry',),('response',1,200,0),('response',3,200,0),('response',2,204,N)]), [['success',N],2])
check('3', solve([('launch',),('response',1,429,0),('response',1,200,N),('retry',),('response',2,400,N),('cancel',)]), [['failure',400],2])
check('4', solve([('launch',),('cancel',),('response',1,200,N),('retry',)]), [['cancelled',None],1])
check('5', solve([('retry',),('launch',),('response',1,300,N)]), [['failure',300],1])
check('6', solve([('launch',),('response',1,199,N)]), [['failure',199],1])
check('7', solve([('launch',),('response',1,500,N)]), [['failure',500],1])
check('8', solve([('launch',),('response',1,200,0),('begin',),('launch',),('response',1,201,N)]), [['success',N],1])
check('9', solve([('launch',),('response',1,503,N),('launch',)]), [None,1])
check('10', solve([('launch',),('launch',)]), [None,1])
check('11', solve([('retry',)]), [None,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:
Cancel final violates retry transition semantics

begin resets generation and final result. launch creates next active generation; response(generation,status,payload) accepts only current active attempt. A 2xx result completes immediately, retryable statuses 429/503 leave logical request pending with a retry token, other statuses terminally fail. retry consumes token to launch next attempt. cancel wins if no final result. Once final, every later event except begin is ignored. Return result and number of attempts launched.

split: open-access


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

N = 1
observations = []
def solve(events):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=None; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[4]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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:
Server date violates retry transition semantics

Controlled decoded Retry-After model. response(server Date or None,Age,received monotonic,local wall at receive) resets advice. delta(nonnegative seconds) or date(absolute seconds) records one advice; multiple advice values are rejected. For date, estimate server time as Date+Age, or local wall if Date absent. Project remaining server delay onto receive monotonic clock. advance moves monotonic time forward. schedule returns remaining wait or missing/ambiguous; no network requests or full header parsing.

split: open-access


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

N = 1
observations = []
def solve(events):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=0; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[3]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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:
Age origin violates retry transition semantics

Controlled decoded Retry-After model. response(server Date or None,Age,received monotonic,local wall at receive) resets advice. delta(nonnegative seconds) or date(absolute seconds) records one advice; multiple advice values are rejected. For date, estimate server time as Date+Age, or local wall if Date absent. Project remaining server delay onto receive monotonic clock. advance moves monotonic time forward. schedule returns remaining wait or missing/ambiguous; no network requests or full header parsing.

split: open-access


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

N = 1
observations = []
def solve(events):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[4]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=0; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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:
Receive monotonic violates retry transition semantics

Controlled decoded Retry-After model. response(server Date or None,Age,received monotonic,local wall at receive) resets advice. delta(nonnegative seconds) or date(absolute seconds) records one advice; multiple advice values are rejected. For date, estimate server time as Date+Age, or local wall if Date absent. Project remaining server delay onto receive monotonic clock. advance moves monotonic time forward. schedule returns remaining wait or missing/ambiguous; no network requests or full header parsing.

split: open-access


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

N = 1
observations = []
def solve(events):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[3]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=0; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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:
Fallback wall violates retry transition semantics

Controlled decoded Retry-After model. response(server Date or None,Age,received monotonic,local wall at receive) resets advice. delta(nonnegative seconds) or date(absolute seconds) records one advice; multiple advice values are rejected. For date, estimate server time as Date+Age, or local wall if Date absent. Project remaining server delay onto receive monotonic clock. advance moves monotonic time forward. schedule returns remaining wait or missing/ambiguous; no network requests or full header parsing.

split: open-access


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

N = 1
observations = []
def solve(events):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=advice
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[('delta',0)]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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:
Response reset violates retry transition semantics

Controlled decoded Retry-After model. response(server Date or None,Age,received monotonic,local wall at receive) resets advice. delta(nonnegative seconds) or date(absolute seconds) records one advice; multiple advice values are rejected. For date, estimate server time as Date+Age, or local wall if Date absent. Project remaining server delay onto receive monotonic clock. advance moves monotonic time forward. schedule returns remaining wait or missing/ambiguous; no network requests or full header parsing.

split: open-access


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

N = 1
observations = []
def solve(events):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice[:]=[(e[0],e[1])]
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.insert(0,(e[0],e[1])); advice[:]=advice[:1]
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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:
Advice retain violates retry transition semantics

Controlled decoded Retry-After model. response(server Date or None,Age,received monotonic,local wall at receive) resets advice. delta(nonnegative seconds) or date(absolute seconds) records one advice; multiple advice values are rejected. For date, estimate server time as Date+Age, or local wall if Date absent. Project remaining server delay onto receive monotonic clock. advance moves monotonic time forward. schedule returns remaining wait or missing/ambiguous; no network requests or full header parsing.

split: open-access


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

N = 1
observations = []
def solve(events):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=e[1]
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=min(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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:
Clock monotonic violates retry transition semantics

Controlled decoded Retry-After model. response(server Date or None,Age,received monotonic,local wall at receive) resets advice. delta(nonnegative seconds) or date(absolute seconds) records one advice; multiple advice values are rejected. For date, estimate server time as Date+Age, or local wall if Date absent. Project remaining server delay onto receive monotonic clock. advance moves monotonic time forward. schedule returns remaining wait or missing/ambiguous; no network requests or full header parsing.

split: open-access


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

N = 1
observations = []
def solve(events):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)>2: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)<1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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:
Duplicate advice violates retry transition semantics

Controlled decoded Retry-After model. response(server Date or None,Age,received monotonic,local wall at receive) resets advice. delta(nonnegative seconds) or date(absolute seconds) records one advice; multiple advice values are rejected. For date, estimate server time as Date+Age, or local wall if Date absent. Project remaining server delay onto receive monotonic clock. advance moves monotonic time forward. schedule returns remaining wait or missing/ambiguous; no network requests or full header parsing.

split: open-access


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

N = 1
observations = []
def solve(events):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=now+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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:
Relative base violates retry transition semantics

Controlled decoded Retry-After model. response(server Date or None,Age,received monotonic,local wall at receive) resets advice. delta(nonnegative seconds) or date(absolute seconds) records one advice; multiple advice values are rejected. For date, estimate server time as Date+Age, or local wall if Date absent. Project remaining server delay onto receive monotonic clock. advance moves monotonic time forward. schedule returns remaining wait or missing/ambiguous; no network requests or full header parsing.

split: open-access


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

N = 1
observations = []
def solve(events):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=value
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,reference-value)
            out.append(max(0,due-now))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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:
Absolute projection violates retry transition semantics

Controlled decoded Retry-After model. response(server Date or None,Age,received monotonic,local wall at receive) resets advice. delta(nonnegative seconds) or date(absolute seconds) records one advice; multiple advice values are rejected. For date, estimate server time as Date+Age, or local wall if Date absent. Project remaining server delay onto receive monotonic clock. advance moves monotonic time forward. schedule returns remaining wait or missing/ambiguous; no network requests or full header parsing.

split: open-access


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

N = 1
observations = []
def solve(events):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-received))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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):
    server=None; age=0; received=0; wall=0; now=0; advice=[]; out=[]
    for e in events:
        if e[0]=='response':
            server=e[1]; age=e[2]; received=e[3]; wall=e[4]; now=received; advice=[]
        elif e[0] in ('delta','date'): advice.append((e[0],e[1]))
        elif e[0]=='advance': now=max(now,e[1])
        elif e[0]=='schedule':
            if not advice: out.append('missing'); continue
            if len(advice)!=1: out.append('ambiguous'); continue
            kind,value=advice[0]
            if kind=='delta': due=received+value
            else:
                reference=server+age if server is not None else wall
                due=received+max(0,value-reference)
            out.append(max(0,due-wall))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('response',100,0,N,200),('schedule',)]), ['missing'])
check('2', solve([('response',100,5,N,200),('date',110),('schedule',),('advance',N+2),('schedule',)]), [5,3])
check('3', solve([('response',None,99,N,200),('date',207),('schedule',)]), [7])
check('4', solve([('response',100,0,N,200),('delta',5),('advance',N+2),('schedule',),('advance',N),('schedule',)]), [3,3])
check('5', solve([('response',100,0,N,200),('delta',5),('delta',5),('schedule',),('response',100,0,N+1,200),('schedule',)]), ['ambiguous','missing'])
check('6', solve([('response',100,0,N,200),('date',90),('schedule',),('advance',N+10),('schedule',)]), [0,0])
check('7', solve([('response',100,13,N,200),('date',120),('schedule',)]), [7])
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:
Elapsed wait violates retry transition semantics

Controlled decoded Retry-After model. response(server Date or None,Age,received monotonic,local wall at receive) resets advice. delta(nonnegative seconds) or date(absolute seconds) records one advice; multiple advice values are rejected. For date, estimate server time as Date+Age, or local wall if Date absent. Project remaining server delay onto receive monotonic clock. advance moves monotonic time forward. schedule returns remaining wait or missing/ambiguous; no network requests or full header parsing.

split: open-access


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

N = 1
observations = []
def solve(events):
    serial=0; key=None; original=None; state='idle'; out=[]
    for e in events:
        if e[0]=='begin':
            serial=1
            key=serial if e[1] is None else e[1]
            original=e[2]
            state='ready'
        elif e[0]=='send':
            if state not in ('ready','uncertain'): out.append('blocked'); continue
            if e[1]!=original: out.append('body-conflict'); continue
            out.append([key,original])
            state='sent'
        elif e[0]=='uncertain':
            if state=='sent': state='uncertain'
        elif e[0]=='reject': state='rejected'
        elif e[0]=='success':
            if state=='sent': state='done'
    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',None,N),('send',N),('uncertain',),('send',N),('send',N),('success',),('uncertain',),('send',N)]), [[1,N],[1,N],'blocked','blocked'])
check('2', solve([('begin',0,N),('send',N)]), [[0,N]])
check('3', solve([('begin','customer-key',N),('send',N),('uncertain',),('send',N+1),('send',N)]), [['customer-key',N],'body-conflict',['customer-key',N]])
check('4', solve([('begin',None,N),('send',N),('reject',),('uncertain',),('send',N),('begin',None,N+1),('send',N+1)]), [[1,N],'blocked',[2,N+1]])
check('5', solve([('begin',None,N),('send',N+1),('send',N)]), ['body-conflict',[1,N]])
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):
    serial=0; key=None; original=None; state='idle'; out=[]
    for e in events:
        if e[0]=='begin':
            serial+=0
            key=serial if e[1] is None else e[1]
            original=e[2]
            state='ready'
        elif e[0]=='send':
            if state not in ('ready','uncertain'): out.append('blocked'); continue
            if e[1]!=original: out.append('body-conflict'); continue
            out.append([key,original])
            state='sent'
        elif e[0]=='uncertain':
            if state=='sent': state='uncertain'
        elif e[0]=='reject': state='rejected'
        elif e[0]=='success':
            if state=='sent': state='done'
    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',None,N),('send',N),('uncertain',),('send',N),('send',N),('success',),('uncertain',),('send',N)]), [[1,N],[1,N],'blocked','blocked'])
check('2', solve([('begin',0,N),('send',N)]), [[0,N]])
check('3', solve([('begin','customer-key',N),('send',N),('uncertain',),('send',N+1),('send',N)]), [['customer-key',N],'body-conflict',['customer-key',N]])
check('4', solve([('begin',None,N),('send',N),('reject',),('uncertain',),('send',N),('begin',None,N+1),('send',N+1)]), [[1,N],'blocked',[2,N+1]])
check('5', solve([('begin',None,N),('send',N+1),('send',N)]), ['body-conflict',[1,N]])
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:
Generated key uniqueness violates retry transition semantics

begin(provided key or None,body) starts a logical operation and advances a local operation serial. Generated key is operation serial; explicit keys including zero remain exact. send(body) first sends only matching snapshotted body. uncertain authorizes a resend; reject is terminal; success is terminal. Retried sends reuse the initial key. Return sent key/body pairs or refusal reason.

split: open-access