FAILURE MAP
← Case archive

FA-11776 / Localization message semantics / Open access

Inserted message arguments are parsed again · case 01

Inserted message arguments are parsed again.

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

ROOT CAUSE

Sequential substitutions interpret placeholders embedded in a previously inserted user value.

VERIFIED REPAIR

Replace placeholders whose names consist of one or more lowercase ASCII letters, enclosed in braces, found in the original template exactly once. Inserted values are opaque strings and missing names retain their original placeholder.

Unsuccessful approach: Reversing substitution order merely changes which inserted value is reparsed.

Case contract

Replace placeholders whose names consist of one or more lowercase ASCII letters, enclosed in braces, found in the original template exactly once. Inserted values are opaque strings and missing names retain their original placeholder.

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(template, values):
    for key,value in values.items(): template = template.replace('{'+key+'}',value)
    return template
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('uppercase literal', solve('{User}',{'User':'Alice'}), '{User}')
check('underscore literal', solve('{user_name}',{'user_name':'Alice'}), '{user_name}')
check('forward cascade', solve('{a}',{'a':'{b}','b':'B'}), '{b}')
check('reverse cascade', solve('{b}',{'a':'A','b':'{a}'}), '{a}')
check('repeat', solve('{a}/{a}',{'a':str(N)}), str(N)+'/'+str(N))
check('missing', solve('{missing}',{}), '{missing}')
check('literal', solve('plain',{'a':'x'}), 'plain')
check('mixed', solve('{a}-{b}',{'a':'{b}','b':'B'}), '{b}-B')
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
uppercase literalAlice{User}Failed
underscore literalAlice{user_name}Failed
forward cascadeB{b}Failed
reverse cascade{a}{a}Passed
repeat1/11/1Passed
missing{missing}{missing}Passed
literalplainplainPassed
mixedB-B{b}-BFailed

SHA-256 / 216f6c4a36849ceba95269d52b31cc6786bbfd31773d1942e185be6461ad95c3

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(template, values):
    for key,value in reversed(list(values.items())): template = template.replace('{'+key+'}',value)
    return template
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('uppercase literal', solve('{User}',{'User':'Alice'}), '{User}')
check('underscore literal', solve('{user_name}',{'user_name':'Alice'}), '{user_name}')
check('forward cascade', solve('{a}',{'a':'{b}','b':'B'}), '{b}')
check('reverse cascade', solve('{b}',{'a':'A','b':'{a}'}), '{a}')
check('repeat', solve('{a}/{a}',{'a':str(N)}), str(N)+'/'+str(N))
check('missing', solve('{missing}',{}), '{missing}')
check('literal', solve('plain',{'a':'x'}), 'plain')
check('mixed', solve('{a}-{b}',{'a':'{b}','b':'B'}), '{b}-B')
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
uppercase literalAlice{User}Failed
underscore literalAlice{user_name}Failed
forward cascade{b}{b}Passed
reverse cascadeA{a}Failed
repeat1/11/1Passed
missing{missing}{missing}Passed
literalplainplainPassed
mixed{b}-B{b}-BPassed

SHA-256 / e9a015008618ecc8b4665892a52a8b58eb9caf35ed873de30b7369b25e8949a3

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(template, values):
    return re.sub(r'\{([a-z]+)\}',lambda m: values.get(m.group(1),m.group(0)),template)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('uppercase literal', solve('{User}',{'User':'Alice'}), '{User}')
check('underscore literal', solve('{user_name}',{'user_name':'Alice'}), '{user_name}')
check('forward cascade', solve('{a}',{'a':'{b}','b':'B'}), '{b}')
check('reverse cascade', solve('{b}',{'a':'A','b':'{a}'}), '{a}')
check('repeat', solve('{a}/{a}',{'a':str(N)}), str(N)+'/'+str(N))
check('missing', solve('{missing}',{}), '{missing}')
check('literal', solve('plain',{'a':'x'}), 'plain')
check('mixed', solve('{a}-{b}',{'a':'{b}','b':'B'}), '{b}-B')
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
uppercase literal{User}{User}Passed
underscore literal{user_name}{user_name}Passed
forward cascade{b}{b}Passed
reverse cascade{a}{a}Passed
repeat1/11/1Passed
missing{missing}{missing}Passed
literalplainplainPassed
mixed{b}-B{b}-BPassed

SHA-256 / b17e2851f305d2f3856a5eed474c32249ce0ea3db69f643cccdb96e293ecb546

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

Case digest / 831e3c2d1acb1e45c42be5c11985d7b45cb789a9926d73eeb6e8c7a03f7e2d0a