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

N = 1
observations = []
def solve(events):
    pending = {}; retired = set(); spoken = []; generation = 0; serial = 0
    for e in events:
        if e[0] == 'submit':
            serial += 1
            pending[e[1]] = [generation, serial, e[2]]
        elif e[0] == 'receipt':
            ident, epoch, ticket = e[1:]
            if epoch != generation: continue
            if ticket in retired: continue
            if ident not in pending: continue
            if pending[ident][1] != ticket: continue
            spoken.append(ident)
            del pending[ident]
            retired.add(ticket)
        elif e[0] == 'disconnect':
            pending.clear()
            generation += 1
            serial = 0
            retired.clear()
    return [spoken, len(pending), generation, serial]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['submit','a','word'*N],['submit','b','other'],['receipt','a',0,1],['receipt','b',0,1],['receipt','b',0,2]]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',0,2]]", "[['submit','a','old'],['submit','b','stale'],['disconnect'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',1,1]]", "[['disconnect'],['disconnect'],['submit','a','x'*N],['receipt','a',2,1]]", "[['submit','a','hello'*N],['receipt','a',0,1],['receipt','a',0,1]]", "[['submit','a','hi'*N],['submit','b','bye'],['receipt','a',0,1],['receipt','b',0,2],['disconnect'],['submit','a','new'],['receipt','a',1,1]]", "[['disconnect'],['submit','a','fresh'*N],['receipt','a',0,1]]", "[['submit','a','old'],['submit','b','old'],['disconnect']]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1]]", '[]']
