FAILURE MAP
← Case archive

FA-47686 / Delimited text / Open access

Metadata containing equals acquires a different name · case 01

A structured table violates the declared record or column contract.

Verified by executionVariant 1 · 10 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The directive parser chooses the final separator instead of the first.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: pair = line[2:].split('=', 1)

Unsuccessful approach: Unbounded splitting rejects valid equals characters inside metadata values.

Case 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.

Why this case matters

Delimited interchange needs explicit framing, schema and field semantics at ingestion and emission boundaries.

1 / The failure

Exit 1
"""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)
Boundary fixtureActualExpectedOutcome
comments[{}, [['cell', 'x']]][{}, [['cell', 'x']]]Passed
escaped marker[{}, [['#literal', 'cell']]][{}, [['#literal', 'cell']]]Passed
space prefix[{}, [[' # data', 'cell']]][{}, [[' # data', 'cell']]]Passed
metadata[{'unit=a': 'b'}, [['cell', 'x']]][{'unit': 'a=b'}, [['cell', 'x']]]Failed
duplicateNoneNonePassed
bad directiveNoneNonePassed
empty nameNoneNonePassed
empty data[{}, [['']]][{}, [['']]]Passed
marker chain[{}, [['##data']]][{}, [['##data']]]Passed
zero[{}, []][{}, []]Passed

SHA-256 / f5831ed594a066d84bf7001aed3fe167e438d702e8953c19f9752d9dedd9271e

2 / The unsuccessful fix

Exit 1
"""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)
Boundary fixtureActualExpectedOutcome
comments[{}, [['cell', 'x']]][{}, [['cell', 'x']]]Passed
escaped marker[{}, [['#literal', 'cell']]][{}, [['#literal', 'cell']]]Passed
space prefix[{}, [[' # data', 'cell']]][{}, [[' # data', 'cell']]]Passed
metadataNone[{'unit': 'a=b'}, [['cell', 'x']]]Failed
duplicateNoneNonePassed
bad directiveNoneNonePassed
empty nameNoneNonePassed
empty data[{}, [['']]][{}, [['']]]Passed
marker chain[{}, [['##data']]][{}, [['##data']]]Passed
zero[{}, []][{}, []]Passed

SHA-256 / f2884818e6110b8e82d28a9335737dc38a5e9eb21216f7bba05cbc03a87eda98

3 / The verified repair

Exit 0
"""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.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)
Boundary fixtureActualExpectedOutcome
comments[{}, [['cell', 'x']]][{}, [['cell', 'x']]]Passed
escaped marker[{}, [['#literal', 'cell']]][{}, [['#literal', 'cell']]]Passed
space prefix[{}, [[' # data', 'cell']]][{}, [[' # data', 'cell']]]Passed
metadata[{'unit': 'a=b'}, [['cell', 'x']]][{'unit': 'a=b'}, [['cell', 'x']]]Passed
duplicateNoneNonePassed
bad directiveNoneNonePassed
empty nameNoneNonePassed
empty data[{}, [['']]][{}, [['']]]Passed
marker chain[{}, [['##data']]][{}, [['##data']]]Passed
zero[{}, []][{}, []]Passed

SHA-256 / c949a9629cf94579fedf19126f589a3255cfeb34d192daea8ddd5ef4b54718b3

Verification & scope

Deterministic bounded in-memory model. No claim of complete CSV or external format conformance. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:44:43.784684+00:00.

Case digest / 53a2d8fdf0b7521660e8f9e9c1efa3474a750ff13b5110e8d05a1663b8f63224