FAILURE MAP
← Case archive

FA-6891 / Content negotiation / Open access

Language lookup truncates rightmost subtags · case 01

Language lookup truncates rightmost subtags.

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

ROOT CAUSE

The faulty implementation uses `language.split('-',1)[0] if '-' in language else None` for the language-lookup-truncates-rightmost-subtags decision.

THE FAILURE

The faulty implementation uses `language.split('-',1)[0] if '-' in language else None` for the language-lookup-truncates-rightmost-subtags decision.

Unsuccessful approach: The attempted repair uses `language` and still violates a separate fixture.

Case contract

Bounded offline decision model: language lookup truncates rightmost subtags. 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 language-lookup-truncates-rightmost-subtags 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(language):
    return language.split('-',1)[0] if '-' in language else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('zh-Hant-TW'), 'zh-Hant')", "check('fixture 2', solve('en-US'), 'en')", "check('fixture 3', solve('en'), None)", "check('fixture 4', solve('sr-Latn-RS'), 'sr-Latn')"]
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 2enenPassed
fixture 3NoneNonePassed
fixture 4srsr-LatnFailed
fixture 1zhzh-HantFailed

SHA-256 / 68102a042cc5aa399a5ee485deb105f66ea91288002371dfcafb319574004e67

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(language):
    return language
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('zh-Hant-TW'), 'zh-Hant')", "check('fixture 2', solve('en-US'), 'en')", "check('fixture 3', solve('en'), None)", "check('fixture 4', solve('sr-Latn-RS'), 'sr-Latn')"]
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 2en-USenFailed
fixture 3enNoneFailed
fixture 4sr-Latn-RSsr-LatnFailed
fixture 1zh-Hant-TWzh-HantFailed

SHA-256 / 2c24b3bbfa78ac0dccfa7e47155f5afe2cedc29c855f124bc10ae43b2a667f72

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 4 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

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

Case digest / 6a1ec9e5098c98047ce2b8e8f4a7f0ac5b06fe53f5afae9e2812127ef1ba1e09