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

N = 1
observations = []
def solve(events):
    items=[]; batching=False; changes=0; out=[]
    for e in events:
        op=e[0]; cue=None
        index=next((i for i,x in enumerate(items) if len(e)>1 and x[0]==e[1]),None)
        if op=='begin': batching=True; changes=0
        elif op=='end':
            if batching and changes: out.append(['changes',changes])
            batching=False; changes=0
        elif op=='reset': items=[]
        elif op=='count': out.append(['count',len(items)])
        elif op=='add':
            if index is not None: items[index][1]=e[2]
            else:
                position=max(0,min(len(items),e[3])); items.insert(position,[e[1],e[2]])
                cue=['added',e[2],position+1]
        elif index is not None:
            if op=='remove':
                item=items.pop(index); cue=['removed',item[0],index+1]
            elif op=='rename': cue=['renamed',items[index][1],e[2]]; items[index][1]=e[2]
            elif op=='move':
                item=items.pop(index); position=max(0,min(len(items),e[2])); items.insert(position,item)
                cue=['moved',item[1],index+1,position+1]
        if cue is not None:
            if batching: changes+=1
            else: out.append(cue)
    return [out,items,batching,changes]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','Alpha'*N,0],['add','b','Beta',0],['add','c','Gamma',1],['count'],['remove','c']]", "[['add','a','Old',0],['add','a','New'*N,4],['rename','a','Latest']]", "[['add','a','A'*N,0],['add','b','B',1],['add','c','C',2],['move','a',99],['move','c',0]]", "[['begin'],['add','a','A'*N,0],['add','b','B',1],['end'],['begin'],['end']]", "[['add','a','A'*N,0],['reset'],['count']]", "[['remove','missing'],['move','missing',N],['end']]", '[]']
