FAILURE MAP
← Case archive

FA-30541 / HTTP retries / Open access

Bounded body spooling for replay: Capture gate violates retry transition semantics · case 01

Capture gate violates retry transition semantics

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

ROOT CAUSE

Capture gate violates retry transition semantics

THE FAILURE

Capture gate violates retry transition semantics

Unsuccessful approach: The attempted repair changes the faulty site to if state=='overflow': continue but still violates a regression oracle.

Case contract

open(memory threshold,total limit) begins capturing byte-list chunks. append stores an entire chunk only if total limit permits; crossing memory threshold spills all prior memory and new chunk to modeled disk. fail_disk invalidates captured body. seal finalizes; replay returns captured bytes only when sealed and valid. Overflow is terminal until next open. Return replay decisions and storage mode.

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):
    threshold=0; limit=0; memory=[]; disk=[]; size=0; mode='memory'; state='idle'; out=[]
    for e in events:
        if e[0]=='open':
            threshold=e[1]; limit=e[2]; memory=[]; disk=[]; size=0; mode='memory'; state='capturing'
        elif e[0]=='append':
            if state=='idle': continue
            chunk=list(e[1])
            if size+len(chunk)>limit:
                state='overflow'; memory=[]; disk=[]; continue
            if mode=='memory' and size+len(chunk)>threshold:
                disk=list(memory); memory=[]; mode='disk'
            if mode=='disk': disk.extend(chunk)
            else: memory.extend(chunk)
            size+=len(chunk)
        elif e[0]=='seal':
            if state=='capturing': state='sealed'
        elif e[0]=='fail_disk':
            if mode=='disk': state='io-error'; memory=[]; disk=[]
        elif e[0]=='replay':
            if state!='sealed': out.append(state); continue
            out.append(list(disk if mode=='disk' else memory))
    return [out,mode]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],'memory'])
check('1', solve([('open',3,8),('append',[N,N+1]),('append',[N+2]),('seal',),('replay',)]), [[[N,N+1,N+2]],'memory'])
check('2', solve([('open',2,8),('append',[N,N+1]),('append',[N+2,N+3]),('append',[N+4]),('seal',),('replay',)]), [[[N,N+1,N+2,N+3,N+4]],'disk'])
check('3', solve([('open',2,3),('append',[N,N+1]),('append',[N+2]),('append',[N+3]),('seal',),('replay',)]), [['overflow'],'disk'])
check('4', solve([('open',0,4),('append',[N]),('fail_disk',),('seal',),('replay',),('open',4,4),('append',[N+1]),('seal',),('replay',)]), [['io-error',[N+1]],'memory'])
check('5', solve([('open',2,2),('append',[N]),('replay',),('seal',),('append',[N+1]),('replay',)]), [['capturing',[N]],'memory'])
check('6', solve([('open',0,0),('append',[]),('seal',),('replay',)]), [[[]],'memory'])
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[[], 'memory'][[], 'memory']Passed
1[[[1, 2, 3]], 'memory'][[[1, 2, 3]], 'memory']Passed
2[[[1, 2, 3, 4, 5]], 'disk'][[[1, 2, 3, 4, 5]], 'disk']Passed
3[['overflow'], 'disk'][['overflow'], 'disk']Passed
4[['io-error', [2]], 'memory'][['io-error', [2]], 'memory']Passed
5[['capturing', [1, 2]], 'memory'][['capturing', [1]], 'memory']Failed
6[[[]], 'memory'][[[]], 'memory']Passed

SHA-256 / 93bec6409e4c1ec36ebb72bff1bb923e21b2963307579a6d1bf23fecaf402ade

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(events):
    threshold=0; limit=0; memory=[]; disk=[]; size=0; mode='memory'; state='idle'; out=[]
    for e in events:
        if e[0]=='open':
            threshold=e[1]; limit=e[2]; memory=[]; disk=[]; size=0; mode='memory'; state='capturing'
        elif e[0]=='append':
            if state=='overflow': continue
            chunk=list(e[1])
            if size+len(chunk)>limit:
                state='overflow'; memory=[]; disk=[]; continue
            if mode=='memory' and size+len(chunk)>threshold:
                disk=list(memory); memory=[]; mode='disk'
            if mode=='disk': disk.extend(chunk)
            else: memory.extend(chunk)
            size+=len(chunk)
        elif e[0]=='seal':
            if state=='capturing': state='sealed'
        elif e[0]=='fail_disk':
            if mode=='disk': state='io-error'; memory=[]; disk=[]
        elif e[0]=='replay':
            if state!='sealed': out.append(state); continue
            out.append(list(disk if mode=='disk' else memory))
    return [out,mode]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],'memory'])
check('1', solve([('open',3,8),('append',[N,N+1]),('append',[N+2]),('seal',),('replay',)]), [[[N,N+1,N+2]],'memory'])
check('2', solve([('open',2,8),('append',[N,N+1]),('append',[N+2,N+3]),('append',[N+4]),('seal',),('replay',)]), [[[N,N+1,N+2,N+3,N+4]],'disk'])
check('3', solve([('open',2,3),('append',[N,N+1]),('append',[N+2]),('append',[N+3]),('seal',),('replay',)]), [['overflow'],'disk'])
check('4', solve([('open',0,4),('append',[N]),('fail_disk',),('seal',),('replay',),('open',4,4),('append',[N+1]),('seal',),('replay',)]), [['io-error',[N+1]],'memory'])
check('5', solve([('open',2,2),('append',[N]),('replay',),('seal',),('append',[N+1]),('replay',)]), [['capturing',[N]],'memory'])
check('6', solve([('open',0,0),('append',[]),('seal',),('replay',)]), [[[]],'memory'])
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[[], 'memory'][[], 'memory']Passed
1[[[1, 2, 3]], 'memory'][[[1, 2, 3]], 'memory']Passed
2[[[1, 2, 3, 4, 5]], 'disk'][[[1, 2, 3, 4, 5]], 'disk']Passed
3[['overflow'], 'disk'][['overflow'], 'disk']Passed
4[['io-error', [2]], 'memory'][['io-error', [2]], 'memory']Passed
5[['capturing', [1, 2]], 'memory'][['capturing', [1]], 'memory']Failed
6[[[]], 'memory'][[[]], 'memory']Passed

SHA-256 / bdb9aa490c233e2b0f89d6bc478f7823e0dd364e86becb6a3b16960101386405

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

Case digest / fa53309af68dccb4657be4a855e807cef5399a931335b0aeebcd880d21ed2255