FAILURE MAP
← Case archive

FA-11761 / Localization message semantics / Open access

Contextual translations collapse identical source words · case 01

Contextual translations collapse identical source words.

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

ROOT CAUSE

The lookup discards the grammatical context from the catalog key.

VERIFIED REPAIR

Look up the exact (context, source) tuple; if absent return source unchanged. Never use a different context, including the empty context.

Unsuccessful approach: Falling back to an arbitrary other context leaks a noun translation into a missing verb entry.

Case contract

Look up the exact (context, source) tuple; if absent return source unchanged. Never use a different context, including the empty context.

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(catalog, context, source):
    return next((v for (c,s),v in catalog.items() if s == source), source)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('verb context', solve({('noun','Open'):'noun',('verb','Open'):'verb'},'verb','Open'), 'verb')
check('missing context', solve({('noun','Open'):'noun'},'verb','Open'), 'Open')
check('empty distinct', solve({('','Open'):'generic'},'verb','Open'), 'Open')
check('noun', solve({('noun','Open'):'noun'},'noun','Open'), 'noun')
check('missing source', solve({},'verb','Item'+str(N)), 'Item'+str(N))
check('dynamic key', solve({('ctx','X'+str(N)):'translated'},'ctx','X'+str(N)), 'translated')
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
verb contextnounverbFailed
missing contextnounOpenFailed
empty distinctgenericOpenFailed
nounnounnounPassed
missing sourceItem1Item1Passed
dynamic keytranslatedtranslatedPassed

SHA-256 / 4ce79b7c11599b0ceb064d75d316efa5b8bddef98fed1488b6e065135f70209f

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(catalog, context, source):
    return catalog.get((context,source), next((v for (c,s),v in catalog.items() if s == source), source))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('verb context', solve({('noun','Open'):'noun',('verb','Open'):'verb'},'verb','Open'), 'verb')
check('missing context', solve({('noun','Open'):'noun'},'verb','Open'), 'Open')
check('empty distinct', solve({('','Open'):'generic'},'verb','Open'), 'Open')
check('noun', solve({('noun','Open'):'noun'},'noun','Open'), 'noun')
check('missing source', solve({},'verb','Item'+str(N)), 'Item'+str(N))
check('dynamic key', solve({('ctx','X'+str(N)):'translated'},'ctx','X'+str(N)), 'translated')
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
verb contextverbverbPassed
missing contextnounOpenFailed
empty distinctgenericOpenFailed
nounnounnounPassed
missing sourceItem1Item1Passed
dynamic keytranslatedtranslatedPassed

SHA-256 / d1c72837d1ebc1b5dded9e8640b6935e11d804c6555d4a11d921ec90b28814cd

3 / The verified repair

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

N = 1
observations = []
def solve(catalog, context, source):
    return catalog.get((context,source), source)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('verb context', solve({('noun','Open'):'noun',('verb','Open'):'verb'},'verb','Open'), 'verb')
check('missing context', solve({('noun','Open'):'noun'},'verb','Open'), 'Open')
check('empty distinct', solve({('','Open'):'generic'},'verb','Open'), 'Open')
check('noun', solve({('noun','Open'):'noun'},'noun','Open'), 'noun')
check('missing source', solve({},'verb','Item'+str(N)), 'Item'+str(N))
check('dynamic key', solve({('ctx','X'+str(N)):'translated'},'ctx','X'+str(N)), 'translated')
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
verb contextverbverbPassed
missing contextOpenOpenPassed
empty distinctOpenOpenPassed
nounnounnounPassed
missing sourceItem1Item1Passed
dynamic keytranslatedtranslatedPassed

SHA-256 / 03bb218293d9a9be571aa3b956c3ece93c2d3e780b4211f081068d8e9e3c6885

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

Case digest / 79292813c0d455fa9829c0dffd56b8234f173007af8c960f786e200dbb506955