FAILURE MAP
← Case archive

FA-47391 / Delimited text / Open access

TSV control escapes are kept as literal letters · case 01

A structured table violates the declared record or column contract.

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

ROOT CAUSE

Escape recognition consumes the prefix but omits control-character decoding.

THE FAILURE

Escape recognition consumes the prefix but omits control-character decoding.

Unsuccessful approach: Decoding tabs alone leaves newline and carriage-return escapes literal.

Case contract

Decode TSV fields with exactly four escapes: backslash-t, backslash-n, backslash-r, backslash-backslash. Raw tabs split fields, raw newlines are forbidden; unknown and dangling escapes reject the row. Empty input is one empty field.

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):
    out, field, escaped = [], [], False
    for ch in data:
        if escaped:
            if ch not in 'tnr\\': return None
            field.append(ch)
            escaped = False
        elif ch == '\\': escaped = True
        elif ch == '\t':
            out.append(''.join(field))
            field = []
        elif ch in '\r\n': return None
        else: field.append(ch)
    if escaped: return None
    out.append(''.join(field))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped escapes', solve(_vary('@\\tA\\nB\\rC\\\\D')), _vary(['@\tA\nB\rC\\D']))
check('separators', solve(_vary('@\t\tZ')), _vary(['@', '', 'Z']))
check('escaped backslash then t', solve(_vary('\\\\t')), _vary(['\\t']))
check('unknown', solve(_vary('\\q')), _vary(None))
check('dangling', solve(_vary('@\\')), _vary(None))
check('raw newline', solve(_vary('@\nZ')), _vary(None))
check('empty', solve(_vary('')), _vary(['']))
check('leading trailing', solve(_vary('\t@\t')), _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
mapped escapes['celltAnBrC\\D']['cell\tA\nB\rC\\D']Failed
separators['cell', '', 'Z']['cell', '', 'Z']Passed
escaped backslash then t['\\t']['\\t']Passed
unknownNoneNonePassed
danglingNoneNonePassed
raw newlineNoneNonePassed
empty['']['']Passed
leading trailing['', 'cell', '']['', 'cell', '']Passed

SHA-256 / 3dcd6380e7f25851941c140be74d12d6498840835987c77b46360c61fa97a480

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):
    out, field, escaped = [], [], False
    for ch in data:
        if escaped:
            if ch not in 'tnr\\': return None
            field.append('\t' if ch == 't' else ch)
            escaped = False
        elif ch == '\\': escaped = True
        elif ch == '\t':
            out.append(''.join(field))
            field = []
        elif ch in '\r\n': return None
        else: field.append(ch)
    if escaped: return None
    out.append(''.join(field))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped escapes', solve(_vary('@\\tA\\nB\\rC\\\\D')), _vary(['@\tA\nB\rC\\D']))
check('separators', solve(_vary('@\t\tZ')), _vary(['@', '', 'Z']))
check('escaped backslash then t', solve(_vary('\\\\t')), _vary(['\\t']))
check('unknown', solve(_vary('\\q')), _vary(None))
check('dangling', solve(_vary('@\\')), _vary(None))
check('raw newline', solve(_vary('@\nZ')), _vary(None))
check('empty', solve(_vary('')), _vary(['']))
check('leading trailing', solve(_vary('\t@\t')), _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
mapped escapes['cell\tAnBrC\\D']['cell\tA\nB\rC\\D']Failed
separators['cell', '', 'Z']['cell', '', 'Z']Passed
escaped backslash then t['\\t']['\\t']Passed
unknownNoneNonePassed
danglingNoneNonePassed
raw newlineNoneNonePassed
empty['']['']Passed
leading trailing['', 'cell', '']['', 'cell', '']Passed

SHA-256 / 71e684967a1f9d003caf0e96958afb214754ef1a933569b08b9df772a51b808d

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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:41.176248+00:00.

Case digest / abd486a158eaf3020413f2dedbed2afd6d2fb7adc9e951b1d6d5c859c071aa90