FAILURE MAP
← Case archive

FA-6841 / Content negotiation / Open access

Equal quality retains server preference order · case 01

Equal quality retains server preference order.

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

ROOT CAUSE

The faulty implementation uses `max(candidates)[0] if candidates else None` for the equal-quality-retains-server-preference-order decision.

VERIFIED REPAIR

Apply the explicit equal-quality-retains-server-preference-order contract, including the tested boundary and negative cases.

Unsuccessful approach: The attempted repair uses `sorted(candidates,key=lambda p:p[1])[-1][0] if candidates else None` and still violates a separate fixture.

Case contract

Bounded offline decision model: equal quality retains server preference order. 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 equal-quality-retains-server-preference-order 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(candidates):
    return max(candidates)[0] if candidates else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve([('a', 1), ('z', 1)]), 'a')", "check('fixture 2', solve([('z', 0.2), ('a', 0.8)]), 'a')", "check('fixture 3', solve([]), None)", "check('fixture 4', solve([('x', 0)]), 'x')"]
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 2zaFailed
fixture 3NoneNonePassed
fixture 4xxPassed
fixture 1zaFailed

SHA-256 / 0a31b306e69f21000e26f8ffe0b57fb7cf4eaab5e30372da48ef964689d1a30d

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(candidates):
    return sorted(candidates,key=lambda p:p[1])[-1][0] if candidates else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve([('a', 1), ('z', 1)]), 'a')", "check('fixture 2', solve([('z', 0.2), ('a', 0.8)]), 'a')", "check('fixture 3', solve([]), None)", "check('fixture 4', solve([('x', 0)]), 'x')"]
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 2aaPassed
fixture 3NoneNonePassed
fixture 4xxPassed
fixture 1zaFailed

SHA-256 / 6c321142a52acbe5b23d79bbff1b256adb2bf8429dc102758c996eda2bb55143

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(candidates):
    return max(candidates,key=lambda p:p[1])[0] if candidates else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve([('a', 1), ('z', 1)]), 'a')", "check('fixture 2', solve([('z', 0.2), ('a', 0.8)]), 'a')", "check('fixture 3', solve([]), None)", "check('fixture 4', solve([('x', 0)]), 'x')"]
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 2aaPassed
fixture 3NoneNonePassed
fixture 4xxPassed
fixture 1aaPassed

SHA-256 / 031d46ba905cb82596ebc73737ec27e214f8ee639a092f5270f1e688f26fcc44

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

Case digest / cf541c983ad8e32b21b0a144d860de327e34ee1f7f035cee680a009c9065afc6