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

N = 1
observations = []
def solve(events):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': pass
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+1+len(row[1])<=budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q=[]
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+1+len(row[1])<=budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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 sentence-packing contract.

Input operations configure character budget then append indivisible phrases [text,language]. Flush packs consecutive same-language phrases with one space while within budget. A phrase longer than budget is emitted alone intact. Language change always starts a new packet. Empty phrases are ignored. Break inserts hard boundary. Cancel removes queued phrases of one language. Returned packets are [language,text], queued phrase count and budget; flush consumes pending phrases.

split: open-access


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

N = 1
observations = []
def solve(events):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+1+len(row[1])<=budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[x for x in q if x is not None and x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+1+len(row[1])<=budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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 sentence-packing contract.

Input operations configure character budget then append indivisible phrases [text,language]. Flush packs consecutive same-language phrases with one space while within budget. A phrase longer than budget is emitted alone intact. Language change always starts a new packet. Empty phrases are ignored. Break inserts hard boundary. Cancel removes queued phrases of one language. Returned packets are [language,text], queued phrase count and budget; flush consumes pending phrases.

split: open-access


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

N = 1
observations = []
def solve(events):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(list(current))
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+1+len(row[1])<=budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=[current[0],'']
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+1+len(row[1])<=budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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 sentence-packing contract.

Input operations configure character budget then append indivisible phrases [text,language]. Flush packs consecutive same-language phrases with one space while within budget. A phrase longer than budget is emitted alone intact. Language change always starts a new packet. Empty phrases are ignored. Break inserts hard boundary. Cancel removes queued phrases of one language. Returned packets are [language,text], queued phrase count and budget; flush consumes pending phrases.

split: open-access


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

N = 1
observations = []
def solve(events):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and True and len(current[1])+1+len(row[1])<=budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and current[0][:2]==row[0][:2] and len(current[1])+1+len(row[1])<=budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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 sentence-packing contract.

Input operations configure character budget then append indivisible phrases [text,language]. Flush packs consecutive same-language phrases with one space while within budget. A phrase longer than budget is emitted alone intact. Language change always starts a new packet. Empty phrases are ignored. Break inserts hard boundary. Cancel removes queued phrases of one language. Returned packets are [language,text], queued phrase count and budget; flush consumes pending phrases.

split: open-access


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

N = 1
observations = []
def solve(events):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+len(row[1])<=budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+1+len(row[1])<budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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 sentence-packing contract.

Input operations configure character budget then append indivisible phrases [text,language]. Flush packs consecutive same-language phrases with one space while within budget. A phrase longer than budget is emitted alone intact. Language change always starts a new packet. Empty phrases are ignored. Break inserts hard boundary. Cancel removes queued phrases of one language. Returned packets are [language,text], queued phrase count and budget; flush consumes pending phrases.

split: open-access


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

N = 1
observations = []
def solve(events):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+1+len(row[1])<=budget:
                    current[1]+=row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+1+len(row[1])<=budget:
                    current[1]+='  '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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 sentence-packing contract.

Input operations configure character budget then append indivisible phrases [text,language]. Flush packs consecutive same-language phrases with one space while within budget. A phrase longer than budget is emitted alone intact. Language change always starts a new packet. Empty phrases are ignored. Break inserts hard boundary. Cancel removes queued phrases of one language. Returned packets are [language,text], queued phrase count and budget; flush consumes pending phrases.

split: open-access


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

N = 1
observations = []
def solve(events):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+1+len(row[1])<=budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=[row[0],row[1][:budget]]
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+1+len(row[1])<=budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=[row[0],row[1][-budget:]]
            if current is not None: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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 sentence-packing contract.

Input operations configure character budget then append indivisible phrases [text,language]. Flush packs consecutive same-language phrases with one space while within budget. A phrase longer than budget is emitted alone intact. Language change always starts a new packet. Empty phrases are ignored. Break inserts hard boundary. Cancel removes queued phrases of one language. Returned packets are [language,text], queued phrase count and budget; flush consumes pending phrases.

split: open-access


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

N = 1
observations = []
def solve(events):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+1+len(row[1])<=budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None: pass
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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):
    budget=10; q=[]; out=[]
    for e in events:
        if e[0]=='budget': budget=max(1,e[1])
        elif e[0]=='phrase':
            if e[1]: q.append([e[2],e[1]])
        elif e[0]=='break': q.append(None)
        elif e[0]=='cancel': q=[x for x in q if x is None or x[0]!=e[1]]
        elif e[0]=='flush':
            current=None
            for row in q:
                if row is None:
                    if current is not None: out.append(current); current=None
                    continue
                if current is not None and current[0]==row[0] and len(current[1])+1+len(row[1])<=budget:
                    current[1]+=' '+row[1]
                else:
                    if current is not None: out.append(current)
                    current=list(row)
            if current is not None and len(current[1])>=budget: out.append(current)
            q.clear()
    return [out,len(q),budget]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['budget',2*N+1],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['phrase','c','en'],['flush']]", "[['budget',2*N],['phrase','a'*N,'en'],['phrase','b'*N,'en'],['flush']]", "[['budget',100],['phrase','hello'*N,'en-US'],['phrase','hi','en-GB'],['break'],['phrase','x','en-GB'],['flush']]", "[['phrase','a','en'],['break'],['phrase','b','en'],['phrase','non','fr'],['cancel','fr'],['flush']]", "[['budget',1],['phrase','oversize'*N,'en'],['flush']]", "[['budget',0],['phrase','','en'],['phrase','  ','en'],['flush']]", "[['flush'],['break'],['flush']]"]
