FAILURE MAP
← Case archive

FA-6906 / Content negotiation / Open access

Charset default is not inferred from an unrelated media type · case 01

Charset default is not inferred from an unrelated media type.

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

ROOT CAUSE

The faulty implementation uses `declared or 'utf-8'` for the charset-default-is-not-inferred-from-an-unrelated-media-type decision.

VERIFIED REPAIR

Apply the explicit charset-default-is-not-inferred-from-an-unrelated-media-type contract, including the tested boundary and negative cases.

Unsuccessful approach: The attempted repair uses `'utf-8' if media == 'application/json' else None` and still violates a separate fixture.

Case contract

Bounded offline decision model: charset default is not inferred from an unrelated media type. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.

Why this case matters

This deterministic content negotiation model isolates the charset-default-is-not-inferred-from-an-unrelated-media-type 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(media, declared):
    return declared or 'utf-8'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('text/plain', None), None)", "check('fixture 2', solve('application/json', None), 'utf-8')", "check('fixture 3', solve('text/plain', 'latin1'), 'latin1')", "check('fixture 4', solve('image/png', None), None)"]
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 2utf-8utf-8Passed
fixture 3latin1latin1Passed
fixture 4utf-8NoneFailed
fixture 1utf-8NoneFailed

SHA-256 / 9595fdafe10bc024c48683a2e086889d790a0cf2c35b253362f6a01141ec9456

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(media, declared):
    return 'utf-8' if media == 'application/json' else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('text/plain', None), None)", "check('fixture 2', solve('application/json', None), 'utf-8')", "check('fixture 3', solve('text/plain', 'latin1'), 'latin1')", "check('fixture 4', solve('image/png', None), None)"]
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 2utf-8utf-8Passed
fixture 3Nonelatin1Failed
fixture 4NoneNonePassed
fixture 1NoneNonePassed

SHA-256 / e229f4b1113f66247aa44651d8422f8daa26bee003b81cff81bc52e29434e1b3

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(media, declared):
    return declared if declared else ('utf-8' if media == 'application/json' else None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('text/plain', None), None)", "check('fixture 2', solve('application/json', None), 'utf-8')", "check('fixture 3', solve('text/plain', 'latin1'), 'latin1')", "check('fixture 4', solve('image/png', None), None)"]
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 2utf-8utf-8Passed
fixture 3latin1latin1Passed
fixture 4NoneNonePassed
fixture 1NoneNonePassed

SHA-256 / 6f9f48e319917e176b7270d0e01aa6d5a451ab7bf8d156f2b61ba301fad546e9

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

Case digest / 98f577187bc71e54b59bc0c86bc16184e5614829bb4ca8295f194ed146720843