FAILURE MAP
← Case archive

FA-27471 / HTTP ranges / Open access

A row-range endpoint builds byte-addressable line record metadata: index entries expose octet counts rather than codepoint counts · case 01

A row-range endpoint builds byte-addressable line record metadata: index entries expose octet counts rather than codepoint counts.

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

ROOT CAUSE

The record-range-byte-index-record-byte-length decision uses 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.decode('utf-8')),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']]].

THE FAILURE

The record-range-byte-index-record-byte-length decision uses 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.decode('utf-8')),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=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),1]) 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=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.decode('utf-8')),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('record-byte-length 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('record-byte-length fixture 1', json.loads(json.dumps(solve({'text':'\ufeffa\n','cap':1,'select':[0]}))), json.loads(json.dumps([[[3,1,1]],['61']])))
check('record-byte-length fixture 2', json.loads(json.dumps(solve({'text':'\n\r\n','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('record-byte-length fixture 3', json.loads(json.dumps(solve({'text':'abc','cap':2,'select':[]}))), json.loads(json.dumps(None)))
check('record-byte-length fixture 4', json.loads(json.dumps(solve({'text':'é','cap':1,'select':[]}))), json.loads(json.dumps(None)))
check('record-byte-length 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('record-byte-length fixture 6', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[-1]}))), json.loads(json.dumps(None)))
check('record-byte-length fixture 7', json.loads(json.dumps(solve({'text':'','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('record-byte-length 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
record-byte-length 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
record-byte-length fixture 1[[[3, 1, 1]], ['61']][[[3, 1, 1]], ['61']]Passed
record-byte-length fixture 2[[], []][[], []]Passed
record-byte-length fixture 3NoneNonePassed
record-byte-length fixture 4NoneNonePassed
record-byte-length fixture 5[[[0, 1, 1]], ['c3a9']][[[0, 2, 1]], ['c3a9']]Failed
record-byte-length fixture 6NoneNonePassed
record-byte-length fixture 7[[], []][[], []]Passed
record-byte-length fixture 8NoneNonePassed

SHA-256 / 18091c7d001ec6a2862489c3b7240fb76cfba571104f18b9637a3809cc914237

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=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),1])
            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('record-byte-length 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('record-byte-length fixture 1', json.loads(json.dumps(solve({'text':'\ufeffa\n','cap':1,'select':[0]}))), json.loads(json.dumps([[[3,1,1]],['61']])))
check('record-byte-length fixture 2', json.loads(json.dumps(solve({'text':'\n\r\n','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('record-byte-length fixture 3', json.loads(json.dumps(solve({'text':'abc','cap':2,'select':[]}))), json.loads(json.dumps(None)))
check('record-byte-length fixture 4', json.loads(json.dumps(solve({'text':'é','cap':1,'select':[]}))), json.loads(json.dumps(None)))
check('record-byte-length 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('record-byte-length fixture 6', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[-1]}))), json.loads(json.dumps(None)))
check('record-byte-length fixture 7', json.loads(json.dumps(solve({'text':'','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('record-byte-length 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
record-byte-length fixture 0[[[0, 1, 1], [3, 1, 1], [6, 2, 1]], ['6364', '61', '6364']][[[0, 1, 2], [3, 1, 1], [6, 2, 0]], ['6364', '61', '6364']]Failed
record-byte-length fixture 1[[[3, 1, 1]], ['61']][[[3, 1, 1]], ['61']]Passed
record-byte-length fixture 2[[], []][[], []]Passed
record-byte-length fixture 3NoneNonePassed
record-byte-length fixture 4NoneNonePassed
record-byte-length fixture 5[[[0, 2, 1]], ['c3a9']][[[0, 2, 1]], ['c3a9']]Passed
record-byte-length fixture 6NoneNonePassed
record-byte-length fixture 7[[], []][[], []]Passed
record-byte-length fixture 8NoneNonePassed

SHA-256 / cb5f2f144bfeda82199183be29fb91ca631c0537704c366471874a587c4230a5

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 9 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:25.328230+00:00.

Case digest / 8d35707d02ea38ba6e420e14719c2de748e284eae6d50432d5a1fb933cb8337f