expected = {1: [[[['en', 'a b'], ['en', 'c']], 0, 3], [[['en', 'a'], ['en', 'b']], 0, 2], [[['en-US', 'hello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 2: [[[['en', 'aa bb'], ['en', 'c']], 0, 5], [[['en', 'aa'], ['en', 'bb']], 0, 4], [[['en-US', 'hellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 3: [[[['en', 'aaa bbb'], ['en', 'c']], 0, 7], [[['en', 'aaa'], ['en', 'bbb']], 0, 6], [[['en-US', 'hellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 4: [[[['en', 'aaaa bbbb'], ['en', 'c']], 0, 9], [[['en', 'aaaa'], ['en', 'bbbb']], 0, 8], [[['en-US', 'hellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]], 5: [[[['en', 'aaaaa bbbbb'], ['en', 'c']], 0, 11], [[['en', 'aaaaa'], ['en', 'bbbbb']], 0, 10], [[['en-US', 'hellohellohellohellohello'], ['en-GB', 'hi'], ['en-GB', 'x']], 0, 100], [[['en', 'a'], ['en', 'b']], 0, 10], [[['en', 'oversizeoversizeoversizeoversizeoversize']], 0, 1], [[['en', '  ']], 0, 1], [[], 0, 10]]}[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 sentence-packing contract.

Input operations configure character budget then append indivisible phrases [text,language]. Flush packs consecutive same-language phrases with one space while within budget. A phrase longer than budget is emitted alone intact. Language change always starts a new packet. Empty phrases are ignored. Break inserts hard boundary. Cancel removes queued phrases of one language. Returned packets are [language,text], queued phrase count and budget; flush consumes pending phrases.

split: open-access


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

N = 1
observations = []
def solve(events):
    current='local'; target=None; devices={'local'}; q=[]; out=[]
    for e in events:
        if e[0]=='add': devices={e[1]}
        elif e[0]=='queue': q.append([current,e[1]])
        elif e[0]=='begin': target=e[1]
        elif e[0]=='cancel': target=None
        elif e[0]=='commit' and target in devices:
            old=current; current=target
            q=[[current if route==old else route,text] for route,text in q]
            target=None
        elif e[0]=='remove':
            devices.discard(e[1])
            q=[x for x in q if x[0]!=e[1]]
            if current==e[1]: current='local'
        elif e[0]=='send' and q:
            index=next((i for i,x in enumerate(q) if x[0] in devices),None)
            if index is not None: out.append(q.pop(index))
    return [out,q,current,target,sorted(devices)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','Headset'],['queue','hello'*N],['begin','Headset'],['queue','before'],['commit'],['queue','after'],['send']]", "[['queue','keep'*N],['begin','missing'],['commit']]", "[['queue','keep'*N],['begin','remote'],['queue','during'*N],['cancel'],['send']]", "[['add','head'],['begin','head'],['commit'],['queue','remote'*N],['remove','head']]", "[['add','head'],['begin','head'],['commit'],['queue','keep'*N],['remove','unused']]", "[['add','remote'],['queue','local'*N],['remove','remote'],['send']]", '[]']
expected = {1: [[[['Headset', 'hello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keep']], 'local', 'missing', ['local']], [[['local', 'keep']], [['local', 'during']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keep']], 'head', None, ['head', 'local']], [[['local', 'local']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 2: [[[['Headset', 'hellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeep']], [['local', 'duringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 3: [[[['Headset', 'hellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeep']], [['local', 'duringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 4: [[[['Headset', 'hellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeep']], [['local', 'duringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 5: [[[['Headset', 'hellohellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeepkeep']], [['local', 'duringduringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]]}[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):
    current='local'; target=None; devices={'local'}; q=[]; out=[]
    for e in events:
        if e[0]=='add': devices.add(e[1].lower())
        elif e[0]=='queue': q.append([current,e[1]])
        elif e[0]=='begin': target=e[1]
        elif e[0]=='cancel': target=None
        elif e[0]=='commit' and target in devices:
            old=current; current=target
            q=[[current if route==old else route,text] for route,text in q]
            target=None
        elif e[0]=='remove':
            devices.discard(e[1])
            q=[x for x in q if x[0]!=e[1]]
            if current==e[1]: current='local'
        elif e[0]=='send' and q:
            index=next((i for i,x in enumerate(q) if x[0] in devices),None)
            if index is not None: out.append(q.pop(index))
    return [out,q,current,target,sorted(devices)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','Headset'],['queue','hello'*N],['begin','Headset'],['queue','before'],['commit'],['queue','after'],['send']]", "[['queue','keep'*N],['begin','missing'],['commit']]", "[['queue','keep'*N],['begin','remote'],['queue','during'*N],['cancel'],['send']]", "[['add','head'],['begin','head'],['commit'],['queue','remote'*N],['remove','head']]", "[['add','head'],['begin','head'],['commit'],['queue','keep'*N],['remove','unused']]", "[['add','remote'],['queue','local'*N],['remove','remote'],['send']]", '[]']
expected = {1: [[[['Headset', 'hello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keep']], 'local', 'missing', ['local']], [[['local', 'keep']], [['local', 'during']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keep']], 'head', None, ['head', 'local']], [[['local', 'local']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 2: [[[['Headset', 'hellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeep']], [['local', 'duringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 3: [[[['Headset', 'hellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeep']], [['local', 'duringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 4: [[[['Headset', 'hellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeep']], [['local', 'duringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 5: [[[['Headset', 'hellohellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeepkeep']], [['local', 'duringduringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]]}[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 device-handoff contract.

Output routes start at local device. Queue snapshots requested route and utterance text. Begin-handoff sets a target while retaining current route. Commit switches current route and migrates only pending items on old route; cancel-handoff leaves queue unchanged. Device removal drops queued output to that device and chooses local if current removed. Send requires route available and sends one queued item; unavailable items remain. Add makes device available. Return [device,text] output and pending routes.

split: open-access


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

N = 1
observations = []
def solve(events):
    current='local'; target=None; devices={'local'}; q=[]; out=[]
    for e in events:
        if e[0]=='add': devices.add(e[1])
        elif e[0]=='queue': q.append([target or current,e[1]])
        elif e[0]=='begin': target=e[1]
        elif e[0]=='cancel': target=None
        elif e[0]=='commit' and target in devices:
            old=current; current=target
            q=[[current if route==old else route,text] for route,text in q]
            target=None
        elif e[0]=='remove':
            devices.discard(e[1])
            q=[x for x in q if x[0]!=e[1]]
            if current==e[1]: current='local'
        elif e[0]=='send' and q:
            index=next((i for i,x in enumerate(q) if x[0] in devices),None)
            if index is not None: out.append(q.pop(index))
    return [out,q,current,target,sorted(devices)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','Headset'],['queue','hello'*N],['begin','Headset'],['queue','before'],['commit'],['queue','after'],['send']]", "[['queue','keep'*N],['begin','missing'],['commit']]", "[['queue','keep'*N],['begin','remote'],['queue','during'*N],['cancel'],['send']]", "[['add','head'],['begin','head'],['commit'],['queue','remote'*N],['remove','head']]", "[['add','head'],['begin','head'],['commit'],['queue','keep'*N],['remove','unused']]", "[['add','remote'],['queue','local'*N],['remove','remote'],['send']]", '[]']
expected = {1: [[[['Headset', 'hello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keep']], 'local', 'missing', ['local']], [[['local', 'keep']], [['local', 'during']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keep']], 'head', None, ['head', 'local']], [[['local', 'local']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 2: [[[['Headset', 'hellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeep']], [['local', 'duringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 3: [[[['Headset', 'hellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeep']], [['local', 'duringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 4: [[[['Headset', 'hellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeep']], [['local', 'duringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 5: [[[['Headset', 'hellohellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeepkeep']], [['local', 'duringduringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]]}[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):
    current='local'; target=None; devices={'local'}; q=[]; out=[]
    for e in events:
        if e[0]=='add': devices.add(e[1])
        elif e[0]=='queue': q.append(['local',e[1]])
        elif e[0]=='begin': target=e[1]
        elif e[0]=='cancel': target=None
        elif e[0]=='commit' and target in devices:
            old=current; current=target
            q=[[current if route==old else route,text] for route,text in q]
            target=None
        elif e[0]=='remove':
            devices.discard(e[1])
            q=[x for x in q if x[0]!=e[1]]
            if current==e[1]: current='local'
        elif e[0]=='send' and q:
            index=next((i for i,x in enumerate(q) if x[0] in devices),None)
            if index is not None: out.append(q.pop(index))
    return [out,q,current,target,sorted(devices)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','Headset'],['queue','hello'*N],['begin','Headset'],['queue','before'],['commit'],['queue','after'],['send']]", "[['queue','keep'*N],['begin','missing'],['commit']]", "[['queue','keep'*N],['begin','remote'],['queue','during'*N],['cancel'],['send']]", "[['add','head'],['begin','head'],['commit'],['queue','remote'*N],['remove','head']]", "[['add','head'],['begin','head'],['commit'],['queue','keep'*N],['remove','unused']]", "[['add','remote'],['queue','local'*N],['remove','remote'],['send']]", '[]']
expected = {1: [[[['Headset', 'hello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keep']], 'local', 'missing', ['local']], [[['local', 'keep']], [['local', 'during']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keep']], 'head', None, ['head', 'local']], [[['local', 'local']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 2: [[[['Headset', 'hellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeep']], [['local', 'duringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 3: [[[['Headset', 'hellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeep']], [['local', 'duringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 4: [[[['Headset', 'hellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeep']], [['local', 'duringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 5: [[[['Headset', 'hellohellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeepkeep']], [['local', 'duringduringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]]}[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 device-handoff contract.

Output routes start at local device. Queue snapshots requested route and utterance text. Begin-handoff sets a target while retaining current route. Commit switches current route and migrates only pending items on old route; cancel-handoff leaves queue unchanged. Device removal drops queued output to that device and chooses local if current removed. Send requires route available and sends one queued item; unavailable items remain. Add makes device available. Return [device,text] output and pending routes.

split: open-access


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

N = 1
observations = []
def solve(events):
    current='local'; target=None; devices={'local'}; q=[]; out=[]
    for e in events:
        if e[0]=='add': devices.add(e[1])
        elif e[0]=='queue': q.append([current,e[1]])
        elif e[0]=='begin': target=e[1]; current=e[1]
        elif e[0]=='cancel': target=None
        elif e[0]=='commit' and target in devices:
            old=current; current=target
            q=[[current if route==old else route,text] for route,text in q]
            target=None
        elif e[0]=='remove':
            devices.discard(e[1])
            q=[x for x in q if x[0]!=e[1]]
            if current==e[1]: current='local'
        elif e[0]=='send' and q:
            index=next((i for i,x in enumerate(q) if x[0] in devices),None)
            if index is not None: out.append(q.pop(index))
    return [out,q,current,target,sorted(devices)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','Headset'],['queue','hello'*N],['begin','Headset'],['queue','before'],['commit'],['queue','after'],['send']]", "[['queue','keep'*N],['begin','missing'],['commit']]", "[['queue','keep'*N],['begin','remote'],['queue','during'*N],['cancel'],['send']]", "[['add','head'],['begin','head'],['commit'],['queue','remote'*N],['remove','head']]", "[['add','head'],['begin','head'],['commit'],['queue','keep'*N],['remove','unused']]", "[['add','remote'],['queue','local'*N],['remove','remote'],['send']]", '[]']
expected = {1: [[[['Headset', 'hello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keep']], 'local', 'missing', ['local']], [[['local', 'keep']], [['local', 'during']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keep']], 'head', None, ['head', 'local']], [[['local', 'local']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 2: [[[['Headset', 'hellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeep']], [['local', 'duringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 3: [[[['Headset', 'hellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeep']], [['local', 'duringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 4: [[[['Headset', 'hellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeep']], [['local', 'duringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 5: [[[['Headset', 'hellohellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeepkeep']], [['local', 'duringduringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]]}[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):
    current='local'; target=None; devices={'local'}; q=[]; out=[]
    for e in events:
        if e[0]=='add': devices.add(e[1])
        elif e[0]=='queue': q.append([current,e[1]])
        elif e[0]=='begin': target=e[1]; q.clear()
        elif e[0]=='cancel': target=None
        elif e[0]=='commit' and target in devices:
            old=current; current=target
            q=[[current if route==old else route,text] for route,text in q]
            target=None
        elif e[0]=='remove':
            devices.discard(e[1])
            q=[x for x in q if x[0]!=e[1]]
            if current==e[1]: current='local'
        elif e[0]=='send' and q:
            index=next((i for i,x in enumerate(q) if x[0] in devices),None)
            if index is not None: out.append(q.pop(index))
    return [out,q,current,target,sorted(devices)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','Headset'],['queue','hello'*N],['begin','Headset'],['queue','before'],['commit'],['queue','after'],['send']]", "[['queue','keep'*N],['begin','missing'],['commit']]", "[['queue','keep'*N],['begin','remote'],['queue','during'*N],['cancel'],['send']]", "[['add','head'],['begin','head'],['commit'],['queue','remote'*N],['remove','head']]", "[['add','head'],['begin','head'],['commit'],['queue','keep'*N],['remove','unused']]", "[['add','remote'],['queue','local'*N],['remove','remote'],['send']]", '[]']
expected = {1: [[[['Headset', 'hello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keep']], 'local', 'missing', ['local']], [[['local', 'keep']], [['local', 'during']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keep']], 'head', None, ['head', 'local']], [[['local', 'local']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 2: [[[['Headset', 'hellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeep']], [['local', 'duringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 3: [[[['Headset', 'hellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeep']], [['local', 'duringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 4: [[[['Headset', 'hellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeep']], [['local', 'duringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 5: [[[['Headset', 'hellohellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeepkeep']], [['local', 'duringduringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]]}[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 device-handoff contract.

Output routes start at local device. Queue snapshots requested route and utterance text. Begin-handoff sets a target while retaining current route. Commit switches current route and migrates only pending items on old route; cancel-handoff leaves queue unchanged. Device removal drops queued output to that device and chooses local if current removed. Send requires route available and sends one queued item; unavailable items remain. Add makes device available. Return [device,text] output and pending routes.

split: open-access


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

N = 1
observations = []
def solve(events):
    current='local'; target=None; devices={'local'}; q=[]; out=[]
    for e in events:
        if e[0]=='add': devices.add(e[1])
        elif e[0]=='queue': q.append([current,e[1]])
        elif e[0]=='begin': target=e[1]
        elif e[0]=='cancel': target=None; q.clear()
        elif e[0]=='commit' and target in devices:
            old=current; current=target
            q=[[current if route==old else route,text] for route,text in q]
            target=None
        elif e[0]=='remove':
            devices.discard(e[1])
            q=[x for x in q if x[0]!=e[1]]
            if current==e[1]: current='local'
        elif e[0]=='send' and q:
            index=next((i for i,x in enumerate(q) if x[0] in devices),None)
            if index is not None: out.append(q.pop(index))
    return [out,q,current,target,sorted(devices)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','Headset'],['queue','hello'*N],['begin','Headset'],['queue','before'],['commit'],['queue','after'],['send']]", "[['queue','keep'*N],['begin','missing'],['commit']]", "[['queue','keep'*N],['begin','remote'],['queue','during'*N],['cancel'],['send']]", "[['add','head'],['begin','head'],['commit'],['queue','remote'*N],['remove','head']]", "[['add','head'],['begin','head'],['commit'],['queue','keep'*N],['remove','unused']]", "[['add','remote'],['queue','local'*N],['remove','remote'],['send']]", '[]']
expected = {1: [[[['Headset', 'hello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keep']], 'local', 'missing', ['local']], [[['local', 'keep']], [['local', 'during']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keep']], 'head', None, ['head', 'local']], [[['local', 'local']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 2: [[[['Headset', 'hellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeep']], [['local', 'duringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 3: [[[['Headset', 'hellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeep']], [['local', 'duringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 4: [[[['Headset', 'hellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeep']], [['local', 'duringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 5: [[[['Headset', 'hellohellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeepkeep']], [['local', 'duringduringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]]}[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):
    current='local'; target=None; devices={'local'}; q=[]; out=[]
    for e in events:
        if e[0]=='add': devices.add(e[1])
        elif e[0]=='queue': q.append([current,e[1]])
        elif e[0]=='begin': target=e[1]
        elif e[0]=='cancel': pass
        elif e[0]=='commit' and target in devices:
            old=current; current=target
            q=[[current if route==old else route,text] for route,text in q]
            target=None
        elif e[0]=='remove':
            devices.discard(e[1])
            q=[x for x in q if x[0]!=e[1]]
            if current==e[1]: current='local'
        elif e[0]=='send' and q:
            index=next((i for i,x in enumerate(q) if x[0] in devices),None)
            if index is not None: out.append(q.pop(index))
    return [out,q,current,target,sorted(devices)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['add','Headset'],['queue','hello'*N],['begin','Headset'],['queue','before'],['commit'],['queue','after'],['send']]", "[['queue','keep'*N],['begin','missing'],['commit']]", "[['queue','keep'*N],['begin','remote'],['queue','during'*N],['cancel'],['send']]", "[['add','head'],['begin','head'],['commit'],['queue','remote'*N],['remove','head']]", "[['add','head'],['begin','head'],['commit'],['queue','keep'*N],['remove','unused']]", "[['add','remote'],['queue','local'*N],['remove','remote'],['send']]", '[]']
expected = {1: [[[['Headset', 'hello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keep']], 'local', 'missing', ['local']], [[['local', 'keep']], [['local', 'during']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keep']], 'head', None, ['head', 'local']], [[['local', 'local']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 2: [[[['Headset', 'hellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeep']], [['local', 'duringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 3: [[[['Headset', 'hellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeep']], [['local', 'duringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 4: [[[['Headset', 'hellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeep']], [['local', 'duringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]], 5: [[[['Headset', 'hellohellohellohellohello']], [['Headset', 'before'], ['Headset', 'after']], 'Headset', None, ['Headset', 'local']], [[], [['local', 'keepkeepkeepkeepkeep']], 'local', 'missing', ['local']], [[['local', 'keepkeepkeepkeepkeep']], [['local', 'duringduringduringduringduring']], 'local', None, ['local']], [[], [], 'local', None, ['local']], [[], [['head', 'keepkeepkeepkeepkeep']], 'head', None, ['head', 'local']], [[['local', 'locallocallocallocallocal']], [], 'local', None, ['local']], [[], [], 'local', None, ['local']]]}[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 device-handoff contract.

Output routes start at local device. Queue snapshots requested route and utterance text. Begin-handoff sets a target while retaining current route. Commit switches current route and migrates only pending items on old route; cancel-handoff leaves queue unchanged. Device removal drops queued output to that device and chooses local if current removed. Send requires route available and sends one queued item; unavailable items remain. Add makes device available. Return [device,text] output and pending routes.

split: open-access