FAILURE MAP
← Case archive

FA-27441 / HTTP ranges / Open access

A row-range endpoint builds byte-addressable line record metadata: the first record starts after the representation BOM bytes · case 01

A row-range endpoint builds byte-addressable line record metadata: the first record starts after the representation BOM bytes.

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

ROOT CAUSE

The record-range-byte-index-bom-position decision uses data=x['text'].encode('utf-8') pos=0 entries=[] bodies=[] while pos<len(data): end=data.find(b'\n',pos) final=end<0 end=len(data) if final else end content_end=end-1 if not final and end>pos and data[end-1]==13 else end terminator=0 if final else end-content_end+1 body=data[pos:content_end] if body: if len(body)>x['cap']: return None entries.append([pos,len(body),terminator]) bodies.append(body.hex()) pos=len(data) if final else end+1 if any(i<0 or i>=len(bodies) for i in x['select']): return None return [entries,[bodies[i] for i in x['select']]].

VERIFIED REPAIR

Apply the bounded decision exactly: data=x['text'].encode('utf-8') pos=3 if data.startswith(b'\xef\xbb\xbf') else 0 entries=[] bodies=[] while pos<len(data): end=data.find(b'\n',pos) final=end<0 end=len(data) if final else end content_end=end-1 if not final and end>pos and data[end-1]==13 else end terminator=0 if final else end-content_end+1 body=data[pos:content_end] if body: if len(body)>x['cap']: return None entries.append([pos,len(body),terminator]) bodies.append(body.hex()) pos=len(data) if final else end+1 if any(i<0 or i>=len(bodies) for i in x['select']): return None return [entries,[bodies[i] for i in x['select']]]

Unsuccessful approach: The partial repair uses data=x['text'].encode('utf-8') pos=1 if data.startswith(b'\xef\xbb\xbf') else 0 entries=[] bodies=[] while pos<len(data): end=data.find(b'\n',pos) final=end<0 end=len(data) if final else end content_end=end-1 if not final and end>pos and data[end-1]==13 else end terminator=0 if final else end-content_end+1 body=data[pos:content_end] if body: if len(body)>x['cap']: return None entries.append([pos,len(body),terminator]) bodies.append(body.hex()) pos=len(data) if final else end+1 if any(i<0 or i>=len(bodies) for i in x['select']): return None return [entries,[bodies[i] for i in x['select']]], which still violates the stated contract.

Case contract

