broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value == '' or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value == 'NULL' or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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:
A structured table violates the declared record or column contract.

Emit typed table cells as one comma row ending CRLF. None is bare NULL; strings equal NULL or empty must be quoted. Booleans are bare true/false, integers bare decimal. Other strings are quoted if they contain comma, quote, newline, CR, leading/trailing space, or begin # (comment protection). Double embedded quotes. Preserve Unicode and cell order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value == '#'
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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:
A structured table violates the declared record or column contract.

Emit typed table cells as one comma row ending CRLF. None is bare NULL; strings equal NULL or empty must be quoted. Booleans are bare true/false, integers bare decimal. Other strings are quoted if they contain comma, quote, newline, CR, leading/trailing space, or begin # (comment protection). Double embedded quotes. Preserve Unicode and cell order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n')  or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value.startswith(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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:
A structured table violates the declared record or column contract.

Emit typed table cells as one comma row ending CRLF. None is bare NULL; strings equal NULL or empty must be quoted. Booleans are bare true/false, integers bare decimal. Other strings are quoted if they contain comma, quote, newline, CR, leading/trailing space, or begin # (comment protection). Double embedded quotes. Preserve Unicode and cell order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = field + '"'
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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:
A structured table violates the declared record or column contract.

Emit typed table cells as one comma row ending CRLF. None is bare NULL; strings equal NULL or empty must be quoted. Booleans are bare true/false, integers bare decimal. Other strings are quoted if they contain comma, quote, newline, CR, leading/trailing space, or begin # (comment protection). Double embedded quotes. Preserve Unicode and cell order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(sorted(out)) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(reversed(out)) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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:
A structured table violates the declared record or column contract.

Emit typed table cells as one comma row ending CRLF. None is bare NULL; strings equal NULL or empty must be quoted. Booleans are bare true/false, integers bare decimal. Other strings are quoted if they contain comma, quote, newline, CR, leading/trailing space, or begin # (comment protection). Double embedded quotes. Preserve Unicode and cell order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field + '\r\n')
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field + '\n')
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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:
A structured table violates the declared record or column contract.

