FAILURE MAP
← Case archive

FA-27161 / HTTP ranges / Open access

A multipart sender resumes framing and payload segments across transport credit windows: a partially sent header resumes at its saved intra-header position · case 01

A multipart sender resumes framing and payload segments across transport credit windows: a partially sent header resumes at its saved intra-header position.

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

ROOT CAUSE

The multipart-write-cursor-slice-origin decision uses segments=x['segments'] index=0 offset=0 out=[] for budget in x['budgets']: sent='' while index<len(segments): segment=segments[index] if offset>=len(segment): index+=1 offset=0 continue if budget==0: break amount=min(budget,len(segment)-offset) sent+=segment[:amount] offset+=amount budget-=amount out.append(sent) return [out,index,offset].

THE FAILURE

The multipart-write-cursor-slice-origin decision uses segments=x['segments'] index=0 offset=0 out=[] for budget in x['budgets']: sent='' while index<len(segments): segment=segments[index] if offset>=len(segment): index+=1 offset=0 continue if budget==0: break amount=min(budget,len(segment)-offset) sent+=segment[:amount] offset+=amount budget-=amount out.append(sent) return [out,index,offset].

Unsuccessful approach: The partial repair uses segments=x['segments'] index=0 offset=0 out=[] for budget in x['budgets']: sent='' while index<len(segments): segment=segments[index] if offset>=len(segment): index+=1 offset=0 continue if budget==0: break amount=min(budget,len(segment)-offset) sent+=segment[-amount:] offset+=amount budget-=amount out.append(sent) return [out,index,offset], which still violates the stated contract.

Case contract

x has nonempty ASCII segments representing alternating boundary/header/body/framing bytes, and nonnegative write budgets. Drain in order, consuming each budget across segment boundaries. Return [one emitted string per budget,segment-index,intra-segment-offset]. Empty segments are skipped even with zero budget. A exhausted plan is stable. These preframed segments isolate cursor management from wire-format construction.

Why this case matters

Range responses combine representation identity, conditional requests, framing, and partial-object state.

1 / The failure

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

N = 1
observations = []
def solve(x):
    segments=x['segments']
    index=0
    offset=0
    out=[]
    for budget in x['budgets']:
        sent=''
        while index<len(segments):
            segment=segments[index]
            if offset>=len(segment):
                index+=1
                offset=0
                continue
            if budget==0: break
            amount=min(budget,len(segment)-offset)
            sent+=segment[:amount]
            offset+=amount
            budget-=amount
        out.append(sent)
    return [out,index,offset]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('slice-origin fixture 0', json.loads(json.dumps(solve({'segments':['--b','H','BODY','\r\n'],'budgets':[2,2,3,3]}))), json.loads(json.dumps([['--','bH','BOD','Y\r\n'],4,0])))
check('slice-origin fixture 1', json.loads(json.dumps(solve({'segments':['A','BC'],'budgets':[1,0,1,1,1]}))), json.loads(json.dumps([['A','','B','C',''],2,0])))
check('slice-origin fixture 2', json.loads(json.dumps(solve({'segments':['','A','','BC',''],'budgets':[0,2,1]}))), json.loads(json.dumps([['','AB','C'],5,0])))
check('slice-origin fixture 3', json.loads(json.dumps(solve({'segments':[],'budgets':[0,1]}))), json.loads(json.dumps([['',''],0,0])))
check('slice-origin fixture 4', json.loads(json.dumps(solve({'segments':['ABCDE'],'budgets':[2,1]}))), json.loads(json.dumps([['AB','C'],0,3])))
check('slice-origin fixture 5', json.loads(json.dumps(solve({'segments':["p"*N,'X'],'budgets':[N,1]}))), json.loads(json.dumps([["p"*N,'X'],2,0])))
check('slice-origin fixture 6', json.loads(json.dumps(solve({'segments':['AB','CDE'],'budgets':[4]}))), json.loads(json.dumps([['ABCD'],1,2])))
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
slice-origin fixture 0[['--', '-H', 'BOD', 'B\r\n'], 4, 0][['--', 'bH', 'BOD', 'Y\r\n'], 4, 0]Failed
slice-origin fixture 1[['A', '', 'B', 'B', ''], 2, 0][['A', '', 'B', 'C', ''], 2, 0]Failed
slice-origin fixture 2[['', 'AB', 'B'], 5, 0][['', 'AB', 'C'], 5, 0]Failed
slice-origin fixture 3[['', ''], 0, 0][['', ''], 0, 0]Passed
slice-origin fixture 4[['AB', 'A'], 0, 3][['AB', 'C'], 0, 3]Failed
slice-origin fixture 5[['p', 'X'], 2, 0][['p', 'X'], 2, 0]Passed
slice-origin fixture 6[['ABCD'], 1, 2][['ABCD'], 1, 2]Passed

