FAILURE MAP
← Case archive

FA-30506 / HTTP retries / Open access

Retry routing with origin affinity: Failure tried violates retry transition semantics · case 01

Failure tried violates retry transition semantics

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Failure tried violates retry transition semantics

THE FAILURE

Failure tried violates retry transition semantics

Unsuccessful approach: The attempted repair changes the faulty site to if active is not None: tried.add(pool[-1]) but still violates a regression oracle.

Case contract

pool(endpoint IDs) sets ordered available endpoints. begin(request,affinity bool) resets attempted endpoint set and pin. pick selects first healthy untried endpoint; an affinity request must reuse its first endpoint on subsequent retries while healthy. down/up alter health. fail marks current endpoint attempted and clears active route. success finalizes. No route changes are HTTP redirects. Return chosen endpoint or exhausted/terminal/active.

Why this case matters

Offline deterministic model of HTTP request retries.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    pool=[]; down=set(); tried=set(); pin=None; active=None; affinity=False; terminal=True; out=[]
    for e in events:
        if e[0]=='pool': pool=list(e[1]); down=set()
        elif e[0]=='begin': tried=set(); pin=None; active=None; affinity=e[2]; terminal=False
        elif e[0]=='down': down.add(e[1])
        elif e[0]=='up': down.discard(e[1])
        elif e[0]=='pick':
            if terminal: out.append('terminal'); continue
            if active is not None: out.append('active'); continue
            if affinity and pin is not None:
                options=[pin] if pin not in down and pin in pool else []
            else: options=[p for p in pool if p not in down and p not in tried]
            if not options: out.append('exhausted'); continue
            active=options[0]
            if pin is None: pin=active
            out.append(active)
        elif e[0]=='fail':
            if active is not None: tried.discard(active)
            active=None
        elif e[0]=='success': terminal=True; active=None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('pool',['b','a','c']),('begin','r',False),('pick',),('pick',),('fail',),('pick',),('fail',),('pick',),('fail',),('pick',)]), ['b','active','a','c','exhausted'])
check('2', solve([('pool',['a','b']),('begin','r',True),('pick',),('fail',),('pick',),('fail',),('down','a'),('pick',)]), ['a','a','exhausted'])
check('3', solve([('pool',['a','b','c']),('down','a'),('down','b'),('up','a'),('begin','r',False),('pick',),('fail',),('pick',)]), ['a','c'])
check('4', solve([('pool',['a','b']),('begin','r',True),('pick',),('fail',),('pool',['b']),('pick',),('begin','s',True),('pick',)]), ['a','exhausted','b'])
check('5', solve([('pool',[N,N+1]),('begin','r',False),('pick',),('success',),('pick',),('begin','s',False),('pick',)]), [N,'terminal',N])
check('6', solve([('pool',['a']),('down','a'),('pool',['a']),('begin','r',False),('pick',)]), ['a'])
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)
Boundary fixtureActualExpectedOutcome
0[][]Passed
1['b', 'active', 'b', 'b', 'b']['b', 'active', 'a', 'c', 'exhausted']Failed
2['a', 'a', 'exhausted']['a', 'a', 'exhausted']Passed
3['a', 'a']['a', 'c']Failed
4['a', 'exhausted', 'b']['a', 'exhausted', 'b']Passed
5[1, 'terminal', 1][1, 'terminal', 1]Passed
6['a']['a']Passed

SHA-256 / 04605cef2613ea50ac066937eb45c6d8fdd4a3baa9b0fe83a88f9b915b739ce5

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    pool=[]; down=set(); tried=set(); pin=None; active=None; affinity=False; terminal=True; out=[]
    for e in events:
        if e[0]=='pool': pool=list(e[1]); down=set()
        elif e[0]=='begin': tried=set(); pin=None; active=None; affinity=e[2]; terminal=False
        elif e[0]=='down': down.add(e[1])
        elif e[0]=='up': down.discard(e[1])
        elif e[0]=='pick':
            if terminal: out.append('terminal'); continue
            if active is not None: out.append('active'); continue
            if affinity and pin is not None:
                options=[pin] if pin not in down and pin in pool else []
            else: options=[p for p in pool if p not in down and p not in tried]
            if not options: out.append('exhausted'); continue
            active=options[0]
            if pin is None: pin=active
            out.append(active)
        elif e[0]=='fail':
            if active is not None: tried.add(pool[-1])
            active=None
        elif e[0]=='success': terminal=True; active=None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('pool',['b','a','c']),('begin','r',False),('pick',),('pick',),('fail',),('pick',),('fail',),('pick',),('fail',),('pick',)]), ['b','active','a','c','exhausted'])
check('2', solve([('pool',['a','b']),('begin','r',True),('pick',),('fail',),('pick',),('fail',),('down','a'),('pick',)]), ['a','a','exhausted'])
check('3', solve([('pool',['a','b','c']),('down','a'),('down','b'),('up','a'),('begin','r',False),('pick',),('fail',),('pick',)]), ['a','c'])
check('4', solve([('pool',['a','b']),('begin','r',True),('pick',),('fail',),('pool',['b']),('pick',),('begin','s',True),('pick',)]), ['a','exhausted','b'])
check('5', solve([('pool',[N,N+1]),('begin','r',False),('pick',),('success',),('pick',),('begin','s',False),('pick',)]), [N,'terminal',N])
check('6', solve([('pool',['a']),('down','a'),('pool',['a']),('begin','r',False),('pick',)]), ['a'])
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)
Boundary fixtureActualExpectedOutcome
0[][]Passed
1['b', 'active', 'b', 'b', 'b']['b', 'active', 'a', 'c', 'exhausted']Failed
2['a', 'a', 'exhausted']['a', 'a', 'exhausted']Passed
3['a', 'a']['a', 'c']Failed
4['a', 'exhausted', 'b']['a', 'exhausted', 'b']Passed
5[1, 'terminal', 1][1, 'terminal', 1]Passed
6['a']['a']Passed

SHA-256 / 308a85bdbee18446cf2e506a44ee3e04ad9243957a9a585e1d4d173abfbf5181

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

Stipulated bounded simulator, not a complete HTTP implementation or a standards conformance claim. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:41:53.677299+00:00.

Case digest / a0cee99232b761cc3224de39e2039ece479ff64fea3edc9adf5d10eb7e51c1b6