FAILURE MAP
← Case archive

FA-6681 / HTTP ranges / Open access

An inclusive byte endpoint yields one more byte than endpoint subtraction · case 01

An inclusive byte endpoint yields one more byte than endpoint subtraction.

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

ROOT CAUSE

The faulty implementation uses `max(0, end-start)` for the range-inclusive decision.

VERIFIED REPAIR

Apply the explicit range-inclusive contract, including the tested boundary and negative cases.

Unsuccessful approach: The attempted repair uses `end-start+1` and still violates a separate fixture.

Case contract

An inclusive byte endpoint yields one more byte than endpoint subtraction: return the result specified by the explicit input/output boundary fixtures.

Why this case matters

This deterministic http ranges model isolates the range-inclusive policy at a network component boundary.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(start, end):
    return max(0, end-start)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(2, 2), 1)", "check('fixture 2', solve(5, 2), 0)", "check('fixture 3', solve(0, 3), 4)", "check('fixture 4', solve(0, -1), 0)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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
fixture 200Passed
fixture 334Failed
fixture 400Passed
fixture 101Failed

SHA-256 / d2e620c149e424b58247ee6be2944eb7952a36e1ac57f8c654f8c8a8b5c957a3

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(start, end):
    return end-start+1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(2, 2), 1)", "check('fixture 2', solve(5, 2), 0)", "check('fixture 3', solve(0, 3), 4)", "check('fixture 4', solve(0, -1), 0)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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
fixture 2-20Failed
fixture 344Passed
fixture 400Passed
fixture 111Passed

SHA-256 / f52a392e64614f6a0641fc75b6ada4671a74bab6396a161d6db560357018ef29

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(start, end):
    return max(0, end - start + 1)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(2, 2), 1)", "check('fixture 2', solve(5, 2), 0)", "check('fixture 3', solve(0, 3), 4)", "check('fixture 4', solve(0, -1), 0)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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
fixture 200Passed
fixture 344Passed
fixture 400Passed
fixture 111Passed

SHA-256 / 637e4144231c5decb550d249dd94536ab1fc01f71110bea6a42272c298062f3a

Verification & scope

Bounded deterministic policy model over validated inputs; not a complete protocol stack or an interoperability claim. The five variants rotate the same explicit fixture set. 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:38:04.330037+00:00.

Case digest / bd818f9e7f9f7a01cbfe147abe0327637518601148d8ad20ab15a9aa62a94c9d