expected = {1: [[[['added', 'Alpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'Alpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'New', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'A', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'A', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'A']], False, 0], [[['changes', 2]], [['a', 'A'], ['b', 'B']], False, 0], [[['added', 'A', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 2: [[[['added', 'AlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AA']], False, 0], [[['changes', 2]], [['a', 'AA'], ['b', 'B']], False, 0], [[['added', 'AA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 3: [[[['added', 'AlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAA']], False, 0], [[['changes', 2]], [['a', 'AAA'], ['b', 'B']], False, 0], [[['added', 'AAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 4: [[[['added', 'AlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAA']], False, 0], [[['changes', 2]], [['a', 'AAAA'], ['b', 'B']], False, 0], [[['added', 'AAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 5: [[[['added', 'AlphaAlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAAA']], False, 0], [[['changes', 2]], [['a', 'AAAAA'], ['b', 'B']], False, 0], [[['added', 'AAAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 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):
    items=[]; batching=False; changes=0; out=[]
    for e in events:
        op=e[0]; cue=None
        index=next((i for i,x in enumerate(items) if len(e)>1 and x[0]==e[1]),None)
        if op=='begin': batching=True; changes=0
        elif op=='end':
            if batching and changes: out.append(['changes',changes])
            batching=False; changes=0
        elif op=='reset': items=[]
        elif op=='count': out.append(['count',len(items)])
        elif op=='add':
            if index is not None: items[index][1]=e[2]
            else:
                position=max(0,min(len(items),e[3])); items.insert(position,[e[1],e[2]])
                cue=['added',e[2],position+1]
        elif index is not None:
            if op=='remove':
                item=items.pop(index); cue=['removed',item[1],len(items)+1]
            elif op=='rename': cue=['renamed',items[index][1],e[2]]; items[index][1]=e[2]
            elif op=='move':
                item=items.pop(index); position=max(0,min(len(items),e[2])); items.insert(position,item)
                cue=['moved',item[1],index+1,position+1]
        if cue is not None:
            if batching: changes+=1
            else: out.append(cue)
    return [out,items,batching,changes]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','Alpha'*N,0],['add','b','Beta',0],['add','c','Gamma',1],['count'],['remove','c']]", "[['add','a','Old',0],['add','a','New'*N,4],['rename','a','Latest']]", "[['add','a','A'*N,0],['add','b','B',1],['add','c','C',2],['move','a',99],['move','c',0]]", "[['begin'],['add','a','A'*N,0],['add','b','B',1],['end'],['begin'],['end']]", "[['add','a','A'*N,0],['reset'],['count']]", "[['remove','missing'],['move','missing',N],['end']]", '[]']
expected = {1: [[[['added', 'Alpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'Alpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'New', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'A', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'A', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'A']], False, 0], [[['changes', 2]], [['a', 'A'], ['b', 'B']], False, 0], [[['added', 'A', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 2: [[[['added', 'AlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AA']], False, 0], [[['changes', 2]], [['a', 'AA'], ['b', 'B']], False, 0], [[['added', 'AA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 3: [[[['added', 'AlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAA']], False, 0], [[['changes', 2]], [['a', 'AAA'], ['b', 'B']], False, 0], [[['added', 'AAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 4: [[[['added', 'AlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAA']], False, 0], [[['changes', 2]], [['a', 'AAAA'], ['b', 'B']], False, 0], [[['added', 'AAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 5: [[[['added', 'AlphaAlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAAA']], False, 0], [[['changes', 2]], [['a', 'AAAAA'], ['b', 'B']], False, 0], [[['added', 'AAAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 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 list-change-narration contract.

An ordered collection maps unique item IDs to spoken labels. Add inserts at clamped zero-based position; existing ID updates label without moving. Remove announces old one-based position. Move removes then inserts at clamped destination and announces old/new positions. Rename announces old/new labels. Begin silences individual cues while accumulating cue count; end announces only count and clears batching. Reset clears list with no cue. Count command reports current cardinality. Return cues and ordered [id,label].

split: open-access


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

N = 1
observations = []
def solve(events):
    items=[]; batching=False; changes=0; out=[]
    for e in events:
        op=e[0]; cue=None
        index=next((i for i,x in enumerate(items) if len(e)>1 and x[0]==e[1]),None)
        if op=='begin': batching=True; changes=0
        elif op=='end':
            if batching and changes: out.append(['changes',changes])
            batching=False; changes=0
        elif op=='reset': items=[]
        elif op=='count': out.append(['count',len(items)])
        elif op=='add':
            if index is not None: items[index][1]=e[2]
            else:
                position=max(0,min(len(items),e[3])); items.insert(position,[e[1],e[2]])
                cue=['added',e[2],position+1]
        elif index is not None:
            if op=='remove':
                item=items.pop(index); cue=['removed',item[1],index+1]
            elif op=='rename': cue=['renamed',e[2],items[index][1]]; items[index][1]=e[2]
            elif op=='move':
                item=items.pop(index); position=max(0,min(len(items),e[2])); items.insert(position,item)
                cue=['moved',item[1],index+1,position+1]
        if cue is not None:
            if batching: changes+=1
            else: out.append(cue)
    return [out,items,batching,changes]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','Alpha'*N,0],['add','b','Beta',0],['add','c','Gamma',1],['count'],['remove','c']]", "[['add','a','Old',0],['add','a','New'*N,4],['rename','a','Latest']]", "[['add','a','A'*N,0],['add','b','B',1],['add','c','C',2],['move','a',99],['move','c',0]]", "[['begin'],['add','a','A'*N,0],['add','b','B',1],['end'],['begin'],['end']]", "[['add','a','A'*N,0],['reset'],['count']]", "[['remove','missing'],['move','missing',N],['end']]", '[]']
expected = {1: [[[['added', 'Alpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'Alpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'New', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'A', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'A', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'A']], False, 0], [[['changes', 2]], [['a', 'A'], ['b', 'B']], False, 0], [[['added', 'A', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 2: [[[['added', 'AlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AA']], False, 0], [[['changes', 2]], [['a', 'AA'], ['b', 'B']], False, 0], [[['added', 'AA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 3: [[[['added', 'AlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAA']], False, 0], [[['changes', 2]], [['a', 'AAA'], ['b', 'B']], False, 0], [[['added', 'AAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 4: [[[['added', 'AlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAA']], False, 0], [[['changes', 2]], [['a', 'AAAA'], ['b', 'B']], False, 0], [[['added', 'AAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 5: [[[['added', 'AlphaAlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAAA']], False, 0], [[['changes', 2]], [['a', 'AAAAA'], ['b', 'B']], False, 0], [[['added', 'AAAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 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)

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):
    items=[]; batching=False; changes=0; out=[]
    for e in events:
        op=e[0]; cue=None
        index=next((i for i,x in enumerate(items) if len(e)>1 and x[0]==e[1]),None)
        if op=='begin': batching=True; changes=0
        elif op=='end':
            if batching and changes: out.append(['changes',changes])
            batching=False; changes=0
        elif op=='reset': items=[]
        elif op=='count': out.append(['count',len(items)])
        elif op=='add':
            if index is not None: items[index][1]=e[2]
            else:
                position=max(0,min(len(items),e[3])); items.insert(position,[e[1],e[2]])
                cue=['added',e[2],position+1]
        elif index is not None:
            if op=='remove':
                item=items.pop(index); cue=['removed',item[1],index+1]
            elif op=='rename': items[index][1]=e[2]; cue=['renamed',items[index][1],e[2]]
            elif op=='move':
                item=items.pop(index); position=max(0,min(len(items),e[2])); items.insert(position,item)
                cue=['moved',item[1],index+1,position+1]
        if cue is not None:
            if batching: changes+=1
            else: out.append(cue)
    return [out,items,batching,changes]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','Alpha'*N,0],['add','b','Beta',0],['add','c','Gamma',1],['count'],['remove','c']]", "[['add','a','Old',0],['add','a','New'*N,4],['rename','a','Latest']]", "[['add','a','A'*N,0],['add','b','B',1],['add','c','C',2],['move','a',99],['move','c',0]]", "[['begin'],['add','a','A'*N,0],['add','b','B',1],['end'],['begin'],['end']]", "[['add','a','A'*N,0],['reset'],['count']]", "[['remove','missing'],['move','missing',N],['end']]", '[]']
expected = {1: [[[['added', 'Alpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'Alpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'New', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'A', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'A', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'A']], False, 0], [[['changes', 2]], [['a', 'A'], ['b', 'B']], False, 0], [[['added', 'A', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 2: [[[['added', 'AlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AA']], False, 0], [[['changes', 2]], [['a', 'AA'], ['b', 'B']], False, 0], [[['added', 'AA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 3: [[[['added', 'AlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAA']], False, 0], [[['changes', 2]], [['a', 'AAA'], ['b', 'B']], False, 0], [[['added', 'AAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 4: [[[['added', 'AlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAA']], False, 0], [[['changes', 2]], [['a', 'AAAA'], ['b', 'B']], False, 0], [[['added', 'AAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 5: [[[['added', 'AlphaAlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAAA']], False, 0], [[['changes', 2]], [['a', 'AAAAA'], ['b', 'B']], False, 0], [[['added', 'AAAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 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 list-change-narration contract.

An ordered collection maps unique item IDs to spoken labels. Add inserts at clamped zero-based position; existing ID updates label without moving. Remove announces old one-based position. Move removes then inserts at clamped destination and announces old/new positions. Rename announces old/new labels. Begin silences individual cues while accumulating cue count; end announces only count and clears batching. Reset clears list with no cue. Count command reports current cardinality. Return cues and ordered [id,label].

split: open-access


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

N = 1
observations = []
def solve(events):
    items=[]; batching=False; changes=0; out=[]
    for e in events:
        op=e[0]; cue=None
        index=next((i for i,x in enumerate(items) if len(e)>1 and x[0]==e[1]),None)
        if op=='begin': batching=True; changes=0
        elif op=='end':
            if batching and changes: out.append(['changes',changes])
            batching=False; changes=0
        elif op=='reset': items=[]
        elif op=='count': out.append(['count',len(items)])
        elif op=='add':
            if index is not None: items[index][1]=e[2]
            else:
                position=max(0,min(len(items),e[3])); items.insert(position,[e[1],e[2]])
                cue=['added',e[2],position+1]
        elif index is not None:
            if op=='remove':
                item=items.pop(index); cue=['removed',item[1],index+1]
            elif op=='rename': cue=['renamed',items[index][1],e[2]]; items[index][1]=e[2]
            elif op=='move':
                item=items.pop(index); position=max(0,min(len(items),e[2])); items.insert(position,item)
                cue=['moved',item[1],index+1,e[2]+1]
        if cue is not None:
            if batching: changes+=1
            else: out.append(cue)
    return [out,items,batching,changes]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','Alpha'*N,0],['add','b','Beta',0],['add','c','Gamma',1],['count'],['remove','c']]", "[['add','a','Old',0],['add','a','New'*N,4],['rename','a','Latest']]", "[['add','a','A'*N,0],['add','b','B',1],['add','c','C',2],['move','a',99],['move','c',0]]", "[['begin'],['add','a','A'*N,0],['add','b','B',1],['end'],['begin'],['end']]", "[['add','a','A'*N,0],['reset'],['count']]", "[['remove','missing'],['move','missing',N],['end']]", '[]']
expected = {1: [[[['added', 'Alpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'Alpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'New', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'A', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'A', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'A']], False, 0], [[['changes', 2]], [['a', 'A'], ['b', 'B']], False, 0], [[['added', 'A', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 2: [[[['added', 'AlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AA']], False, 0], [[['changes', 2]], [['a', 'AA'], ['b', 'B']], False, 0], [[['added', 'AA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 3: [[[['added', 'AlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAA']], False, 0], [[['changes', 2]], [['a', 'AAA'], ['b', 'B']], False, 0], [[['added', 'AAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 4: [[[['added', 'AlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAA']], False, 0], [[['changes', 2]], [['a', 'AAAA'], ['b', 'B']], False, 0], [[['added', 'AAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 5: [[[['added', 'AlphaAlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAAA']], False, 0], [[['changes', 2]], [['a', 'AAAAA'], ['b', 'B']], False, 0], [[['added', 'AAAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 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):
    items=[]; batching=False; changes=0; out=[]
    for e in events:
        op=e[0]; cue=None
        index=next((i for i,x in enumerate(items) if len(e)>1 and x[0]==e[1]),None)
        if op=='begin': batching=True; changes=0
        elif op=='end':
            if batching and changes: out.append(['changes',changes])
            batching=False; changes=0
        elif op=='reset': items=[]
        elif op=='count': out.append(['count',len(items)])
        elif op=='add':
            if index is not None: items[index][1]=e[2]
            else:
                position=max(0,min(len(items),e[3])); items.insert(position,[e[1],e[2]])
                cue=['added',e[2],position+1]
        elif index is not None:
            if op=='remove':
                item=items.pop(index); cue=['removed',item[1],index+1]
            elif op=='rename': cue=['renamed',items[index][1],e[2]]; items[index][1]=e[2]
            elif op=='move':
                item=items.pop(index); position=max(0,min(len(items),e[2])); items.insert(position,item)
                cue=['moved',item[1],position+1,index+1]
        if cue is not None:
            if batching: changes+=1
            else: out.append(cue)
    return [out,items,batching,changes]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','Alpha'*N,0],['add','b','Beta',0],['add','c','Gamma',1],['count'],['remove','c']]", "[['add','a','Old',0],['add','a','New'*N,4],['rename','a','Latest']]", "[['add','a','A'*N,0],['add','b','B',1],['add','c','C',2],['move','a',99],['move','c',0]]", "[['begin'],['add','a','A'*N,0],['add','b','B',1],['end'],['begin'],['end']]", "[['add','a','A'*N,0],['reset'],['count']]", "[['remove','missing'],['move','missing',N],['end']]", '[]']
expected = {1: [[[['added', 'Alpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'Alpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'New', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'A', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'A', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'A']], False, 0], [[['changes', 2]], [['a', 'A'], ['b', 'B']], False, 0], [[['added', 'A', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 2: [[[['added', 'AlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AA']], False, 0], [[['changes', 2]], [['a', 'AA'], ['b', 'B']], False, 0], [[['added', 'AA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 3: [[[['added', 'AlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAA']], False, 0], [[['changes', 2]], [['a', 'AAA'], ['b', 'B']], False, 0], [[['added', 'AAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 4: [[[['added', 'AlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAA']], False, 0], [[['changes', 2]], [['a', 'AAAA'], ['b', 'B']], False, 0], [[['added', 'AAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 5: [[[['added', 'AlphaAlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAAA']], False, 0], [[['changes', 2]], [['a', 'AAAAA'], ['b', 'B']], False, 0], [[['added', 'AAAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 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 list-change-narration contract.

An ordered collection maps unique item IDs to spoken labels. Add inserts at clamped zero-based position; existing ID updates label without moving. Remove announces old one-based position. Move removes then inserts at clamped destination and announces old/new positions. Rename announces old/new labels. Begin silences individual cues while accumulating cue count; end announces only count and clears batching. Reset clears list with no cue. Count command reports current cardinality. Return cues and ordered [id,label].

split: open-access


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

N = 1
observations = []
def solve(events):
    items=[]; batching=False; changes=0; out=[]
    for e in events:
        op=e[0]; cue=None
        index=next((i for i,x in enumerate(items) if len(e)>1 and x[0]==e[1]),None)
        if op=='begin': batching=True; changes=0
        elif op=='end':
            if batching and changes: out.append(['changes',changes])
            batching=False; changes=0
        elif op=='reset': items=[]
        elif op=='count': out.append(['count',len(items)])
        elif op=='add':
            if index is not None: items[index][1]=e[2]
            else:
                position=max(0,min(len(items),e[3])); items.insert(position,[e[1],e[2]])
                cue=['added',e[2],position+1]
        elif index is not None:
            if op=='remove':
                item=items.pop(index); cue=['removed',item[1],index+1]
            elif op=='rename': cue=['renamed',items[index][1],e[2]]; items[index][1]=e[2]
            elif op=='move':
                item=items.pop(index); position=max(0,min(len(items),e[2])); items.insert(position,item)
                cue=['moved',item[1],index+1,position+1]
        if cue is not None:
            if batching: changes+=len(cue)
            else: out.append(cue)
    return [out,items,batching,changes]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','Alpha'*N,0],['add','b','Beta',0],['add','c','Gamma',1],['count'],['remove','c']]", "[['add','a','Old',0],['add','a','New'*N,4],['rename','a','Latest']]", "[['add','a','A'*N,0],['add','b','B',1],['add','c','C',2],['move','a',99],['move','c',0]]", "[['begin'],['add','a','A'*N,0],['add','b','B',1],['end'],['begin'],['end']]", "[['add','a','A'*N,0],['reset'],['count']]", "[['remove','missing'],['move','missing',N],['end']]", '[]']
expected = {1: [[[['added', 'Alpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'Alpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'New', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'A', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'A', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'A']], False, 0], [[['changes', 2]], [['a', 'A'], ['b', 'B']], False, 0], [[['added', 'A', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 2: [[[['added', 'AlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AA']], False, 0], [[['changes', 2]], [['a', 'AA'], ['b', 'B']], False, 0], [[['added', 'AA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 3: [[[['added', 'AlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAA']], False, 0], [[['changes', 2]], [['a', 'AAA'], ['b', 'B']], False, 0], [[['added', 'AAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 4: [[[['added', 'AlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAA']], False, 0], [[['changes', 2]], [['a', 'AAAA'], ['b', 'B']], False, 0], [[['added', 'AAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 5: [[[['added', 'AlphaAlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAAA']], False, 0], [[['changes', 2]], [['a', 'AAAAA'], ['b', 'B']], False, 0], [[['added', 'AAAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 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):
    items=[]; batching=False; changes=0; out=[]
    for e in events:
        op=e[0]; cue=None
        index=next((i for i,x in enumerate(items) if len(e)>1 and x[0]==e[1]),None)
        if op=='begin': batching=True; changes=0
        elif op=='end':
            if batching and changes: out.append(['changes',changes])
            batching=False; changes=0
        elif op=='reset': items=[]
        elif op=='count': out.append(['count',len(items)])
        elif op=='add':
            if index is not None: items[index][1]=e[2]
            else:
                position=max(0,min(len(items),e[3])); items.insert(position,[e[1],e[2]])
                cue=['added',e[2],position+1]
        elif index is not None:
            if op=='remove':
                item=items.pop(index); cue=['removed',item[1],index+1]
            elif op=='rename': cue=['renamed',items[index][1],e[2]]; items[index][1]=e[2]
            elif op=='move':
                item=items.pop(index); position=max(0,min(len(items),e[2])); items.insert(position,item)
                cue=['moved',item[1],index+1,position+1]
        if cue is not None:
            if batching: changes=1
            else: out.append(cue)
    return [out,items,batching,changes]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','a','Alpha'*N,0],['add','b','Beta',0],['add','c','Gamma',1],['count'],['remove','c']]", "[['add','a','Old',0],['add','a','New'*N,4],['rename','a','Latest']]", "[['add','a','A'*N,0],['add','b','B',1],['add','c','C',2],['move','a',99],['move','c',0]]", "[['begin'],['add','a','A'*N,0],['add','b','B',1],['end'],['begin'],['end']]", "[['add','a','A'*N,0],['reset'],['count']]", "[['remove','missing'],['move','missing',N],['end']]", '[]']
expected = {1: [[[['added', 'Alpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'Alpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'New', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'A', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'A', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'A']], False, 0], [[['changes', 2]], [['a', 'A'], ['b', 'B']], False, 0], [[['added', 'A', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 2: [[[['added', 'AlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AA']], False, 0], [[['changes', 2]], [['a', 'AA'], ['b', 'B']], False, 0], [[['added', 'AA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 3: [[[['added', 'AlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAA']], False, 0], [[['changes', 2]], [['a', 'AAA'], ['b', 'B']], False, 0], [[['added', 'AAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 4: [[[['added', 'AlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAA']], False, 0], [[['changes', 2]], [['a', 'AAAA'], ['b', 'B']], False, 0], [[['added', 'AAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 0]], 5: [[[['added', 'AlphaAlphaAlphaAlphaAlpha', 1], ['added', 'Beta', 1], ['added', 'Gamma', 2], ['count', 3], ['removed', 'Gamma', 2]], [['b', 'Beta'], ['a', 'AlphaAlphaAlphaAlphaAlpha']], False, 0], [[['added', 'Old', 1], ['renamed', 'NewNewNewNewNew', 'Latest']], [['a', 'Latest']], False, 0], [[['added', 'AAAAA', 1], ['added', 'B', 2], ['added', 'C', 3], ['moved', 'AAAAA', 1, 3], ['moved', 'C', 2, 1]], [['c', 'C'], ['b', 'B'], ['a', 'AAAAA']], False, 0], [[['changes', 2]], [['a', 'AAAAA'], ['b', 'B']], False, 0], [[['added', 'AAAAA', 1], ['count', 0]], [], False, 0], [[], [], False, 0], [[], [], False, 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 list-change-narration contract.

An ordered collection maps unique item IDs to spoken labels. Add inserts at clamped zero-based position; existing ID updates label without moving. Remove announces old one-based position. Move removes then inserts at clamped destination and announces old/new positions. Rename announces old/new labels. Begin silences individual cues while accumulating cue count; end announces only count and clears batching. Reset clears list with no cue. Count command reports current cardinality. Return cues and ordered [id,label].

split: open-access


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

N = 1
observations = []
def solve(events):
    bundles={}; delivered=set(); out=[]
    for e in events:
        if e[0]=='open': bundles[e[1]]=[[],False]
        elif e[0]=='retract': bundles.pop(e[1],None); delivered.discard(e[1])
        elif len(e)>1 and e[1] in bundles:
            parts,sealed=bundles[e[1]]
            if e[0]=='part' and not sealed: parts.append([e[2],e[3]])
            elif e[0]=='replace' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[1]=e[3]
            elif e[0]=='rename' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[0]=e[3]
            elif e[0]=='limit' and not sealed: del parts[max(0,e[2]):]
            elif e[0]=='seal': bundles[e[1]][1]=True
            elif e[0]=='dispatch':
                if not sealed or not parts: continue
                if e[1] in delivered: continue
                out.append(' | '.join(label+': '+text for label,text in parts))
                delivered.add(e[1]); del bundles[e[1]]
    return [out,[[k,v[0],v[1]] for k,v in bundles.items()],sorted(delivered)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['open','a'],['part','a','Name','A'*N],['part','a','Count','2'],['replace','a','Name','New'],['rename','a','Count','Total'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['part','a','Late','no'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['part','a','Two','y'],['part','a','Three','z'],['limit','a',2],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','a'],['part','a','Again','y'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','b'],['part','b','Two','y'],['retract','b']]", "[['open','a'],['part','a','Partial','x'*N],['dispatch','a'],['open','b'],['seal','b'],['dispatch','b']]", "[['open','a'],['part','a','Old','x'*N],['open','a']]"]
expected = {1: [[['Name: New | Total: 2'], [], ['a']], [['One: x'], [], ['a']], [['One: x | Two: y'], [], ['a']], [['One: x', 'Again: y'], [], ['a']], [['One: x'], [], ['a']], [[], [['a', [['Partial', 'x']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 2: [[['Name: New | Total: 2'], [], ['a']], [['One: xx'], [], ['a']], [['One: xx | Two: y'], [], ['a']], [['One: xx', 'Again: y'], [], ['a']], [['One: xx'], [], ['a']], [[], [['a', [['Partial', 'xx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 3: [[['Name: New | Total: 2'], [], ['a']], [['One: xxx'], [], ['a']], [['One: xxx | Two: y'], [], ['a']], [['One: xxx', 'Again: y'], [], ['a']], [['One: xxx'], [], ['a']], [[], [['a', [['Partial', 'xxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 4: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxx'], [], ['a']], [['One: xxxx | Two: y'], [], ['a']], [['One: xxxx', 'Again: y'], [], ['a']], [['One: xxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 5: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxxx'], [], ['a']], [['One: xxxxx | Two: y'], [], ['a']], [['One: xxxxx', 'Again: y'], [], ['a']], [['One: xxxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]]}[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):
    bundles={}; delivered=set(); out=[]
    for e in events:
        if e[0]=='open': bundles.setdefault(e[1],[[],False]); delivered.discard(e[1])
        elif e[0]=='retract': bundles.pop(e[1],None); delivered.discard(e[1])
        elif len(e)>1 and e[1] in bundles:
            parts,sealed=bundles[e[1]]
            if e[0]=='part' and not sealed: parts.append([e[2],e[3]])
            elif e[0]=='replace' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[1]=e[3]
            elif e[0]=='rename' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[0]=e[3]
            elif e[0]=='limit' and not sealed: del parts[max(0,e[2]):]
            elif e[0]=='seal': bundles[e[1]][1]=True
            elif e[0]=='dispatch':
                if not sealed or not parts: continue
                if e[1] in delivered: continue
                out.append(' | '.join(label+': '+text for label,text in parts))
                delivered.add(e[1]); del bundles[e[1]]
    return [out,[[k,v[0],v[1]] for k,v in bundles.items()],sorted(delivered)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['open','a'],['part','a','Name','A'*N],['part','a','Count','2'],['replace','a','Name','New'],['rename','a','Count','Total'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['part','a','Late','no'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['part','a','Two','y'],['part','a','Three','z'],['limit','a',2],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','a'],['part','a','Again','y'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','b'],['part','b','Two','y'],['retract','b']]", "[['open','a'],['part','a','Partial','x'*N],['dispatch','a'],['open','b'],['seal','b'],['dispatch','b']]", "[['open','a'],['part','a','Old','x'*N],['open','a']]"]
expected = {1: [[['Name: New | Total: 2'], [], ['a']], [['One: x'], [], ['a']], [['One: x | Two: y'], [], ['a']], [['One: x', 'Again: y'], [], ['a']], [['One: x'], [], ['a']], [[], [['a', [['Partial', 'x']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 2: [[['Name: New | Total: 2'], [], ['a']], [['One: xx'], [], ['a']], [['One: xx | Two: y'], [], ['a']], [['One: xx', 'Again: y'], [], ['a']], [['One: xx'], [], ['a']], [[], [['a', [['Partial', 'xx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 3: [[['Name: New | Total: 2'], [], ['a']], [['One: xxx'], [], ['a']], [['One: xxx | Two: y'], [], ['a']], [['One: xxx', 'Again: y'], [], ['a']], [['One: xxx'], [], ['a']], [[], [['a', [['Partial', 'xxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 4: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxx'], [], ['a']], [['One: xxxx | Two: y'], [], ['a']], [['One: xxxx', 'Again: y'], [], ['a']], [['One: xxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 5: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxxx'], [], ['a']], [['One: xxxxx | Two: y'], [], ['a']], [['One: xxxxx', 'Again: y'], [], ['a']], [['One: xxxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]]}[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 utterance-bundle contract.

Bundles are atomic ordered speech segments. Open initializes unsealed bundle; part appends [label,text] while unsealed; replace edits matching label only. Seal marks immutable. Dispatch requires sealed and nonempty, emits a single joined label:text string, removes bundle and records delivered ID. Reopen delivered ID clears delivery receipt. Retract drops bundle and receipt. Rename updates label preserving text. Limit truncates number of pending segments from end. Return speech and pending bundle segments/sealed status.

split: open-access


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

N = 1
observations = []
def solve(events):
    bundles={}; delivered=set(); out=[]
    for e in events:
        if e[0]=='open': bundles[e[1]]=[[],False]; delivered.discard(e[1])
        elif e[0]=='retract': bundles.pop(e[1],None); delivered.clear()
        elif len(e)>1 and e[1] in bundles:
            parts,sealed=bundles[e[1]]
            if e[0]=='part' and not sealed: parts.append([e[2],e[3]])
            elif e[0]=='replace' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[1]=e[3]
            elif e[0]=='rename' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[0]=e[3]
            elif e[0]=='limit' and not sealed: del parts[max(0,e[2]):]
            elif e[0]=='seal': bundles[e[1]][1]=True
            elif e[0]=='dispatch':
                if not sealed or not parts: continue
                if e[1] in delivered: continue
                out.append(' | '.join(label+': '+text for label,text in parts))
                delivered.add(e[1]); del bundles[e[1]]
    return [out,[[k,v[0],v[1]] for k,v in bundles.items()],sorted(delivered)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['open','a'],['part','a','Name','A'*N],['part','a','Count','2'],['replace','a','Name','New'],['rename','a','Count','Total'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['part','a','Late','no'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['part','a','Two','y'],['part','a','Three','z'],['limit','a',2],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','a'],['part','a','Again','y'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','b'],['part','b','Two','y'],['retract','b']]", "[['open','a'],['part','a','Partial','x'*N],['dispatch','a'],['open','b'],['seal','b'],['dispatch','b']]", "[['open','a'],['part','a','Old','x'*N],['open','a']]"]
expected = {1: [[['Name: New | Total: 2'], [], ['a']], [['One: x'], [], ['a']], [['One: x | Two: y'], [], ['a']], [['One: x', 'Again: y'], [], ['a']], [['One: x'], [], ['a']], [[], [['a', [['Partial', 'x']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 2: [[['Name: New | Total: 2'], [], ['a']], [['One: xx'], [], ['a']], [['One: xx | Two: y'], [], ['a']], [['One: xx', 'Again: y'], [], ['a']], [['One: xx'], [], ['a']], [[], [['a', [['Partial', 'xx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 3: [[['Name: New | Total: 2'], [], ['a']], [['One: xxx'], [], ['a']], [['One: xxx | Two: y'], [], ['a']], [['One: xxx', 'Again: y'], [], ['a']], [['One: xxx'], [], ['a']], [[], [['a', [['Partial', 'xxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 4: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxx'], [], ['a']], [['One: xxxx | Two: y'], [], ['a']], [['One: xxxx', 'Again: y'], [], ['a']], [['One: xxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 5: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxxx'], [], ['a']], [['One: xxxxx | Two: y'], [], ['a']], [['One: xxxxx', 'Again: y'], [], ['a']], [['One: xxxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]]}[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):
    bundles={}; delivered=set(); out=[]
    for e in events:
        if e[0]=='open': bundles[e[1]]=[[],False]; delivered.discard(e[1])
        elif e[0]=='retract': delivered.discard(e[1])
        elif len(e)>1 and e[1] in bundles:
            parts,sealed=bundles[e[1]]
            if e[0]=='part' and not sealed: parts.append([e[2],e[3]])
            elif e[0]=='replace' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[1]=e[3]
            elif e[0]=='rename' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[0]=e[3]
            elif e[0]=='limit' and not sealed: del parts[max(0,e[2]):]
            elif e[0]=='seal': bundles[e[1]][1]=True
            elif e[0]=='dispatch':
                if not sealed or not parts: continue
                if e[1] in delivered: continue
                out.append(' | '.join(label+': '+text for label,text in parts))
                delivered.add(e[1]); del bundles[e[1]]
    return [out,[[k,v[0],v[1]] for k,v in bundles.items()],sorted(delivered)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['open','a'],['part','a','Name','A'*N],['part','a','Count','2'],['replace','a','Name','New'],['rename','a','Count','Total'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['part','a','Late','no'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['part','a','Two','y'],['part','a','Three','z'],['limit','a',2],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','a'],['part','a','Again','y'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','b'],['part','b','Two','y'],['retract','b']]", "[['open','a'],['part','a','Partial','x'*N],['dispatch','a'],['open','b'],['seal','b'],['dispatch','b']]", "[['open','a'],['part','a','Old','x'*N],['open','a']]"]
expected = {1: [[['Name: New | Total: 2'], [], ['a']], [['One: x'], [], ['a']], [['One: x | Two: y'], [], ['a']], [['One: x', 'Again: y'], [], ['a']], [['One: x'], [], ['a']], [[], [['a', [['Partial', 'x']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 2: [[['Name: New | Total: 2'], [], ['a']], [['One: xx'], [], ['a']], [['One: xx | Two: y'], [], ['a']], [['One: xx', 'Again: y'], [], ['a']], [['One: xx'], [], ['a']], [[], [['a', [['Partial', 'xx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 3: [[['Name: New | Total: 2'], [], ['a']], [['One: xxx'], [], ['a']], [['One: xxx | Two: y'], [], ['a']], [['One: xxx', 'Again: y'], [], ['a']], [['One: xxx'], [], ['a']], [[], [['a', [['Partial', 'xxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 4: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxx'], [], ['a']], [['One: xxxx | Two: y'], [], ['a']], [['One: xxxx', 'Again: y'], [], ['a']], [['One: xxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 5: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxxx'], [], ['a']], [['One: xxxxx | Two: y'], [], ['a']], [['One: xxxxx', 'Again: y'], [], ['a']], [['One: xxxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]]}[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 utterance-bundle contract.

Bundles are atomic ordered speech segments. Open initializes unsealed bundle; part appends [label,text] while unsealed; replace edits matching label only. Seal marks immutable. Dispatch requires sealed and nonempty, emits a single joined label:text string, removes bundle and records delivered ID. Reopen delivered ID clears delivery receipt. Retract drops bundle and receipt. Rename updates label preserving text. Limit truncates number of pending segments from end. Return speech and pending bundle segments/sealed status.

split: open-access


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

N = 1
observations = []
def solve(events):
    bundles={}; delivered=set(); out=[]
    for e in events:
        if e[0]=='open': bundles[e[1]]=[[],False]; delivered.discard(e[1])
        elif e[0]=='retract': bundles.pop(e[1],None); delivered.discard(e[1])
        elif len(e)>1 and e[1] in bundles:
            parts,sealed=bundles[e[1]]
            if e[0]=='part': parts.append([e[2],e[3]])
            elif e[0]=='replace' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[1]=e[3]
            elif e[0]=='rename' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[0]=e[3]
            elif e[0]=='limit' and not sealed: del parts[max(0,e[2]):]
            elif e[0]=='seal': bundles[e[1]][1]=True
            elif e[0]=='dispatch':
                if not sealed or not parts: continue
                if e[1] in delivered: continue
                out.append(' | '.join(label+': '+text for label,text in parts))
                delivered.add(e[1]); del bundles[e[1]]
    return [out,[[k,v[0],v[1]] for k,v in bundles.items()],sorted(delivered)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['open','a'],['part','a','Name','A'*N],['part','a','Count','2'],['replace','a','Name','New'],['rename','a','Count','Total'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['part','a','Late','no'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['part','a','Two','y'],['part','a','Three','z'],['limit','a',2],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','a'],['part','a','Again','y'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','b'],['part','b','Two','y'],['retract','b']]", "[['open','a'],['part','a','Partial','x'*N],['dispatch','a'],['open','b'],['seal','b'],['dispatch','b']]", "[['open','a'],['part','a','Old','x'*N],['open','a']]"]
expected = {1: [[['Name: New | Total: 2'], [], ['a']], [['One: x'], [], ['a']], [['One: x | Two: y'], [], ['a']], [['One: x', 'Again: y'], [], ['a']], [['One: x'], [], ['a']], [[], [['a', [['Partial', 'x']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 2: [[['Name: New | Total: 2'], [], ['a']], [['One: xx'], [], ['a']], [['One: xx | Two: y'], [], ['a']], [['One: xx', 'Again: y'], [], ['a']], [['One: xx'], [], ['a']], [[], [['a', [['Partial', 'xx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 3: [[['Name: New | Total: 2'], [], ['a']], [['One: xxx'], [], ['a']], [['One: xxx | Two: y'], [], ['a']], [['One: xxx', 'Again: y'], [], ['a']], [['One: xxx'], [], ['a']], [[], [['a', [['Partial', 'xxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 4: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxx'], [], ['a']], [['One: xxxx | Two: y'], [], ['a']], [['One: xxxx', 'Again: y'], [], ['a']], [['One: xxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 5: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxxx'], [], ['a']], [['One: xxxxx | Two: y'], [], ['a']], [['One: xxxxx', 'Again: y'], [], ['a']], [['One: xxxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]]}[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):
    bundles={}; delivered=set(); out=[]
    for e in events:
        if e[0]=='open': bundles[e[1]]=[[],False]; delivered.discard(e[1])
        elif e[0]=='retract': bundles.pop(e[1],None); delivered.discard(e[1])
        elif len(e)>1 and e[1] in bundles:
            parts,sealed=bundles[e[1]]
            if e[0]=='part' and not sealed: parts.insert(0,[e[2],e[3]])
            elif e[0]=='replace' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[1]=e[3]
            elif e[0]=='rename' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[0]=e[3]
            elif e[0]=='limit' and not sealed: del parts[max(0,e[2]):]
            elif e[0]=='seal': bundles[e[1]][1]=True
            elif e[0]=='dispatch':
                if not sealed or not parts: continue
                if e[1] in delivered: continue
                out.append(' | '.join(label+': '+text for label,text in parts))
                delivered.add(e[1]); del bundles[e[1]]
    return [out,[[k,v[0],v[1]] for k,v in bundles.items()],sorted(delivered)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['open','a'],['part','a','Name','A'*N],['part','a','Count','2'],['replace','a','Name','New'],['rename','a','Count','Total'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['part','a','Late','no'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['part','a','Two','y'],['part','a','Three','z'],['limit','a',2],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','a'],['part','a','Again','y'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','b'],['part','b','Two','y'],['retract','b']]", "[['open','a'],['part','a','Partial','x'*N],['dispatch','a'],['open','b'],['seal','b'],['dispatch','b']]", "[['open','a'],['part','a','Old','x'*N],['open','a']]"]
expected = {1: [[['Name: New | Total: 2'], [], ['a']], [['One: x'], [], ['a']], [['One: x | Two: y'], [], ['a']], [['One: x', 'Again: y'], [], ['a']], [['One: x'], [], ['a']], [[], [['a', [['Partial', 'x']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 2: [[['Name: New | Total: 2'], [], ['a']], [['One: xx'], [], ['a']], [['One: xx | Two: y'], [], ['a']], [['One: xx', 'Again: y'], [], ['a']], [['One: xx'], [], ['a']], [[], [['a', [['Partial', 'xx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 3: [[['Name: New | Total: 2'], [], ['a']], [['One: xxx'], [], ['a']], [['One: xxx | Two: y'], [], ['a']], [['One: xxx', 'Again: y'], [], ['a']], [['One: xxx'], [], ['a']], [[], [['a', [['Partial', 'xxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 4: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxx'], [], ['a']], [['One: xxxx | Two: y'], [], ['a']], [['One: xxxx', 'Again: y'], [], ['a']], [['One: xxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 5: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxxx'], [], ['a']], [['One: xxxxx | Two: y'], [], ['a']], [['One: xxxxx', 'Again: y'], [], ['a']], [['One: xxxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]]}[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 utterance-bundle contract.

Bundles are atomic ordered speech segments. Open initializes unsealed bundle; part appends [label,text] while unsealed; replace edits matching label only. Seal marks immutable. Dispatch requires sealed and nonempty, emits a single joined label:text string, removes bundle and records delivered ID. Reopen delivered ID clears delivery receipt. Retract drops bundle and receipt. Rename updates label preserving text. Limit truncates number of pending segments from end. Return speech and pending bundle segments/sealed status.

split: open-access


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

N = 1
observations = []
def solve(events):
    bundles={}; delivered=set(); out=[]
    for e in events:
        if e[0]=='open': bundles[e[1]]=[[],False]; delivered.discard(e[1])
        elif e[0]=='retract': bundles.pop(e[1],None); delivered.discard(e[1])
        elif len(e)>1 and e[1] in bundles:
            parts,sealed=bundles[e[1]]
            if e[0]=='part' and not sealed: parts.append([e[2],e[3]])
            elif e[0]=='replace' and not sealed:
                for p in parts:
                    p[1]=e[3]
            elif e[0]=='rename' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[0]=e[3]
            elif e[0]=='limit' and not sealed: del parts[max(0,e[2]):]
            elif e[0]=='seal': bundles[e[1]][1]=True
            elif e[0]=='dispatch':
                if not sealed or not parts: continue
                if e[1] in delivered: continue
                out.append(' | '.join(label+': '+text for label,text in parts))
                delivered.add(e[1]); del bundles[e[1]]
    return [out,[[k,v[0],v[1]] for k,v in bundles.items()],sorted(delivered)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['open','a'],['part','a','Name','A'*N],['part','a','Count','2'],['replace','a','Name','New'],['rename','a','Count','Total'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['part','a','Late','no'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['part','a','Two','y'],['part','a','Three','z'],['limit','a',2],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','a'],['part','a','Again','y'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','b'],['part','b','Two','y'],['retract','b']]", "[['open','a'],['part','a','Partial','x'*N],['dispatch','a'],['open','b'],['seal','b'],['dispatch','b']]", "[['open','a'],['part','a','Old','x'*N],['open','a']]"]
expected = {1: [[['Name: New | Total: 2'], [], ['a']], [['One: x'], [], ['a']], [['One: x | Two: y'], [], ['a']], [['One: x', 'Again: y'], [], ['a']], [['One: x'], [], ['a']], [[], [['a', [['Partial', 'x']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 2: [[['Name: New | Total: 2'], [], ['a']], [['One: xx'], [], ['a']], [['One: xx | Two: y'], [], ['a']], [['One: xx', 'Again: y'], [], ['a']], [['One: xx'], [], ['a']], [[], [['a', [['Partial', 'xx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 3: [[['Name: New | Total: 2'], [], ['a']], [['One: xxx'], [], ['a']], [['One: xxx | Two: y'], [], ['a']], [['One: xxx', 'Again: y'], [], ['a']], [['One: xxx'], [], ['a']], [[], [['a', [['Partial', 'xxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 4: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxx'], [], ['a']], [['One: xxxx | Two: y'], [], ['a']], [['One: xxxx', 'Again: y'], [], ['a']], [['One: xxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 5: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxxx'], [], ['a']], [['One: xxxxx | Two: y'], [], ['a']], [['One: xxxxx', 'Again: y'], [], ['a']], [['One: xxxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]]}[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):
    bundles={}; delivered=set(); out=[]
    for e in events:
        if e[0]=='open': bundles[e[1]]=[[],False]; delivered.discard(e[1])
        elif e[0]=='retract': bundles.pop(e[1],None); delivered.discard(e[1])
        elif len(e)>1 and e[1] in bundles:
            parts,sealed=bundles[e[1]]
            if e[0]=='part' and not sealed: parts.append([e[2],e[3]])
            elif e[0]=='replace' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[1]+=e[3]
            elif e[0]=='rename' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[0]=e[3]
            elif e[0]=='limit' and not sealed: del parts[max(0,e[2]):]
            elif e[0]=='seal': bundles[e[1]][1]=True
            elif e[0]=='dispatch':
                if not sealed or not parts: continue
                if e[1] in delivered: continue
                out.append(' | '.join(label+': '+text for label,text in parts))
                delivered.add(e[1]); del bundles[e[1]]
    return [out,[[k,v[0],v[1]] for k,v in bundles.items()],sorted(delivered)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['open','a'],['part','a','Name','A'*N],['part','a','Count','2'],['replace','a','Name','New'],['rename','a','Count','Total'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['part','a','Late','no'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['part','a','Two','y'],['part','a','Three','z'],['limit','a',2],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','a'],['part','a','Again','y'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','b'],['part','b','Two','y'],['retract','b']]", "[['open','a'],['part','a','Partial','x'*N],['dispatch','a'],['open','b'],['seal','b'],['dispatch','b']]", "[['open','a'],['part','a','Old','x'*N],['open','a']]"]
expected = {1: [[['Name: New | Total: 2'], [], ['a']], [['One: x'], [], ['a']], [['One: x | Two: y'], [], ['a']], [['One: x', 'Again: y'], [], ['a']], [['One: x'], [], ['a']], [[], [['a', [['Partial', 'x']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 2: [[['Name: New | Total: 2'], [], ['a']], [['One: xx'], [], ['a']], [['One: xx | Two: y'], [], ['a']], [['One: xx', 'Again: y'], [], ['a']], [['One: xx'], [], ['a']], [[], [['a', [['Partial', 'xx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 3: [[['Name: New | Total: 2'], [], ['a']], [['One: xxx'], [], ['a']], [['One: xxx | Two: y'], [], ['a']], [['One: xxx', 'Again: y'], [], ['a']], [['One: xxx'], [], ['a']], [[], [['a', [['Partial', 'xxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 4: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxx'], [], ['a']], [['One: xxxx | Two: y'], [], ['a']], [['One: xxxx', 'Again: y'], [], ['a']], [['One: xxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 5: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxxx'], [], ['a']], [['One: xxxxx | Two: y'], [], ['a']], [['One: xxxxx', 'Again: y'], [], ['a']], [['One: xxxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]]}[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 utterance-bundle contract.

Bundles are atomic ordered speech segments. Open initializes unsealed bundle; part appends [label,text] while unsealed; replace edits matching label only. Seal marks immutable. Dispatch requires sealed and nonempty, emits a single joined label:text string, removes bundle and records delivered ID. Reopen delivered ID clears delivery receipt. Retract drops bundle and receipt. Rename updates label preserving text. Limit truncates number of pending segments from end. Return speech and pending bundle segments/sealed status.

split: open-access


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

N = 1
observations = []
def solve(events):
    bundles={}; delivered=set(); out=[]
    for e in events:
        if e[0]=='open': bundles[e[1]]=[[],False]; delivered.discard(e[1])
        elif e[0]=='retract': bundles.pop(e[1],None); delivered.discard(e[1])
        elif len(e)>1 and e[1] in bundles:
            parts,sealed=bundles[e[1]]
            if e[0]=='part' and not sealed: parts.append([e[2],e[3]])
            elif e[0]=='replace' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[1]=e[3]
            elif e[0]=='rename' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[1]=e[3]
            elif e[0]=='limit' and not sealed: del parts[max(0,e[2]):]
            elif e[0]=='seal': bundles[e[1]][1]=True
            elif e[0]=='dispatch':
                if not sealed or not parts: continue
                if e[1] in delivered: continue
                out.append(' | '.join(label+': '+text for label,text in parts))
                delivered.add(e[1]); del bundles[e[1]]
    return [out,[[k,v[0],v[1]] for k,v in bundles.items()],sorted(delivered)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['open','a'],['part','a','Name','A'*N],['part','a','Count','2'],['replace','a','Name','New'],['rename','a','Count','Total'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['part','a','Late','no'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['part','a','Two','y'],['part','a','Three','z'],['limit','a',2],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','a'],['part','a','Again','y'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','b'],['part','b','Two','y'],['retract','b']]", "[['open','a'],['part','a','Partial','x'*N],['dispatch','a'],['open','b'],['seal','b'],['dispatch','b']]", "[['open','a'],['part','a','Old','x'*N],['open','a']]"]
expected = {1: [[['Name: New | Total: 2'], [], ['a']], [['One: x'], [], ['a']], [['One: x | Two: y'], [], ['a']], [['One: x', 'Again: y'], [], ['a']], [['One: x'], [], ['a']], [[], [['a', [['Partial', 'x']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 2: [[['Name: New | Total: 2'], [], ['a']], [['One: xx'], [], ['a']], [['One: xx | Two: y'], [], ['a']], [['One: xx', 'Again: y'], [], ['a']], [['One: xx'], [], ['a']], [[], [['a', [['Partial', 'xx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 3: [[['Name: New | Total: 2'], [], ['a']], [['One: xxx'], [], ['a']], [['One: xxx | Two: y'], [], ['a']], [['One: xxx', 'Again: y'], [], ['a']], [['One: xxx'], [], ['a']], [[], [['a', [['Partial', 'xxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 4: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxx'], [], ['a']], [['One: xxxx | Two: y'], [], ['a']], [['One: xxxx', 'Again: y'], [], ['a']], [['One: xxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 5: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxxx'], [], ['a']], [['One: xxxxx | Two: y'], [], ['a']], [['One: xxxxx', 'Again: y'], [], ['a']], [['One: xxxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]]}[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):
    bundles={}; delivered=set(); out=[]
    for e in events:
        if e[0]=='open': bundles[e[1]]=[[],False]; delivered.discard(e[1])
        elif e[0]=='retract': bundles.pop(e[1],None); delivered.discard(e[1])
        elif len(e)>1 and e[1] in bundles:
            parts,sealed=bundles[e[1]]
            if e[0]=='part' and not sealed: parts.append([e[2],e[3]])
            elif e[0]=='replace' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[1]=e[3]
            elif e[0]=='rename' and not sealed:
                for p in parts:
                    p[0]=e[3]
            elif e[0]=='limit' and not sealed: del parts[max(0,e[2]):]
            elif e[0]=='seal': bundles[e[1]][1]=True
            elif e[0]=='dispatch':
                if not sealed or not parts: continue
                if e[1] in delivered: continue
                out.append(' | '.join(label+': '+text for label,text in parts))
                delivered.add(e[1]); del bundles[e[1]]
    return [out,[[k,v[0],v[1]] for k,v in bundles.items()],sorted(delivered)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['open','a'],['part','a','Name','A'*N],['part','a','Count','2'],['replace','a','Name','New'],['rename','a','Count','Total'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['part','a','Late','no'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['part','a','Two','y'],['part','a','Three','z'],['limit','a',2],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','a'],['part','a','Again','y'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','b'],['part','b','Two','y'],['retract','b']]", "[['open','a'],['part','a','Partial','x'*N],['dispatch','a'],['open','b'],['seal','b'],['dispatch','b']]", "[['open','a'],['part','a','Old','x'*N],['open','a']]"]
expected = {1: [[['Name: New | Total: 2'], [], ['a']], [['One: x'], [], ['a']], [['One: x | Two: y'], [], ['a']], [['One: x', 'Again: y'], [], ['a']], [['One: x'], [], ['a']], [[], [['a', [['Partial', 'x']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 2: [[['Name: New | Total: 2'], [], ['a']], [['One: xx'], [], ['a']], [['One: xx | Two: y'], [], ['a']], [['One: xx', 'Again: y'], [], ['a']], [['One: xx'], [], ['a']], [[], [['a', [['Partial', 'xx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 3: [[['Name: New | Total: 2'], [], ['a']], [['One: xxx'], [], ['a']], [['One: xxx | Two: y'], [], ['a']], [['One: xxx', 'Again: y'], [], ['a']], [['One: xxx'], [], ['a']], [[], [['a', [['Partial', 'xxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 4: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxx'], [], ['a']], [['One: xxxx | Two: y'], [], ['a']], [['One: xxxx', 'Again: y'], [], ['a']], [['One: xxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 5: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxxx'], [], ['a']], [['One: xxxxx | Two: y'], [], ['a']], [['One: xxxxx', 'Again: y'], [], ['a']], [['One: xxxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]]}[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 utterance-bundle contract.

Bundles are atomic ordered speech segments. Open initializes unsealed bundle; part appends [label,text] while unsealed; replace edits matching label only. Seal marks immutable. Dispatch requires sealed and nonempty, emits a single joined label:text string, removes bundle and records delivered ID. Reopen delivered ID clears delivery receipt. Retract drops bundle and receipt. Rename updates label preserving text. Limit truncates number of pending segments from end. Return speech and pending bundle segments/sealed status.

split: open-access


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

N = 1
observations = []
def solve(events):
    bundles={}; delivered=set(); out=[]
    for e in events:
        if e[0]=='open': bundles[e[1]]=[[],False]; delivered.discard(e[1])
        elif e[0]=='retract': bundles.pop(e[1],None); delivered.discard(e[1])
        elif len(e)>1 and e[1] in bundles:
            parts,sealed=bundles[e[1]]
            if e[0]=='part' and not sealed: parts.append([e[2],e[3]])
            elif e[0]=='replace' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[1]=e[3]
            elif e[0]=='rename' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[0]=e[3]
            elif e[0]=='limit' and not sealed: del parts[:max(0,len(parts)-e[2])]
            elif e[0]=='seal': bundles[e[1]][1]=True
            elif e[0]=='dispatch':
                if not sealed or not parts: continue
                if e[1] in delivered: continue
                out.append(' | '.join(label+': '+text for label,text in parts))
                delivered.add(e[1]); del bundles[e[1]]
    return [out,[[k,v[0],v[1]] for k,v in bundles.items()],sorted(delivered)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['open','a'],['part','a','Name','A'*N],['part','a','Count','2'],['replace','a','Name','New'],['rename','a','Count','Total'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['part','a','Late','no'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['part','a','Two','y'],['part','a','Three','z'],['limit','a',2],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','a'],['part','a','Again','y'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','b'],['part','b','Two','y'],['retract','b']]", "[['open','a'],['part','a','Partial','x'*N],['dispatch','a'],['open','b'],['seal','b'],['dispatch','b']]", "[['open','a'],['part','a','Old','x'*N],['open','a']]"]
expected = {1: [[['Name: New | Total: 2'], [], ['a']], [['One: x'], [], ['a']], [['One: x | Two: y'], [], ['a']], [['One: x', 'Again: y'], [], ['a']], [['One: x'], [], ['a']], [[], [['a', [['Partial', 'x']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 2: [[['Name: New | Total: 2'], [], ['a']], [['One: xx'], [], ['a']], [['One: xx | Two: y'], [], ['a']], [['One: xx', 'Again: y'], [], ['a']], [['One: xx'], [], ['a']], [[], [['a', [['Partial', 'xx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 3: [[['Name: New | Total: 2'], [], ['a']], [['One: xxx'], [], ['a']], [['One: xxx | Two: y'], [], ['a']], [['One: xxx', 'Again: y'], [], ['a']], [['One: xxx'], [], ['a']], [[], [['a', [['Partial', 'xxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 4: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxx'], [], ['a']], [['One: xxxx | Two: y'], [], ['a']], [['One: xxxx', 'Again: y'], [], ['a']], [['One: xxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 5: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxxx'], [], ['a']], [['One: xxxxx | Two: y'], [], ['a']], [['One: xxxxx', 'Again: y'], [], ['a']], [['One: xxxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]]}[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):
    bundles={}; delivered=set(); out=[]
    for e in events:
        if e[0]=='open': bundles[e[1]]=[[],False]; delivered.discard(e[1])
        elif e[0]=='retract': bundles.pop(e[1],None); delivered.discard(e[1])
        elif len(e)>1 and e[1] in bundles:
            parts,sealed=bundles[e[1]]
            if e[0]=='part' and not sealed: parts.append([e[2],e[3]])
            elif e[0]=='replace' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[1]=e[3]
            elif e[0]=='rename' and not sealed:
                for p in parts:
                    if p[0]==e[2]: p[0]=e[3]
            elif e[0]=='limit' and not sealed: del parts[max(0,e[2]-1):]
            elif e[0]=='seal': bundles[e[1]][1]=True
            elif e[0]=='dispatch':
                if not sealed or not parts: continue
                if e[1] in delivered: continue
                out.append(' | '.join(label+': '+text for label,text in parts))
                delivered.add(e[1]); del bundles[e[1]]
    return [out,[[k,v[0],v[1]] for k,v in bundles.items()],sorted(delivered)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['open','a'],['part','a','Name','A'*N],['part','a','Count','2'],['replace','a','Name','New'],['rename','a','Count','Total'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['part','a','Late','no'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['part','a','Two','y'],['part','a','Three','z'],['limit','a',2],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','a'],['part','a','Again','y'],['seal','a'],['dispatch','a']]", "[['open','a'],['part','a','One','x'*N],['seal','a'],['dispatch','a'],['open','b'],['part','b','Two','y'],['retract','b']]", "[['open','a'],['part','a','Partial','x'*N],['dispatch','a'],['open','b'],['seal','b'],['dispatch','b']]", "[['open','a'],['part','a','Old','x'*N],['open','a']]"]
expected = {1: [[['Name: New | Total: 2'], [], ['a']], [['One: x'], [], ['a']], [['One: x | Two: y'], [], ['a']], [['One: x', 'Again: y'], [], ['a']], [['One: x'], [], ['a']], [[], [['a', [['Partial', 'x']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 2: [[['Name: New | Total: 2'], [], ['a']], [['One: xx'], [], ['a']], [['One: xx | Two: y'], [], ['a']], [['One: xx', 'Again: y'], [], ['a']], [['One: xx'], [], ['a']], [[], [['a', [['Partial', 'xx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 3: [[['Name: New | Total: 2'], [], ['a']], [['One: xxx'], [], ['a']], [['One: xxx | Two: y'], [], ['a']], [['One: xxx', 'Again: y'], [], ['a']], [['One: xxx'], [], ['a']], [[], [['a', [['Partial', 'xxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 4: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxx'], [], ['a']], [['One: xxxx | Two: y'], [], ['a']], [['One: xxxx', 'Again: y'], [], ['a']], [['One: xxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]], 5: [[['Name: New | Total: 2'], [], ['a']], [['One: xxxxx'], [], ['a']], [['One: xxxxx | Two: y'], [], ['a']], [['One: xxxxx', 'Again: y'], [], ['a']], [['One: xxxxx'], [], ['a']], [[], [['a', [['Partial', 'xxxxx']], False], ['b', [], True]], []], [[], [['a', [], False]], []]]}[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 utterance-bundle contract.

Bundles are atomic ordered speech segments. Open initializes unsealed bundle; part appends [label,text] while unsealed; replace edits matching label only. Seal marks immutable. Dispatch requires sealed and nonempty, emits a single joined label:text string, removes bundle and records delivered ID. Reopen delivered ID clears delivery receipt. Retract drops bundle and receipt. Rename updates label preserving text. Limit truncates number of pending segments from end. Return speech and pending bundle segments/sealed status.

split: open-access