expected = {1: [[['word', 'other'], 0, 0, 2], [['new'], 0, 0, 2], [['new'], 0, 1, 1], [['x'], 0, 2, 1], [['hello'], 0, 0, 1], [['hi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 2: [[['wordword', 'other'], 0, 0, 2], [['newnew'], 0, 0, 2], [['newnew'], 0, 1, 1], [['xx'], 0, 2, 1], [['hellohello'], 0, 0, 1], [['hihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 3: [[['wordwordword', 'other'], 0, 0, 2], [['newnewnew'], 0, 0, 2], [['newnewnew'], 0, 1, 1], [['xxx'], 0, 2, 1], [['hellohellohello'], 0, 0, 1], [['hihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 4: [[['wordwordwordword', 'other'], 0, 0, 2], [['newnewnewnew'], 0, 0, 2], [['newnewnewnew'], 0, 1, 1], [['xxxx'], 0, 2, 1], [['hellohellohellohello'], 0, 0, 1], [['hihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 5: [[['wordwordwordwordword', 'other'], 0, 0, 2], [['newnewnewnewnew'], 0, 0, 2], [['newnewnewnewnew'], 0, 1, 1], [['xxxxx'], 0, 2, 1], [['hellohellohellohellohello'], 0, 0, 1], [['hihihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 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):
    pending = {}; retired = set(); spoken = []; generation = 0; serial = 0
    for e in events:
        if e[0] == 'submit':
            serial += 1
            pending[e[1]] = [generation, serial, e[2]]
        elif e[0] == 'receipt':
            ident, epoch, ticket = e[1:]
            if epoch != generation: continue
            if ticket in retired: continue
            if ident not in pending: continue
            if pending[ident][1] != ticket: continue
            spoken.append(pending[ident][2][:1])
            del pending[ident]
            retired.add(ticket)
        elif e[0] == 'disconnect':
            pending.clear()
            generation += 1
            serial = 0
            retired.clear()
    return [spoken, len(pending), generation, serial]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['submit','a','word'*N],['submit','b','other'],['receipt','a',0,1],['receipt','b',0,1],['receipt','b',0,2]]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',0,2]]", "[['submit','a','old'],['submit','b','stale'],['disconnect'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',1,1]]", "[['disconnect'],['disconnect'],['submit','a','x'*N],['receipt','a',2,1]]", "[['submit','a','hello'*N],['receipt','a',0,1],['receipt','a',0,1]]", "[['submit','a','hi'*N],['submit','b','bye'],['receipt','a',0,1],['receipt','b',0,2],['disconnect'],['submit','a','new'],['receipt','a',1,1]]", "[['disconnect'],['submit','a','fresh'*N],['receipt','a',0,1]]", "[['submit','a','old'],['submit','b','old'],['disconnect']]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1]]", '[]']
expected = {1: [[['word', 'other'], 0, 0, 2], [['new'], 0, 0, 2], [['new'], 0, 1, 1], [['x'], 0, 2, 1], [['hello'], 0, 0, 1], [['hi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 2: [[['wordword', 'other'], 0, 0, 2], [['newnew'], 0, 0, 2], [['newnew'], 0, 1, 1], [['xx'], 0, 2, 1], [['hellohello'], 0, 0, 1], [['hihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 3: [[['wordwordword', 'other'], 0, 0, 2], [['newnewnew'], 0, 0, 2], [['newnewnew'], 0, 1, 1], [['xxx'], 0, 2, 1], [['hellohellohello'], 0, 0, 1], [['hihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 4: [[['wordwordwordword', 'other'], 0, 0, 2], [['newnewnewnew'], 0, 0, 2], [['newnewnewnew'], 0, 1, 1], [['xxxx'], 0, 2, 1], [['hellohellohellohello'], 0, 0, 1], [['hihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 5: [[['wordwordwordwordword', 'other'], 0, 0, 2], [['newnewnewnewnew'], 0, 0, 2], [['newnewnewnewnew'], 0, 1, 1], [['xxxxx'], 0, 2, 1], [['hellohellohellohellohello'], 0, 0, 1], [['hihihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 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 delivery-receipts contract.

A delivery is keyed by (utterance, generation). Submit replaces pending text for that key. A receipt is accepted only for the active generation and exact serial; accepted receipts append spoken text, remove pending, and retire the serial. Disconnect discards pending, increments generation, resets serial. Duplicate receipts do nothing. Report spoken, pending count, generation and next serial.

split: open-access


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

N = 1
observations = []
def solve(events):
    pending = {}; retired = set(); spoken = []; generation = 0; serial = 0
    for e in events:
        if e[0] == 'submit':
            serial += 1
            pending[e[1]] = [generation, serial, e[2]]
        elif e[0] == 'receipt':
            ident, epoch, ticket = e[1:]
            if epoch != generation: continue
            if ticket in retired: continue
            if ident not in pending: continue
            if pending[ident][1] != ticket: continue
            spoken.append(pending[ident][2])
            pending[ident][2] = ""
            retired.add(ticket)
        elif e[0] == 'disconnect':
            pending.clear()
            generation += 1
            serial = 0
            retired.clear()
    return [spoken, len(pending), generation, serial]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['submit','a','word'*N],['submit','b','other'],['receipt','a',0,1],['receipt','b',0,1],['receipt','b',0,2]]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',0,2]]", "[['submit','a','old'],['submit','b','stale'],['disconnect'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',1,1]]", "[['disconnect'],['disconnect'],['submit','a','x'*N],['receipt','a',2,1]]", "[['submit','a','hello'*N],['receipt','a',0,1],['receipt','a',0,1]]", "[['submit','a','hi'*N],['submit','b','bye'],['receipt','a',0,1],['receipt','b',0,2],['disconnect'],['submit','a','new'],['receipt','a',1,1]]", "[['disconnect'],['submit','a','fresh'*N],['receipt','a',0,1]]", "[['submit','a','old'],['submit','b','old'],['disconnect']]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1]]", '[]']
expected = {1: [[['word', 'other'], 0, 0, 2], [['new'], 0, 0, 2], [['new'], 0, 1, 1], [['x'], 0, 2, 1], [['hello'], 0, 0, 1], [['hi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 2: [[['wordword', 'other'], 0, 0, 2], [['newnew'], 0, 0, 2], [['newnew'], 0, 1, 1], [['xx'], 0, 2, 1], [['hellohello'], 0, 0, 1], [['hihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 3: [[['wordwordword', 'other'], 0, 0, 2], [['newnewnew'], 0, 0, 2], [['newnewnew'], 0, 1, 1], [['xxx'], 0, 2, 1], [['hellohellohello'], 0, 0, 1], [['hihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 4: [[['wordwordwordword', 'other'], 0, 0, 2], [['newnewnewnew'], 0, 0, 2], [['newnewnewnew'], 0, 1, 1], [['xxxx'], 0, 2, 1], [['hellohellohellohello'], 0, 0, 1], [['hihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 5: [[['wordwordwordwordword', 'other'], 0, 0, 2], [['newnewnewnewnew'], 0, 0, 2], [['newnewnewnewnew'], 0, 1, 1], [['xxxxx'], 0, 2, 1], [['hellohellohellohellohello'], 0, 0, 1], [['hihihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 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):
    pending = {}; retired = set(); spoken = []; generation = 0; serial = 0
    for e in events:
        if e[0] == 'submit':
            serial += 1
            pending[e[1]] = [generation, serial, e[2]]
        elif e[0] == 'receipt':
            ident, epoch, ticket = e[1:]
            if epoch != generation: continue
            if ticket in retired: continue
            if ident not in pending: continue
            if pending[ident][1] != ticket: continue
            spoken.append(pending[ident][2])
            pending.pop(ident) if len(pending) > 1 else None
            retired.add(ticket)
        elif e[0] == 'disconnect':
            pending.clear()
            generation += 1
            serial = 0
            retired.clear()
    return [spoken, len(pending), generation, serial]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['submit','a','word'*N],['submit','b','other'],['receipt','a',0,1],['receipt','b',0,1],['receipt','b',0,2]]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',0,2]]", "[['submit','a','old'],['submit','b','stale'],['disconnect'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',1,1]]", "[['disconnect'],['disconnect'],['submit','a','x'*N],['receipt','a',2,1]]", "[['submit','a','hello'*N],['receipt','a',0,1],['receipt','a',0,1]]", "[['submit','a','hi'*N],['submit','b','bye'],['receipt','a',0,1],['receipt','b',0,2],['disconnect'],['submit','a','new'],['receipt','a',1,1]]", "[['disconnect'],['submit','a','fresh'*N],['receipt','a',0,1]]", "[['submit','a','old'],['submit','b','old'],['disconnect']]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1]]", '[]']
expected = {1: [[['word', 'other'], 0, 0, 2], [['new'], 0, 0, 2], [['new'], 0, 1, 1], [['x'], 0, 2, 1], [['hello'], 0, 0, 1], [['hi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 2: [[['wordword', 'other'], 0, 0, 2], [['newnew'], 0, 0, 2], [['newnew'], 0, 1, 1], [['xx'], 0, 2, 1], [['hellohello'], 0, 0, 1], [['hihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 3: [[['wordwordword', 'other'], 0, 0, 2], [['newnewnew'], 0, 0, 2], [['newnewnew'], 0, 1, 1], [['xxx'], 0, 2, 1], [['hellohellohello'], 0, 0, 1], [['hihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 4: [[['wordwordwordword', 'other'], 0, 0, 2], [['newnewnewnew'], 0, 0, 2], [['newnewnewnew'], 0, 1, 1], [['xxxx'], 0, 2, 1], [['hellohellohellohello'], 0, 0, 1], [['hihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 5: [[['wordwordwordwordword', 'other'], 0, 0, 2], [['newnewnewnewnew'], 0, 0, 2], [['newnewnewnewnew'], 0, 1, 1], [['xxxxx'], 0, 2, 1], [['hellohellohellohellohello'], 0, 0, 1], [['hihihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 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 delivery-receipts contract.

A delivery is keyed by (utterance, generation). Submit replaces pending text for that key. A receipt is accepted only for the active generation and exact serial; accepted receipts append spoken text, remove pending, and retire the serial. Disconnect discards pending, increments generation, resets serial. Duplicate receipts do nothing. Report spoken, pending count, generation and next serial.

split: open-access


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

N = 1
observations = []
def solve(events):
    pending = {}; retired = set(); spoken = []; generation = 0; serial = 0
    for e in events:
        if e[0] == 'submit':
            serial += 1
            pending[e[1]] = [generation, serial, e[2]]
        elif e[0] == 'receipt':
            ident, epoch, ticket = e[1:]
            if epoch != generation: continue
            if ticket in retired: continue
            if ident not in pending: continue
            if pending[ident][1] != ticket: continue
            spoken.append(pending[ident][2])
            del pending[ident]
            retired.add(ticket)
        elif e[0] == 'disconnect':
            pass
            generation += 1
            serial = 0
            retired.clear()
    return [spoken, len(pending), generation, serial]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['submit','a','word'*N],['submit','b','other'],['receipt','a',0,1],['receipt','b',0,1],['receipt','b',0,2]]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',0,2]]", "[['submit','a','old'],['submit','b','stale'],['disconnect'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',1,1]]", "[['disconnect'],['disconnect'],['submit','a','x'*N],['receipt','a',2,1]]", "[['submit','a','hello'*N],['receipt','a',0,1],['receipt','a',0,1]]", "[['submit','a','hi'*N],['submit','b','bye'],['receipt','a',0,1],['receipt','b',0,2],['disconnect'],['submit','a','new'],['receipt','a',1,1]]", "[['disconnect'],['submit','a','fresh'*N],['receipt','a',0,1]]", "[['submit','a','old'],['submit','b','old'],['disconnect']]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1]]", '[]']
expected = {1: [[['word', 'other'], 0, 0, 2], [['new'], 0, 0, 2], [['new'], 0, 1, 1], [['x'], 0, 2, 1], [['hello'], 0, 0, 1], [['hi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 2: [[['wordword', 'other'], 0, 0, 2], [['newnew'], 0, 0, 2], [['newnew'], 0, 1, 1], [['xx'], 0, 2, 1], [['hellohello'], 0, 0, 1], [['hihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 3: [[['wordwordword', 'other'], 0, 0, 2], [['newnewnew'], 0, 0, 2], [['newnewnew'], 0, 1, 1], [['xxx'], 0, 2, 1], [['hellohellohello'], 0, 0, 1], [['hihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 4: [[['wordwordwordword', 'other'], 0, 0, 2], [['newnewnewnew'], 0, 0, 2], [['newnewnewnew'], 0, 1, 1], [['xxxx'], 0, 2, 1], [['hellohellohellohello'], 0, 0, 1], [['hihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 5: [[['wordwordwordwordword', 'other'], 0, 0, 2], [['newnewnewnewnew'], 0, 0, 2], [['newnewnewnewnew'], 0, 1, 1], [['xxxxx'], 0, 2, 1], [['hellohellohellohellohello'], 0, 0, 1], [['hihihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 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):
    pending = {}; retired = set(); spoken = []; generation = 0; serial = 0
    for e in events:
        if e[0] == 'submit':
            serial += 1
            pending[e[1]] = [generation, serial, e[2]]
        elif e[0] == 'receipt':
            ident, epoch, ticket = e[1:]
            if epoch != generation: continue
            if ticket in retired: continue
            if ident not in pending: continue
            if pending[ident][1] != ticket: continue
            spoken.append(pending[ident][2])
            del pending[ident]
            retired.add(ticket)
        elif e[0] == 'disconnect':
            pending.pop(next(iter(pending)), None) if pending else None
            generation += 1
            serial = 0
            retired.clear()
    return [spoken, len(pending), generation, serial]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['submit','a','word'*N],['submit','b','other'],['receipt','a',0,1],['receipt','b',0,1],['receipt','b',0,2]]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',0,2]]", "[['submit','a','old'],['submit','b','stale'],['disconnect'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',1,1]]", "[['disconnect'],['disconnect'],['submit','a','x'*N],['receipt','a',2,1]]", "[['submit','a','hello'*N],['receipt','a',0,1],['receipt','a',0,1]]", "[['submit','a','hi'*N],['submit','b','bye'],['receipt','a',0,1],['receipt','b',0,2],['disconnect'],['submit','a','new'],['receipt','a',1,1]]", "[['disconnect'],['submit','a','fresh'*N],['receipt','a',0,1]]", "[['submit','a','old'],['submit','b','old'],['disconnect']]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1]]", '[]']
expected = {1: [[['word', 'other'], 0, 0, 2], [['new'], 0, 0, 2], [['new'], 0, 1, 1], [['x'], 0, 2, 1], [['hello'], 0, 0, 1], [['hi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 2: [[['wordword', 'other'], 0, 0, 2], [['newnew'], 0, 0, 2], [['newnew'], 0, 1, 1], [['xx'], 0, 2, 1], [['hellohello'], 0, 0, 1], [['hihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 3: [[['wordwordword', 'other'], 0, 0, 2], [['newnewnew'], 0, 0, 2], [['newnewnew'], 0, 1, 1], [['xxx'], 0, 2, 1], [['hellohellohello'], 0, 0, 1], [['hihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 4: [[['wordwordwordword', 'other'], 0, 0, 2], [['newnewnewnew'], 0, 0, 2], [['newnewnewnew'], 0, 1, 1], [['xxxx'], 0, 2, 1], [['hellohellohellohello'], 0, 0, 1], [['hihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 5: [[['wordwordwordwordword', 'other'], 0, 0, 2], [['newnewnewnewnew'], 0, 0, 2], [['newnewnewnewnew'], 0, 1, 1], [['xxxxx'], 0, 2, 1], [['hellohellohellohellohello'], 0, 0, 1], [['hihihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 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 delivery-receipts contract.

A delivery is keyed by (utterance, generation). Submit replaces pending text for that key. A receipt is accepted only for the active generation and exact serial; accepted receipts append spoken text, remove pending, and retire the serial. Disconnect discards pending, increments generation, resets serial. Duplicate receipts do nothing. Report spoken, pending count, generation and next serial.

split: open-access


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

N = 1
observations = []
def solve(events):
    pending = {}; retired = set(); spoken = []; generation = 0; serial = 0
    for e in events:
        if e[0] == 'submit':
            serial += 1
            pending[e[1]] = [generation, serial, e[2]]
        elif e[0] == 'receipt':
            ident, epoch, ticket = e[1:]
            if epoch != generation: continue
            if ticket in retired: continue
            if ident not in pending: continue
            if pending[ident][1] != ticket: continue
            spoken.append(pending[ident][2])
            del pending[ident]
            retired.add(ticket)
        elif e[0] == 'disconnect':
            pending.clear()
            generation = 0
            serial = 0
            retired.clear()
    return [spoken, len(pending), generation, serial]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['submit','a','word'*N],['submit','b','other'],['receipt','a',0,1],['receipt','b',0,1],['receipt','b',0,2]]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',0,2]]", "[['submit','a','old'],['submit','b','stale'],['disconnect'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',1,1]]", "[['disconnect'],['disconnect'],['submit','a','x'*N],['receipt','a',2,1]]", "[['submit','a','hello'*N],['receipt','a',0,1],['receipt','a',0,1]]", "[['submit','a','hi'*N],['submit','b','bye'],['receipt','a',0,1],['receipt','b',0,2],['disconnect'],['submit','a','new'],['receipt','a',1,1]]", "[['disconnect'],['submit','a','fresh'*N],['receipt','a',0,1]]", "[['submit','a','old'],['submit','b','old'],['disconnect']]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1]]", '[]']
expected = {1: [[['word', 'other'], 0, 0, 2], [['new'], 0, 0, 2], [['new'], 0, 1, 1], [['x'], 0, 2, 1], [['hello'], 0, 0, 1], [['hi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 2: [[['wordword', 'other'], 0, 0, 2], [['newnew'], 0, 0, 2], [['newnew'], 0, 1, 1], [['xx'], 0, 2, 1], [['hellohello'], 0, 0, 1], [['hihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 3: [[['wordwordword', 'other'], 0, 0, 2], [['newnewnew'], 0, 0, 2], [['newnewnew'], 0, 1, 1], [['xxx'], 0, 2, 1], [['hellohellohello'], 0, 0, 1], [['hihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 4: [[['wordwordwordword', 'other'], 0, 0, 2], [['newnewnewnew'], 0, 0, 2], [['newnewnewnew'], 0, 1, 1], [['xxxx'], 0, 2, 1], [['hellohellohellohello'], 0, 0, 1], [['hihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 5: [[['wordwordwordwordword', 'other'], 0, 0, 2], [['newnewnewnewnew'], 0, 0, 2], [['newnewnewnewnew'], 0, 1, 1], [['xxxxx'], 0, 2, 1], [['hellohellohellohellohello'], 0, 0, 1], [['hihihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 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):
    pending = {}; retired = set(); spoken = []; generation = 0; serial = 0
    for e in events:
        if e[0] == 'submit':
            serial += 1
            pending[e[1]] = [generation, serial, e[2]]
        elif e[0] == 'receipt':
            ident, epoch, ticket = e[1:]
            if epoch != generation: continue
            if ticket in retired: continue
            if ident not in pending: continue
            if pending[ident][1] != ticket: continue
            spoken.append(pending[ident][2])
            del pending[ident]
            retired.add(ticket)
        elif e[0] == 'disconnect':
            pending.clear()
            generation = 1
            serial = 0
            retired.clear()
    return [spoken, len(pending), generation, serial]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['submit','a','word'*N],['submit','b','other'],['receipt','a',0,1],['receipt','b',0,1],['receipt','b',0,2]]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',0,2]]", "[['submit','a','old'],['submit','b','stale'],['disconnect'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',1,1]]", "[['disconnect'],['disconnect'],['submit','a','x'*N],['receipt','a',2,1]]", "[['submit','a','hello'*N],['receipt','a',0,1],['receipt','a',0,1]]", "[['submit','a','hi'*N],['submit','b','bye'],['receipt','a',0,1],['receipt','b',0,2],['disconnect'],['submit','a','new'],['receipt','a',1,1]]", "[['disconnect'],['submit','a','fresh'*N],['receipt','a',0,1]]", "[['submit','a','old'],['submit','b','old'],['disconnect']]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1]]", '[]']
expected = {1: [[['word', 'other'], 0, 0, 2], [['new'], 0, 0, 2], [['new'], 0, 1, 1], [['x'], 0, 2, 1], [['hello'], 0, 0, 1], [['hi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 2: [[['wordword', 'other'], 0, 0, 2], [['newnew'], 0, 0, 2], [['newnew'], 0, 1, 1], [['xx'], 0, 2, 1], [['hellohello'], 0, 0, 1], [['hihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 3: [[['wordwordword', 'other'], 0, 0, 2], [['newnewnew'], 0, 0, 2], [['newnewnew'], 0, 1, 1], [['xxx'], 0, 2, 1], [['hellohellohello'], 0, 0, 1], [['hihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 4: [[['wordwordwordword', 'other'], 0, 0, 2], [['newnewnewnew'], 0, 0, 2], [['newnewnewnew'], 0, 1, 1], [['xxxx'], 0, 2, 1], [['hellohellohellohello'], 0, 0, 1], [['hihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 5: [[['wordwordwordwordword', 'other'], 0, 0, 2], [['newnewnewnewnew'], 0, 0, 2], [['newnewnewnewnew'], 0, 1, 1], [['xxxxx'], 0, 2, 1], [['hellohellohellohellohello'], 0, 0, 1], [['hihihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 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 delivery-receipts contract.

A delivery is keyed by (utterance, generation). Submit replaces pending text for that key. A receipt is accepted only for the active generation and exact serial; accepted receipts append spoken text, remove pending, and retire the serial. Disconnect discards pending, increments generation, resets serial. Duplicate receipts do nothing. Report spoken, pending count, generation and next serial.

split: open-access


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

N = 1
observations = []
def solve(events):
    pending = {}; retired = set(); spoken = []; generation = 0; serial = 0
    for e in events:
        if e[0] == 'submit':
            serial += 1
            pending[e[1]] = [generation, serial, e[2]]
        elif e[0] == 'receipt':
            ident, epoch, ticket = e[1:]
            if epoch != generation: continue
            if ticket in retired: continue
            if ident not in pending: continue
            if pending[ident][1] != ticket: continue
            spoken.append(pending[ident][2])
            del pending[ident]
            retired.add(ticket)
        elif e[0] == 'disconnect':
            pending.clear()
            generation += 1
            serial = serial
            retired.clear()
    return [spoken, len(pending), generation, serial]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['submit','a','word'*N],['submit','b','other'],['receipt','a',0,1],['receipt','b',0,1],['receipt','b',0,2]]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',0,2]]", "[['submit','a','old'],['submit','b','stale'],['disconnect'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',1,1]]", "[['disconnect'],['disconnect'],['submit','a','x'*N],['receipt','a',2,1]]", "[['submit','a','hello'*N],['receipt','a',0,1],['receipt','a',0,1]]", "[['submit','a','hi'*N],['submit','b','bye'],['receipt','a',0,1],['receipt','b',0,2],['disconnect'],['submit','a','new'],['receipt','a',1,1]]", "[['disconnect'],['submit','a','fresh'*N],['receipt','a',0,1]]", "[['submit','a','old'],['submit','b','old'],['disconnect']]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1]]", '[]']
expected = {1: [[['word', 'other'], 0, 0, 2], [['new'], 0, 0, 2], [['new'], 0, 1, 1], [['x'], 0, 2, 1], [['hello'], 0, 0, 1], [['hi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 2: [[['wordword', 'other'], 0, 0, 2], [['newnew'], 0, 0, 2], [['newnew'], 0, 1, 1], [['xx'], 0, 2, 1], [['hellohello'], 0, 0, 1], [['hihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 3: [[['wordwordword', 'other'], 0, 0, 2], [['newnewnew'], 0, 0, 2], [['newnewnew'], 0, 1, 1], [['xxx'], 0, 2, 1], [['hellohellohello'], 0, 0, 1], [['hihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 4: [[['wordwordwordword', 'other'], 0, 0, 2], [['newnewnewnew'], 0, 0, 2], [['newnewnewnew'], 0, 1, 1], [['xxxx'], 0, 2, 1], [['hellohellohellohello'], 0, 0, 1], [['hihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 5: [[['wordwordwordwordword', 'other'], 0, 0, 2], [['newnewnewnewnew'], 0, 0, 2], [['newnewnewnewnew'], 0, 1, 1], [['xxxxx'], 0, 2, 1], [['hellohellohellohellohello'], 0, 0, 1], [['hihihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 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):
    pending = {}; retired = set(); spoken = []; generation = 0; serial = 0
    for e in events:
        if e[0] == 'submit':
            serial += 1
            pending[e[1]] = [generation, serial, e[2]]
        elif e[0] == 'receipt':
            ident, epoch, ticket = e[1:]
            if epoch != generation: continue
            if ticket in retired: continue
            if ident not in pending: continue
            if pending[ident][1] != ticket: continue
            spoken.append(pending[ident][2])
            del pending[ident]
            retired.add(ticket)
        elif e[0] == 'disconnect':
            pending.clear()
            generation += 1
            serial = 1
            retired.clear()
    return [spoken, len(pending), generation, serial]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['submit','a','word'*N],['submit','b','other'],['receipt','a',0,1],['receipt','b',0,1],['receipt','b',0,2]]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',0,2]]", "[['submit','a','old'],['submit','b','stale'],['disconnect'],['submit','a','new'*N],['receipt','a',0,1],['receipt','a',1,1]]", "[['disconnect'],['disconnect'],['submit','a','x'*N],['receipt','a',2,1]]", "[['submit','a','hello'*N],['receipt','a',0,1],['receipt','a',0,1]]", "[['submit','a','hi'*N],['submit','b','bye'],['receipt','a',0,1],['receipt','b',0,2],['disconnect'],['submit','a','new'],['receipt','a',1,1]]", "[['disconnect'],['submit','a','fresh'*N],['receipt','a',0,1]]", "[['submit','a','old'],['submit','b','old'],['disconnect']]", "[['submit','a','old'],['submit','a','new'*N],['receipt','a',0,1]]", '[]']
expected = {1: [[['word', 'other'], 0, 0, 2], [['new'], 0, 0, 2], [['new'], 0, 1, 1], [['x'], 0, 2, 1], [['hello'], 0, 0, 1], [['hi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 2: [[['wordword', 'other'], 0, 0, 2], [['newnew'], 0, 0, 2], [['newnew'], 0, 1, 1], [['xx'], 0, 2, 1], [['hellohello'], 0, 0, 1], [['hihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 3: [[['wordwordword', 'other'], 0, 0, 2], [['newnewnew'], 0, 0, 2], [['newnewnew'], 0, 1, 1], [['xxx'], 0, 2, 1], [['hellohellohello'], 0, 0, 1], [['hihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 4: [[['wordwordwordword', 'other'], 0, 0, 2], [['newnewnewnew'], 0, 0, 2], [['newnewnewnew'], 0, 1, 1], [['xxxx'], 0, 2, 1], [['hellohellohellohello'], 0, 0, 1], [['hihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 0, 0]], 5: [[['wordwordwordwordword', 'other'], 0, 0, 2], [['newnewnewnewnew'], 0, 0, 2], [['newnewnewnewnew'], 0, 1, 1], [['xxxxx'], 0, 2, 1], [['hellohellohellohellohello'], 0, 0, 1], [['hihihihihi', 'bye', 'new'], 0, 1, 1], [[], 1, 1, 1], [[], 0, 1, 0], [[], 1, 0, 2], [[], 0, 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 delivery-receipts contract.

A delivery is keyed by (utterance, generation). Submit replaces pending text for that key. A receipt is accepted only for the active generation and exact serial; accepted receipts append spoken text, remove pending, and retire the serial. Disconnect discards pending, increments generation, resets serial. Duplicate receipts do nothing. Report spoken, pending count, generation and next serial.

split: open-access


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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=min(cursor,len(words)); done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=1 if words else 0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Finite word arrays model announcements. Load copies words and resets cursor and completion. Speak advances one word only while unpaused. Seek clamps to [0,length]. Rewind moves one word. Cancel discards current words. Completion is logged exactly once when a speak reaches end, never for an empty load. Speed changes do not move word cursor. Return spoken words, completion count, cursor and paused flag.

split: open-access


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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=False
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=bool(cursor)
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Finite word arrays model announcements. Load copies words and resets cursor and completion. Speak advances one word only while unpaused. Seek clamps to [0,length]. Rewind moves one word. Cancel discards current words. Completion is logged exactly once when a speak reaches end, never for an empty load. Speed changes do not move word cursor. Return spoken words, completion count, cursor and paused flag.

split: open-access


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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=True
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False; cursor=0
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Finite word arrays model announcements. Load copies words and resets cursor and completion. Speak advances one word only while unpaused. Seek clamps to [0,length]. Rewind moves one word. Cancel discards current words. Completion is logged exactly once when a speak reaches end, never for an empty load. Speed changes do not move word cursor. Return spoken words, completion count, cursor and paused flag.

split: open-access


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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=e[1] if 0<=e[1]<len(words) else 0
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],max(0,len(words)-1)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Finite word arrays model announcements. Load copies words and resets cursor and completion. Speak advances one word only while unpaused. Seek clamps to [0,length]. Rewind moves one word. Cancel discards current words. Completion is logged exactly once when a speak reaches end, never for an empty load. Speed changes do not move word cursor. Return spoken words, completion count, cursor and paused flag.

split: open-access


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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-2)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=0
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Finite word arrays model announcements. Load copies words and resets cursor and completion. Speak advances one word only while unpaused. Seek clamps to [0,length]. Rewind moves one word. Cancel discards current words. Completion is logged exactly once when a speak reaches end, never for an empty load. Speed changes do not move word cursor. Return spoken words, completion count, cursor and paused flag.

split: open-access


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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Finite word arrays model announcements. Load copies words and resets cursor and completion. Speak advances one word only while unpaused. Seek clamps to [0,length]. Rewind moves one word. Cancel discards current words. Completion is logged exactly once when a speak reaches end, never for an empty load. Speed changes do not move word cursor. Return spoken words, completion count, cursor and paused flag.

split: open-access


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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': cursor=min(len(words),cursor+1)
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': cursor=0
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Finite word arrays model announcements. Load copies words and resets cursor and completion. Speak advances one word only while unpaused. Seek clamps to [0,length]. Rewind moves one word. Cancel discards current words. Completion is logged exactly once when a speak reaches end, never for an empty load. Speed changes do not move word cursor. Return spoken words, completion count, cursor and paused flag.

split: open-access


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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused and not words: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused and cursor>0: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Finite word arrays model announcements. Load copies words and resets cursor and completion. Speak advances one word only while unpaused. Seek clamps to [0,length]. Rewind moves one word. Cancel discards current words. Completion is logged exactly once when a speak reaches end, never for an empty load. Speed changes do not move word cursor. Return spoken words, completion count, cursor and paused flag.

split: open-access


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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=2
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor=len(words)
            if words and cursor==len(words) and not done:
                completions+=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Finite word arrays model announcements. Load copies words and resets cursor and completion. Speak advances one word only while unpaused. Seek clamps to [0,length]. Rewind moves one word. Cancel discards current words. Completion is logged exactly once when a speak reaches end, never for an empty load. Speed changes do not move word cursor. Return spoken words, completion count, cursor and paused flag.

split: open-access


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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions+=1; done=False
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(events):
    words=[]; cursor=0; paused=False; done=False; spoken=[]; completions=0
    for e in events:
        if e[0]=='load':
            words=list(e[1]); cursor=0; done=False
        elif e[0]=='pause': paused=True
        elif e[0]=='resume': paused=False
        elif e[0]=='seek': cursor=max(0,min(e[1],len(words)))
        elif e[0]=='rewind': cursor=max(0,cursor-1)
        elif e[0]=='cancel': words=[]; cursor=0; done=True
        elif e[0]=='speed': pass
        elif e[0]=='speak':
            if paused: continue
            if cursor<len(words):
                spoken.append(words[cursor]); cursor+=1
            if words and cursor==len(words) and not done:
                completions=1; done=True
    return [spoken,completions,cursor,paused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['load',['word']*(N+3)],['speak'],['speak'],['rewind'],['speed',2],['speak'],['pause'],['speak'],['resume'],['speak']]", "[['load',['x']*(N+1)],['pause'],['speak'],['resume'],['speak'],['load',['a','b']],['speak']]", "[['load',['x']*N]]+[['speak']]*(N+2)+[['load',['y']],['speak'],['speak']]", "[['load',['x']*(N+2)],['speak'],['speak'],['cancel'],['speak']]", "[['load',['x']*N],['seek',N+5],['speak'],['seek',-2]]", "[['load',[]],['speak'],['cancel']]", "[['load',['x']*(N+4)],['seek',3],['rewind']]"]
expected = {1: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 2: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 3: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 4: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]], 5: [[['word', 'word', 'word', 'word'], 0, 3, False], [['x', 'a'], 0, 1, False], [['x', 'x', 'x', 'x', 'x', 'y'], 2, 1, False], [['x', 'x'], 0, 0, False], [[], 1, 0, False], [[], 0, 0, False], [[], 0, 2, False]]}[N]
for i, expression in enumerate(fixtures):
    check("trace-"+str(i+1), solve(eval(expression)), expected[i])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Finite word arrays model announcements. Load copies words and resets cursor and completion. Speak advances one word only while unpaused. Seek clamps to [0,length]. Rewind moves one word. Cancel discards current words. Completion is logged exactly once when a speak reaches end, never for an empty load. Speed changes do not move word cursor. Return spoken words, completion count, cursor and paused flag.

split: open-access