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

N = 1
observations = []
def solve(events):
    history=[]; out=[]; cursor=0; limit=3
    for e in events:
        if e[0]=='deliver':
            history=[x for x in history if x[0]!=e[1]]
            history.append([e[1],e[2]])
            history=history[-limit:]
            cursor=len(history)
            out.append(e[2])
        elif e[0]=='replay':
            match=next((x for x in history if x[0]==e[1]),None)
            if match: out.append(match[1])
        elif e[0]=='previous' and history:
            cursor=max(0,cursor-1)
            out.append(history[cursor][1])
        elif e[0]=='forget': history=[]; cursor=0
        elif e[0]=='clear': history=[]; cursor=0
        elif e[0]=='limit': limit=max(1,e[1]); history=history[-limit:]; cursor=len(history)
    return [out,history,cursor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['deliver',str(i),'word'*N+str(i)] for i in range(N+4)]+[['previous'],['previous'],['previous'],['previous']]", "[['deliver','a','same'*N],['deliver','b','same'*N]]", "[['deliver','a','same'*N],['deliver','b','same'*N],['deliver','a','new'],['replay','a']]", "[['deliver','a','alpha'*N],['deliver','b','beta'],['previous'],['deliver','c','gamma'],['previous']]", "[['deliver','a','alpha'*N],['deliver','b','beta'],['deliver','c','gamma'],['forget','a'],['previous']]", "[['deliver','a','alpha'*N],['clear'],['replay','a']]", "[['deliver','a','a'*N],['deliver','b','b'],['deliver','c','c'],['limit',1],['previous']]", '[]']
