FAILURE MAP
← Case archive

FA-30451 / HTTP retries / Open access

Retry routing with origin affinity: Pool order violates retry transition semantics · case 01

Pool order violates retry transition semantics

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

ROOT CAUSE

Pool order violates retry transition semantics

THE FAILURE

Pool order violates retry transition semantics

Unsuccessful approach: The attempted repair changes the faulty site to pool=list(reversed(e[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=sorted(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(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['a', 'active', 'b', 'c', 'exhausted']['b', 'active', 'a', 'c', 'exhausted']Failed
2['a', 'a', 'exhausted']['a', 'a', 'exhausted']Passed
3['a', 'c']['a', 'c']Passed
4['a', 'exhausted', 'b']['a', 'exhausted', 'b']Passed
5[1, 'terminal', 1][1, 'terminal', 1]Passed
6['a']['a']Passed

SHA-256 / af45064af856203373c504d40265b6b4db5a262be7bd46f7734416546da6bd51

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(reversed(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(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['c', 'active', 'a', 'b', 'exhausted']['b', 'active', 'a', 'c', 'exhausted']Failed
2['b', 'b', 'b']['a', 'a', 'exhausted']Failed
3['c', 'a']['a', 'c']Failed
4['b', 'b', 'b']['a', 'exhausted', 'b']Failed
5[2, 'terminal', 2][1, 'terminal', 1]Failed
6['a']['a']Passed

SHA-256 / bbd4a7a2e91fd4d9d4748aea49c5a9efd7670e20921ebd2441c5840d2fd897f5

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 / 64016d794760797fd6d4e33b9f231a4e8249cabc5d2a9fbc2b148b8569f19a21