FAILURE MAP
← Case archive

FA-29446 / HTTP retries / Open access

Fresh body factories on retries: A new request inherits spent factory invocations · case 01

A new request inherits spent factory invocations

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

ROOT CAUSE

A new request inherits spent factory invocations

VERIFIED REPAIR

Restore the specified transition calls=0 active.

Unsuccessful approach: The attempted repair changes the faulty site to calls=calls active 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=1
            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], [], 'exhausted', 'inactive', 'exhausted']['factory', [1, 2], [3], [], 'factory', [1, 2, 3], 'exhausted']Failed
2['exhausted', 'inactive']['factory', [1, 2]]Failed
3['exhausted', 'inactive']['factory', []]Failed
4['exhausted', 'inactive']['exhausted', 'inactive']Passed
5['exhausted', 'inactive', 'exhausted', 'inactive']['factory', 'inactive', 'factory', [2]]Failed

SHA-256 / 449418c19d2b221e068aa2d308213300150cc1f1729b0e4760cced7aa9437370

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=calls
            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', 'exhausted', 'inactive']['factory', 'inactive', 'factory', [2]]Failed

SHA-256 / 8860fc8813155b0f9d289979e3f8c720f6041e32a1576462d4bd7821e78369cd

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

Case digest / ea7927de6ee0d372285d4f5a2d7668a9fdcfacc0f41a002f3594f47f94e2ca21