SHA-256 / d43f335da1dcf554e0d2f8642322f3f8b04571cad051b219ac4d09760bc13bf2

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    segments=x['segments']
    index=0
    offset=0
    out=[]
    for budget in x['budgets']:
        sent=''
        while index<len(segments):
            segment=segments[index]
            if offset>=len(segment):
                index+=1
                offset=0
                continue
            if budget==0: break
            amount=min(budget,len(segment)-offset)
            sent+=segment[-amount:]
            offset+=amount
            budget-=amount
        out.append(sent)
    return [out,index,offset]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('slice-origin fixture 0', json.loads(json.dumps(solve({'segments':['--b','H','BODY','\r\n'],'budgets':[2,2,3,3]}))), json.loads(json.dumps([['--','bH','BOD','Y\r\n'],4,0])))
check('slice-origin fixture 1', json.loads(json.dumps(solve({'segments':['A','BC'],'budgets':[1,0,1,1,1]}))), json.loads(json.dumps([['A','','B','C',''],2,0])))
check('slice-origin fixture 2', json.loads(json.dumps(solve({'segments':['','A','','BC',''],'budgets':[0,2,1]}))), json.loads(json.dumps([['','AB','C'],5,0])))
check('slice-origin fixture 3', json.loads(json.dumps(solve({'segments':[],'budgets':[0,1]}))), json.loads(json.dumps([['',''],0,0])))
check('slice-origin fixture 4', json.loads(json.dumps(solve({'segments':['ABCDE'],'budgets':[2,1]}))), json.loads(json.dumps([['AB','C'],0,3])))
check('slice-origin fixture 5', json.loads(json.dumps(solve({'segments':["p"*N,'X'],'budgets':[N,1]}))), json.loads(json.dumps([["p"*N,'X'],2,0])))
check('slice-origin fixture 6', json.loads(json.dumps(solve({'segments':['AB','CDE'],'budgets':[4]}))), json.loads(json.dumps([['ABCD'],1,2])))
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
slice-origin fixture 0[['-b', 'bH', 'ODY', 'Y\r\n'], 4, 0][['--', 'bH', 'BOD', 'Y\r\n'], 4, 0]Failed
slice-origin fixture 1[['A', '', 'C', 'C', ''], 2, 0][['A', '', 'B', 'C', ''], 2, 0]Failed
slice-origin fixture 2[['', 'AC', 'C'], 5, 0][['', 'AB', 'C'], 5, 0]Failed
slice-origin fixture 3[['', ''], 0, 0][['', ''], 0, 0]Passed
slice-origin fixture 4[['DE', 'E'], 0, 3][['AB', 'C'], 0, 3]Failed
slice-origin fixture 5[['p', 'X'], 2, 0][['p', 'X'], 2, 0]Passed
slice-origin fixture 6[['ABDE'], 1, 2][['ABCD'], 1, 2]Failed

SHA-256 / df182149a801687be9e94a5465987e9715466f48269cde19217eb1868b478114

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

Deterministic simplified range service, with stipulated local policies and already parsed trusted inputs; not a complete HTTP implementation. 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:22.661268+00:00.

Case digest / 342859980d926e1dcf3df3980d4504224454cfa742dc56079c618f6d3082d902