Emit typed table cells as one comma row ending CRLF. None is bare NULL; strings equal NULL or empty must be quoted. Booleans are bare true/false, integers bare decimal. Other strings are quoted if they contain comma, quote, newline, CR, leading/trailing space, or begin # (comment protection). Double embedded quotes. Preserve Unicode and cell order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    meta, rows = {}, []
    for line in data:
        if line.startswith('##'): continue
        elif line.startswith('#!'):
            pair = line[2:].split('=', 1)
            if len(pair) != 2 or not pair[0]: return None
            key, value = pair
            if key in meta: return None
            meta[key] = value
        elif line.startswith('#'): continue
        else: rows.append(line.split('|'))
    return [meta, rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comments', solve(_vary(['# comment', '@|x'])), _vary([{}, [['@', 'x']]]))
check('escaped marker', solve(_vary(['##literal|@'])), _vary([{}, [['#literal', '@']]]))
check('space prefix', solve(_vary([' # data|@'])), _vary([{}, [[' # data', '@']]]))
check('metadata', solve(_vary(['#!unit=a=b', '@|x'])), _vary([{'unit': 'a=b'}, [['@', 'x']]]))
check('duplicate', solve(_vary(['#!x=1', '#!x=2'])), _vary(None))
check('bad directive', solve(_vary(['#!x'])), _vary(None))
check('empty name', solve(_vary(['#!=value'])), _vary(None))
check('empty data', solve(_vary([''])), _vary([{}, [['']]]))
check('marker chain', solve(_vary(['###data'])), _vary([{}, [['##data']]]))
check('zero', solve(_vary([])), _vary([{}, []]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    meta, rows = {}, []
    for line in data:
        if line.startswith('##'): rows.append(line.lstrip('#').split('|'))
        elif line.startswith('#!'):
            pair = line[2:].split('=', 1)
            if len(pair) != 2 or not pair[0]: return None
            key, value = pair
            if key in meta: return None
            meta[key] = value
        elif line.startswith('#'): continue
        else: rows.append(line.split('|'))
    return [meta, rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comments', solve(_vary(['# comment', '@|x'])), _vary([{}, [['@', 'x']]]))
check('escaped marker', solve(_vary(['##literal|@'])), _vary([{}, [['#literal', '@']]]))
check('space prefix', solve(_vary([' # data|@'])), _vary([{}, [[' # data', '@']]]))
check('metadata', solve(_vary(['#!unit=a=b', '@|x'])), _vary([{'unit': 'a=b'}, [['@', 'x']]]))
check('duplicate', solve(_vary(['#!x=1', '#!x=2'])), _vary(None))
check('bad directive', solve(_vary(['#!x'])), _vary(None))
check('empty name', solve(_vary(['#!=value'])), _vary(None))
check('empty data', solve(_vary([''])), _vary([{}, [['']]]))
check('marker chain', solve(_vary(['###data'])), _vary([{}, [['##data']]]))
check('zero', solve(_vary([])), _vary([{}, []]))
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:
A structured table violates the declared record or column contract.

Process already framed pipe records. Column-zero # starts a comment except ## encodes a literal leading # data record. A column-zero #!name=value directive sets a unique metadata name; malformed or duplicate directives reject. Other records, including leading-space # and empty records, are data. Return metadata and data rows.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    meta, rows = {}, []
    for line in data:
        if line.startswith('##'): rows.append(line[1:].split('|'))
        elif line.startswith('#!'):
            pair = line[2:].rsplit('=', 1)
            if len(pair) != 2 or not pair[0]: return None
            key, value = pair
            if key in meta: return None
            meta[key] = value
        elif line.startswith('#'): continue
        else: rows.append(line.split('|'))
    return [meta, rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comments', solve(_vary(['# comment', '@|x'])), _vary([{}, [['@', 'x']]]))
check('escaped marker', solve(_vary(['##literal|@'])), _vary([{}, [['#literal', '@']]]))
check('space prefix', solve(_vary([' # data|@'])), _vary([{}, [[' # data', '@']]]))
check('metadata', solve(_vary(['#!unit=a=b', '@|x'])), _vary([{'unit': 'a=b'}, [['@', 'x']]]))
check('duplicate', solve(_vary(['#!x=1', '#!x=2'])), _vary(None))
check('bad directive', solve(_vary(['#!x'])), _vary(None))
check('empty name', solve(_vary(['#!=value'])), _vary(None))
check('empty data', solve(_vary([''])), _vary([{}, [['']]]))
check('marker chain', solve(_vary(['###data'])), _vary([{}, [['##data']]]))
check('zero', solve(_vary([])), _vary([{}, []]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    meta, rows = {}, []
    for line in data:
        if line.startswith('##'): rows.append(line[1:].split('|'))
        elif line.startswith('#!'):
            pair = line[2:].split('=')
            if len(pair) != 2 or not pair[0]: return None
            key, value = pair
            if key in meta: return None
            meta[key] = value
        elif line.startswith('#'): continue
        else: rows.append(line.split('|'))
    return [meta, rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comments', solve(_vary(['# comment', '@|x'])), _vary([{}, [['@', 'x']]]))
check('escaped marker', solve(_vary(['##literal|@'])), _vary([{}, [['#literal', '@']]]))
check('space prefix', solve(_vary([' # data|@'])), _vary([{}, [[' # data', '@']]]))
check('metadata', solve(_vary(['#!unit=a=b', '@|x'])), _vary([{'unit': 'a=b'}, [['@', 'x']]]))
check('duplicate', solve(_vary(['#!x=1', '#!x=2'])), _vary(None))
check('bad directive', solve(_vary(['#!x'])), _vary(None))
check('empty name', solve(_vary(['#!=value'])), _vary(None))
check('empty data', solve(_vary([''])), _vary([{}, [['']]]))
check('marker chain', solve(_vary(['###data'])), _vary([{}, [['##data']]]))
check('zero', solve(_vary([])), _vary([{}, []]))
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:
A structured table violates the declared record or column contract.

Process already framed pipe records. Column-zero # starts a comment except ## encodes a literal leading # data record. A column-zero #!name=value directive sets a unique metadata name; malformed or duplicate directives reject. Other records, including leading-space # and empty records, are data. Return metadata and data rows.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    meta, rows = {}, []
    for line in data:
        if line.startswith('##'): rows.append(line[1:].split('|'))
        elif line.startswith('#!'):
            pair = line[2:].split('=', 1)
            if len(pair) != 2 or not pair[0]: return None
            key, value = pair
            if False: return None
            meta[key] = value
        elif line.startswith('#'): continue
        else: rows.append(line.split('|'))
    return [meta, rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comments', solve(_vary(['# comment', '@|x'])), _vary([{}, [['@', 'x']]]))
check('escaped marker', solve(_vary(['##literal|@'])), _vary([{}, [['#literal', '@']]]))
check('space prefix', solve(_vary([' # data|@'])), _vary([{}, [[' # data', '@']]]))
check('metadata', solve(_vary(['#!unit=a=b', '@|x'])), _vary([{'unit': 'a=b'}, [['@', 'x']]]))
check('duplicate', solve(_vary(['#!x=1', '#!x=2'])), _vary(None))
check('bad directive', solve(_vary(['#!x'])), _vary(None))
check('empty name', solve(_vary(['#!=value'])), _vary(None))
check('empty data', solve(_vary([''])), _vary([{}, [['']]]))
check('marker chain', solve(_vary(['###data'])), _vary([{}, [['##data']]]))
check('zero', solve(_vary([])), _vary([{}, []]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    meta, rows = {}, []
    for line in data:
        if line.startswith('##'): rows.append(line[1:].split('|'))
        elif line.startswith('#!'):
            pair = line[2:].split('=', 1)
            if len(pair) != 2 or not pair[0]: return None
            key, value = pair
            if key in meta: continue
            meta[key] = value
        elif line.startswith('#'): continue
        else: rows.append(line.split('|'))
    return [meta, rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comments', solve(_vary(['# comment', '@|x'])), _vary([{}, [['@', 'x']]]))
check('escaped marker', solve(_vary(['##literal|@'])), _vary([{}, [['#literal', '@']]]))
check('space prefix', solve(_vary([' # data|@'])), _vary([{}, [[' # data', '@']]]))
check('metadata', solve(_vary(['#!unit=a=b', '@|x'])), _vary([{'unit': 'a=b'}, [['@', 'x']]]))
check('duplicate', solve(_vary(['#!x=1', '#!x=2'])), _vary(None))
check('bad directive', solve(_vary(['#!x'])), _vary(None))
check('empty name', solve(_vary(['#!=value'])), _vary(None))
check('empty data', solve(_vary([''])), _vary([{}, [['']]]))
check('marker chain', solve(_vary(['###data'])), _vary([{}, [['##data']]]))
check('zero', solve(_vary([])), _vary([{}, []]))
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:
A structured table violates the declared record or column contract.

Process already framed pipe records. Column-zero # starts a comment except ## encodes a literal leading # data record. A column-zero #!name=value directive sets a unique metadata name; malformed or duplicate directives reject. Other records, including leading-space # and empty records, are data. Return metadata and data rows.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    meta, rows = {}, []
    for line in data:
        if line.startswith('##'): rows.append(line[1:].split('|'))
        elif line.startswith('#!'):
            pair = line[2:].split('=', 1)
            if len(pair) != 2 or not pair[0]: return None
            key, value = pair
            if key in meta: return None
            meta[key] = value
        elif line.lstrip().startswith('#'): continue
        else: rows.append(line.split('|'))
    return [meta, rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comments', solve(_vary(['# comment', '@|x'])), _vary([{}, [['@', 'x']]]))
check('escaped marker', solve(_vary(['##literal|@'])), _vary([{}, [['#literal', '@']]]))
check('space prefix', solve(_vary([' # data|@'])), _vary([{}, [[' # data', '@']]]))
check('metadata', solve(_vary(['#!unit=a=b', '@|x'])), _vary([{'unit': 'a=b'}, [['@', 'x']]]))
check('duplicate', solve(_vary(['#!x=1', '#!x=2'])), _vary(None))
check('bad directive', solve(_vary(['#!x'])), _vary(None))
check('empty name', solve(_vary(['#!=value'])), _vary(None))
check('empty data', solve(_vary([''])), _vary([{}, [['']]]))
check('marker chain', solve(_vary(['###data'])), _vary([{}, [['##data']]]))
check('zero', solve(_vary([])), _vary([{}, []]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    meta, rows = {}, []
    for line in data:
        if line.startswith('##'): rows.append(line[1:].split('|'))
        elif line.startswith('#!'):
            pair = line[2:].split('=', 1)
            if len(pair) != 2 or not pair[0]: return None
            key, value = pair
            if key in meta: return None
            meta[key] = value
        elif '#' in line: continue
        else: rows.append(line.split('|'))
    return [meta, rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comments', solve(_vary(['# comment', '@|x'])), _vary([{}, [['@', 'x']]]))
check('escaped marker', solve(_vary(['##literal|@'])), _vary([{}, [['#literal', '@']]]))
check('space prefix', solve(_vary([' # data|@'])), _vary([{}, [[' # data', '@']]]))
check('metadata', solve(_vary(['#!unit=a=b', '@|x'])), _vary([{'unit': 'a=b'}, [['@', 'x']]]))
check('duplicate', solve(_vary(['#!x=1', '#!x=2'])), _vary(None))
check('bad directive', solve(_vary(['#!x'])), _vary(None))
check('empty name', solve(_vary(['#!=value'])), _vary(None))
check('empty data', solve(_vary([''])), _vary([{}, [['']]]))
check('marker chain', solve(_vary(['###data'])), _vary([{}, [['##data']]]))
check('zero', solve(_vary([])), _vary([{}, []]))
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:
A structured table violates the declared record or column contract.

Process already framed pipe records. Column-zero # starts a comment except ## encodes a literal leading # data record. A column-zero #!name=value directive sets a unique metadata name; malformed or duplicate directives reject. Other records, including leading-space # and empty records, are data. Return metadata and data rows.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    meta, rows = {}, []
    for line in data:
        if line.startswith('##'): rows.append(line[1:].split('|'))
        elif line.startswith('#!'):
            pair = line[1:].split('=', 1)
            if len(pair) != 2 or not pair[0]: return None
            key, value = pair
            if key in meta: return None
            meta[key] = value
        elif line.startswith('#'): continue
        else: rows.append(line.split('|'))
    return [meta, rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comments', solve(_vary(['# comment', '@|x'])), _vary([{}, [['@', 'x']]]))
check('escaped marker', solve(_vary(['##literal|@'])), _vary([{}, [['#literal', '@']]]))
check('space prefix', solve(_vary([' # data|@'])), _vary([{}, [[' # data', '@']]]))
check('metadata', solve(_vary(['#!unit=a=b', '@|x'])), _vary([{'unit': 'a=b'}, [['@', 'x']]]))
check('duplicate', solve(_vary(['#!x=1', '#!x=2'])), _vary(None))
check('bad directive', solve(_vary(['#!x'])), _vary(None))
check('empty name', solve(_vary(['#!=value'])), _vary(None))
check('empty data', solve(_vary([''])), _vary([{}, [['']]]))
check('marker chain', solve(_vary(['###data'])), _vary([{}, [['##data']]]))
check('zero', solve(_vary([])), _vary([{}, []]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    meta, rows = {}, []
    for line in data:
        if line.startswith('##'): rows.append(line[1:].split('|'))
        elif line.startswith('#!'):
            pair = line.split('=', 1)
            if len(pair) != 2 or not pair[0]: return None
            key, value = pair
            if key in meta: return None
            meta[key] = value
        elif line.startswith('#'): continue
        else: rows.append(line.split('|'))
    return [meta, rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comments', solve(_vary(['# comment', '@|x'])), _vary([{}, [['@', 'x']]]))
check('escaped marker', solve(_vary(['##literal|@'])), _vary([{}, [['#literal', '@']]]))
check('space prefix', solve(_vary([' # data|@'])), _vary([{}, [[' # data', '@']]]))
check('metadata', solve(_vary(['#!unit=a=b', '@|x'])), _vary([{'unit': 'a=b'}, [['@', 'x']]]))
check('duplicate', solve(_vary(['#!x=1', '#!x=2'])), _vary(None))
check('bad directive', solve(_vary(['#!x'])), _vary(None))
check('empty name', solve(_vary(['#!=value'])), _vary(None))
check('empty data', solve(_vary([''])), _vary([{}, [['']]]))
check('marker chain', solve(_vary(['###data'])), _vary([{}, [['##data']]]))
check('zero', solve(_vary([])), _vary([{}, []]))
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:
A structured table violates the declared record or column contract.

Process already framed pipe records. Column-zero # starts a comment except ## encodes a literal leading # data record. A column-zero #!name=value directive sets a unique metadata name; malformed or duplicate directives reject. Other records, including leading-space # and empty records, are data. Return metadata and data rows.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[0]
            elif cell == '^^': value = '^'
            elif cell == '^!': value = None
            else: value = cell
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('copy columns', solve(_vary(['@;a', '^;b', 'c;^'])), _vary([['@', 'a'], ['@', 'b'], ['c', 'b']]))
check('first copy', solve(_vary(['^;x'])), _vary(None))
check('literal marker', solve(_vary(['^^;@'])), _vary([['^', '@']]))
check('null reset', solve(_vary(['@;a', '^!;^', '^;z'])), _vary([['@', 'a'], [None, 'a'], [None, 'z']]))
check('empty replaces', solve(_vary(['@;a', ';b', '^;^'])), _vary([['@', 'a'], ['', 'b'], ['', 'b']]))
check('wrong width', solve(_vary(['@'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('literal prefix', solve(_vary(['^x;@'])), _vary([['^x', '@']]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[-1]
            elif cell == '^^': value = '^'
            elif cell == '^!': value = None
            else: value = cell
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('copy columns', solve(_vary(['@;a', '^;b', 'c;^'])), _vary([['@', 'a'], ['@', 'b'], ['c', 'b']]))
check('first copy', solve(_vary(['^;x'])), _vary(None))
check('literal marker', solve(_vary(['^^;@'])), _vary([['^', '@']]))
check('null reset', solve(_vary(['@;a', '^!;^', '^;z'])), _vary([['@', 'a'], [None, 'a'], [None, 'z']]))
check('empty replaces', solve(_vary(['@;a', ';b', '^;^'])), _vary([['@', 'a'], ['', 'b'], ['', 'b']]))
check('wrong width', solve(_vary(['@'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('literal prefix', solve(_vary(['^x;@'])), _vary([['^x', '@']]))
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:
A structured table violates the declared record or column contract.

Read semicolon rows in a schema where bare ^ copies the previous value in that column, ^^ represents literal ^, and ^! resets that column to null. A copy in the first row rejects. Exactly two columns are required; an explicit empty string replaces the previous value.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            elif cell == '^^': value = '^'
            elif cell == '^!': value = None
            else: value = cell
            row.append(value)
        rows.append(row)
        if previous is None: previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('copy columns', solve(_vary(['@;a', '^;b', 'c;^'])), _vary([['@', 'a'], ['@', 'b'], ['c', 'b']]))
check('first copy', solve(_vary(['^;x'])), _vary(None))
check('literal marker', solve(_vary(['^^;@'])), _vary([['^', '@']]))
check('null reset', solve(_vary(['@;a', '^!;^', '^;z'])), _vary([['@', 'a'], [None, 'a'], [None, 'z']]))
check('empty replaces', solve(_vary(['@;a', ';b', '^;^'])), _vary([['@', 'a'], ['', 'b'], ['', 'b']]))
check('wrong width', solve(_vary(['@'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('literal prefix', solve(_vary(['^x;@'])), _vary([['^x', '@']]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            elif cell == '^^': value = '^'
            elif cell == '^!': value = None
            else: value = cell
            row.append(value)
        rows.append(row)
        previous = rows[0]
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('copy columns', solve(_vary(['@;a', '^;b', 'c;^'])), _vary([['@', 'a'], ['@', 'b'], ['c', 'b']]))
check('first copy', solve(_vary(['^;x'])), _vary(None))
check('literal marker', solve(_vary(['^^;@'])), _vary([['^', '@']]))
check('null reset', solve(_vary(['@;a', '^!;^', '^;z'])), _vary([['@', 'a'], [None, 'a'], [None, 'z']]))
check('empty replaces', solve(_vary(['@;a', ';b', '^;^'])), _vary([['@', 'a'], ['', 'b'], ['', 'b']]))
check('wrong width', solve(_vary(['@'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('literal prefix', solve(_vary(['^x;@'])), _vary([['^x', '@']]))
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:
A structured table violates the declared record or column contract.

Read semicolon rows in a schema where bare ^ copies the previous value in that column, ^^ represents literal ^, and ^! resets that column to null. A copy in the first row rejects. Exactly two columns are required; an explicit empty string replaces the previous value.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell in ('^', ''):
                if previous is None: return None
                value = previous[i]
            elif cell == '^^': value = '^'
            elif cell == '^!': value = None
            else: value = cell
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('copy columns', solve(_vary(['@;a', '^;b', 'c;^'])), _vary([['@', 'a'], ['@', 'b'], ['c', 'b']]))
check('first copy', solve(_vary(['^;x'])), _vary(None))
check('literal marker', solve(_vary(['^^;@'])), _vary([['^', '@']]))
check('null reset', solve(_vary(['@;a', '^!;^', '^;z'])), _vary([['@', 'a'], [None, 'a'], [None, 'z']]))
check('empty replaces', solve(_vary(['@;a', ';b', '^;^'])), _vary([['@', 'a'], ['', 'b'], ['', 'b']]))
check('wrong width', solve(_vary(['@'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('literal prefix', solve(_vary(['^x;@'])), _vary([['^x', '@']]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^' or not cell.strip():
                if previous is None: return None
                value = previous[i]
            elif cell == '^^': value = '^'
            elif cell == '^!': value = None
            else: value = cell
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('copy columns', solve(_vary(['@;a', '^;b', 'c;^'])), _vary([['@', 'a'], ['@', 'b'], ['c', 'b']]))
check('first copy', solve(_vary(['^;x'])), _vary(None))
check('literal marker', solve(_vary(['^^;@'])), _vary([['^', '@']]))
check('null reset', solve(_vary(['@;a', '^!;^', '^;z'])), _vary([['@', 'a'], [None, 'a'], [None, 'z']]))
check('empty replaces', solve(_vary(['@;a', ';b', '^;^'])), _vary([['@', 'a'], ['', 'b'], ['', 'b']]))
check('wrong width', solve(_vary(['@'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('literal prefix', solve(_vary(['^x;@'])), _vary([['^x', '@']]))
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:
A structured table violates the declared record or column contract.

Read semicolon rows in a schema where bare ^ copies the previous value in that column, ^^ represents literal ^, and ^! resets that column to null. A copy in the first row rejects. Exactly two columns are required; an explicit empty string replaces the previous value.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            elif cell == '^^': value = '^^'
            elif cell == '^!': value = None
            else: value = cell
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('copy columns', solve(_vary(['@;a', '^;b', 'c;^'])), _vary([['@', 'a'], ['@', 'b'], ['c', 'b']]))
check('first copy', solve(_vary(['^;x'])), _vary(None))
check('literal marker', solve(_vary(['^^;@'])), _vary([['^', '@']]))
check('null reset', solve(_vary(['@;a', '^!;^', '^;z'])), _vary([['@', 'a'], [None, 'a'], [None, 'z']]))
check('empty replaces', solve(_vary(['@;a', ';b', '^;^'])), _vary([['@', 'a'], ['', 'b'], ['', 'b']]))
check('wrong width', solve(_vary(['@'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('literal prefix', solve(_vary(['^x;@'])), _vary([['^x', '@']]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            elif cell == '^^': value = ''
            elif cell == '^!': value = None
            else: value = cell
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('copy columns', solve(_vary(['@;a', '^;b', 'c;^'])), _vary([['@', 'a'], ['@', 'b'], ['c', 'b']]))
check('first copy', solve(_vary(['^;x'])), _vary(None))
check('literal marker', solve(_vary(['^^;@'])), _vary([['^', '@']]))
check('null reset', solve(_vary(['@;a', '^!;^', '^;z'])), _vary([['@', 'a'], [None, 'a'], [None, 'z']]))
check('empty replaces', solve(_vary(['@;a', ';b', '^;^'])), _vary([['@', 'a'], ['', 'b'], ['', 'b']]))
check('wrong width', solve(_vary(['@'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('literal prefix', solve(_vary(['^x;@'])), _vary([['^x', '@']]))
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:
A structured table violates the declared record or column contract.

Read semicolon rows in a schema where bare ^ copies the previous value in that column, ^^ represents literal ^, and ^! resets that column to null. A copy in the first row rejects. Exactly two columns are required; an explicit empty string replaces the previous value.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            elif cell == '^^': value = '^'
            elif cell == '^!': value = None
            else: value = cell
            row.append(value)
        rows.append(row)
        previous = [old if new is None else new for old,new in zip(previous or row,row)]
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('copy columns', solve(_vary(['@;a', '^;b', 'c;^'])), _vary([['@', 'a'], ['@', 'b'], ['c', 'b']]))
check('first copy', solve(_vary(['^;x'])), _vary(None))
check('literal marker', solve(_vary(['^^;@'])), _vary([['^', '@']]))
check('null reset', solve(_vary(['@;a', '^!;^', '^;z'])), _vary([['@', 'a'], [None, 'a'], [None, 'z']]))
check('empty replaces', solve(_vary(['@;a', ';b', '^;^'])), _vary([['@', 'a'], ['', 'b'], ['', 'b']]))
check('wrong width', solve(_vary(['@'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('literal prefix', solve(_vary(['^x;@'])), _vary([['^x', '@']]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            elif cell == '^^': value = '^'
            elif cell == '^!': value = None
            else: value = cell
            row.append(value)
        rows.append(row)
        previous = [new if new else old for old,new in zip(previous or row,row)]
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('copy columns', solve(_vary(['@;a', '^;b', 'c;^'])), _vary([['@', 'a'], ['@', 'b'], ['c', 'b']]))
check('first copy', solve(_vary(['^;x'])), _vary(None))
check('literal marker', solve(_vary(['^^;@'])), _vary([['^', '@']]))
check('null reset', solve(_vary(['@;a', '^!;^', '^;z'])), _vary([['@', 'a'], [None, 'a'], [None, 'z']]))
check('empty replaces', solve(_vary(['@;a', ';b', '^;^'])), _vary([['@', 'a'], ['', 'b'], ['', 'b']]))
check('wrong width', solve(_vary(['@'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('literal prefix', solve(_vary(['^x;@'])), _vary([['^x', '@']]))
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:
A structured table violates the declared record or column contract.

Read semicolon rows in a schema where bare ^ copies the previous value in that column, ^^ represents literal ^, and ^! resets that column to null. A copy in the first row rejects. Exactly two columns are required; an explicit empty string replaces the previous value.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    best, score = None, -1
    for name, counts in data:
        counts = [0 if c is None else c for c in counts]
        if not counts: continue
        if min(counts) < 2: continue
        if len(set(counts)) != 1: continue
        candidate_score = len(counts) * counts[0]
        if candidate_score > score:
            best, score = name, candidate_score
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    best, score = None, -1
    for name, counts in data:
        counts = [1 if c is None else c for c in counts]
        if not counts: continue
        if min(counts) < 2: continue
        if len(set(counts)) != 1: continue
        candidate_score = len(counts) * counts[0]
        if candidate_score > score:
            best, score = name, candidate_score
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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:
A structured table violates the declared record or column contract.

Choose comma, tab, or semicolon from precomputed per-record field counts. Ignore blank physical records marked null. A candidate must have >=2 fields on every sampled record and constant width. Score is record count times width; greatest score wins, ties use candidate order. No valid candidate returns null.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    best, score = None, -1
    for name, counts in data:
        counts = [c for c in counts if c is not None]
        if not counts: continue
        if min(counts) < 1: continue
        if len(set(counts)) != 1: continue
        candidate_score = len(counts) * counts[0]
        if candidate_score > score:
            best, score = name, candidate_score
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    best, score = None, -1
    for name, counts in data:
        counts = [c for c in counts if c is not None]
        if not counts: continue
        if min(counts) < 0: continue
        if len(set(counts)) != 1: continue
        candidate_score = len(counts) * counts[0]
        if candidate_score > score:
            best, score = name, candidate_score
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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:
A structured table violates the declared record or column contract.

Choose comma, tab, or semicolon from precomputed per-record field counts. Ignore blank physical records marked null. A candidate must have >=2 fields on every sampled record and constant width. Score is record count times width; greatest score wins, ties use candidate order. No valid candidate returns null.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    best, score = None, -1
    for name, counts in data:
        counts = [c for c in counts if c is not None]
        if not counts: continue
        if min(counts) < 2: continue
        if False: continue
        candidate_score = len(counts) * counts[0]
        if candidate_score > score:
            best, score = name, candidate_score
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    best, score = None, -1
    for name, counts in data:
        counts = [c for c in counts if c is not None]
        if not counts: continue
        if min(counts) < 2: continue
        if len(set(counts)) > 2: continue
        candidate_score = len(counts) * counts[0]
        if candidate_score > score:
            best, score = name, candidate_score
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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:
A structured table violates the declared record or column contract.

Choose comma, tab, or semicolon from precomputed per-record field counts. Ignore blank physical records marked null. A candidate must have >=2 fields on every sampled record and constant width. Score is record count times width; greatest score wins, ties use candidate order. No valid candidate returns null.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    best, score = None, -1
    for name, counts in data:
        counts = [c for c in counts if c is not None]
        if not counts: continue
        if min(counts) < 2: continue
        if len(set(counts)) != 1: continue
        candidate_score = counts[0]
        if candidate_score > score:
            best, score = name, candidate_score
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    best, score = None, -1
    for name, counts in data:
        counts = [c for c in counts if c is not None]
        if not counts: continue
        if min(counts) < 2: continue
        if len(set(counts)) != 1: continue
        candidate_score = max(counts)
        if candidate_score > score:
            best, score = name, candidate_score
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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:
A structured table violates the declared record or column contract.

Choose comma, tab, or semicolon from precomputed per-record field counts. Ignore blank physical records marked null. A candidate must have >=2 fields on every sampled record and constant width. Score is record count times width; greatest score wins, ties use candidate order. No valid candidate returns null.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    best, score = None, -1
    for name, counts in data:
        counts = [c for c in counts if c is not None]
        if not counts: continue
        if min(counts) < 2: continue
        if len(set(counts)) != 1: continue
        candidate_score = len(counts) * counts[0]
        if candidate_score >= score:
            best, score = name, candidate_score
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    best, score = None, -1
    for name, counts in data:
        counts = [c for c in counts if c is not None]
        if not counts: continue
        if min(counts) < 2: continue
        if len(set(counts)) != 1: continue
        candidate_score = len(counts) * counts[0]
        if candidate_score >= score or best is None:
            best, score = name, candidate_score
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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:
A structured table violates the declared record or column contract.

Choose comma, tab, or semicolon from precomputed per-record field counts. Ignore blank physical records marked null. A candidate must have >=2 fields on every sampled record and constant width. Score is record count times width; greatest score wins, ties use candidate order. No valid candidate returns null.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    best, score = None, -1
    for name, counts in data:
        counts = [c for c in counts if c is not None]
        if not counts: continue
        if min(counts) < 2: continue
        if len(set(counts)) != 1: continue
        candidate_score = len(counts) * counts[0]
        if candidate_score > score:
            best = name
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    best, score = None, -1
    for name, counts in data:
        counts = [c for c in counts if c is not None]
        if not counts: continue
        if min(counts) < 2: continue
        if len(set(counts)) != 1: continue
        candidate_score = len(counts) * counts[0]
        if candidate_score > score:
            best, score = name, 0
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stable', solve(_vary([['comma', [2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ragged distractor', solve(_vary([['comma', [2, 3]], ['tab', [2, 2]]])), _vary('tab'))
check('blank ignored', solve(_vary([['comma', [None, 2, 2]], ['tab', [1, 1]]])), _vary('comma'))
check('ties', solve(_vary([['comma', [2, 2]], ['tab', [2, 2]]])), _vary('comma'))
check('score', solve(_vary([['comma', [3]], ['tab', [2, 2]]])), _vary('tab'))
check('none', solve(_vary([['comma', [1, 1]], ['tab', []]])), _vary(None))
check('large width', solve(_vary([['@', [4, 4]], ['tab', [2, 2]]])), _vary('@'))
check('singleton row distractor', solve(_vary([['comma', [2, 1]], ['tab', [2, 2]]])), _vary('tab'))
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:
A structured table violates the declared record or column contract.

Choose comma, tab, or semicolon from precomputed per-record field counts. Ignore blank physical records marked null. A candidate must have >=2 fields on every sampled record and constant width. Score is record count times width; greatest score wins, ties use candidate order. No valid candidate returns null.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    evidence = [set(), set()]
    for row in data:
        for i, (value, quoted) in enumerate(row):
            if False: continue
            if quoted: kind = 'text'
            elif value in ('true', 'false'): kind = 'bool'
            elif value.lstrip('-').isascii() and value.lstrip('-').isdigit() and value == str(int(value)): kind = 'int'
            else: kind = 'text'
            evidence[i].add(kind)
    return [next(iter(kinds)) if len(kinds) == 1 else 'text' if kinds else 'unknown' for kinds in evidence]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary([[['12', False], ['true', False]], [['-2', False], ['false', False]]])), _vary(['int', 'bool']))
check('quoted number', solve(_vary([[['12', True], ['@', False]]])), _vary(['text', 'text']))
check('null only', solve(_vary([[['NULL', False], ['', False]]])), _vary(['unknown', 'unknown']))
check('quoted empty', solve(_vary([[['', True], ['NULL', True]]])), _vary(['text', 'text']))
check('leading zero', solve(_vary([[['01', False], ['-0', False]]])), _vary(['text', 'text']))
check('mixed', solve(_vary([[['1', False], ['true', False]], [['@', False], ['2', False]]])), _vary(['text', 'text']))
check('null ignored', solve(_vary([[['NULL', False], ['', False]], [['1', False], ['false', False]]])), _vary(['int', 'bool']))
check('empty table', solve(_vary([])), _vary(['unknown', 'unknown']))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    evidence = [set(), set()]
    for row in data:
        for i, (value, quoted) in enumerate(row):
            if not quoted and value == 'NULL': continue
            if quoted: kind = 'text'
            elif value in ('true', 'false'): kind = 'bool'
            elif value.lstrip('-').isascii() and value.lstrip('-').isdigit() and value == str(int(value)): kind = 'int'
            else: kind = 'text'
            evidence[i].add(kind)
    return [next(iter(kinds)) if len(kinds) == 1 else 'text' if kinds else 'unknown' for kinds in evidence]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary([[['12', False], ['true', False]], [['-2', False], ['false', False]]])), _vary(['int', 'bool']))
check('quoted number', solve(_vary([[['12', True], ['@', False]]])), _vary(['text', 'text']))
check('null only', solve(_vary([[['NULL', False], ['', False]]])), _vary(['unknown', 'unknown']))
check('quoted empty', solve(_vary([[['', True], ['NULL', True]]])), _vary(['text', 'text']))
check('leading zero', solve(_vary([[['01', False], ['-0', False]]])), _vary(['text', 'text']))
check('mixed', solve(_vary([[['1', False], ['true', False]], [['@', False], ['2', False]]])), _vary(['text', 'text']))
check('null ignored', solve(_vary([[['NULL', False], ['', False]], [['1', False], ['false', False]]])), _vary(['int', 'bool']))
check('empty table', solve(_vary([])), _vary(['unknown', 'unknown']))
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:
A structured table violates the declared record or column contract.

Infer per-column wire types from already lexed two-column rows. Unquoted empty and NULL cells supply no evidence; quoted cells force text. Unquoted lowercase true/false are bool; canonical signed decimal integers without leading zeros are int; all other cells text. Mixed non-null kinds promote to text; a column with no evidence is unknown.

split: open-access