FA-30071 / HTTP retries / Open access
File-backed request replay integrity: Read bound violates retry transition semantics · case 01
Read bound violates retry transition semantics
ROOT CAUSE
Read bound violates retry transition semantics
VERIFIED REPAIR
Restore the specified transition min(e[1],max(0,snapshot[1]-cursor)).
Unsuccessful approach: The attempted repair changes the faulty site to min(e[1],snapshot[1]) but still violates a regression oracle.
Case contract
open(file identity,size,mtime,offset) snapshots file metadata and starting byte. inspect(current identity,size,mtime) records current metadata. read(count) advances bounded cursor only while valid. retry compares all snapshot metadata before rewinding; any mismatch permanently invalidates this body. close invalidates. New open resets validity. Return read byte counts and retry dispositions.
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):
snapshot=None; current=None; origin=0; cursor=0; valid=False; out=[]
for e in events:
if e[0]=='open':
snapshot=tuple(e[1:4]); current=snapshot
origin=e[4]; cursor=origin
valid=True
elif e[0]=='inspect': current=tuple(e[1:4])
elif e[0]=='close': valid=False
elif e[0]=='read':
if not valid: out.append('invalid'); continue
amount=e[1]
cursor+=amount
out.append(amount)
elif e[0]=='retry':
if not valid: out.append('invalid'); continue
if current!=snapshot:
valid=False; out.append('changed'); continue
cursor=origin
out.append('rewound')
return [out,cursor]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0])
check('1', solve([('open','a',N+5,1,2),('read',2),('read',N+9),('read',1),('retry',),('read',1)]), [[2,N+1,0,'rewound',1],3])
check('2', solve([('open','a',5,1,0),('inspect','b',5,1),('retry',),('read',1)]), [['changed','invalid'],0])
check('3', solve([('open','a',5,1,0),('inspect','a',6,1),('retry',),('retry',)]), [['changed','invalid'],0])
check('4', solve([('open','a',5,1,0),('inspect','a',5,2),('retry',),('inspect','a',5,1),('retry',)]), [['changed','invalid'],0])
check('5', solve([('open','a',0,1,0),('read',1),('retry',),('close',),('read',1),('retry',)]), [[0,'rewound','invalid','invalid'],0])
check('6', solve([('open','a',N+3,1,1),('close',),('open','b',2,2,1),('read',1)]), [[1],2])
check('7', solve([('open','a',N+3,1,1),('inspect','a',N+3,1),('retry',),('close',),('read',1),('retry',)]), [['rewound','invalid','invalid'],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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 0 | [[], 0] | [[], 0] | Passed |
| 1 | [[2, 10, 1, 'rewound', 1], 3] | [[2, 2, 0, 'rewound', 1], 3] | Failed |
| 2 | [['changed', 'invalid'], 0] | [['changed', 'invalid'], 0] | Passed |
| 3 | [['changed', 'invalid'], 0] | [['changed', 'invalid'], 0] | Passed |
| 4 | [['changed', 'invalid'], 0] | [['changed', 'invalid'], 0] | Passed |
| 5 | [[1, 'rewound', 'invalid', 'invalid'], 0] | [[0, 'rewound', 'invalid', 'invalid'], 0] | Failed |
| 6 | [[1], 2] | [[1], 2] | Passed |
| 7 | [['rewound', 'invalid', 'invalid'], 1] | [['rewound', 'invalid', 'invalid'], 1] | Passed |
SHA-256 / 1c470cfcdfe536e77d3291975c2c3e7dc948b26641f9d6d69df8113b15d40b5e
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events):
snapshot=None; current=None; origin=0; cursor=0; valid=False; out=[]
for e in events:
if e[0]=='open':
snapshot=tuple(e[1:4]); current=snapshot
origin=e[4]; cursor=origin
valid=True
elif e[0]=='inspect': current=tuple(e[1:4])
elif e[0]=='close': valid=False
elif e[0]=='read':
if not valid: out.append('invalid'); continue
amount=min(e[1],snapshot[1])
cursor+=amount
out.append(amount)
elif e[0]=='retry':
if not valid: out.append('invalid'); continue
if current!=snapshot:
valid=False; out.append('changed'); continue
cursor=origin
out.append('rewound')
return [out,cursor]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0])
check('1', solve([('open','a',N+5,1,2),('read',2),('read',N+9),('read',1),('retry',),('read',1)]), [[2,N+1,0,'rewound',1],3])
check('2', solve([('open','a',5,1,0),('inspect','b',5,1),('retry',),('read',1)]), [['changed','invalid'],0])
check('3', solve([('open','a',5,1,0),('inspect','a',6,1),('retry',),('retry',)]), [['changed','invalid'],0])
check('4', solve([('open','a',5,1,0),('inspect','a',5,2),('retry',),('inspect','a',5,1),('retry',)]), [['changed','invalid'],0])
check('5', solve([('open','a',0,1,0),('read',1),('retry',),('close',),('read',1),('retry',)]), [[0,'rewound','invalid','invalid'],0])
check('6', solve([('open','a',N+3,1,1),('close',),('open','b',2,2,1),('read',1)]), [[1],2])
check('7', solve([('open','a',N+3,1,1),('inspect','a',N+3,1),('retry',),('close',),('read',1),('retry',)]), [['rewound','invalid','invalid'],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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 0 | [[], 0] | [[], 0] | Passed |
| 1 | [[2, 6, 1, 'rewound', 1], 3] | [[2, 2, 0, 'rewound', 1], 3] | Failed |
| 2 | [['changed', 'invalid'], 0] | [['changed', 'invalid'], 0] | Passed |
| 3 | [['changed', 'invalid'], 0] | [['changed', 'invalid'], 0] | Passed |
| 4 | [['changed', 'invalid'], 0] | [['changed', 'invalid'], 0] | Passed |
| 5 | [[0, 'rewound', 'invalid', 'invalid'], 0] | [[0, 'rewound', 'invalid', 'invalid'], 0] | Passed |
| 6 | [[1], 2] | [[1], 2] | Passed |
| 7 | [['rewound', 'invalid', 'invalid'], 1] | [['rewound', 'invalid', 'invalid'], 1] | Passed |
SHA-256 / fc890dc92898c29508d0d59a98aeb91d3eccc4ecbb828ee258ae06ac450c4d21
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events):
snapshot=None; current=None; origin=0; cursor=0; valid=False; out=[]
for e in events:
if e[0]=='open':
snapshot=tuple(e[1:4]); current=snapshot
origin=e[4]; cursor=origin
valid=True
elif e[0]=='inspect': current=tuple(e[1:4])
elif e[0]=='close': valid=False
elif e[0]=='read':
if not valid: out.append('invalid'); continue
amount=min(e[1],max(0,snapshot[1]-cursor))
cursor+=amount
out.append(amount)
elif e[0]=='retry':
if not valid: out.append('invalid'); continue
if current!=snapshot:
valid=False; out.append('changed'); continue
cursor=origin
out.append('rewound')
return [out,cursor]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0])
check('1', solve([('open','a',N+5,1,2),('read',2),('read',N+9),('read',1),('retry',),('read',1)]), [[2,N+1,0,'rewound',1],3])
check('2', solve([('open','a',5,1,0),('inspect','b',5,1),('retry',),('read',1)]), [['changed','invalid'],0])
check('3', solve([('open','a',5,1,0),('inspect','a',6,1),('retry',),('retry',)]), [['changed','invalid'],0])
check('4', solve([('open','a',5,1,0),('inspect','a',5,2),('retry',),('inspect','a',5,1),('retry',)]), [['changed','invalid'],0])
check('5', solve([('open','a',0,1,0),('read',1),('retry',),('close',),('read',1),('retry',)]), [[0,'rewound','invalid','invalid'],0])
check('6', solve([('open','a',N+3,1,1),('close',),('open','b',2,2,1),('read',1)]), [[1],2])
check('7', solve([('open','a',N+3,1,1),('inspect','a',N+3,1),('retry',),('close',),('read',1),('retry',)]), [['rewound','invalid','invalid'],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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 0 | [[], 0] | [[], 0] | Passed |
| 1 | [[2, 2, 0, 'rewound', 1], 3] | [[2, 2, 0, 'rewound', 1], 3] | Passed |
| 2 | [['changed', 'invalid'], 0] | [['changed', 'invalid'], 0] | Passed |
| 3 | [['changed', 'invalid'], 0] | [['changed', 'invalid'], 0] | Passed |
| 4 | [['changed', 'invalid'], 0] | [['changed', 'invalid'], 0] | Passed |
| 5 | [[0, 'rewound', 'invalid', 'invalid'], 0] | [[0, 'rewound', 'invalid', 'invalid'], 0] | Passed |
| 6 | [[1], 2] | [[1], 2] | Passed |
| 7 | [['rewound', 'invalid', 'invalid'], 1] | [['rewound', 'invalid', 'invalid'], 1] | Passed |
SHA-256 / dfb4b951db5e073350bfb8a305973ea669079245a6119c1a30c4f3597818385d
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:49.271303+00:00.
Case digest / e714b6c95448c2351a9c3f7c4e4080b22cd7977d7ddab7c8d2cd010142014977