broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    voices={}; disabled=set(); out=[]
    for e in events:
        if e[0]=='add': voices[e[1]]=e[1:]
        elif e[0]=='remove': disabled.add(e[1])
        elif e[0]=='enable': disabled.discard(e[1])
        elif e[0]=='request':
            lang,offline,required,preferred=e[1:]
            rows=[v for k,v in voices.items() if k not in disabled]
            rows=[v for v in rows if not offline or v[2]]
            rows=[v for v in rows if set(required)<=set(v[4])]
            rows=list(rows)
            if not rows: out.append(None); continue
            def rank(v):
                language_rank=0 if v[1]==lang else (1 if v[1].split('-')[0]==lang.split('-')[0] else 2)
                return (v[0]!=preferred,language_rank,not v[2],-v[3],v[0])
            out.append(min(rows,key=rank)[0])
    return [out,list(voices),sorted(disabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','en',True,1,['marks']],['add','b','en',True,N+5,['marks','spell']],['request','en',True,['marks'],None]]", "[['add','a','fr',False,9,['marks']],['add','b','fr',True,1,['marks']],['request','fr',False,[],None],['request','fr',True,[],None],['request','fr',False,[],'a']]", "[['add','z','fr-CA',True,1,[]],['add','a','fr',True,9,[]],['add','e','en',True,1,[]],['request','fr-CA',False,[],None],['request','fr-BE',False,[],None],['request','fr-CA',False,[],'e']]", "[['add','a','en',True,9,['marks']],['add','b','en',True,2,['marks','spell','pause']],['request','en',True,['marks','spell'],None],['add','a','en',True,10,['marks','spell']],['request','en',True,['spell'],None]]", "[['add','a','en',True,N+5,[]],['add','b','en',True,1,[]],['remove','a'],['request','en',False,[],None],['remove','b'],['enable','b'],['request','en',False,[],None]]", "[['add','remote','ja',False,N,[]],['request','ja',False,[],None],['request','ja',True,[],None],['request','de',False,[],'remote']]", "[['request','en',True,[],None]]"]
expected = {1: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 2: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 3: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 4: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 5: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    voices={}; disabled=set(); out=[]
    for e in events:
        if e[0]=='add': voices[e[1]]=e[1:]
        elif e[0]=='remove': disabled.add(e[1])
        elif e[0]=='enable': disabled.discard(e[1])
        elif e[0]=='request':
            lang,offline,required,preferred=e[1:]
            rows=[v for k,v in voices.items() if k not in disabled]
            rows=[v for v in rows if not offline or v[2]]
            rows=[v for v in rows if set(required)<=set(v[4])]
            rows=[v for v in rows if v[1]==lang or v[1]=='en']
            if not rows: out.append(None); continue
            def rank(v):
                language_rank=0 if v[1]==lang else (1 if v[1].split('-')[0]==lang.split('-')[0] else 2)
                return (v[0]!=preferred,language_rank,not v[2],-v[3],v[0])
            out.append(min(rows,key=rank)[0])
    return [out,list(voices),sorted(disabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','en',True,1,['marks']],['add','b','en',True,N+5,['marks','spell']],['request','en',True,['marks'],None]]", "[['add','a','fr',False,9,['marks']],['add','b','fr',True,1,['marks']],['request','fr',False,[],None],['request','fr',True,[],None],['request','fr',False,[],'a']]", "[['add','z','fr-CA',True,1,[]],['add','a','fr',True,9,[]],['add','e','en',True,1,[]],['request','fr-CA',False,[],None],['request','fr-BE',False,[],None],['request','fr-CA',False,[],'e']]", "[['add','a','en',True,9,['marks']],['add','b','en',True,2,['marks','spell','pause']],['request','en',True,['marks','spell'],None],['add','a','en',True,10,['marks','spell']],['request','en',True,['spell'],None]]", "[['add','a','en',True,N+5,[]],['add','b','en',True,1,[]],['remove','a'],['request','en',False,[],None],['remove','b'],['enable','b'],['request','en',False,[],None]]", "[['add','remote','ja',False,N,[]],['request','ja',False,[],None],['request','ja',True,[],None],['request','de',False,[],'remote']]", "[['request','en',True,[],None]]"]
expected = {1: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 2: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 3: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 4: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 5: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

prompt:
The announcement trace violates the stated voice-negotiation contract.

Voice inventory rows are [id,language,local,quality,features]. Request [language,offline,required-features,preferred-id]. Selection excludes unavailable or missing-feature voices, honors exact preferred only among eligible, then ranks exact language before base-language before en fallback, local before remote, higher quality, then lexical ID. Add replaces same ID; remove marks unavailable; enable restores it. Return selected IDs or None, inventory IDs and disabled IDs.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    voices={}; disabled=set(); out=[]
    for e in events:
        if e[0]=='add': voices[e[1]]=e[1:]
        elif e[0]=='remove': disabled.add(e[1])
        elif e[0]=='enable': disabled.discard(e[1])
        elif e[0]=='request':
            lang,offline,required,preferred=e[1:]
            rows=[v for k,v in voices.items() if k not in disabled]
            rows=[v for v in rows if not offline or v[2]]
            rows=[v for v in rows if set(required)<=set(v[4])]
            rows=[v for v in rows if v[1]==lang or v[1].split('-')[0]==lang.split('-')[0] or v[1]=='en']
            if not rows: out.append(None); continue
            def rank(v):
                language_rank=0 if v[1]==lang else (1 if v[1].split('-')[0]==lang.split('-')[0] else 2)
                return (False,language_rank,not v[2],-v[3],v[0])
            out.append(min(rows,key=rank)[0])
    return [out,list(voices),sorted(disabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','en',True,1,['marks']],['add','b','en',True,N+5,['marks','spell']],['request','en',True,['marks'],None]]", "[['add','a','fr',False,9,['marks']],['add','b','fr',True,1,['marks']],['request','fr',False,[],None],['request','fr',True,[],None],['request','fr',False,[],'a']]", "[['add','z','fr-CA',True,1,[]],['add','a','fr',True,9,[]],['add','e','en',True,1,[]],['request','fr-CA',False,[],None],['request','fr-BE',False,[],None],['request','fr-CA',False,[],'e']]", "[['add','a','en',True,9,['marks']],['add','b','en',True,2,['marks','spell','pause']],['request','en',True,['marks','spell'],None],['add','a','en',True,10,['marks','spell']],['request','en',True,['spell'],None]]", "[['add','a','en',True,N+5,[]],['add','b','en',True,1,[]],['remove','a'],['request','en',False,[],None],['remove','b'],['enable','b'],['request','en',False,[],None]]", "[['add','remote','ja',False,N,[]],['request','ja',False,[],None],['request','ja',True,[],None],['request','de',False,[],'remote']]", "[['request','en',True,[],None]]"]
expected = {1: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 2: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 3: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 4: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 5: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    voices={}; disabled=set(); out=[]
    for e in events:
        if e[0]=='add': voices[e[1]]=e[1:]
        elif e[0]=='remove': disabled.add(e[1])
        elif e[0]=='enable': disabled.discard(e[1])
        elif e[0]=='request':
            lang,offline,required,preferred=e[1:]
            rows=[v for k,v in voices.items() if k not in disabled]
            rows=[v for v in rows if not offline or v[2]]
            rows=[v for v in rows if set(required)<=set(v[4])]
            rows=[v for v in rows if v[1]==lang or v[1].split('-')[0]==lang.split('-')[0] or v[1]=='en']
            if not rows: out.append(None); continue
            def rank(v):
                language_rank=0 if v[1]==lang else (1 if v[1].split('-')[0]==lang.split('-')[0] else 2)
                return (v[0]!=preferred and language_rank==0,language_rank,not v[2],-v[3],v[0])
            out.append(min(rows,key=rank)[0])
    return [out,list(voices),sorted(disabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','en',True,1,['marks']],['add','b','en',True,N+5,['marks','spell']],['request','en',True,['marks'],None]]", "[['add','a','fr',False,9,['marks']],['add','b','fr',True,1,['marks']],['request','fr',False,[],None],['request','fr',True,[],None],['request','fr',False,[],'a']]", "[['add','z','fr-CA',True,1,[]],['add','a','fr',True,9,[]],['add','e','en',True,1,[]],['request','fr-CA',False,[],None],['request','fr-BE',False,[],None],['request','fr-CA',False,[],'e']]", "[['add','a','en',True,9,['marks']],['add','b','en',True,2,['marks','spell','pause']],['request','en',True,['marks','spell'],None],['add','a','en',True,10,['marks','spell']],['request','en',True,['spell'],None]]", "[['add','a','en',True,N+5,[]],['add','b','en',True,1,[]],['remove','a'],['request','en',False,[],None],['remove','b'],['enable','b'],['request','en',False,[],None]]", "[['add','remote','ja',False,N,[]],['request','ja',False,[],None],['request','ja',True,[],None],['request','de',False,[],'remote']]", "[['request','en',True,[],None]]"]
expected = {1: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 2: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 3: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 4: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 5: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

prompt:
The announcement trace violates the stated voice-negotiation contract.

Voice inventory rows are [id,language,local,quality,features]. Request [language,offline,required-features,preferred-id]. Selection excludes unavailable or missing-feature voices, honors exact preferred only among eligible, then ranks exact language before base-language before en fallback, local before remote, higher quality, then lexical ID. Add replaces same ID; remove marks unavailable; enable restores it. Return selected IDs or None, inventory IDs and disabled IDs.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    voices={}; disabled=set(); out=[]
    for e in events:
        if e[0]=='add': voices[e[1]]=e[1:]
        elif e[0]=='remove': disabled.add(e[1])
        elif e[0]=='enable': disabled.discard(e[1])
        elif e[0]=='request':
            lang,offline,required,preferred=e[1:]
            rows=[v for k,v in voices.items() if k not in disabled]
            rows=[v for v in rows if not offline or v[2]]
            rows=[v for v in rows if set(required)<=set(v[4])]
            rows=[v for v in rows if v[1]==lang or v[1].split('-')[0]==lang.split('-')[0] or v[1]=='en']
            if not rows: out.append(None); continue
            def rank(v):
                language_rank=1 if v[1]==lang else (0 if v[1].split('-')[0]==lang.split('-')[0] else 2)
                return (v[0]!=preferred,language_rank,not v[2],-v[3],v[0])
            out.append(min(rows,key=rank)[0])
    return [out,list(voices),sorted(disabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','en',True,1,['marks']],['add','b','en',True,N+5,['marks','spell']],['request','en',True,['marks'],None]]", "[['add','a','fr',False,9,['marks']],['add','b','fr',True,1,['marks']],['request','fr',False,[],None],['request','fr',True,[],None],['request','fr',False,[],'a']]", "[['add','z','fr-CA',True,1,[]],['add','a','fr',True,9,[]],['add','e','en',True,1,[]],['request','fr-CA',False,[],None],['request','fr-BE',False,[],None],['request','fr-CA',False,[],'e']]", "[['add','a','en',True,9,['marks']],['add','b','en',True,2,['marks','spell','pause']],['request','en',True,['marks','spell'],None],['add','a','en',True,10,['marks','spell']],['request','en',True,['spell'],None]]", "[['add','a','en',True,N+5,[]],['add','b','en',True,1,[]],['remove','a'],['request','en',False,[],None],['remove','b'],['enable','b'],['request','en',False,[],None]]", "[['add','remote','ja',False,N,[]],['request','ja',False,[],None],['request','ja',True,[],None],['request','de',False,[],'remote']]", "[['request','en',True,[],None]]"]
expected = {1: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 2: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 3: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 4: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 5: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    voices={}; disabled=set(); out=[]
    for e in events:
        if e[0]=='add': voices[e[1]]=e[1:]
        elif e[0]=='remove': disabled.add(e[1])
        elif e[0]=='enable': disabled.discard(e[1])
        elif e[0]=='request':
            lang,offline,required,preferred=e[1:]
            rows=[v for k,v in voices.items() if k not in disabled]
            rows=[v for v in rows if not offline or v[2]]
            rows=[v for v in rows if set(required)<=set(v[4])]
            rows=[v for v in rows if v[1]==lang or v[1].split('-')[0]==lang.split('-')[0] or v[1]=='en']
            if not rows: out.append(None); continue
            def rank(v):
                language_rank=0 if v[1].split('-')[0]==lang.split('-')[0] else 2
                return (v[0]!=preferred,language_rank,not v[2],-v[3],v[0])
            out.append(min(rows,key=rank)[0])
    return [out,list(voices),sorted(disabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','en',True,1,['marks']],['add','b','en',True,N+5,['marks','spell']],['request','en',True,['marks'],None]]", "[['add','a','fr',False,9,['marks']],['add','b','fr',True,1,['marks']],['request','fr',False,[],None],['request','fr',True,[],None],['request','fr',False,[],'a']]", "[['add','z','fr-CA',True,1,[]],['add','a','fr',True,9,[]],['add','e','en',True,1,[]],['request','fr-CA',False,[],None],['request','fr-BE',False,[],None],['request','fr-CA',False,[],'e']]", "[['add','a','en',True,9,['marks']],['add','b','en',True,2,['marks','spell','pause']],['request','en',True,['marks','spell'],None],['add','a','en',True,10,['marks','spell']],['request','en',True,['spell'],None]]", "[['add','a','en',True,N+5,[]],['add','b','en',True,1,[]],['remove','a'],['request','en',False,[],None],['remove','b'],['enable','b'],['request','en',False,[],None]]", "[['add','remote','ja',False,N,[]],['request','ja',False,[],None],['request','ja',True,[],None],['request','de',False,[],'remote']]", "[['request','en',True,[],None]]"]
expected = {1: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 2: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 3: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 4: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 5: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

prompt:
The announcement trace violates the stated voice-negotiation contract.

Voice inventory rows are [id,language,local,quality,features]. Request [language,offline,required-features,preferred-id]. Selection excludes unavailable or missing-feature voices, honors exact preferred only among eligible, then ranks exact language before base-language before en fallback, local before remote, higher quality, then lexical ID. Add replaces same ID; remove marks unavailable; enable restores it. Return selected IDs or None, inventory IDs and disabled IDs.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    voices={}; disabled=set(); out=[]
    for e in events:
        if e[0]=='add': voices[e[1]]=e[1:]
        elif e[0]=='remove': disabled.add(e[1])
        elif e[0]=='enable': disabled.discard(e[1])
        elif e[0]=='request':
            lang,offline,required,preferred=e[1:]
            rows=[v for k,v in voices.items() if k not in disabled]
            rows=[v for v in rows if not offline or v[2]]
            rows=[v for v in rows if set(required)<=set(v[4])]
            rows=[v for v in rows if v[1]==lang or v[1].split('-')[0]==lang.split('-')[0] or v[1]=='en']
            if not rows: out.append(None); continue
            def rank(v):
                language_rank=0 if v[1]==lang else (1 if v[1].split('-')[0]==lang.split('-')[0] else 2)
                return (v[0]!=preferred,language_rank,v[2],-v[3],v[0])
            out.append(min(rows,key=rank)[0])
    return [out,list(voices),sorted(disabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','en',True,1,['marks']],['add','b','en',True,N+5,['marks','spell']],['request','en',True,['marks'],None]]", "[['add','a','fr',False,9,['marks']],['add','b','fr',True,1,['marks']],['request','fr',False,[],None],['request','fr',True,[],None],['request','fr',False,[],'a']]", "[['add','z','fr-CA',True,1,[]],['add','a','fr',True,9,[]],['add','e','en',True,1,[]],['request','fr-CA',False,[],None],['request','fr-BE',False,[],None],['request','fr-CA',False,[],'e']]", "[['add','a','en',True,9,['marks']],['add','b','en',True,2,['marks','spell','pause']],['request','en',True,['marks','spell'],None],['add','a','en',True,10,['marks','spell']],['request','en',True,['spell'],None]]", "[['add','a','en',True,N+5,[]],['add','b','en',True,1,[]],['remove','a'],['request','en',False,[],None],['remove','b'],['enable','b'],['request','en',False,[],None]]", "[['add','remote','ja',False,N,[]],['request','ja',False,[],None],['request','ja',True,[],None],['request','de',False,[],'remote']]", "[['request','en',True,[],None]]"]
expected = {1: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 2: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 3: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 4: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 5: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    voices={}; disabled=set(); out=[]
    for e in events:
        if e[0]=='add': voices[e[1]]=e[1:]
        elif e[0]=='remove': disabled.add(e[1])
        elif e[0]=='enable': disabled.discard(e[1])
        elif e[0]=='request':
            lang,offline,required,preferred=e[1:]
            rows=[v for k,v in voices.items() if k not in disabled]
            rows=[v for v in rows if not offline or v[2]]
            rows=[v for v in rows if set(required)<=set(v[4])]
            rows=[v for v in rows if v[1]==lang or v[1].split('-')[0]==lang.split('-')[0] or v[1]=='en']
            if not rows: out.append(None); continue
            def rank(v):
                language_rank=0 if v[1]==lang else (1 if v[1].split('-')[0]==lang.split('-')[0] else 2)
                return (v[0]!=preferred,language_rank,False,-v[3],v[0])
            out.append(min(rows,key=rank)[0])
    return [out,list(voices),sorted(disabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','en',True,1,['marks']],['add','b','en',True,N+5,['marks','spell']],['request','en',True,['marks'],None]]", "[['add','a','fr',False,9,['marks']],['add','b','fr',True,1,['marks']],['request','fr',False,[],None],['request','fr',True,[],None],['request','fr',False,[],'a']]", "[['add','z','fr-CA',True,1,[]],['add','a','fr',True,9,[]],['add','e','en',True,1,[]],['request','fr-CA',False,[],None],['request','fr-BE',False,[],None],['request','fr-CA',False,[],'e']]", "[['add','a','en',True,9,['marks']],['add','b','en',True,2,['marks','spell','pause']],['request','en',True,['marks','spell'],None],['add','a','en',True,10,['marks','spell']],['request','en',True,['spell'],None]]", "[['add','a','en',True,N+5,[]],['add','b','en',True,1,[]],['remove','a'],['request','en',False,[],None],['remove','b'],['enable','b'],['request','en',False,[],None]]", "[['add','remote','ja',False,N,[]],['request','ja',False,[],None],['request','ja',True,[],None],['request','de',False,[],'remote']]", "[['request','en',True,[],None]]"]
expected = {1: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 2: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 3: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 4: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 5: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

prompt:
The announcement trace violates the stated voice-negotiation contract.

Voice inventory rows are [id,language,local,quality,features]. Request [language,offline,required-features,preferred-id]. Selection excludes unavailable or missing-feature voices, honors exact preferred only among eligible, then ranks exact language before base-language before en fallback, local before remote, higher quality, then lexical ID. Add replaces same ID; remove marks unavailable; enable restores it. Return selected IDs or None, inventory IDs and disabled IDs.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    voices={}; disabled=set(); out=[]
    for e in events:
        if e[0]=='add': voices[e[1]]=e[1:]
        elif e[0]=='remove': disabled.add(e[1])
        elif e[0]=='enable': disabled.discard(e[1])
        elif e[0]=='request':
            lang,offline,required,preferred=e[1:]
            rows=[v for k,v in voices.items() if k not in disabled]
            rows=[v for v in rows if not offline or v[2]]
            rows=[v for v in rows if set(required)<=set(v[4])]
            rows=[v for v in rows if v[1]==lang or v[1].split('-')[0]==lang.split('-')[0] or v[1]=='en']
            if not rows: out.append(None); continue
            def rank(v):
                language_rank=0 if v[1]==lang else (1 if v[1].split('-')[0]==lang.split('-')[0] else 2)
                return (v[0]!=preferred,language_rank,not v[2],v[3],v[0])
            out.append(min(rows,key=rank)[0])
    return [out,list(voices),sorted(disabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','en',True,1,['marks']],['add','b','en',True,N+5,['marks','spell']],['request','en',True,['marks'],None]]", "[['add','a','fr',False,9,['marks']],['add','b','fr',True,1,['marks']],['request','fr',False,[],None],['request','fr',True,[],None],['request','fr',False,[],'a']]", "[['add','z','fr-CA',True,1,[]],['add','a','fr',True,9,[]],['add','e','en',True,1,[]],['request','fr-CA',False,[],None],['request','fr-BE',False,[],None],['request','fr-CA',False,[],'e']]", "[['add','a','en',True,9,['marks']],['add','b','en',True,2,['marks','spell','pause']],['request','en',True,['marks','spell'],None],['add','a','en',True,10,['marks','spell']],['request','en',True,['spell'],None]]", "[['add','a','en',True,N+5,[]],['add','b','en',True,1,[]],['remove','a'],['request','en',False,[],None],['remove','b'],['enable','b'],['request','en',False,[],None]]", "[['add','remote','ja',False,N,[]],['request','ja',False,[],None],['request','ja',True,[],None],['request','de',False,[],'remote']]", "[['request','en',True,[],None]]"]
expected = {1: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 2: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 3: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 4: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 5: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    voices={}; disabled=set(); out=[]
    for e in events:
        if e[0]=='add': voices[e[1]]=e[1:]
        elif e[0]=='remove': disabled.add(e[1])
        elif e[0]=='enable': disabled.discard(e[1])
        elif e[0]=='request':
            lang,offline,required,preferred=e[1:]
            rows=[v for k,v in voices.items() if k not in disabled]
            rows=[v for v in rows if not offline or v[2]]
            rows=[v for v in rows if set(required)<=set(v[4])]
            rows=[v for v in rows if v[1]==lang or v[1].split('-')[0]==lang.split('-')[0] or v[1]=='en']
            if not rows: out.append(None); continue
            def rank(v):
                language_rank=0 if v[1]==lang else (1 if v[1].split('-')[0]==lang.split('-')[0] else 2)
                return (v[0]!=preferred,language_rank,not v[2],0,v[0])
            out.append(min(rows,key=rank)[0])
    return [out,list(voices),sorted(disabled)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','en',True,1,['marks']],['add','b','en',True,N+5,['marks','spell']],['request','en',True,['marks'],None]]", "[['add','a','fr',False,9,['marks']],['add','b','fr',True,1,['marks']],['request','fr',False,[],None],['request','fr',True,[],None],['request','fr',False,[],'a']]", "[['add','z','fr-CA',True,1,[]],['add','a','fr',True,9,[]],['add','e','en',True,1,[]],['request','fr-CA',False,[],None],['request','fr-BE',False,[],None],['request','fr-CA',False,[],'e']]", "[['add','a','en',True,9,['marks']],['add','b','en',True,2,['marks','spell','pause']],['request','en',True,['marks','spell'],None],['add','a','en',True,10,['marks','spell']],['request','en',True,['spell'],None]]", "[['add','a','en',True,N+5,[]],['add','b','en',True,1,[]],['remove','a'],['request','en',False,[],None],['remove','b'],['enable','b'],['request','en',False,[],None]]", "[['add','remote','ja',False,N,[]],['request','ja',False,[],None],['request','ja',True,[],None],['request','de',False,[],'remote']]", "[['request','en',True,[],None]]"]
expected = {1: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 2: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 3: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 4: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]], 5: [[['b'], ['a', 'b'], []], [['b', 'b', 'a'], ['a', 'b'], []], [['z', 'a', 'e'], ['z', 'a', 'e'], []], [['b', 'a'], ['a', 'b'], []], [['b', 'b'], ['a', 'b'], ['a']], [['remote', None, None], ['remote'], []], [[None], [], []]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

prompt:
The announcement trace violates the stated voice-negotiation contract.

Voice inventory rows are [id,language,local,quality,features]. Request [language,offline,required-features,preferred-id]. Selection excludes unavailable or missing-feature voices, honors exact preferred only among eligible, then ranks exact language before base-language before en fallback, local before remote, higher quality, then lexical ID. Add replaces same ID; remove marks unavailable; enable restores it. Return selected IDs or None, inventory IDs and disabled IDs.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    languages=['en']; emphasis=['normal']; out=[]; count=0
    for e in events:
        op=e[0]
        if op=='language': languages=[e[1]]
        elif op=='end-language':
            if len(languages)>1: languages.pop()
        elif op=='emphasis': emphasis.append(e[1])
        elif op=='end-emphasis':
            if len(emphasis)>1: emphasis.pop()
        elif op=='reset': languages=['en']; emphasis=['normal']
        elif op=='pause': out.append(['pause',max(0,e[1])])
        elif op=='mark': out.append(['mark',e[1],count])
        else:
            if op=='spell': text=' '.join(e[1])
            elif op=='digits': text=' '.join(['zero','one','two','three','four','five','six','seven','eight','nine'][int(c)] for c in e[1])
            elif op=='break': text='\n'
            else: text=e[1]
            if text: out.append([languages[-1],emphasis[-1],text]); count+=1
    return [out,languages,emphasis,count]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['language','fr'],['language','de'],['text','hallo'*N],['end-language'],['text','salut'],['end-language'],['text','hello']]", "[['emphasis','strong'],['emphasis','soft'],['text','word'*N],['end-emphasis'],['text','more'],['end-emphasis']]", "[['text','x'*N],['pause',-N],['pause',N],['mark','here'],['spell','AB'],['digits','00'+str(N)]]", "[['emphasis','strong'],['text','before'*N],['reset'],['text','after']]", "[['text',''],['break'],['mark','after']]", "[['end-language'],['end-emphasis'],['digits','0']]", '[]']
expected = {1: [[[['de', 'normal', 'hallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'word'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'x'], ['pause', 0], ['pause', 1], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero one']], ['en'], ['normal'], 3], [[['en', 'strong', 'before'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 2: [[[['de', 'normal', 'hallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xx'], ['pause', 0], ['pause', 2], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero two']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 3: [[[['de', 'normal', 'hallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxx'], ['pause', 0], ['pause', 3], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero three']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 4: [[[['de', 'normal', 'hallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxx'], ['pause', 0], ['pause', 4], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero four']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 5: [[[['de', 'normal', 'hallohallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxxx'], ['pause', 0], ['pause', 5], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero five']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    languages=['en']; emphasis=['normal']; out=[]; count=0
    for e in events:
        op=e[0]
        if op=='language': languages.insert(0,e[1])
        elif op=='end-language':
            if len(languages)>1: languages.pop()
        elif op=='emphasis': emphasis.append(e[1])
        elif op=='end-emphasis':
            if len(emphasis)>1: emphasis.pop()
        elif op=='reset': languages=['en']; emphasis=['normal']
        elif op=='pause': out.append(['pause',max(0,e[1])])
        elif op=='mark': out.append(['mark',e[1],count])
        else:
            if op=='spell': text=' '.join(e[1])
            elif op=='digits': text=' '.join(['zero','one','two','three','four','five','six','seven','eight','nine'][int(c)] for c in e[1])
            elif op=='break': text='\n'
            else: text=e[1]
            if text: out.append([languages[-1],emphasis[-1],text]); count+=1
    return [out,languages,emphasis,count]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['language','fr'],['language','de'],['text','hallo'*N],['end-language'],['text','salut'],['end-language'],['text','hello']]", "[['emphasis','strong'],['emphasis','soft'],['text','word'*N],['end-emphasis'],['text','more'],['end-emphasis']]", "[['text','x'*N],['pause',-N],['pause',N],['mark','here'],['spell','AB'],['digits','00'+str(N)]]", "[['emphasis','strong'],['text','before'*N],['reset'],['text','after']]", "[['text',''],['break'],['mark','after']]", "[['end-language'],['end-emphasis'],['digits','0']]", '[]']
expected = {1: [[[['de', 'normal', 'hallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'word'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'x'], ['pause', 0], ['pause', 1], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero one']], ['en'], ['normal'], 3], [[['en', 'strong', 'before'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 2: [[[['de', 'normal', 'hallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xx'], ['pause', 0], ['pause', 2], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero two']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 3: [[[['de', 'normal', 'hallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxx'], ['pause', 0], ['pause', 3], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero three']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 4: [[[['de', 'normal', 'hallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxx'], ['pause', 0], ['pause', 4], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero four']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 5: [[[['de', 'normal', 'hallohallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxxx'], ['pause', 0], ['pause', 5], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero five']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

prompt:
The announcement trace violates the stated speech-markup contract.

Bounded token renderer has independent language and emphasis stacks. Text emits [language,emphasis,text]. Push/pop scopes restore prior values; unmatched pops are ignored. Spell emits characters separated by spaces; digits uses fixed English digit words preserving zeros. Pause emits [pause,nonnegative duration] without text. Mark emits named bookmark and current spoken-text count. Break emits newline. Reset restores base en/normal without deleting output. Empty text emits nothing.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    languages=['en']; emphasis=['normal']; out=[]; count=0
    for e in events:
        op=e[0]
        if op=='language': languages.append(e[1])
        elif op=='end-language':
            if len(languages)>1: languages=[languages[0]]
        elif op=='emphasis': emphasis.append(e[1])
        elif op=='end-emphasis':
            if len(emphasis)>1: emphasis.pop()
        elif op=='reset': languages=['en']; emphasis=['normal']
        elif op=='pause': out.append(['pause',max(0,e[1])])
        elif op=='mark': out.append(['mark',e[1],count])
        else:
            if op=='spell': text=' '.join(e[1])
            elif op=='digits': text=' '.join(['zero','one','two','three','four','five','six','seven','eight','nine'][int(c)] for c in e[1])
            elif op=='break': text='\n'
            else: text=e[1]
            if text: out.append([languages[-1],emphasis[-1],text]); count+=1
    return [out,languages,emphasis,count]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['language','fr'],['language','de'],['text','hallo'*N],['end-language'],['text','salut'],['end-language'],['text','hello']]", "[['emphasis','strong'],['emphasis','soft'],['text','word'*N],['end-emphasis'],['text','more'],['end-emphasis']]", "[['text','x'*N],['pause',-N],['pause',N],['mark','here'],['spell','AB'],['digits','00'+str(N)]]", "[['emphasis','strong'],['text','before'*N],['reset'],['text','after']]", "[['text',''],['break'],['mark','after']]", "[['end-language'],['end-emphasis'],['digits','0']]", '[]']
expected = {1: [[[['de', 'normal', 'hallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'word'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'x'], ['pause', 0], ['pause', 1], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero one']], ['en'], ['normal'], 3], [[['en', 'strong', 'before'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 2: [[[['de', 'normal', 'hallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xx'], ['pause', 0], ['pause', 2], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero two']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 3: [[[['de', 'normal', 'hallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxx'], ['pause', 0], ['pause', 3], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero three']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 4: [[[['de', 'normal', 'hallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxx'], ['pause', 0], ['pause', 4], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero four']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 5: [[[['de', 'normal', 'hallohallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxxx'], ['pause', 0], ['pause', 5], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero five']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    languages=['en']; emphasis=['normal']; out=[]; count=0
    for e in events:
        op=e[0]
        if op=='language': languages.append(e[1])
        elif op=='end-language':
            if len(languages)>1: languages.pop(0)
        elif op=='emphasis': emphasis.append(e[1])
        elif op=='end-emphasis':
            if len(emphasis)>1: emphasis.pop()
        elif op=='reset': languages=['en']; emphasis=['normal']
        elif op=='pause': out.append(['pause',max(0,e[1])])
        elif op=='mark': out.append(['mark',e[1],count])
        else:
            if op=='spell': text=' '.join(e[1])
            elif op=='digits': text=' '.join(['zero','one','two','three','four','five','six','seven','eight','nine'][int(c)] for c in e[1])
            elif op=='break': text='\n'
            else: text=e[1]
            if text: out.append([languages[-1],emphasis[-1],text]); count+=1
    return [out,languages,emphasis,count]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['language','fr'],['language','de'],['text','hallo'*N],['end-language'],['text','salut'],['end-language'],['text','hello']]", "[['emphasis','strong'],['emphasis','soft'],['text','word'*N],['end-emphasis'],['text','more'],['end-emphasis']]", "[['text','x'*N],['pause',-N],['pause',N],['mark','here'],['spell','AB'],['digits','00'+str(N)]]", "[['emphasis','strong'],['text','before'*N],['reset'],['text','after']]", "[['text',''],['break'],['mark','after']]", "[['end-language'],['end-emphasis'],['digits','0']]", '[]']
expected = {1: [[[['de', 'normal', 'hallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'word'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'x'], ['pause', 0], ['pause', 1], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero one']], ['en'], ['normal'], 3], [[['en', 'strong', 'before'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 2: [[[['de', 'normal', 'hallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xx'], ['pause', 0], ['pause', 2], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero two']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 3: [[[['de', 'normal', 'hallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxx'], ['pause', 0], ['pause', 3], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero three']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 4: [[[['de', 'normal', 'hallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxx'], ['pause', 0], ['pause', 4], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero four']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 5: [[[['de', 'normal', 'hallohallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxxx'], ['pause', 0], ['pause', 5], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero five']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

prompt:
The announcement trace violates the stated speech-markup contract.

Bounded token renderer has independent language and emphasis stacks. Text emits [language,emphasis,text]. Push/pop scopes restore prior values; unmatched pops are ignored. Spell emits characters separated by spaces; digits uses fixed English digit words preserving zeros. Pause emits [pause,nonnegative duration] without text. Mark emits named bookmark and current spoken-text count. Break emits newline. Reset restores base en/normal without deleting output. Empty text emits nothing.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    languages=['en']; emphasis=['normal']; out=[]; count=0
    for e in events:
        op=e[0]
        if op=='language': languages.append(e[1])
        elif op=='end-language':
            if len(languages)>1: languages.pop()
        elif op=='emphasis': languages.append(e[1])
        elif op=='end-emphasis':
            if len(emphasis)>1: emphasis.pop()
        elif op=='reset': languages=['en']; emphasis=['normal']
        elif op=='pause': out.append(['pause',max(0,e[1])])
        elif op=='mark': out.append(['mark',e[1],count])
        else:
            if op=='spell': text=' '.join(e[1])
            elif op=='digits': text=' '.join(['zero','one','two','three','four','five','six','seven','eight','nine'][int(c)] for c in e[1])
            elif op=='break': text='\n'
            else: text=e[1]
            if text: out.append([languages[-1],emphasis[-1],text]); count+=1
    return [out,languages,emphasis,count]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['language','fr'],['language','de'],['text','hallo'*N],['end-language'],['text','salut'],['end-language'],['text','hello']]", "[['emphasis','strong'],['emphasis','soft'],['text','word'*N],['end-emphasis'],['text','more'],['end-emphasis']]", "[['text','x'*N],['pause',-N],['pause',N],['mark','here'],['spell','AB'],['digits','00'+str(N)]]", "[['emphasis','strong'],['text','before'*N],['reset'],['text','after']]", "[['text',''],['break'],['mark','after']]", "[['end-language'],['end-emphasis'],['digits','0']]", '[]']
expected = {1: [[[['de', 'normal', 'hallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'word'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'x'], ['pause', 0], ['pause', 1], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero one']], ['en'], ['normal'], 3], [[['en', 'strong', 'before'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 2: [[[['de', 'normal', 'hallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xx'], ['pause', 0], ['pause', 2], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero two']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 3: [[[['de', 'normal', 'hallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxx'], ['pause', 0], ['pause', 3], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero three']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 4: [[[['de', 'normal', 'hallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxx'], ['pause', 0], ['pause', 4], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero four']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 5: [[[['de', 'normal', 'hallohallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxxx'], ['pause', 0], ['pause', 5], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero five']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    languages=['en']; emphasis=['normal']; out=[]; count=0
    for e in events:
        op=e[0]
        if op=='language': languages.append(e[1])
        elif op=='end-language':
            if len(languages)>1: languages.pop()
        elif op=='emphasis': emphasis=[e[1]]
        elif op=='end-emphasis':
            if len(emphasis)>1: emphasis.pop()
        elif op=='reset': languages=['en']; emphasis=['normal']
        elif op=='pause': out.append(['pause',max(0,e[1])])
        elif op=='mark': out.append(['mark',e[1],count])
        else:
            if op=='spell': text=' '.join(e[1])
            elif op=='digits': text=' '.join(['zero','one','two','three','four','five','six','seven','eight','nine'][int(c)] for c in e[1])
            elif op=='break': text='\n'
            else: text=e[1]
            if text: out.append([languages[-1],emphasis[-1],text]); count+=1
    return [out,languages,emphasis,count]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['language','fr'],['language','de'],['text','hallo'*N],['end-language'],['text','salut'],['end-language'],['text','hello']]", "[['emphasis','strong'],['emphasis','soft'],['text','word'*N],['end-emphasis'],['text','more'],['end-emphasis']]", "[['text','x'*N],['pause',-N],['pause',N],['mark','here'],['spell','AB'],['digits','00'+str(N)]]", "[['emphasis','strong'],['text','before'*N],['reset'],['text','after']]", "[['text',''],['break'],['mark','after']]", "[['end-language'],['end-emphasis'],['digits','0']]", '[]']
expected = {1: [[[['de', 'normal', 'hallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'word'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'x'], ['pause', 0], ['pause', 1], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero one']], ['en'], ['normal'], 3], [[['en', 'strong', 'before'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 2: [[[['de', 'normal', 'hallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xx'], ['pause', 0], ['pause', 2], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero two']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 3: [[[['de', 'normal', 'hallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxx'], ['pause', 0], ['pause', 3], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero three']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 4: [[[['de', 'normal', 'hallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxx'], ['pause', 0], ['pause', 4], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero four']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 5: [[[['de', 'normal', 'hallohallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxxx'], ['pause', 0], ['pause', 5], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero five']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

prompt:
The announcement trace violates the stated speech-markup contract.

Bounded token renderer has independent language and emphasis stacks. Text emits [language,emphasis,text]. Push/pop scopes restore prior values; unmatched pops are ignored. Spell emits characters separated by spaces; digits uses fixed English digit words preserving zeros. Pause emits [pause,nonnegative duration] without text. Mark emits named bookmark and current spoken-text count. Break emits newline. Reset restores base en/normal without deleting output. Empty text emits nothing.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    languages=['en']; emphasis=['normal']; out=[]; count=0
    for e in events:
        op=e[0]
        if op=='language': languages.append(e[1])
        elif op=='end-language':
            if len(languages)>1: languages.pop()
        elif op=='emphasis': emphasis.append(e[1])
        elif op=='end-emphasis':
            if len(emphasis)>1: emphasis.pop(0)
        elif op=='reset': languages=['en']; emphasis=['normal']
        elif op=='pause': out.append(['pause',max(0,e[1])])
        elif op=='mark': out.append(['mark',e[1],count])
        else:
            if op=='spell': text=' '.join(e[1])
            elif op=='digits': text=' '.join(['zero','one','two','three','four','five','six','seven','eight','nine'][int(c)] for c in e[1])
            elif op=='break': text='\n'
            else: text=e[1]
            if text: out.append([languages[-1],emphasis[-1],text]); count+=1
    return [out,languages,emphasis,count]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['language','fr'],['language','de'],['text','hallo'*N],['end-language'],['text','salut'],['end-language'],['text','hello']]", "[['emphasis','strong'],['emphasis','soft'],['text','word'*N],['end-emphasis'],['text','more'],['end-emphasis']]", "[['text','x'*N],['pause',-N],['pause',N],['mark','here'],['spell','AB'],['digits','00'+str(N)]]", "[['emphasis','strong'],['text','before'*N],['reset'],['text','after']]", "[['text',''],['break'],['mark','after']]", "[['end-language'],['end-emphasis'],['digits','0']]", '[]']
expected = {1: [[[['de', 'normal', 'hallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'word'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'x'], ['pause', 0], ['pause', 1], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero one']], ['en'], ['normal'], 3], [[['en', 'strong', 'before'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 2: [[[['de', 'normal', 'hallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xx'], ['pause', 0], ['pause', 2], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero two']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 3: [[[['de', 'normal', 'hallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxx'], ['pause', 0], ['pause', 3], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero three']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 4: [[[['de', 'normal', 'hallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxx'], ['pause', 0], ['pause', 4], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero four']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 5: [[[['de', 'normal', 'hallohallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxxx'], ['pause', 0], ['pause', 5], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero five']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    languages=['en']; emphasis=['normal']; out=[]; count=0
    for e in events:
        op=e[0]
        if op=='language': languages.append(e[1])
        elif op=='end-language':
            if len(languages)>1: languages.pop()
        elif op=='emphasis': emphasis.append(e[1])
        elif op=='end-emphasis':
            if len(emphasis)>1: emphasis=[emphasis[0]]
        elif op=='reset': languages=['en']; emphasis=['normal']
        elif op=='pause': out.append(['pause',max(0,e[1])])
        elif op=='mark': out.append(['mark',e[1],count])
        else:
            if op=='spell': text=' '.join(e[1])
            elif op=='digits': text=' '.join(['zero','one','two','three','four','five','six','seven','eight','nine'][int(c)] for c in e[1])
            elif op=='break': text='\n'
            else: text=e[1]
            if text: out.append([languages[-1],emphasis[-1],text]); count+=1
    return [out,languages,emphasis,count]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['language','fr'],['language','de'],['text','hallo'*N],['end-language'],['text','salut'],['end-language'],['text','hello']]", "[['emphasis','strong'],['emphasis','soft'],['text','word'*N],['end-emphasis'],['text','more'],['end-emphasis']]", "[['text','x'*N],['pause',-N],['pause',N],['mark','here'],['spell','AB'],['digits','00'+str(N)]]", "[['emphasis','strong'],['text','before'*N],['reset'],['text','after']]", "[['text',''],['break'],['mark','after']]", "[['end-language'],['end-emphasis'],['digits','0']]", '[]']
expected = {1: [[[['de', 'normal', 'hallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'word'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'x'], ['pause', 0], ['pause', 1], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero one']], ['en'], ['normal'], 3], [[['en', 'strong', 'before'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 2: [[[['de', 'normal', 'hallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xx'], ['pause', 0], ['pause', 2], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero two']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 3: [[[['de', 'normal', 'hallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxx'], ['pause', 0], ['pause', 3], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero three']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 4: [[[['de', 'normal', 'hallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxx'], ['pause', 0], ['pause', 4], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero four']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 5: [[[['de', 'normal', 'hallohallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxxx'], ['pause', 0], ['pause', 5], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero five']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

prompt:
The announcement trace violates the stated speech-markup contract.

Bounded token renderer has independent language and emphasis stacks. Text emits [language,emphasis,text]. Push/pop scopes restore prior values; unmatched pops are ignored. Spell emits characters separated by spaces; digits uses fixed English digit words preserving zeros. Pause emits [pause,nonnegative duration] without text. Mark emits named bookmark and current spoken-text count. Break emits newline. Reset restores base en/normal without deleting output. Empty text emits nothing.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    languages=['en']; emphasis=['normal']; out=[]; count=0
    for e in events:
        op=e[0]
        if op=='language': languages.append(e[1])
        elif op=='end-language':
            if len(languages)>1: languages.pop()
        elif op=='emphasis': emphasis.append(e[1])
        elif op=='end-emphasis':
            if len(emphasis)>1: emphasis.pop()
        elif op=='reset': languages=['en']; emphasis=['normal']; out=[]
        elif op=='pause': out.append(['pause',max(0,e[1])])
        elif op=='mark': out.append(['mark',e[1],count])
        else:
            if op=='spell': text=' '.join(e[1])
            elif op=='digits': text=' '.join(['zero','one','two','three','four','five','six','seven','eight','nine'][int(c)] for c in e[1])
            elif op=='break': text='\n'
            else: text=e[1]
            if text: out.append([languages[-1],emphasis[-1],text]); count+=1
    return [out,languages,emphasis,count]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['language','fr'],['language','de'],['text','hallo'*N],['end-language'],['text','salut'],['end-language'],['text','hello']]", "[['emphasis','strong'],['emphasis','soft'],['text','word'*N],['end-emphasis'],['text','more'],['end-emphasis']]", "[['text','x'*N],['pause',-N],['pause',N],['mark','here'],['spell','AB'],['digits','00'+str(N)]]", "[['emphasis','strong'],['text','before'*N],['reset'],['text','after']]", "[['text',''],['break'],['mark','after']]", "[['end-language'],['end-emphasis'],['digits','0']]", '[]']
expected = {1: [[[['de', 'normal', 'hallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'word'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'x'], ['pause', 0], ['pause', 1], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero one']], ['en'], ['normal'], 3], [[['en', 'strong', 'before'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 2: [[[['de', 'normal', 'hallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xx'], ['pause', 0], ['pause', 2], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero two']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 3: [[[['de', 'normal', 'hallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxx'], ['pause', 0], ['pause', 3], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero three']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 4: [[[['de', 'normal', 'hallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxx'], ['pause', 0], ['pause', 4], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero four']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 5: [[[['de', 'normal', 'hallohallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxxx'], ['pause', 0], ['pause', 5], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero five']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events):
    languages=['en']; emphasis=['normal']; out=[]; count=0
    for e in events:
        op=e[0]
        if op=='language': languages.append(e[1])
        elif op=='end-language':
            if len(languages)>1: languages.pop()
        elif op=='emphasis': emphasis.append(e[1])
        elif op=='end-emphasis':
            if len(emphasis)>1: emphasis.pop()
        elif op=='reset': languages=['en']
        elif op=='pause': out.append(['pause',max(0,e[1])])
        elif op=='mark': out.append(['mark',e[1],count])
        else:
            if op=='spell': text=' '.join(e[1])
            elif op=='digits': text=' '.join(['zero','one','two','three','four','five','six','seven','eight','nine'][int(c)] for c in e[1])
            elif op=='break': text='\n'
            else: text=e[1]
            if text: out.append([languages[-1],emphasis[-1],text]); count+=1
    return [out,languages,emphasis,count]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['language','fr'],['language','de'],['text','hallo'*N],['end-language'],['text','salut'],['end-language'],['text','hello']]", "[['emphasis','strong'],['emphasis','soft'],['text','word'*N],['end-emphasis'],['text','more'],['end-emphasis']]", "[['text','x'*N],['pause',-N],['pause',N],['mark','here'],['spell','AB'],['digits','00'+str(N)]]", "[['emphasis','strong'],['text','before'*N],['reset'],['text','after']]", "[['text',''],['break'],['mark','after']]", "[['end-language'],['end-emphasis'],['digits','0']]", '[]']
expected = {1: [[[['de', 'normal', 'hallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'word'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'x'], ['pause', 0], ['pause', 1], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero one']], ['en'], ['normal'], 3], [[['en', 'strong', 'before'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 2: [[[['de', 'normal', 'hallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xx'], ['pause', 0], ['pause', 2], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero two']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 3: [[[['de', 'normal', 'hallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxx'], ['pause', 0], ['pause', 3], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero three']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 4: [[[['de', 'normal', 'hallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxx'], ['pause', 0], ['pause', 4], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero four']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]], 5: [[[['de', 'normal', 'hallohallohallohallohallo'], ['fr', 'normal', 'salut'], ['en', 'normal', 'hello']], ['en'], ['normal'], 3], [[['en', 'soft', 'wordwordwordwordword'], ['en', 'strong', 'more']], ['en'], ['normal'], 2], [[['en', 'normal', 'xxxxx'], ['pause', 0], ['pause', 5], ['mark', 'here', 1], ['en', 'normal', 'A B'], ['en', 'normal', 'zero zero five']], ['en'], ['normal'], 3], [[['en', 'strong', 'beforebeforebeforebeforebefore'], ['en', 'normal', 'after']], ['en'], ['normal'], 2], [[['en', 'normal', '\n'], ['mark', 'after', 1]], ['en'], ['normal'], 1], [[['en', 'normal', 'zero']], ['en'], ['normal'], 1], [[], ['en'], ['normal'], 0]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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)

prompt:
The announcement trace violates the stated speech-markup contract.

Bounded token renderer has independent language and emphasis stacks. Text emits [language,emphasis,text]. Push/pop scopes restore prior values; unmatched pops are ignored. Spell emits characters separated by spaces; digits uses fixed English digit words preserving zeros. Pause emits [pause,nonnegative duration] without text. Mark emits named bookmark and current spoken-text count. Break emits newline. Reset restores base en/normal without deleting output. Empty text emits nothing.

split: open-access