FA-29596 / HTTP retries / Open access
Retry reconciliation with a server receipt: Reusing an idempotency key for changed content replays an unrelated result · case 01
Reusing an idempotency key for changed content replays an unrelated result
ROOT CAUSE
Reusing an idempotency key for changed content replays an unrelated result
VERIFIED REPAIR
Restore the specified transition elif receipts[key][0]!=body:.
Unsuccessful approach: The attempted repair changes the faulty site to elif receipts[key][0]!=body and receipts[key][1]=="pending": but still violates a regression oracle.
Case contract
submit(key,body) returns new for absent key, pending for matching in-flight key, conflict for a changed body, and cached(value) for a completed matching key. commit(key,value) commits only existing pending entries. forget removes a receipt. Return decisions and receipt table.
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):
receipts={}; out=[]
for e in events:
if e[0]=='submit':
key,body=e[1],e[2]
if key not in receipts:
receipts[key]=[body,'pending',None]
out.append('new')
elif False:
out.append('conflict')
elif receipts[key][1]=='pending':
out.append('pending')
else:
out.append(['cached',receipts[key][2]])
elif e[0]=='commit':
if e[1] in receipts and receipts[e[1]][1]=='pending':
receipts[e[1]][1]='done'
receipts[e[1]][2]=e[2]
elif e[0]=='forget':
receipts.pop(e[1],None)
return [out,receipts]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],{}])
check('1', solve([('submit','a',N),('submit','a',N)]), [['new','pending'],{'a':[N,'pending',None]}])
check('2', solve([('submit','a',N),('submit','b',N),('submit','a',N+1)]), [['new','new','conflict'],{'a':[N,'pending',None],'b':[N,'pending',None]}])
check('3', solve([('submit','a',N),('commit','a',N+5),('commit','a',99),('submit','a',N),('submit','a',N+1)]), [['new',['cached',N+5],'conflict'],{'a':[N,'done',N+5]}])
check('4', solve([('commit','absent',N),('forget','absent')]), [[],{}])
check('5', solve([('submit','a',N),('submit','b',N+1),('forget','a'),('submit','a',N+2)]), [['new','new','new'],{'b':[N+1,'pending',None],'a':[N+2,'pending',None]}])
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 | [[], {}] | [[], {}] | Passed |
| 1 | [['new', 'pending'], {'a': [1, 'pending', None]}] | [['new', 'pending'], {'a': [1, 'pending', None]}] | Passed |
| 2 | [['new', 'new', 'pending'], {'a': [1, 'pending', None], 'b': [1, 'pending', None]}] | [['new', 'new', 'conflict'], {'a': [1, 'pending', None], 'b': [1, 'pending', None]}] | Failed |
| 3 | [['new', ['cached', 6], ['cached', 6]], {'a': [1, 'done', 6]}] | [['new', ['cached', 6], 'conflict'], {'a': [1, 'done', 6]}] | Failed |
| 4 | [[], {}] | [[], {}] | Passed |
| 5 | [['new', 'new', 'new'], {'a': [3, 'pending', None], 'b': [2, 'pending', None]}] | [['new', 'new', 'new'], {'a': [3, 'pending', None], 'b': [2, 'pending', None]}] | Passed |
SHA-256 / 754a25b7fd881147161a3f96c10d4f0589817959742b13d9f24df9364e270068
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events):
receipts={}; out=[]
for e in events:
if e[0]=='submit':
key,body=e[1],e[2]
if key not in receipts:
receipts[key]=[body,'pending',None]
out.append('new')
elif receipts[key][0]!=body and receipts[key][1]=="pending":
out.append('conflict')
elif receipts[key][1]=='pending':
out.append('pending')
else:
out.append(['cached',receipts[key][2]])
elif e[0]=='commit':
if e[1] in receipts and receipts[e[1]][1]=='pending':
receipts[e[1]][1]='done'
receipts[e[1]][2]=e[2]
elif e[0]=='forget':
receipts.pop(e[1],None)
return [out,receipts]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],{}])
check('1', solve([('submit','a',N),('submit','a',N)]), [['new','pending'],{'a':[N,'pending',None]}])
check('2', solve([('submit','a',N),('submit','b',N),('submit','a',N+1)]), [['new','new','conflict'],{'a':[N,'pending',None],'b':[N,'pending',None]}])
check('3', solve([('submit','a',N),('commit','a',N+5),('commit','a',99),('submit','a',N),('submit','a',N+1)]), [['new',['cached',N+5],'conflict'],{'a':[N,'done',N+5]}])
check('4', solve([('commit','absent',N),('forget','absent')]), [[],{}])
check('5', solve([('submit','a',N),('submit','b',N+1),('forget','a'),('submit','a',N+2)]), [['new','new','new'],{'b':[N+1,'pending',None],'a':[N+2,'pending',None]}])
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 | [[], {}] | [[], {}] | Passed |
| 1 | [['new', 'pending'], {'a': [1, 'pending', None]}] | [['new', 'pending'], {'a': [1, 'pending', None]}] | Passed |
| 2 | [['new', 'new', 'conflict'], {'a': [1, 'pending', None], 'b': [1, 'pending', None]}] | [['new', 'new', 'conflict'], {'a': [1, 'pending', None], 'b': [1, 'pending', None]}] | Passed |
| 3 | [['new', ['cached', 6], ['cached', 6]], {'a': [1, 'done', 6]}] | [['new', ['cached', 6], 'conflict'], {'a': [1, 'done', 6]}] | Failed |
| 4 | [[], {}] | [[], {}] | Passed |
| 5 | [['new', 'new', 'new'], {'a': [3, 'pending', None], 'b': [2, 'pending', None]}] | [['new', 'new', 'new'], {'a': [3, 'pending', None], 'b': [2, 'pending', None]}] | Passed |
SHA-256 / 48abc3b86e4a73688c3a2d667851dd465ef691d9adf4439c51f4b89f2da48bf6
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events):
receipts={}; out=[]
for e in events:
if e[0]=='submit':
key,body=e[1],e[2]
if key not in receipts:
receipts[key]=[body,'pending',None]
out.append('new')
elif receipts[key][0]!=body:
out.append('conflict')
elif receipts[key][1]=='pending':
out.append('pending')
else:
out.append(['cached',receipts[key][2]])
elif e[0]=='commit':
if e[1] in receipts and receipts[e[1]][1]=='pending':
receipts[e[1]][1]='done'
receipts[e[1]][2]=e[2]
elif e[0]=='forget':
receipts.pop(e[1],None)
return [out,receipts]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],{}])
check('1', solve([('submit','a',N),('submit','a',N)]), [['new','pending'],{'a':[N,'pending',None]}])
check('2', solve([('submit','a',N),('submit','b',N),('submit','a',N+1)]), [['new','new','conflict'],{'a':[N,'pending',None],'b':[N,'pending',None]}])
check('3', solve([('submit','a',N),('commit','a',N+5),('commit','a',99),('submit','a',N),('submit','a',N+1)]), [['new',['cached',N+5],'conflict'],{'a':[N,'done',N+5]}])
check('4', solve([('commit','absent',N),('forget','absent')]), [[],{}])
check('5', solve([('submit','a',N),('submit','b',N+1),('forget','a'),('submit','a',N+2)]), [['new','new','new'],{'b':[N+1,'pending',None],'a':[N+2,'pending',None]}])
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 | [[], {}] | [[], {}] | Passed |
| 1 | [['new', 'pending'], {'a': [1, 'pending', None]}] | [['new', 'pending'], {'a': [1, 'pending', None]}] | Passed |
| 2 | [['new', 'new', 'conflict'], {'a': [1, 'pending', None], 'b': [1, 'pending', None]}] | [['new', 'new', 'conflict'], {'a': [1, 'pending', None], 'b': [1, 'pending', None]}] | Passed |
| 3 | [['new', ['cached', 6], 'conflict'], {'a': [1, 'done', 6]}] | [['new', ['cached', 6], 'conflict'], {'a': [1, 'done', 6]}] | Passed |
| 4 | [[], {}] | [[], {}] | Passed |
| 5 | [['new', 'new', 'new'], {'a': [3, 'pending', None], 'b': [2, 'pending', None]}] | [['new', 'new', 'new'], {'a': [3, 'pending', None], 'b': [2, 'pending', None]}] | Passed |
SHA-256 / d954eef688bc7ddbed441b3968ffe7e8f2aca46edfd6335bbe8676104a62e2cb
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:44.786360+00:00.
Case digest / 2bdb7f13272ca9c69a6ca3745cb707498aeab2818fa135b18c54db7381f4bf09