FAILURE MAP
← Case archive

FA-48451 / Delimited text / Open access

The first literal pipe is mistaken for a checksum trailer separator · 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 first literal pipe is mistaken for a checksum trailer separator.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: parts=data.rsplit('|',1)

Unsuccessful approach: The alternate implementation still violates the same declared invariant: the first literal pipe is mistaken for a checksum trailer separator.

Case contract

Decode rows encoded as comma cells followed by |decimal check. The check is the sum of Unicode code points in the exact comma payload modulo 97; this is only a corruption-detection toy, not cryptographic integrity. Use the last pipe as trailer separator, permitting pipes in cells. Reject malformed or mismatched checks. Return fields.

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):
    parts=data.split('|',1)
    if len(parts)!=2: return None
    payload,token=parts
    if not token.isascii() or not token.isdecimal(): return None
    check=int(token)
    if check>=97: return None
    expected=sum(ord(ch) for ch in payload)%97
    if check!=expected: return None
    return payload.split(',')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comma', solve(_vary('a,b|45')), _vary(['a', 'b']))
check('empty', solve(_vary('|0')), _vary(['']))
check('pipe data', solve(_vary('a|b|28')), _vary(['a|b']))
check('unicode', solve(_vary('é|39')), _vary(['é']))
check('astral checksum', solve(_vary('😀|84')), _vary(['😀']))
check('bad checksum', solve(_vary('a|1')), _vary(None))
check('bad trailer', solve(_vary('a|-1')), _vary(None))
check('unreduced', solve(_vary('a|97')), _vary(None))
check('normal', solve(_vary('z|25')), _vary(['z']))
check('variant checksum width', solve(('x'*N)+'|'+str((120*N)%97)), ['x'*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)
Boundary fixtureActualExpectedOutcome
comma['a', 'b']['a', 'b']Passed
empty['']['']Passed
pipe dataNone['a|b']Failed
unicode['é']['é']Passed
astral checksum['😀']['😀']Passed
bad checksumNoneNonePassed
bad trailerNoneNonePassed
unreducedNoneNonePassed
normal['z']['z']Passed
variant checksum width['x']['x']Passed

SHA-256 / ae24f5c567b021892a4c76f7a038882e6b7b58db8b1befb3edc0933574089e27

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):
    parts=data.split('|')
    if len(parts)!=2: return None
    payload,token=parts
    if not token.isascii() or not token.isdecimal(): return None
    check=int(token)
    if check>=97: return None
    expected=sum(ord(ch) for ch in payload)%97
    if check!=expected: return None
    return payload.split(',')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comma', solve(_vary('a,b|45')), _vary(['a', 'b']))
check('empty', solve(_vary('|0')), _vary(['']))
check('pipe data', solve(_vary('a|b|28')), _vary(['a|b']))
check('unicode', solve(_vary('é|39')), _vary(['é']))
check('astral checksum', solve(_vary('😀|84')), _vary(['😀']))
check('bad checksum', solve(_vary('a|1')), _vary(None))
check('bad trailer', solve(_vary('a|-1')), _vary(None))
check('unreduced', solve(_vary('a|97')), _vary(None))
check('normal', solve(_vary('z|25')), _vary(['z']))
check('variant checksum width', solve(('x'*N)+'|'+str((120*N)%97)), ['x'*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)
Boundary fixtureActualExpectedOutcome
comma['a', 'b']['a', 'b']Passed
empty['']['']Passed
pipe dataNone['a|b']Failed
unicode['é']['é']Passed
astral checksum['😀']['😀']Passed
bad checksumNoneNonePassed
bad trailerNoneNonePassed
unreducedNoneNonePassed
normal['z']['z']Passed
variant checksum width['x']['x']Passed

SHA-256 / 3debfbdac8a01cdb8c0edf1d2893607aa8c5f3ff125cde948852a5a481a72fac

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):
    parts=data.rsplit('|',1)
    if len(parts)!=2: return None
    payload,token=parts
    if not token.isascii() or not token.isdecimal(): return None
    check=int(token)
    if check>=97: return None
    expected=sum(ord(ch) for ch in payload)%97
    if check!=expected: return None
    return payload.split(',')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comma', solve(_vary('a,b|45')), _vary(['a', 'b']))
check('empty', solve(_vary('|0')), _vary(['']))
check('pipe data', solve(_vary('a|b|28')), _vary(['a|b']))
check('unicode', solve(_vary('é|39')), _vary(['é']))
check('astral checksum', solve(_vary('😀|84')), _vary(['😀']))
check('bad checksum', solve(_vary('a|1')), _vary(None))
check('bad trailer', solve(_vary('a|-1')), _vary(None))
check('unreduced', solve(_vary('a|97')), _vary(None))
check('normal', solve(_vary('z|25')), _vary(['z']))
check('variant checksum width', solve(('x'*N)+'|'+str((120*N)%97)), ['x'*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)
Boundary fixtureActualExpectedOutcome
comma['a', 'b']['a', 'b']Passed
empty['']['']Passed
pipe data['a|b']['a|b']Passed
unicode['é']['é']Passed
astral checksum['😀']['😀']Passed
bad checksumNoneNonePassed
bad trailerNoneNonePassed
unreducedNoneNonePassed
normal['z']['z']Passed
variant checksum width['x']['x']Passed

SHA-256 / 29d730969b37e0a97a1bcc1b47a9743e4aadd304abbb762728730f445f42bbb7

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

Case digest / a17523d84acec4a15c731425d180a1cf7eca3cfa1f577601133f89badc457adb