FAILURE MAP
← Case archive

FA-11786 / Localization message semantics / Open access

Locale negotiation ignores preference weights or explicit exclusions · case 01

Locale negotiation ignores preference weights or explicit exclusions.

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

ROOT CAUSE

The first supported language is selected without comparing preference weights.

THE FAILURE

The first supported language is selected without comparing preference weights.

Unsuccessful approach: Sorting preferences by quality but accepting zero-weight entries chooses explicitly excluded languages.

Case contract

Given unique exact toy locale preferences (tag, integer quality 0..1000), choose the supported tag with largest positive quality; ties preserve preference order. Return none if no positive supported preference exists. No wildcard or language-parent expansion is modeled.

Why this case matters

This offline controlled message model isolates a localization decision; it does not implement a complete message-format or locale standard.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(preferences, supported):
    return next((tag for tag,q in preferences if tag in supported), 'none')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('quality ordering', solve([('fr',N),('de',1000)],['fr','de']), 'de')
check('excluded only', solve([('fr',0)],['fr']), 'none')
check('tie stable', solve([('fr',N),('de',N)],['de','fr']), 'fr')
check('unsupported high', solve([('fr',1000),('de',N)],['de']), 'de')
check('empty preferences', solve([],['fr']), 'none')
check('zero before positive', solve([('fr',0),('de',N)],['fr','de']), 'de')
check('exact tags only', solve([('fr-CA',N)],['fr']), 'none')
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
quality orderingfrdeFailed
excluded onlyfrnoneFailed
tie stablefrfrPassed
unsupported highdedePassed
empty preferencesnonenonePassed
zero before positivefrdeFailed
exact tags onlynonenonePassed

SHA-256 / bad1b9f38b5fda8908bf860c4255fc8249d4d335bf42134baec106b49a9dafb9

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(preferences, supported):
    return next((tag for tag,q in sorted(preferences,key=lambda x:-x[1]) if tag in supported), 'none')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('quality ordering', solve([('fr',N),('de',1000)],['fr','de']), 'de')
check('excluded only', solve([('fr',0)],['fr']), 'none')
check('tie stable', solve([('fr',N),('de',N)],['de','fr']), 'fr')
check('unsupported high', solve([('fr',1000),('de',N)],['de']), 'de')
check('empty preferences', solve([],['fr']), 'none')
check('zero before positive', solve([('fr',0),('de',N)],['fr','de']), 'de')
check('exact tags only', solve([('fr-CA',N)],['fr']), 'none')
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
quality orderingdedePassed
excluded onlyfrnoneFailed
tie stablefrfrPassed
unsupported highdedePassed
empty preferencesnonenonePassed
zero before positivededePassed
exact tags onlynonenonePassed

SHA-256 / 4f3f588ccffbad9b5fc59d5e251405b6eb5998a1c6c1f130e24ba0af3eb4b5ca

HELD IN THE MEMBER ARCHIVE

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

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

Only the explicitly specified miniature locale/message rules are modeled. 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:51.054752+00:00.

Case digest / 9e9e20ab79118f325097177810090b132b0abc76b33997185773e6c51e5b5101