FA-11781 / Localization message semantics / Open access
Unselected message branches demand unavailable variables · case 01
Unselected message branches demand unavailable variables.
ROOT CAUSE
All branch templates are formatted before selecting the active message.
VERIFIED REPAIR
The named branch or other must exist. Select the named branch if present, otherwise other, then format only that branch with str.format. Return missing only if the selected branch requires an absent argument.
Unsuccessful approach: Checking all branches for missing arguments before selection retains the same eager requirement.
Case contract
The named branch or other must exist. Select the named branch if present, otherwise other, then format only that branch with str.format. Return missing only if the selected branch requires an absent argument.
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
import re
N = 1
observations = []
def solve(branches, choice, values):
try:
rendered = {k:v.format(**values) for k,v in branches.items()}
return rendered.get(choice,rendered['other'])
except KeyError: return 'missing'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('explicit branch without default', solve({'special':'ok'},'special',{}), 'ok')
check('inactive missing', solve({'special':'{secret}','other':'Hello {name}'},'other',{'name':str(N)}), 'Hello '+str(N))
check('chosen complete', solve({'special':'{secret}','other':'{name}'},'special',{'secret':'yes'}), 'yes')
check('selected missing', solve({'other':'{name}'},'other',{}), 'missing')
check('fallback', solve({'special':'{secret}','other':'ok'},'unknown',{}), 'ok')
check('constant', solve({'other':'ok'},'other',{}), 'ok')
check('supplied variables', solve({'special':'{secret}','other':'{name}'},'other',{'secret':'x','name':str(N)}), str(N))
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit branch without default | missing | ok | Failed |
| inactive missing | missing | Hello 1 | Failed |
| chosen complete | missing | yes | Failed |
| selected missing | missing | missing | Passed |
| fallback | missing | ok | Failed |
| constant | ok | ok | Passed |
| supplied variables | 1 | 1 | Passed |
SHA-256 / 2c57eb5e96be61f2715263cdb74676fd28f1e14fc95f14eca21f52e8eee7ecf4
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(branches, choice, values):
if any(name not in values for text in branches.values() for name in re.findall(r'\{([a-z]+)\}',text)): return 'missing'
return (branches[choice] if choice in branches else branches.get('other','missing')).format(**values)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('explicit branch without default', solve({'special':'ok'},'special',{}), 'ok')
check('inactive missing', solve({'special':'{secret}','other':'Hello {name}'},'other',{'name':str(N)}), 'Hello '+str(N))
check('chosen complete', solve({'special':'{secret}','other':'{name}'},'special',{'secret':'yes'}), 'yes')
check('selected missing', solve({'other':'{name}'},'other',{}), 'missing')
check('fallback', solve({'special':'{secret}','other':'ok'},'unknown',{}), 'ok')
check('constant', solve({'other':'ok'},'other',{}), 'ok')
check('supplied variables', solve({'special':'{secret}','other':'{name}'},'other',{'secret':'x','name':str(N)}), str(N))
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit branch without default | ok | ok | Passed |
| inactive missing | missing | Hello 1 | Failed |
| chosen complete | missing | yes | Failed |
| selected missing | missing | missing | Passed |
| fallback | missing | ok | Failed |
| constant | ok | ok | Passed |
| supplied variables | 1 | 1 | Passed |
SHA-256 / 95ce1c1c727f5e9defc589506464a633bc6ca1a8136679a42cd2f9bfdf567546
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(branches, choice, values):
try:
template = branches[choice] if choice in branches else branches['other']
return template.format(**values)
except KeyError: return 'missing'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('explicit branch without default', solve({'special':'ok'},'special',{}), 'ok')
check('inactive missing', solve({'special':'{secret}','other':'Hello {name}'},'other',{'name':str(N)}), 'Hello '+str(N))
check('chosen complete', solve({'special':'{secret}','other':'{name}'},'special',{'secret':'yes'}), 'yes')
check('selected missing', solve({'other':'{name}'},'other',{}), 'missing')
check('fallback', solve({'special':'{secret}','other':'ok'},'unknown',{}), 'ok')
check('constant', solve({'other':'ok'},'other',{}), 'ok')
check('supplied variables', solve({'special':'{secret}','other':'{name}'},'other',{'secret':'x','name':str(N)}), str(N))
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit branch without default | ok | ok | Passed |
| inactive missing | Hello 1 | Hello 1 | Passed |
| chosen complete | yes | yes | Passed |
| selected missing | missing | missing | Passed |
| fallback | ok | ok | Passed |
| constant | ok | ok | Passed |
| supplied variables | 1 | 1 | Passed |
SHA-256 / 6a0e78d3460b7d117fc9c5b95198a93f46cda025d1d86b3f7015adc03ad015b2
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.965674+00:00.
Case digest / 096e82328ef8809707da11ba995d6bb78ff07535bd161fec524e812a7d7c41a3