FAILURE MAP
← Case archive

FA-29471 / HTTP retries / Open access

Fresh body factories on retries: Factory calls fail to consume exactly one attempt allowance · case 01

Factory calls fail to consume exactly one attempt allowance

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

ROOT CAUSE

Factory calls fail to consume exactly one attempt allowance

VERIFIED REPAIR

Restore the specified transition calls+=1.

Unsuccessful approach: The attempted repair changes the faulty site to calls+=2 but still violates a regression oracle.

Case contract

open sets a body factory recipe; attempt calls it to make a fresh cursor, read consumes the current body, change changes the recipe for future logical requests only, new snapshots the changed recipe. Return emitted chunks; attempts beyond allowance return exhausted. Recipe is snapshotted on open/new.

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):
    recipe=[]; snapshot=(); body=[]; cursor=0; calls=0; limit=0; out=[]; active=False
    for e in events:
        if e[0] in ('open','new'):
            recipe=list(e[1]); limit=e[2]
            snapshot=tuple(recipe)
            calls=0
            active=False
        elif e[0]=='change': recipe[:]=e[1]
        elif e[0]=='attempt':
            if calls>=limit:
                out.append('exhausted'); active=False; continue
            body=list(snapshot)
            cursor=0
            calls=1
            active=True
            out.append('factory')
        elif e[0]=='read':
            if not active: out.append('inactive'); continue
            chunk=body[cursor:cursor+e[1]]
            cursor+=len(chunk)
            out.append(chunk)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],2),('attempt',),('read',2),('read',1),('read',1),('attempt',),('read',3),('attempt',)]), ['factory',[N,N+1],[N+2],[],'factory',[N,N+1,N+2],'exhausted'])
check('2', solve([('open',[N,N+1],1),('change',[9]),('attempt',),('read',2)]), ['factory',[N,N+1]])
check('3', solve([('open',[],1),('attempt',),('read',1)]), ['factory',[]])
check('4', solve([('open',[N],0),('attempt',),('read',1)]), ['exhausted','inactive'])
check('5', solve([('open',[N],1),('attempt',),('new',[N+1],1),('read',1),('attempt',),('read',1)]), ['factory','inactive','factory',[N+1]])
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['factory', [1, 2], [3], [], 'factory', [1, 2, 3], 'factory']['factory', [1, 2], [3], [], 'factory', [1, 2, 3], 'exhausted']Failed
2['factory', [1, 2]]['factory', [1, 2]]Passed
3['factory', []]['factory', []]Passed
4['exhausted', 'inactive']['exhausted', 'inactive']Passed
5['factory', 'inactive', 'factory', [2]]['factory', 'inactive', 'factory', [2]]Passed

SHA-256 / 27f0ca9fc1c7914968cd5b29afc52e37df3a52070a5c39361622ae949bf1021c

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(events):
    recipe=[]; snapshot=(); body=[]; cursor=0; calls=0; limit=0; out=[]; active=False
    for e in events:
        if e[0] in ('open','new'):
            recipe=list(e[1]); limit=e[2]
            snapshot=tuple(recipe)
            calls=0
            active=False
        elif e[0]=='change': recipe[:]=e[1]
        elif e[0]=='attempt':
            if calls>=limit:
                out.append('exhausted'); active=False; continue
            body=list(snapshot)
            cursor=0
            calls+=2
            active=True
            out.append('factory')
        elif e[0]=='read':
            if not active: out.append('inactive'); continue
            chunk=body[cursor:cursor+e[1]]
            cursor+=len(chunk)
            out.append(chunk)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],2),('attempt',),('read',2),('read',1),('read',1),('attempt',),('read',3),('attempt',)]), ['factory',[N,N+1],[N+2],[],'factory',[N,N+1,N+2],'exhausted'])
check('2', solve([('open',[N,N+1],1),('change',[9]),('attempt',),('read',2)]), ['factory',[N,N+1]])
check('3', solve([('open',[],1),('attempt',),('read',1)]), ['factory',[]])
check('4', solve([('open',[N],0),('attempt',),('read',1)]), ['exhausted','inactive'])
check('5', solve([('open',[N],1),('attempt',),('new',[N+1],1),('read',1),('attempt',),('read',1)]), ['factory','inactive','factory',[N+1]])
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['factory', [1, 2], [3], [], 'exhausted', 'inactive', 'exhausted']['factory', [1, 2], [3], [], 'factory', [1, 2, 3], 'exhausted']Failed
2['factory', [1, 2]]['factory', [1, 2]]Passed
3['factory', []]['factory', []]Passed
4['exhausted', 'inactive']['exhausted', 'inactive']Passed
5['factory', 'inactive', 'factory', [2]]['factory', 'inactive', 'factory', [2]]Passed

SHA-256 / c15194d89359b52f5d2ceb3b44da244ab14193b5e7d98590930d73363af2c889

3 / The verified repair

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

N = 1
observations = []
def solve(events):
    recipe=[]; snapshot=(); body=[]; cursor=0; calls=0; limit=0; out=[]; active=False
    for e in events:
        if e[0] in ('open','new'):
            recipe=list(e[1]); limit=e[2]
            snapshot=tuple(recipe)
            calls=0
            active=False
        elif e[0]=='change': recipe[:]=e[1]
        elif e[0]=='attempt':
            if calls>=limit:
                out.append('exhausted'); active=False; continue
            body=list(snapshot)
            cursor=0
            calls+=1
            active=True
            out.append('factory')
        elif e[0]=='read':
            if not active: out.append('inactive'); continue
            chunk=body[cursor:cursor+e[1]]
            cursor+=len(chunk)
            out.append(chunk)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [])
check('1', solve([('open',[N,N+1,N+2],2),('attempt',),('read',2),('read',1),('read',1),('attempt',),('read',3),('attempt',)]), ['factory',[N,N+1],[N+2],[],'factory',[N,N+1,N+2],'exhausted'])
check('2', solve([('open',[N,N+1],1),('change',[9]),('attempt',),('read',2)]), ['factory',[N,N+1]])
check('3', solve([('open',[],1),('attempt',),('read',1)]), ['factory',[]])
check('4', solve([('open',[N],0),('attempt',),('read',1)]), ['exhausted','inactive'])
check('5', solve([('open',[N],1),('attempt',),('new',[N+1],1),('read',1),('attempt',),('read',1)]), ['factory','inactive','factory',[N+1]])
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['factory', [1, 2], [3], [], 'factory', [1, 2, 3], 'exhausted']['factory', [1, 2], [3], [], 'factory', [1, 2, 3], 'exhausted']Passed
2['factory', [1, 2]]['factory', [1, 2]]Passed
3['factory', []]['factory', []]Passed
4['exhausted', 'inactive']['exhausted', 'inactive']Passed
5['factory', 'inactive', 'factory', [2]]['factory', 'inactive', 'factory', [2]]Passed

SHA-256 / 583b9d90190284a19466c10aa3e48e7523c10605c9675147686d38e8c17a45fd

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:43.526217+00:00.

Case digest / b16f55eaf78838e925a67fe44f60272ef2daeb62ad9b7746ed54c400b8e98a5e