FAILURE MAP
← Case archive

FA-47431 / Delimited text / Open access

Carriage returns remain structural in escaped TSV · 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

A carriage return is omitted from the escape alphabet during emission.

THE FAILURE

A carriage return is omitted from the escape alphabet during emission.

Unsuccessful approach: Normalizing it to line feed breaks exact cell round trips.

Case contract

Encode a list of text cells as TSV without a terminator. Escape backslashes before introducing backslash-t, backslash-n, backslash-r; preserve empty columns and all other text.

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 = []
    for field in data:
        field = field.replace('\\', '\\\\')
        field = field.replace('\t', '\\t')
        field = field.replace('\n', '\\n')
        field = field
        out.append(field)
    return '\t'.join(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all controls', solve(_vary(['@\t\n\r\\'])), _vary('@\\t\\n\\r\\\\'))
check('empty cells', solve(_vary(['', '@', ''])), _vary('\t@\t'))
check('literal slash-t', solve(_vary(['\\t'])), _vary('\\\\t'))
check('normal', solve(_vary(['@', 'x'])), _vary('@\tx'))
check('zero columns', solve(_vary([])), _vary(''))
check('all empty', solve(_vary(['', '', ''])), _vary('\t\t'))
check('LF only', solve(_vary(['\n'])), _vary('\\n'))
check('CR only', solve(_vary(['\r'])), _vary('\\r'))
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
all controlscell\t\n \\cell\t\n\r\\Failed
empty cells cell cell Passed
literal slash-t\\t\\tPassed
normalcell xcell xPassed
zero columnsPassed
all empty Passed
LF only\n\nPassed
CR only \rFailed

SHA-256 / ba020ccbd8cccf73e06bf2ee2c51ee8d7a6d2323b9bb5e52bd2d5d98482305b6

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 = []
    for field in data:
        field = field.replace('\\', '\\\\')
        field = field.replace('\t', '\\t')
        field = field.replace('\n', '\\n')
        field = field.replace('\r', '\\n')
        out.append(field)
    return '\t'.join(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all controls', solve(_vary(['@\t\n\r\\'])), _vary('@\\t\\n\\r\\\\'))
check('empty cells', solve(_vary(['', '@', ''])), _vary('\t@\t'))
check('literal slash-t', solve(_vary(['\\t'])), _vary('\\\\t'))
check('normal', solve(_vary(['@', 'x'])), _vary('@\tx'))
check('zero columns', solve(_vary([])), _vary(''))
check('all empty', solve(_vary(['', '', ''])), _vary('\t\t'))
check('LF only', solve(_vary(['\n'])), _vary('\\n'))
check('CR only', solve(_vary(['\r'])), _vary('\\r'))
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
all controlscell\t\n\n\\cell\t\n\r\\Failed
empty cells cell cell Passed
literal slash-t\\t\\tPassed
normalcell xcell xPassed
zero columnsPassed
all empty Passed
LF only\n\nPassed
CR only\n\rFailed

SHA-256 / 4ee03b825fdb301939ecf00115f78dbc578168897a6458c399a626ea9ae2ede7

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

Case digest / aeb05443d5a1445f70e2ef60a94f6a41df8463b542e63d92b60b8a750998be7d