expected = {1: [[['word0', 'word1', 'word2', 'word3', 'word4', 'word4', 'word3', 'word2', 'word2'], [['2', 'word2'], ['3', 'word3'], ['4', 'word4']], 0], [['same', 'same'], [['a', 'same'], ['b', 'same']], 2], [['same', 'same', 'new', 'new'], [['b', 'same'], ['a', 'new']], 2], [['alpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alpha'], [], 0], [['a', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 2: [[['wordword0', 'wordword1', 'wordword2', 'wordword3', 'wordword4', 'wordword5', 'wordword5', 'wordword4', 'wordword3', 'wordword3'], [['3', 'wordword3'], ['4', 'wordword4'], ['5', 'wordword5']], 0], [['samesame', 'samesame'], [['a', 'samesame'], ['b', 'samesame']], 2], [['samesame', 'samesame', 'new', 'new'], [['b', 'samesame'], ['a', 'new']], 2], [['alphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalpha'], [], 0], [['aa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 3: [[['wordwordword0', 'wordwordword1', 'wordwordword2', 'wordwordword3', 'wordwordword4', 'wordwordword5', 'wordwordword6', 'wordwordword6', 'wordwordword5', 'wordwordword4', 'wordwordword4'], [['4', 'wordwordword4'], ['5', 'wordwordword5'], ['6', 'wordwordword6']], 0], [['samesamesame', 'samesamesame'], [['a', 'samesamesame'], ['b', 'samesamesame']], 2], [['samesamesame', 'samesamesame', 'new', 'new'], [['b', 'samesamesame'], ['a', 'new']], 2], [['alphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalpha'], [], 0], [['aaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 4: [[['wordwordwordword0', 'wordwordwordword1', 'wordwordwordword2', 'wordwordwordword3', 'wordwordwordword4', 'wordwordwordword5', 'wordwordwordword6', 'wordwordwordword7', 'wordwordwordword7', 'wordwordwordword6', 'wordwordwordword5', 'wordwordwordword5'], [['5', 'wordwordwordword5'], ['6', 'wordwordwordword6'], ['7', 'wordwordwordword7']], 0], [['samesamesamesame', 'samesamesamesame'], [['a', 'samesamesamesame'], ['b', 'samesamesamesame']], 2], [['samesamesamesame', 'samesamesamesame', 'new', 'new'], [['b', 'samesamesamesame'], ['a', 'new']], 2], [['alphaalphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalphaalpha'], [], 0], [['aaaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 5: [[['wordwordwordwordword0', 'wordwordwordwordword1', 'wordwordwordwordword2', 'wordwordwordwordword3', 'wordwordwordwordword4', 'wordwordwordwordword5', 'wordwordwordwordword6', 'wordwordwordwordword7', 'wordwordwordwordword8', 'wordwordwordwordword8', 'wordwordwordwordword7', 'wordwordwordwordword6', 'wordwordwordwordword6'], [['6', 'wordwordwordwordword6'], ['7', 'wordwordwordwordword7'], ['8', 'wordwordwordwordword8']], 0], [['samesamesamesamesame', 'samesamesamesamesame'], [['a', 'samesamesamesamesame'], ['b', 'samesamesamesamesame']], 2], [['samesamesamesamesame', 'samesamesamesamesame', 'new', 'new'], [['b', 'samesamesamesamesame'], ['a', 'new']], 2], [['alphaalphaalphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalphaalphaalpha'], [], 0], [['aaaaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 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):
    history=[]; out=[]; cursor=0; limit=3
    for e in events:
        if e[0]=='deliver':
            history=[x for x in history if x[0]!=e[1]]
            history.append([e[1],e[2]])
            history=history[-limit:]
            cursor=len(history)
            out.append(e[2])
        elif e[0]=='replay':
            match=next((x for x in history if x[0]==e[1]),None)
            if match: out.append(match[1])
        elif e[0]=='previous' and history:
            cursor=max(0,cursor-1)
            out.append(history[cursor][1])
        elif e[0]=='forget': history=[x for x in history if x[0]!=e[1]]; cursor=0
        elif e[0]=='clear': history=[]; cursor=0
        elif e[0]=='limit': limit=max(1,e[1]); history=history[-limit:]; cursor=len(history)
    return [out,history,cursor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['deliver',str(i),'word'*N+str(i)] for i in range(N+4)]+[['previous'],['previous'],['previous'],['previous']]", "[['deliver','a','same'*N],['deliver','b','same'*N]]", "[['deliver','a','same'*N],['deliver','b','same'*N],['deliver','a','new'],['replay','a']]", "[['deliver','a','alpha'*N],['deliver','b','beta'],['previous'],['deliver','c','gamma'],['previous']]", "[['deliver','a','alpha'*N],['deliver','b','beta'],['deliver','c','gamma'],['forget','a'],['previous']]", "[['deliver','a','alpha'*N],['clear'],['replay','a']]", "[['deliver','a','a'*N],['deliver','b','b'],['deliver','c','c'],['limit',1],['previous']]", '[]']
expected = {1: [[['word0', 'word1', 'word2', 'word3', 'word4', 'word4', 'word3', 'word2', 'word2'], [['2', 'word2'], ['3', 'word3'], ['4', 'word4']], 0], [['same', 'same'], [['a', 'same'], ['b', 'same']], 2], [['same', 'same', 'new', 'new'], [['b', 'same'], ['a', 'new']], 2], [['alpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alpha'], [], 0], [['a', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 2: [[['wordword0', 'wordword1', 'wordword2', 'wordword3', 'wordword4', 'wordword5', 'wordword5', 'wordword4', 'wordword3', 'wordword3'], [['3', 'wordword3'], ['4', 'wordword4'], ['5', 'wordword5']], 0], [['samesame', 'samesame'], [['a', 'samesame'], ['b', 'samesame']], 2], [['samesame', 'samesame', 'new', 'new'], [['b', 'samesame'], ['a', 'new']], 2], [['alphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalpha'], [], 0], [['aa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 3: [[['wordwordword0', 'wordwordword1', 'wordwordword2', 'wordwordword3', 'wordwordword4', 'wordwordword5', 'wordwordword6', 'wordwordword6', 'wordwordword5', 'wordwordword4', 'wordwordword4'], [['4', 'wordwordword4'], ['5', 'wordwordword5'], ['6', 'wordwordword6']], 0], [['samesamesame', 'samesamesame'], [['a', 'samesamesame'], ['b', 'samesamesame']], 2], [['samesamesame', 'samesamesame', 'new', 'new'], [['b', 'samesamesame'], ['a', 'new']], 2], [['alphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalpha'], [], 0], [['aaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 4: [[['wordwordwordword0', 'wordwordwordword1', 'wordwordwordword2', 'wordwordwordword3', 'wordwordwordword4', 'wordwordwordword5', 'wordwordwordword6', 'wordwordwordword7', 'wordwordwordword7', 'wordwordwordword6', 'wordwordwordword5', 'wordwordwordword5'], [['5', 'wordwordwordword5'], ['6', 'wordwordwordword6'], ['7', 'wordwordwordword7']], 0], [['samesamesamesame', 'samesamesamesame'], [['a', 'samesamesamesame'], ['b', 'samesamesamesame']], 2], [['samesamesamesame', 'samesamesamesame', 'new', 'new'], [['b', 'samesamesamesame'], ['a', 'new']], 2], [['alphaalphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalphaalpha'], [], 0], [['aaaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 5: [[['wordwordwordwordword0', 'wordwordwordwordword1', 'wordwordwordwordword2', 'wordwordwordwordword3', 'wordwordwordwordword4', 'wordwordwordwordword5', 'wordwordwordwordword6', 'wordwordwordwordword7', 'wordwordwordwordword8', 'wordwordwordwordword8', 'wordwordwordwordword7', 'wordwordwordwordword6', 'wordwordwordwordword6'], [['6', 'wordwordwordwordword6'], ['7', 'wordwordwordwordword7'], ['8', 'wordwordwordwordword8']], 0], [['samesamesamesamesame', 'samesamesamesamesame'], [['a', 'samesamesamesamesame'], ['b', 'samesamesamesamesame']], 2], [['samesamesamesamesame', 'samesamesamesamesame', 'new', 'new'], [['b', 'samesamesamesamesame'], ['a', 'new']], 2], [['alphaalphaalphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalphaalphaalpha'], [], 0], [['aaaaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

History retains the last three delivered utterances [id,text], newest last. Deliver same ID replaces its prior record and moves it newest. Replay speaks selected history text without adding history. Previous walks a separate cursor newest to oldest and clamps at oldest. Deliver resets cursor to newest. Forget deletes one ID and resets cursor. Clear removes history without changing spoken output. Limit clamps to at least one and trims oldest. Report spoken and history.

split: open-access


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

N = 1
observations = []
def solve(events):
    history=[]; out=[]; cursor=0; limit=3
    for e in events:
        if e[0]=='deliver':
            history=[x for x in history if x[0]!=e[1]]
            history.append([e[1],e[2]])
            history=history[-limit:]
            cursor=len(history)
            out.append(e[2])
        elif e[0]=='replay':
            match=next((x for x in history if x[0]==e[1]),None)
            if match: out.append(match[1])
        elif e[0]=='previous' and history:
            cursor=max(0,cursor-1)
            out.append(history[cursor][1])
        elif e[0]=='forget': history=[x for x in history if x[0]!=e[1]]; cursor=len(history)
        elif e[0]=='clear': history=[]; cursor=0; out=[]
        elif e[0]=='limit': limit=max(1,e[1]); history=history[-limit:]; cursor=len(history)
    return [out,history,cursor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['deliver',str(i),'word'*N+str(i)] for i in range(N+4)]+[['previous'],['previous'],['previous'],['previous']]", "[['deliver','a','same'*N],['deliver','b','same'*N]]", "[['deliver','a','same'*N],['deliver','b','same'*N],['deliver','a','new'],['replay','a']]", "[['deliver','a','alpha'*N],['deliver','b','beta'],['previous'],['deliver','c','gamma'],['previous']]", "[['deliver','a','alpha'*N],['deliver','b','beta'],['deliver','c','gamma'],['forget','a'],['previous']]", "[['deliver','a','alpha'*N],['clear'],['replay','a']]", "[['deliver','a','a'*N],['deliver','b','b'],['deliver','c','c'],['limit',1],['previous']]", '[]']
expected = {1: [[['word0', 'word1', 'word2', 'word3', 'word4', 'word4', 'word3', 'word2', 'word2'], [['2', 'word2'], ['3', 'word3'], ['4', 'word4']], 0], [['same', 'same'], [['a', 'same'], ['b', 'same']], 2], [['same', 'same', 'new', 'new'], [['b', 'same'], ['a', 'new']], 2], [['alpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alpha'], [], 0], [['a', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 2: [[['wordword0', 'wordword1', 'wordword2', 'wordword3', 'wordword4', 'wordword5', 'wordword5', 'wordword4', 'wordword3', 'wordword3'], [['3', 'wordword3'], ['4', 'wordword4'], ['5', 'wordword5']], 0], [['samesame', 'samesame'], [['a', 'samesame'], ['b', 'samesame']], 2], [['samesame', 'samesame', 'new', 'new'], [['b', 'samesame'], ['a', 'new']], 2], [['alphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalpha'], [], 0], [['aa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 3: [[['wordwordword0', 'wordwordword1', 'wordwordword2', 'wordwordword3', 'wordwordword4', 'wordwordword5', 'wordwordword6', 'wordwordword6', 'wordwordword5', 'wordwordword4', 'wordwordword4'], [['4', 'wordwordword4'], ['5', 'wordwordword5'], ['6', 'wordwordword6']], 0], [['samesamesame', 'samesamesame'], [['a', 'samesamesame'], ['b', 'samesamesame']], 2], [['samesamesame', 'samesamesame', 'new', 'new'], [['b', 'samesamesame'], ['a', 'new']], 2], [['alphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalpha'], [], 0], [['aaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 4: [[['wordwordwordword0', 'wordwordwordword1', 'wordwordwordword2', 'wordwordwordword3', 'wordwordwordword4', 'wordwordwordword5', 'wordwordwordword6', 'wordwordwordword7', 'wordwordwordword7', 'wordwordwordword6', 'wordwordwordword5', 'wordwordwordword5'], [['5', 'wordwordwordword5'], ['6', 'wordwordwordword6'], ['7', 'wordwordwordword7']], 0], [['samesamesamesame', 'samesamesamesame'], [['a', 'samesamesamesame'], ['b', 'samesamesamesame']], 2], [['samesamesamesame', 'samesamesamesame', 'new', 'new'], [['b', 'samesamesamesame'], ['a', 'new']], 2], [['alphaalphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalphaalpha'], [], 0], [['aaaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 5: [[['wordwordwordwordword0', 'wordwordwordwordword1', 'wordwordwordwordword2', 'wordwordwordwordword3', 'wordwordwordwordword4', 'wordwordwordwordword5', 'wordwordwordwordword6', 'wordwordwordwordword7', 'wordwordwordwordword8', 'wordwordwordwordword8', 'wordwordwordwordword7', 'wordwordwordwordword6', 'wordwordwordwordword6'], [['6', 'wordwordwordwordword6'], ['7', 'wordwordwordwordword7'], ['8', 'wordwordwordwordword8']], 0], [['samesamesamesamesame', 'samesamesamesamesame'], [['a', 'samesamesamesamesame'], ['b', 'samesamesamesamesame']], 2], [['samesamesamesamesame', 'samesamesamesamesame', 'new', 'new'], [['b', 'samesamesamesamesame'], ['a', 'new']], 2], [['alphaalphaalphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalphaalphaalpha'], [], 0], [['aaaaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 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):
    history=[]; out=[]; cursor=0; limit=3
    for e in events:
        if e[0]=='deliver':
            history=[x for x in history if x[0]!=e[1]]
            history.append([e[1],e[2]])
            history=history[-limit:]
            cursor=len(history)
            out.append(e[2])
        elif e[0]=='replay':
            match=next((x for x in history if x[0]==e[1]),None)
            if match: out.append(match[1])
        elif e[0]=='previous' and history:
            cursor=max(0,cursor-1)
            out.append(history[cursor][1])
        elif e[0]=='forget': history=[x for x in history if x[0]!=e[1]]; cursor=len(history)
        elif e[0]=='clear': cursor=0
        elif e[0]=='limit': limit=max(1,e[1]); history=history[-limit:]; cursor=len(history)
    return [out,history,cursor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['deliver',str(i),'word'*N+str(i)] for i in range(N+4)]+[['previous'],['previous'],['previous'],['previous']]", "[['deliver','a','same'*N],['deliver','b','same'*N]]", "[['deliver','a','same'*N],['deliver','b','same'*N],['deliver','a','new'],['replay','a']]", "[['deliver','a','alpha'*N],['deliver','b','beta'],['previous'],['deliver','c','gamma'],['previous']]", "[['deliver','a','alpha'*N],['deliver','b','beta'],['deliver','c','gamma'],['forget','a'],['previous']]", "[['deliver','a','alpha'*N],['clear'],['replay','a']]", "[['deliver','a','a'*N],['deliver','b','b'],['deliver','c','c'],['limit',1],['previous']]", '[]']
expected = {1: [[['word0', 'word1', 'word2', 'word3', 'word4', 'word4', 'word3', 'word2', 'word2'], [['2', 'word2'], ['3', 'word3'], ['4', 'word4']], 0], [['same', 'same'], [['a', 'same'], ['b', 'same']], 2], [['same', 'same', 'new', 'new'], [['b', 'same'], ['a', 'new']], 2], [['alpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alpha'], [], 0], [['a', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 2: [[['wordword0', 'wordword1', 'wordword2', 'wordword3', 'wordword4', 'wordword5', 'wordword5', 'wordword4', 'wordword3', 'wordword3'], [['3', 'wordword3'], ['4', 'wordword4'], ['5', 'wordword5']], 0], [['samesame', 'samesame'], [['a', 'samesame'], ['b', 'samesame']], 2], [['samesame', 'samesame', 'new', 'new'], [['b', 'samesame'], ['a', 'new']], 2], [['alphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalpha'], [], 0], [['aa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 3: [[['wordwordword0', 'wordwordword1', 'wordwordword2', 'wordwordword3', 'wordwordword4', 'wordwordword5', 'wordwordword6', 'wordwordword6', 'wordwordword5', 'wordwordword4', 'wordwordword4'], [['4', 'wordwordword4'], ['5', 'wordwordword5'], ['6', 'wordwordword6']], 0], [['samesamesame', 'samesamesame'], [['a', 'samesamesame'], ['b', 'samesamesame']], 2], [['samesamesame', 'samesamesame', 'new', 'new'], [['b', 'samesamesame'], ['a', 'new']], 2], [['alphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalpha'], [], 0], [['aaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 4: [[['wordwordwordword0', 'wordwordwordword1', 'wordwordwordword2', 'wordwordwordword3', 'wordwordwordword4', 'wordwordwordword5', 'wordwordwordword6', 'wordwordwordword7', 'wordwordwordword7', 'wordwordwordword6', 'wordwordwordword5', 'wordwordwordword5'], [['5', 'wordwordwordword5'], ['6', 'wordwordwordword6'], ['7', 'wordwordwordword7']], 0], [['samesamesamesame', 'samesamesamesame'], [['a', 'samesamesamesame'], ['b', 'samesamesamesame']], 2], [['samesamesamesame', 'samesamesamesame', 'new', 'new'], [['b', 'samesamesamesame'], ['a', 'new']], 2], [['alphaalphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalphaalpha'], [], 0], [['aaaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 5: [[['wordwordwordwordword0', 'wordwordwordwordword1', 'wordwordwordwordword2', 'wordwordwordwordword3', 'wordwordwordwordword4', 'wordwordwordwordword5', 'wordwordwordwordword6', 'wordwordwordwordword7', 'wordwordwordwordword8', 'wordwordwordwordword8', 'wordwordwordwordword7', 'wordwordwordwordword6', 'wordwordwordwordword6'], [['6', 'wordwordwordwordword6'], ['7', 'wordwordwordwordword7'], ['8', 'wordwordwordwordword8']], 0], [['samesamesamesamesame', 'samesamesamesamesame'], [['a', 'samesamesamesamesame'], ['b', 'samesamesamesamesame']], 2], [['samesamesamesamesame', 'samesamesamesamesame', 'new', 'new'], [['b', 'samesamesamesamesame'], ['a', 'new']], 2], [['alphaalphaalphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalphaalphaalpha'], [], 0], [['aaaaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

History retains the last three delivered utterances [id,text], newest last. Deliver same ID replaces its prior record and moves it newest. Replay speaks selected history text without adding history. Previous walks a separate cursor newest to oldest and clamps at oldest. Deliver resets cursor to newest. Forget deletes one ID and resets cursor. Clear removes history without changing spoken output. Limit clamps to at least one and trims oldest. Report spoken and history.

split: open-access


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

N = 1
observations = []
def solve(events):
    history=[]; out=[]; cursor=0; limit=3
    for e in events:
        if e[0]=='deliver':
            history=[x for x in history if x[0]!=e[1]]
            history.append([e[1],e[2]])
            history=history[-limit:]
            cursor=len(history)
            out.append(e[2])
        elif e[0]=='replay':
            match=next((x for x in history if x[0]==e[1]),None)
            if match: out.append(match[1])
        elif e[0]=='previous' and history:
            cursor=max(0,cursor-1)
            out.append(history[cursor][1])
        elif e[0]=='forget': history=[x for x in history if x[0]!=e[1]]; cursor=len(history)
        elif e[0]=='clear': history=[]; cursor=0
        elif e[0]=='limit': limit=max(1,e[1]); history=history[:limit]; cursor=len(history)
    return [out,history,cursor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['deliver',str(i),'word'*N+str(i)] for i in range(N+4)]+[['previous'],['previous'],['previous'],['previous']]", "[['deliver','a','same'*N],['deliver','b','same'*N]]", "[['deliver','a','same'*N],['deliver','b','same'*N],['deliver','a','new'],['replay','a']]", "[['deliver','a','alpha'*N],['deliver','b','beta'],['previous'],['deliver','c','gamma'],['previous']]", "[['deliver','a','alpha'*N],['deliver','b','beta'],['deliver','c','gamma'],['forget','a'],['previous']]", "[['deliver','a','alpha'*N],['clear'],['replay','a']]", "[['deliver','a','a'*N],['deliver','b','b'],['deliver','c','c'],['limit',1],['previous']]", '[]']
expected = {1: [[['word0', 'word1', 'word2', 'word3', 'word4', 'word4', 'word3', 'word2', 'word2'], [['2', 'word2'], ['3', 'word3'], ['4', 'word4']], 0], [['same', 'same'], [['a', 'same'], ['b', 'same']], 2], [['same', 'same', 'new', 'new'], [['b', 'same'], ['a', 'new']], 2], [['alpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alpha'], [], 0], [['a', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 2: [[['wordword0', 'wordword1', 'wordword2', 'wordword3', 'wordword4', 'wordword5', 'wordword5', 'wordword4', 'wordword3', 'wordword3'], [['3', 'wordword3'], ['4', 'wordword4'], ['5', 'wordword5']], 0], [['samesame', 'samesame'], [['a', 'samesame'], ['b', 'samesame']], 2], [['samesame', 'samesame', 'new', 'new'], [['b', 'samesame'], ['a', 'new']], 2], [['alphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalpha'], [], 0], [['aa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 3: [[['wordwordword0', 'wordwordword1', 'wordwordword2', 'wordwordword3', 'wordwordword4', 'wordwordword5', 'wordwordword6', 'wordwordword6', 'wordwordword5', 'wordwordword4', 'wordwordword4'], [['4', 'wordwordword4'], ['5', 'wordwordword5'], ['6', 'wordwordword6']], 0], [['samesamesame', 'samesamesame'], [['a', 'samesamesame'], ['b', 'samesamesame']], 2], [['samesamesame', 'samesamesame', 'new', 'new'], [['b', 'samesamesame'], ['a', 'new']], 2], [['alphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalpha'], [], 0], [['aaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 4: [[['wordwordwordword0', 'wordwordwordword1', 'wordwordwordword2', 'wordwordwordword3', 'wordwordwordword4', 'wordwordwordword5', 'wordwordwordword6', 'wordwordwordword7', 'wordwordwordword7', 'wordwordwordword6', 'wordwordwordword5', 'wordwordwordword5'], [['5', 'wordwordwordword5'], ['6', 'wordwordwordword6'], ['7', 'wordwordwordword7']], 0], [['samesamesamesame', 'samesamesamesame'], [['a', 'samesamesamesame'], ['b', 'samesamesamesame']], 2], [['samesamesamesame', 'samesamesamesame', 'new', 'new'], [['b', 'samesamesamesame'], ['a', 'new']], 2], [['alphaalphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalphaalpha'], [], 0], [['aaaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 5: [[['wordwordwordwordword0', 'wordwordwordwordword1', 'wordwordwordwordword2', 'wordwordwordwordword3', 'wordwordwordwordword4', 'wordwordwordwordword5', 'wordwordwordwordword6', 'wordwordwordwordword7', 'wordwordwordwordword8', 'wordwordwordwordword8', 'wordwordwordwordword7', 'wordwordwordwordword6', 'wordwordwordwordword6'], [['6', 'wordwordwordwordword6'], ['7', 'wordwordwordwordword7'], ['8', 'wordwordwordwordword8']], 0], [['samesamesamesamesame', 'samesamesamesamesame'], [['a', 'samesamesamesamesame'], ['b', 'samesamesamesamesame']], 2], [['samesamesamesamesame', 'samesamesamesamesame', 'new', 'new'], [['b', 'samesamesamesamesame'], ['a', 'new']], 2], [['alphaalphaalphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalphaalphaalpha'], [], 0], [['aaaaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 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):
    history=[]; out=[]; cursor=0; limit=3
    for e in events:
        if e[0]=='deliver':
            history=[x for x in history if x[0]!=e[1]]
            history.append([e[1],e[2]])
            history=history[-limit:]
            cursor=len(history)
            out.append(e[2])
        elif e[0]=='replay':
            match=next((x for x in history if x[0]==e[1]),None)
            if match: out.append(match[1])
        elif e[0]=='previous' and history:
            cursor=max(0,cursor-1)
            out.append(history[cursor][1])
        elif e[0]=='forget': history=[x for x in history if x[0]!=e[1]]; cursor=len(history)
        elif e[0]=='clear': history=[]; cursor=0
        elif e[0]=='limit': limit=max(1,e[1]); cursor=len(history)
    return [out,history,cursor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['deliver',str(i),'word'*N+str(i)] for i in range(N+4)]+[['previous'],['previous'],['previous'],['previous']]", "[['deliver','a','same'*N],['deliver','b','same'*N]]", "[['deliver','a','same'*N],['deliver','b','same'*N],['deliver','a','new'],['replay','a']]", "[['deliver','a','alpha'*N],['deliver','b','beta'],['previous'],['deliver','c','gamma'],['previous']]", "[['deliver','a','alpha'*N],['deliver','b','beta'],['deliver','c','gamma'],['forget','a'],['previous']]", "[['deliver','a','alpha'*N],['clear'],['replay','a']]", "[['deliver','a','a'*N],['deliver','b','b'],['deliver','c','c'],['limit',1],['previous']]", '[]']
expected = {1: [[['word0', 'word1', 'word2', 'word3', 'word4', 'word4', 'word3', 'word2', 'word2'], [['2', 'word2'], ['3', 'word3'], ['4', 'word4']], 0], [['same', 'same'], [['a', 'same'], ['b', 'same']], 2], [['same', 'same', 'new', 'new'], [['b', 'same'], ['a', 'new']], 2], [['alpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alpha'], [], 0], [['a', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 2: [[['wordword0', 'wordword1', 'wordword2', 'wordword3', 'wordword4', 'wordword5', 'wordword5', 'wordword4', 'wordword3', 'wordword3'], [['3', 'wordword3'], ['4', 'wordword4'], ['5', 'wordword5']], 0], [['samesame', 'samesame'], [['a', 'samesame'], ['b', 'samesame']], 2], [['samesame', 'samesame', 'new', 'new'], [['b', 'samesame'], ['a', 'new']], 2], [['alphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalpha'], [], 0], [['aa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 3: [[['wordwordword0', 'wordwordword1', 'wordwordword2', 'wordwordword3', 'wordwordword4', 'wordwordword5', 'wordwordword6', 'wordwordword6', 'wordwordword5', 'wordwordword4', 'wordwordword4'], [['4', 'wordwordword4'], ['5', 'wordwordword5'], ['6', 'wordwordword6']], 0], [['samesamesame', 'samesamesame'], [['a', 'samesamesame'], ['b', 'samesamesame']], 2], [['samesamesame', 'samesamesame', 'new', 'new'], [['b', 'samesamesame'], ['a', 'new']], 2], [['alphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalpha'], [], 0], [['aaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 4: [[['wordwordwordword0', 'wordwordwordword1', 'wordwordwordword2', 'wordwordwordword3', 'wordwordwordword4', 'wordwordwordword5', 'wordwordwordword6', 'wordwordwordword7', 'wordwordwordword7', 'wordwordwordword6', 'wordwordwordword5', 'wordwordwordword5'], [['5', 'wordwordwordword5'], ['6', 'wordwordwordword6'], ['7', 'wordwordwordword7']], 0], [['samesamesamesame', 'samesamesamesame'], [['a', 'samesamesamesame'], ['b', 'samesamesamesame']], 2], [['samesamesamesame', 'samesamesamesame', 'new', 'new'], [['b', 'samesamesamesame'], ['a', 'new']], 2], [['alphaalphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalphaalpha'], [], 0], [['aaaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]], 5: [[['wordwordwordwordword0', 'wordwordwordwordword1', 'wordwordwordwordword2', 'wordwordwordwordword3', 'wordwordwordwordword4', 'wordwordwordwordword5', 'wordwordwordwordword6', 'wordwordwordwordword7', 'wordwordwordwordword8', 'wordwordwordwordword8', 'wordwordwordwordword7', 'wordwordwordwordword6', 'wordwordwordwordword6'], [['6', 'wordwordwordwordword6'], ['7', 'wordwordwordwordword7'], ['8', 'wordwordwordwordword8']], 0], [['samesamesamesamesame', 'samesamesamesamesame'], [['a', 'samesamesamesamesame'], ['b', 'samesamesamesamesame']], 2], [['samesamesamesamesame', 'samesamesamesamesame', 'new', 'new'], [['b', 'samesamesamesamesame'], ['a', 'new']], 2], [['alphaalphaalphaalphaalpha', 'beta', 'beta', 'gamma', 'gamma'], [['a', 'alphaalphaalphaalphaalpha'], ['b', 'beta'], ['c', 'gamma']], 2], [['alphaalphaalphaalphaalpha', 'beta', 'gamma', 'gamma'], [['b', 'beta'], ['c', 'gamma']], 1], [['alphaalphaalphaalphaalpha'], [], 0], [['aaaaa', 'b', 'c', 'c'], [['c', 'c']], 0], [[], [], 0]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

History retains the last three delivered utterances [id,text], newest last. Deliver same ID replaces its prior record and moves it newest. Replay speaks selected history text without adding history. Previous walks a separate cursor newest to oldest and clamps at oldest. Deliver resets cursor to newest. Forget deletes one ID and resets cursor. Clear removes history without changing spoken output. Limit clamps to at least one and trims oldest. Report spoken and history.

split: open-access


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

N = 1
observations = []
def solve(events):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,drafts.get(e[1],[0,e[2]])[1]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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 confirmation-gate contract.

Sensitive announcements require a one-use consent token bound to message ID and text revision. Draft replaces text and increments revision. Grant captures current revision. Speak requires current matching consent, emits text and consumes consent. Revoke removes consent; delete removes draft and consent. Nonsensitive preview emits only fixed redacted cue without consuming consent. Expire removes all grants but preserves drafts. Return speech and remaining grant/draft revisions.

split: open-access


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

N = 1
observations = []
def solve(events):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=1
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]+1
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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 confirmation-gate contract.

Sensitive announcements require a one-use consent token bound to message ID and text revision. Draft replaces text and increments revision. Grant captures current revision. Speak requires current matching consent, emits text and consumes consent. Revoke removes consent; delete removes draft and consent. Nonsensitive preview emits only fixed redacted cue without consuming consent. Expire removes all grants but preserves drafts. Return speech and remaining grant/draft revisions.

split: open-access


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

N = 1
observations = []
def solve(events):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': pass
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': grants.clear()
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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 confirmation-gate contract.

Sensitive announcements require a one-use consent token bound to message ID and text revision. Draft replaces text and increments revision. Grant captures current revision. Speak requires current matching consent, emits text and consumes consent. Revoke removes consent; delete removes draft and consent. Nonsensitive preview emits only fixed redacted cue without consuming consent. Expire removes all grants but preserves drafts. Return speech and remaining grant/draft revisions.

split: open-access


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

N = 1
observations = []
def solve(events):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': drafts.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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 confirmation-gate contract.

Sensitive announcements require a one-use consent token bound to message ID and text revision. Draft replaces text and increments revision. Grant captures current revision. Speak requires current matching consent, emits text and consumes consent. Revoke removes consent; delete removes draft and consent. Nonsensitive preview emits only fixed redacted cue without consuming consent. Expire removes all grants but preserves drafts. Return speech and remaining grant/draft revisions.

split: open-access


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

N = 1
observations = []
def solve(events):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear(); drafts.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': pass
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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 confirmation-gate contract.

Sensitive announcements require a one-use consent token bound to message ID and text revision. Draft replaces text and increments revision. Grant captures current revision. Speak requires current matching consent, emits text and consumes consent. Revoke removes consent; delete removes draft and consent. Nonsensitive preview emits only fixed redacted cue without consuming consent. Expire removes all grants but preserves drafts. Return speech and remaining grant/draft revisions.

split: open-access


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

N = 1
observations = []
def solve(events):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append(drafts[e[1]][1])
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available'); grants.pop(e[1],None)
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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 confirmation-gate contract.

Sensitive announcements require a one-use consent token bound to message ID and text revision. Draft replaces text and increments revision. Grant captures current revision. Speak requires current matching consent, emits text and consumes consent. Revoke removes consent; delete removes draft and consent. Nonsensitive preview emits only fixed redacted cue without consuming consent. Expire removes all grants but preserves drafts. Return speech and remaining grant/draft revisions.

split: open-access


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

N = 1
observations = []
def solve(events):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: drafts[e[1]]=[0,'']; continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: out.append('missing'); continue
            if grants.get(e[1])!=drafts[e[1]][0]: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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 confirmation-gate contract.

Sensitive announcements require a one-use consent token bound to message ID and text revision. Draft replaces text and increments revision. Grant captures current revision. Speak requires current matching consent, emits text and consumes consent. Revoke removes consent; delete removes draft and consent. Nonsensitive preview emits only fixed redacted cue without consuming consent. Expire removes all grants but preserves drafts. Return speech and remaining grant/draft revisions.

split: open-access


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

N = 1
observations = []
def solve(events):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if e[1] not in grants: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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):
    drafts={}; grants={}; out=[]
    for e in events:
        if e[0]=='draft': drafts[e[1]]=[drafts.get(e[1],[0,''])[0]+1,e[2]]
        elif e[0]=='grant' and e[1] in drafts: grants[e[1]]=drafts[e[1]][0]
        elif e[0]=='revoke': grants.pop(e[1],None)
        elif e[0]=='delete': drafts.pop(e[1],None); grants.pop(e[1],None)
        elif e[0]=='expire': grants.clear()
        elif e[0]=='preview' and e[1] in drafts: out.append('private announcement available')
        elif e[0]=='speak':
            if e[1] not in drafts: continue
            if not grants: continue
            out.append(drafts[e[1]][1])
            grants.pop(e[1],None)
    return [out,sorted(grants.items()),[[k,v[0]] for k,v in drafts.items()]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['draft','a','secret'*N],['grant','a'],['speak','a'],['speak','a']]", "[['draft','a','old'],['grant','a'],['draft','a','new'*N],['speak','a'],['grant','a'],['speak','a']]", "[['draft','a','secret'*N],['draft','b','other'],['grant','a'],['grant','b'],['revoke','a'],['speak','b']]", "[['draft','a','secret'*N],['grant','a'],['preview','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['delete','a'],['speak','a']]", "[['draft','a','secret'*N],['grant','a'],['expire'],['speak','a']]", "[['speak','missing']]", "[['draft','a','a'*N],['draft','b','b'],['grant','a'],['grant','b'],['speak','a']]"]
expected = {1: [[['secret'], [], [['a', 1]]], [['new'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['a'], [('b', 1)], [['a', 1], ['b', 1]]]], 2: [[['secretsecret'], [], [['a', 1]]], [['newnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aa'], [('b', 1)], [['a', 1], ['b', 1]]]], 3: [[['secretsecretsecret'], [], [['a', 1]]], [['newnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 4: [[['secretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaa'], [('b', 1)], [['a', 1], ['b', 1]]]], 5: [[['secretsecretsecretsecretsecret'], [], [['a', 1]]], [['newnewnewnewnew'], [], [['a', 2]]], [['other'], [], [['a', 1], ['b', 1]]], [['private announcement available', 'secretsecretsecretsecretsecret'], [], [['a', 1]]], [[], [], []], [[], [], [['a', 1]]], [[], [], []], [['aaaaa'], [('b', 1)], [['a', 1], ['b', 1]]]]}[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 confirmation-gate contract.

Sensitive announcements require a one-use consent token bound to message ID and text revision. Draft replaces text and increments revision. Grant captures current revision. Speak requires current matching consent, emits text and consumes consent. Revoke removes consent; delete removes draft and consent. Nonsensitive preview emits only fixed redacted cue without consuming consent. Expire removes all grants but preserves drafts. Return speech and remaining grant/draft revisions.

split: open-access