Build a bounded row index over UTF-8 text. A leading UTF-8 BOM is excluded from records but occupies3 representation bytes. LF or CRLF terminates a row; blank rows are ignored. A final unterminated nonempty row is included. Return [entries,selected-hex-bodies], with each entry [absolute-byte-start,content-byte-count,terminator-byte-count]. Enforce a per-record byte cap and nonnegative selected row indices. Selection order and multiplicity are meaningful.

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):
    data=x['text'].encode('utf-8')
    pos=0
    entries=[]
    bodies=[]
    while pos<len(data):
        end=data.find(b'\n',pos)
        final=end<0
        end=len(data) if final else end
        content_end=end-1 if not final and end>pos and data[end-1]==13 else end
        terminator=0 if final else end-content_end+1
        body=data[pos:content_end]
        if body:
            if len(body)>x['cap']: return None
            entries.append([pos,len(body),terminator])
            bodies.append(body.hex())
        pos=len(data) if final else end+1
    if any(i<0 or i>=len(bodies) for i in x['select']): return None
    return [entries,[bodies[i] for i in x['select']]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bom-position fixture 0', json.loads(json.dumps(solve({'text':'a\r\nb\n\ncd','cap':5,'select':[2,0,2]}))), json.loads(json.dumps([[[0,1,2],[3,1,1],[6,2,0]],['6364','61','6364']])))
check('bom-position fixture 1', json.loads(json.dumps(solve({'text':'\ufeffa\n','cap':1,'select':[0]}))), json.loads(json.dumps([[[3,1,1]],['61']])))
check('bom-position fixture 2', json.loads(json.dumps(solve({'text':'\n\r\n','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('bom-position fixture 3', json.loads(json.dumps(solve({'text':'abc','cap':2,'select':[]}))), json.loads(json.dumps(None)))
check('bom-position fixture 4', json.loads(json.dumps(solve({'text':'é','cap':1,'select':[]}))), json.loads(json.dumps(None)))
check('bom-position fixture 5', json.loads(json.dumps(solve({'text':"é"*N+"\n",'cap':2*N,'select':[0]}))), json.loads(json.dumps([[[0,2*N,1]],["c3a9"*N]])))
check('bom-position fixture 6', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[-1]}))), json.loads(json.dumps(None)))
check('bom-position fixture 7', json.loads(json.dumps(solve({'text':'','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('bom-position fixture 8', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[1]}))), json.loads(json.dumps(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 fixtureActualExpectedOutcome
bom-position fixture 0[[[0, 1, 2], [3, 1, 1], [6, 2, 0]], ['6364', '61', '6364']][[[0, 1, 2], [3, 1, 1], [6, 2, 0]], ['6364', '61', '6364']]Passed
bom-position fixture 1None[[[3, 1, 1]], ['61']]Failed
bom-position fixture 2[[], []][[], []]Passed
bom-position fixture 3NoneNonePassed
bom-position fixture 4NoneNonePassed
bom-position fixture 5[[[0, 2, 1]], ['c3a9']][[[0, 2, 1]], ['c3a9']]Passed
bom-position fixture 6NoneNonePassed
bom-position fixture 7[[], []][[], []]Passed
bom-position fixture 8NoneNonePassed

SHA-256 / 07d74d014338ac4636d15cc1ea240c239ef7ccb22ce5ed4a58eb14064c506d99

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    data=x['text'].encode('utf-8')
    pos=1 if data.startswith(b'\xef\xbb\xbf') else 0
    entries=[]
    bodies=[]
    while pos<len(data):
        end=data.find(b'\n',pos)
        final=end<0
        end=len(data) if final else end
        content_end=end-1 if not final and end>pos and data[end-1]==13 else end
        terminator=0 if final else end-content_end+1
        body=data[pos:content_end]
        if body:
            if len(body)>x['cap']: return None
            entries.append([pos,len(body),terminator])
            bodies.append(body.hex())
        pos=len(data) if final else end+1
    if any(i<0 or i>=len(bodies) for i in x['select']): return None
    return [entries,[bodies[i] for i in x['select']]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bom-position fixture 0', json.loads(json.dumps(solve({'text':'a\r\nb\n\ncd','cap':5,'select':[2,0,2]}))), json.loads(json.dumps([[[0,1,2],[3,1,1],[6,2,0]],['6364','61','6364']])))
check('bom-position fixture 1', json.loads(json.dumps(solve({'text':'\ufeffa\n','cap':1,'select':[0]}))), json.loads(json.dumps([[[3,1,1]],['61']])))
check('bom-position fixture 2', json.loads(json.dumps(solve({'text':'\n\r\n','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('bom-position fixture 3', json.loads(json.dumps(solve({'text':'abc','cap':2,'select':[]}))), json.loads(json.dumps(None)))
check('bom-position fixture 4', json.loads(json.dumps(solve({'text':'é','cap':1,'select':[]}))), json.loads(json.dumps(None)))
check('bom-position fixture 5', json.loads(json.dumps(solve({'text':"é"*N+"\n",'cap':2*N,'select':[0]}))), json.loads(json.dumps([[[0,2*N,1]],["c3a9"*N]])))
check('bom-position fixture 6', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[-1]}))), json.loads(json.dumps(None)))
check('bom-position fixture 7', json.loads(json.dumps(solve({'text':'','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('bom-position fixture 8', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[1]}))), json.loads(json.dumps(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 fixtureActualExpectedOutcome
bom-position fixture 0[[[0, 1, 2], [3, 1, 1], [6, 2, 0]], ['6364', '61', '6364']][[[0, 1, 2], [3, 1, 1], [6, 2, 0]], ['6364', '61', '6364']]Passed
bom-position fixture 1None[[[3, 1, 1]], ['61']]Failed
bom-position fixture 2[[], []][[], []]Passed
bom-position fixture 3NoneNonePassed
bom-position fixture 4NoneNonePassed
bom-position fixture 5[[[0, 2, 1]], ['c3a9']][[[0, 2, 1]], ['c3a9']]Passed
bom-position fixture 6NoneNonePassed
bom-position fixture 7[[], []][[], []]Passed
bom-position fixture 8NoneNonePassed

SHA-256 / 26d712e52819793942cc2924d8d514e42a38b035dc3461bf45e94afe401f21af

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    data=x['text'].encode('utf-8')
    pos=3 if data.startswith(b'\xef\xbb\xbf') else 0
    entries=[]
    bodies=[]
    while pos<len(data):
        end=data.find(b'\n',pos)
        final=end<0
        end=len(data) if final else end
        content_end=end-1 if not final and end>pos and data[end-1]==13 else end
        terminator=0 if final else end-content_end+1
        body=data[pos:content_end]
        if body:
            if len(body)>x['cap']: return None
            entries.append([pos,len(body),terminator])
            bodies.append(body.hex())
        pos=len(data) if final else end+1
    if any(i<0 or i>=len(bodies) for i in x['select']): return None
    return [entries,[bodies[i] for i in x['select']]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bom-position fixture 0', json.loads(json.dumps(solve({'text':'a\r\nb\n\ncd','cap':5,'select':[2,0,2]}))), json.loads(json.dumps([[[0,1,2],[3,1,1],[6,2,0]],['6364','61','6364']])))
check('bom-position fixture 1', json.loads(json.dumps(solve({'text':'\ufeffa\n','cap':1,'select':[0]}))), json.loads(json.dumps([[[3,1,1]],['61']])))
check('bom-position fixture 2', json.loads(json.dumps(solve({'text':'\n\r\n','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('bom-position fixture 3', json.loads(json.dumps(solve({'text':'abc','cap':2,'select':[]}))), json.loads(json.dumps(None)))
check('bom-position fixture 4', json.loads(json.dumps(solve({'text':'é','cap':1,'select':[]}))), json.loads(json.dumps(None)))
check('bom-position fixture 5', json.loads(json.dumps(solve({'text':"é"*N+"\n",'cap':2*N,'select':[0]}))), json.loads(json.dumps([[[0,2*N,1]],["c3a9"*N]])))
check('bom-position fixture 6', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[-1]}))), json.loads(json.dumps(None)))
check('bom-position fixture 7', json.loads(json.dumps(solve({'text':'','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('bom-position fixture 8', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[1]}))), json.loads(json.dumps(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 fixtureActualExpectedOutcome
bom-position fixture 0[[[0, 1, 2], [3, 1, 1], [6, 2, 0]], ['6364', '61', '6364']][[[0, 1, 2], [3, 1, 1], [6, 2, 0]], ['6364', '61', '6364']]Passed
bom-position fixture 1[[[3, 1, 1]], ['61']][[[3, 1, 1]], ['61']]Passed
bom-position fixture 2[[], []][[], []]Passed
bom-position fixture 3NoneNonePassed
bom-position fixture 4NoneNonePassed
bom-position fixture 5[[[0, 2, 1]], ['c3a9']][[[0, 2, 1]], ['c3a9']]Passed
bom-position fixture 6NoneNonePassed
bom-position fixture 7[[], []][[], []]Passed
bom-position fixture 8NoneNonePassed

SHA-256 / 371e396796d098d54ea5044584c137b3373367e38c281f59362b32a2a887c8ad

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

Case digest / 3af5ce433c08146cc473b654026e561a78f1ab0849060959650fbede139574c0