FAILURE MAP
← Case archive

FA-29466 / HTTP retries / Open access

Fresh body factories on retries: A fresh retry body inherits a consumed cursor · case 01

A fresh retry body inherits a consumed cursor

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

ROOT CAUSE

A fresh retry body inherits a consumed cursor

VERIFIED REPAIR

Restore the specified transition cursor=0 calls.

Unsuccessful approach: The attempted repair changes the faulty site to cursor=1 calls 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=cursor
            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', [], '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 / 3d4c11059ec2e2f3e7eeae5d1d616636721432c1b3831c65ea57e1dc0af6b7bb

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=1
            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', [2, 3], [], [], 'factory', [2, 3], 'exhausted']['factory', [1, 2], [3], [], 'factory', [1, 2, 3], 'exhausted']Failed
2['factory', [2]]['factory', [1, 2]]Failed
3['factory', []]['factory', []]Passed
4['exhausted', 'inactive']['exhausted', 'inactive']Passed
5['factory', 'inactive', 'factory', []]['factory', 'inactive', 'factory', [2]]Failed

SHA-256 / bc8b773a48d0facfffdd7be57bc0267a72fe2b159c1f2062b778c4b587034204

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

Case digest / e1f5ad954e8f65906dd785767eedca76611865525bd75927369e5990efc6f73b