FA-26711 / HTTP ranges / Open access
Non-ASCII response bodies report UTF-8 byte length instead of character count · case 01
Non-ASCII response bodies report UTF-8 byte length instead of character count.
ROOT CAUSE
The content-length-body-byte-unit decision uses return len(body).
VERIFIED REPAIR
Apply the bounded decision exactly: return len(body.encode("utf-8"))
Unsuccessful approach: The partial repair uses return len(body.encode("utf-16-le")), which still violates the stated contract.
Case contract
The selected representation is UTF-8 text. Return wire octet length; no normalization or decoding after selection.
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(body):
return len(body)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('content-length-body-byte-unit fixture 0', solve("é"*N), 2*N)
check('content-length-body-byte-unit fixture 1', solve("😀"*N), 4*N)
check('content-length-body-byte-unit fixture 2', solve("a"*N), N)
check('content-length-body-byte-unit fixture 3', solve(""), 0)
check('content-length-body-byte-unit fixture 4', solve("aé"), 3)
check('content-length-body-byte-unit fixture 5', solve("e\u0301"), 3)
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 |
|---|---|---|---|
| content-length-body-byte-unit fixture 0 | 1 | 2 | Failed |
| content-length-body-byte-unit fixture 1 | 1 | 4 | Failed |
| content-length-body-byte-unit fixture 2 | 1 | 1 | Passed |
| content-length-body-byte-unit fixture 3 | 0 | 0 | Passed |
| content-length-body-byte-unit fixture 4 | 2 | 3 | Failed |
| content-length-body-byte-unit fixture 5 | 2 | 3 | Failed |
SHA-256 / d51b156a2d8da01b6c6f0f4078bfc9bb477d5ecd8c2858b9d7da61301798c29e
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(body):
return len(body.encode("utf-16-le"))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('content-length-body-byte-unit fixture 0', solve("é"*N), 2*N)
check('content-length-body-byte-unit fixture 1', solve("😀"*N), 4*N)
check('content-length-body-byte-unit fixture 2', solve("a"*N), N)
check('content-length-body-byte-unit fixture 3', solve(""), 0)
check('content-length-body-byte-unit fixture 4', solve("aé"), 3)
check('content-length-body-byte-unit fixture 5', solve("e\u0301"), 3)
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 |
|---|---|---|---|
| content-length-body-byte-unit fixture 0 | 2 | 2 | Passed |
| content-length-body-byte-unit fixture 1 | 4 | 4 | Passed |
| content-length-body-byte-unit fixture 2 | 2 | 1 | Failed |
| content-length-body-byte-unit fixture 3 | 0 | 0 | Passed |
| content-length-body-byte-unit fixture 4 | 4 | 3 | Failed |
| content-length-body-byte-unit fixture 5 | 4 | 3 | Failed |
SHA-256 / 573ebc01fee4314ee832dd9aa69d5906cce5ff46c27dea2ad2318153a9a203bf
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(body):
return len(body.encode("utf-8"))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('content-length-body-byte-unit fixture 0', solve("é"*N), 2*N)
check('content-length-body-byte-unit fixture 1', solve("😀"*N), 4*N)
check('content-length-body-byte-unit fixture 2', solve("a"*N), N)
check('content-length-body-byte-unit fixture 3', solve(""), 0)
check('content-length-body-byte-unit fixture 4', solve("aé"), 3)
check('content-length-body-byte-unit fixture 5', solve("e\u0301"), 3)
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 |
|---|---|---|---|
| content-length-body-byte-unit fixture 0 | 2 | 2 | Passed |
| content-length-body-byte-unit fixture 1 | 4 | 4 | Passed |
| content-length-body-byte-unit fixture 2 | 1 | 1 | Passed |
| content-length-body-byte-unit fixture 3 | 0 | 0 | Passed |
| content-length-body-byte-unit fixture 4 | 3 | 3 | Passed |
| content-length-body-byte-unit fixture 5 | 3 | 3 | Passed |
SHA-256 / 711c793c4f1faffaa52c6616f53a7d9327d532f262d0d95f2cb3cded4e0c4741
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:18.422942+00:00.
Case digest / 512aaac1fbc89b253ffded71cca76bc0c3b19f4377a867df3ec627db5976a09e