FAILURE MAP
← Case archive

FA-30821 / HTTP retries / Open access

Retry hook failure containment: Success before observer violates retry transition semantics · case 01

Success before observer violates retry transition semantics

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

ROOT CAUSE

Success before observer violates retry transition semantics

THE FAILURE

Success before observer violates retry transition semantics

Unsuccessful approach: The attempted repair changes the faulty site to state='failed'; out.append('success') but still violates a regression oracle.

Case contract

begin(cap) starts pending request. fail(eligible,before-hook-ok) calls retry hook only for eligible failures with remaining cap; a failing hook terminally records hook-error without spending retry budget. Otherwise admit consumes one cap and enters waiting. wake starts it. success(observer-ok) stores success before observer invocation; observer failure is diagnostic only and never creates a retry. cancel is terminal. Return lifecycle decisions and remaining cap.

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):
    cap=0; state='idle'; out=[]
    for e in events:
        if e[0]=='begin': cap=e[1]; state='running'
        elif e[0]=='fail':
            if state!='running': out.append('ignored'); continue
            if not e[1]: state='failed'; out.append('fatal'); continue
            if cap==0: state='failed'; out.append('exhausted'); continue
            if not e[2]: state='failed'; out.append('hook-error'); continue
            cap-=1; state='waiting'; out.append('scheduled')
        elif e[0]=='wake':
            if state=='waiting': state='running'; out.append('started')
        elif e[0]=='success':
            if state!='running': out.append('ignored'); continue
            state='running'; out.append('success')
            if not e[1]: out.append('observer-error')
        elif e[0]=='cancel': state='cancelled'
    return [out,cap,state]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,'idle'])
check('1', solve([('begin',2),('fail',True,True),('fail',True,True),('wake',),('success',False),('fail',True,True)]), [['scheduled','ignored','started','success','observer-error','ignored'],1,'done'])
check('2', solve([('begin',N),('fail',True,False),('wake',)]), [['hook-error'],N,'failed'])
check('3', solve([('begin',N),('fail',False,False)]), [['fatal'],N,'failed'])
check('4', solve([('begin',0),('fail',True,False)]), [['exhausted'],0,'failed'])
check('5', solve([('begin',N),('success',True),('success',False)]), [['success','ignored'],N,'done'])
check('6', solve([('begin',N),('fail',True,True),('cancel',),('wake',),('success',False)]), [['scheduled','ignored'],N-1,'cancelled'])
check('7', solve([('begin',N),('fail',False,True)]), [['fatal'],N,'failed'])
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[[], 0, 'idle'][[], 0, 'idle']Passed
1[['scheduled', 'ignored', 'started', 'success', 'observer-error', 'scheduled'], 0, 'waiting'][['scheduled', 'ignored', 'started', 'success', 'observer-error', 'ignored'], 1, 'done']Failed
2[['hook-error'], 1, 'failed'][['hook-error'], 1, 'failed']Passed
3[['fatal'], 1, 'failed'][['fatal'], 1, 'failed']Passed
4[['exhausted'], 0, 'failed'][['exhausted'], 0, 'failed']Passed
5[['success', 'success', 'observer-error'], 1, 'running'][['success', 'ignored'], 1, 'done']Failed
6[['scheduled', 'ignored'], 0, 'cancelled'][['scheduled', 'ignored'], 0, 'cancelled']Passed
7[['fatal'], 1, 'failed'][['fatal'], 1, 'failed']Passed

SHA-256 / c4e46f49cd56932e50b3c03a29ef20eb1a1d10f115b86f89c7d82ed2d588b90e

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(events):
    cap=0; state='idle'; out=[]
    for e in events:
        if e[0]=='begin': cap=e[1]; state='running'
        elif e[0]=='fail':
            if state!='running': out.append('ignored'); continue
            if not e[1]: state='failed'; out.append('fatal'); continue
            if cap==0: state='failed'; out.append('exhausted'); continue
            if not e[2]: state='failed'; out.append('hook-error'); continue
            cap-=1; state='waiting'; out.append('scheduled')
        elif e[0]=='wake':
            if state=='waiting': state='running'; out.append('started')
        elif e[0]=='success':
            if state!='running': out.append('ignored'); continue
            state='failed'; out.append('success')
            if not e[1]: out.append('observer-error')
        elif e[0]=='cancel': state='cancelled'
    return [out,cap,state]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([]), [[],0,'idle'])
check('1', solve([('begin',2),('fail',True,True),('fail',True,True),('wake',),('success',False),('fail',True,True)]), [['scheduled','ignored','started','success','observer-error','ignored'],1,'done'])
check('2', solve([('begin',N),('fail',True,False),('wake',)]), [['hook-error'],N,'failed'])
check('3', solve([('begin',N),('fail',False,False)]), [['fatal'],N,'failed'])
check('4', solve([('begin',0),('fail',True,False)]), [['exhausted'],0,'failed'])
check('5', solve([('begin',N),('success',True),('success',False)]), [['success','ignored'],N,'done'])
check('6', solve([('begin',N),('fail',True,True),('cancel',),('wake',),('success',False)]), [['scheduled','ignored'],N-1,'cancelled'])
check('7', solve([('begin',N),('fail',False,True)]), [['fatal'],N,'failed'])
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[[], 0, 'idle'][[], 0, 'idle']Passed
1[['scheduled', 'ignored', 'started', 'success', 'observer-error', 'ignored'], 1, 'failed'][['scheduled', 'ignored', 'started', 'success', 'observer-error', 'ignored'], 1, 'done']Failed
2[['hook-error'], 1, 'failed'][['hook-error'], 1, 'failed']Passed
3[['fatal'], 1, 'failed'][['fatal'], 1, 'failed']Passed
4[['exhausted'], 0, 'failed'][['exhausted'], 0, 'failed']Passed
5[['success', 'ignored'], 1, 'failed'][['success', 'ignored'], 1, 'done']Failed
6[['scheduled', 'ignored'], 0, 'cancelled'][['scheduled', 'ignored'], 0, 'cancelled']Passed
7[['fatal'], 1, 'failed'][['fatal'], 1, 'failed']Passed

SHA-256 / 6d1924e41f88fbd378612807bec0eca5a04b60ceae5157e7ec90d454148eaa58

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 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:56.511971+00:00.

Case digest / 23757ce6d8b8365e9c77bdc20da6d6cd36be4422f3fa89069b81451134acfd3a