FA-30591 / HTTP retries / Open access
Bounded body spooling for replay: Disk failure violates retry transition semantics · case 01
Disk failure violates retry transition semantics
ROOT CAUSE
Disk failure violates retry transition semantics
VERIFIED REPAIR
Restore the specified transition if mode=='disk': state='io-error'; memory=[]; disk=[].
Unsuccessful approach: The attempted repair changes the faulty site to if mode=='disk': state='capturing'; memory=[]; disk=[] 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!='capturing': 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='sealed'; 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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 | [[[], [2]], 'memory'] | [['io-error', [2]], 'memory'] | Failed |
| 5 | [['capturing', [1]], 'memory'] | [['capturing', [1]], 'memory'] | Passed |
| 6 | [[[]], 'memory'] | [[[]], 'memory'] | Passed |
SHA-256 / 99403766f14ca59682a8bd3c2222aa7570ed52dce8316f4fdb98ec3e0e10088c
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!='capturing': 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='capturing'; 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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 | [[[], [2]], 'memory'] | [['io-error', [2]], 'memory'] | Failed |
| 5 | [['capturing', [1]], 'memory'] | [['capturing', [1]], 'memory'] | Passed |
| 6 | [[[]], 'memory'] | [[[]], 'memory'] | Passed |
SHA-256 / 8535bb49c997dda07c11522e61fc35a70ecfdd9577f6b38fa5a1490719bf07fb
3 / The verified repair
Exit 0"""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!='capturing': 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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]], 'memory'] | [['capturing', [1]], 'memory'] | Passed |
| 6 | [[[]], 'memory'] | [[[]], 'memory'] | Passed |
SHA-256 / 3d1804eb8df0a19e00936722d7d55e99e0d04122b7e9e2e9505ea59b66387cb9
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.320028+00:00.
Case digest / 2745297315950a81b7204ceb5c52ef3f6e9f54a4cf33e53bc0e449676d92facc