FAILURE MAP
← Case archive

FA-6881 / Content negotiation / Open access

Content length after coding describes transmitted octets · case 01

Content length after coding describes transmitted octets.

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

ROOT CAUSE

The faulty implementation uses `len(plain)` for the content-length-after-coding-describes-transmitted-octets decision.

VERIFIED REPAIR

Apply the explicit content-length-after-coding-describes-transmitted-octets contract, including the tested boundary and negative cases.

Unsuccessful approach: The attempted repair uses `sum(len(chunk) for chunk in coded) if coded else len(plain.encode("utf-8"))` and still violates a separate fixture.

Case contract

Given plain, coded, content length after coding describes transmitted octets. Return the protocol decision or transformed value; fields are validated and fixtures state boundary outcomes.

Why this case matters

This deterministic content negotiation model isolates the content-length-after-coding-describes-transmitted-octets 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(plain, coded):
    return len(plain)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('é', None), 2)", "check('fixture 2', solve('hello', ['a', 'bc']), 3)", "check('fixture 3', solve('hello', []), 0)", "check('fixture 4', solve('', None), 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 253Failed
fixture 350Failed
fixture 400Passed
fixture 112Failed

SHA-256 / 129f027c670a0bb437cd909e093bd1dc07011b190886033171c6b6533e215cfb

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(plain, coded):
    return sum(len(chunk) for chunk in coded) if coded else len(plain.encode("utf-8"))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('é', None), 2)", "check('fixture 2', solve('hello', ['a', 'bc']), 3)", "check('fixture 3', solve('hello', []), 0)", "check('fixture 4', solve('', None), 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 233Passed
fixture 350Failed
fixture 400Passed
fixture 122Passed

SHA-256 / 0a4fccc41f0a3470788635f1322c5ed553982afe43bca76975646edfe444fc63

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(plain, coded):
    return sum(len(chunk) for chunk in coded) if coded is not None else len(plain.encode("utf-8"))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('é', None), 2)", "check('fixture 2', solve('hello', ['a', 'bc']), 3)", "check('fixture 3', solve('hello', []), 0)", "check('fixture 4', solve('', None), 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 233Passed
fixture 300Passed
fixture 400Passed
fixture 122Passed

SHA-256 / 72e57906641b072673221e2b07e0b200a600f51a76c6e7c0470a71ad3e0a999a

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

Case digest / 4cc15663b80b50dfa977cff482a890272d0fcdb9fd1c6be7d967cace9465ab1c