FAILURE MAP
← Case archive

FA-27156 / HTTP ranges / Open access

A multipart sender resumes framing and payload segments across transport credit windows: drain size considers the remaining suffix instead of whole segment length · case 01

A multipart sender resumes framing and payload segments across transport credit windows: drain size considers the remaining suffix instead of whole segment length.

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

ROOT CAUSE

The multipart-write-cursor-remaining-segment 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)) amount=min(amount,len(segment)-offset) if offset==0 else min(amount,len(segment)-offset+1) sent+=segment[offset:offset+amount] offset+=amount budget-=amount out.append(sent) return [out,index,offset].

THE FAILURE

The multipart-write-cursor-remaining-segment 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)) amount=min(amount,len(segment)-offset) if offset==0 else min(amount,len(segment)-offset+1) sent+=segment[offset:offset+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,max(0,len(segment)-offset-1)) if amount==0: break sent+=segment[offset:offset+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))
            amount=min(amount,len(segment)-offset) if offset==0 else min(amount,len(segment)-offset+1)
            sent+=segment[offset:offset+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('remaining-segment 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('remaining-segment 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('remaining-segment fixture 2', json.loads(json.dumps(solve({'segments':['','A','','BC',''],'budgets':[0,2,1]}))), json.loads(json.dumps([['','AB','C'],5,0])))
check('remaining-segment fixture 3', json.loads(json.dumps(solve({'segments':[],'budgets':[0,1]}))), json.loads(json.dumps([['',''],0,0])))
check('remaining-segment fixture 4', json.loads(json.dumps(solve({'segments':['ABCDE'],'budgets':[2,1]}))), json.loads(json.dumps([['AB','C'],0,3])))
check('remaining-segment fixture 5', json.loads(json.dumps(solve({'segments':["p"*N,'X'],'budgets':[N,1]}))), json.loads(json.dumps([["p"*N,'X'],2,0])))
check('remaining-segment 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
remaining-segment fixture 0[['--', 'b', 'HBO', 'DY'], 3, 0][['--', 'bH', 'BOD', 'Y\r\n'], 4, 0]Failed
remaining-segment fixture 1[['A', '', 'B', 'C', ''], 2, 0][['A', '', 'B', 'C', ''], 2, 0]Passed
remaining-segment fixture 2[['', 'AB', 'C'], 5, 0][['', 'AB', 'C'], 5, 0]Passed
remaining-segment fixture 3[['', ''], 0, 0][['', ''], 0, 0]Passed
remaining-segment fixture 4[['AB', 'C'], 0, 3][['AB', 'C'], 0, 3]Passed
remaining-segment fixture 5[['p', 'X'], 2, 0][['p', 'X'], 2, 0]Passed
remaining-segment fixture 6[['ABCD'], 1, 2][['ABCD'], 1, 2]Passed

SHA-256 / affd300e99d51a430b8b1611446e44b0d381af9eb2855debefb65f328a675cac

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,max(0,len(segment)-offset-1))
            if amount==0: break
            sent+=segment[offset:offset+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('remaining-segment 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('remaining-segment 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('remaining-segment fixture 2', json.loads(json.dumps(solve({'segments':['','A','','BC',''],'budgets':[0,2,1]}))), json.loads(json.dumps([['','AB','C'],5,0])))
check('remaining-segment fixture 3', json.loads(json.dumps(solve({'segments':[],'budgets':[0,1]}))), json.loads(json.dumps([['',''],0,0])))
check('remaining-segment fixture 4', json.loads(json.dumps(solve({'segments':['ABCDE'],'budgets':[2,1]}))), json.loads(json.dumps([['AB','C'],0,3])))
check('remaining-segment fixture 5', json.loads(json.dumps(solve({'segments':["p"*N,'X'],'budgets':[N,1]}))), json.loads(json.dumps([["p"*N,'X'],2,0])))
check('remaining-segment 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
remaining-segment fixture 0[['--', '', '', ''], 0, 2][['--', 'bH', 'BOD', 'Y\r\n'], 4, 0]Failed
remaining-segment fixture 1[['', '', '', '', ''], 0, 0][['A', '', 'B', 'C', ''], 2, 0]Failed
remaining-segment fixture 2[['', '', ''], 1, 0][['', 'AB', 'C'], 5, 0]Failed
remaining-segment fixture 3[['', ''], 0, 0][['', ''], 0, 0]Passed
remaining-segment fixture 4[['AB', 'C'], 0, 3][['AB', 'C'], 0, 3]Passed
remaining-segment fixture 5[['', ''], 0, 0][['p', 'X'], 2, 0]Failed
remaining-segment fixture 6[['A'], 0, 1][['ABCD'], 1, 2]Failed

SHA-256 / 88a7ed27810e6c49a5e43521313b51d11e4bade7458f5cd5510d9c524668242c

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.654547+00:00.

Case digest / 41640588171731ec9da3d358d0ab5d5e11e4329e3fc8d92b9ccf5613aeedc80b