FA-27151 / HTTP ranges / Open access
A multipart sender resumes framing and payload segments across transport credit windows: zero transport credit cannot emit a pending delimiter byte · case 01
A multipart sender resumes framing and payload segments across transport credit windows: zero transport credit cannot emit a pending delimiter byte.
ROOT CAUSE
The multipart-write-cursor-zero-credit 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: budget=1 amount=min(budget,len(segment)-offset) sent+=segment[offset:offset+amount] offset+=amount budget-=amount out.append(sent) return [out,index,offset].
VERIFIED REPAIR
Apply the bounded decision exactly: 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[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 and sent: break if budget==0: budget=1 amount=min(budget,len(segment)-offset) 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: budget=1
amount=min(budget,len(segment)-offset)
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('zero-credit 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('zero-credit 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('zero-credit fixture 2', json.loads(json.dumps(solve({'segments':['','A','','BC',''],'budgets':[0,2,1]}))), json.loads(json.dumps([['','AB','C'],5,0])))
check('zero-credit fixture 3', json.loads(json.dumps(solve({'segments':[],'budgets':[0,1]}))), json.loads(json.dumps([['',''],0,0])))
check('zero-credit fixture 4', json.loads(json.dumps(solve({'segments':['ABCDE'],'budgets':[2,1]}))), json.loads(json.dumps([['AB','C'],0,3])))
check('zero-credit fixture 5', json.loads(json.dumps(solve({'segments':["p"*N,'X'],'budgets':[N,1]}))), json.loads(json.dumps([["p"*N,'X'],2,0])))
check('zero-credit 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| zero-credit fixture 0 | [['--bHBODY\r\n', '', '', ''], 4, 0] | [['--', 'bH', 'BOD', 'Y\r\n'], 4, 0] | Failed |
| zero-credit fixture 1 | [['ABC', '', '', '', ''], 2, 0] | [['A', '', 'B', 'C', ''], 2, 0] | Failed |
| zero-credit fixture 2 | [['ABC', '', ''], 5, 0] | [['', 'AB', 'C'], 5, 0] | Failed |
| zero-credit fixture 3 | [['', ''], 0, 0] | [['', ''], 0, 0] | Passed |
| zero-credit fixture 4 | [['ABCDE', ''], 1, 0] | [['AB', 'C'], 0, 3] | Failed |
| zero-credit fixture 5 | [['pX', ''], 2, 0] | [['p', 'X'], 2, 0] | Failed |
| zero-credit fixture 6 | [['ABCDE'], 2, 0] | [['ABCD'], 1, 2] | Failed |
SHA-256 / 3f9cb56746e2c652084b87cb854fb5b95c49e40a72b9f0610d3982204172feb6
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 and sent: break
if budget==0: budget=1
amount=min(budget,len(segment)-offset)
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('zero-credit 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('zero-credit 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('zero-credit fixture 2', json.loads(json.dumps(solve({'segments':['','A','','BC',''],'budgets':[0,2,1]}))), json.loads(json.dumps([['','AB','C'],5,0])))
check('zero-credit fixture 3', json.loads(json.dumps(solve({'segments':[],'budgets':[0,1]}))), json.loads(json.dumps([['',''],0,0])))
check('zero-credit fixture 4', json.loads(json.dumps(solve({'segments':['ABCDE'],'budgets':[2,1]}))), json.loads(json.dumps([['AB','C'],0,3])))
check('zero-credit fixture 5', json.loads(json.dumps(solve({'segments':["p"*N,'X'],'budgets':[N,1]}))), json.loads(json.dumps([["p"*N,'X'],2,0])))
check('zero-credit 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| zero-credit fixture 0 | [['--', 'bH', 'BOD', 'Y\r\n'], 4, 0] | [['--', 'bH', 'BOD', 'Y\r\n'], 4, 0] | Passed |
| zero-credit fixture 1 | [['A', 'B', 'C', '', ''], 2, 0] | [['A', '', 'B', 'C', ''], 2, 0] | Failed |
| zero-credit fixture 2 | [['A', 'BC', ''], 5, 0] | [['', 'AB', 'C'], 5, 0] | Failed |
| zero-credit fixture 3 | [['', ''], 0, 0] | [['', ''], 0, 0] | Passed |
| zero-credit fixture 4 | [['AB', 'C'], 0, 3] | [['AB', 'C'], 0, 3] | Passed |
| zero-credit fixture 5 | [['p', 'X'], 2, 0] | [['p', 'X'], 2, 0] | Passed |
| zero-credit fixture 6 | [['ABCD'], 1, 2] | [['ABCD'], 1, 2] | Passed |
SHA-256 / 1edbfc53a24625e312483c83ce9307477447156c1773085b5557c9f4e6acc2ae
3 / The verified repair
Exit 0"""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[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('zero-credit 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('zero-credit 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('zero-credit fixture 2', json.loads(json.dumps(solve({'segments':['','A','','BC',''],'budgets':[0,2,1]}))), json.loads(json.dumps([['','AB','C'],5,0])))
check('zero-credit fixture 3', json.loads(json.dumps(solve({'segments':[],'budgets':[0,1]}))), json.loads(json.dumps([['',''],0,0])))
check('zero-credit fixture 4', json.loads(json.dumps(solve({'segments':['ABCDE'],'budgets':[2,1]}))), json.loads(json.dumps([['AB','C'],0,3])))
check('zero-credit fixture 5', json.loads(json.dumps(solve({'segments':["p"*N,'X'],'budgets':[N,1]}))), json.loads(json.dumps([["p"*N,'X'],2,0])))
check('zero-credit 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| zero-credit fixture 0 | [['--', 'bH', 'BOD', 'Y\r\n'], 4, 0] | [['--', 'bH', 'BOD', 'Y\r\n'], 4, 0] | Passed |
| zero-credit fixture 1 | [['A', '', 'B', 'C', ''], 2, 0] | [['A', '', 'B', 'C', ''], 2, 0] | Passed |
| zero-credit fixture 2 | [['', 'AB', 'C'], 5, 0] | [['', 'AB', 'C'], 5, 0] | Passed |
| zero-credit fixture 3 | [['', ''], 0, 0] | [['', ''], 0, 0] | Passed |
| zero-credit fixture 4 | [['AB', 'C'], 0, 3] | [['AB', 'C'], 0, 3] | Passed |
| zero-credit fixture 5 | [['p', 'X'], 2, 0] | [['p', 'X'], 2, 0] | Passed |
| zero-credit fixture 6 | [['ABCD'], 1, 2] | [['ABCD'], 1, 2] | Passed |
SHA-256 / 6d0021779c7db0de4e3403b26ccd4a46981dc5ecf7f7f8e92567a310064ea542
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.616766+00:00.
Case digest / 2f859c4614ef5f38534dc6f6292ace2cf8f740dd8fe3ae16287798c206f622c3