FAILURE MAP
← Case archive

FA-206 / Parsing / Open access

Removing carriage returns joins separate records · case 01

CRLF input leaves stray carriage returns, while a cleanup step merges records separated by CR alone.

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

ROOT CAUSE

The parser treats line endings as removable characters instead of alternative record separators.

THE FAILURE

The parser treats line endings as removable characters instead of alternative record separators.

Unsuccessful approach: Deleting all carriage returns fixes CRLF fixtures but erases lone-CR record boundaries.

Case contract

Split records on CRLF, CR, or LF only. Preserve empty records between separators, omit one final terminator-created empty element, and map empty input to []. Unicode line-separator characters are ordinary content.

Why this case matters

Cross-platform text imports encounter several newline conventions. Blind normalization can lose records or unexpectedly split Unicode content.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(text):
    if not text:
        return []
    fields = text.split('\n')
    return fields[:-1] if text.endswith('\n') else fields
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
label = 'record' * N
check('CRLF is one separator', solve(label + '\r\nend\r\n'), [label, 'end'])
check('lone CR remains a boundary', solve(label + '\rend\r'), [label, 'end'])
check('LF records', solve(label + '\nend\n'), [label, 'end'])
check('mixed blank records', solve(label + '\r\n\r\nend'), [label, '', 'end'])
check('Unicode separator is not a record boundary', solve(label + '\u2028end'), [label + '\u2028end'])
check('empty document', solve(''), [])
check('one empty record', solve('\r'), [''])
check('two terminators preserve one blank record', solve(label + '\n\n'), [label, ''])
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
CRLF is one separator['record\r', 'end\r']['record', 'end']Failed
lone CR remains a boundary['record\rend\r']['record', 'end']Failed
LF records['record', 'end']['record', 'end']Passed
mixed blank records['record\r', '\r', 'end']['record', '', 'end']Failed
Unicode separator is not a record boundary['record\u2028end']['record\u2028end']Passed
empty document[][]Passed
one empty record['\r']['']Failed
two terminators preserve one blank record['record', '']['record', '']Passed

SHA-256 / ec437ce9dc41d0915adff5b0ab1571e8cfedbdcd4b9aacfa00202aed62bf5099

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(text):
    text = text.replace('\r', '')
    if not text:
        return []
    fields = text.split('\n')
    return fields[:-1] if text.endswith('\n') else fields
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
label = 'record' * N
check('CRLF is one separator', solve(label + '\r\nend\r\n'), [label, 'end'])
check('lone CR remains a boundary', solve(label + '\rend\r'), [label, 'end'])
check('LF records', solve(label + '\nend\n'), [label, 'end'])
check('mixed blank records', solve(label + '\r\n\r\nend'), [label, '', 'end'])
check('Unicode separator is not a record boundary', solve(label + '\u2028end'), [label + '\u2028end'])
check('empty document', solve(''), [])
check('one empty record', solve('\r'), [''])
check('two terminators preserve one blank record', solve(label + '\n\n'), [label, ''])
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
CRLF is one separator['record', 'end']['record', 'end']Passed
lone CR remains a boundary['recordend']['record', 'end']Failed
LF records['record', 'end']['record', 'end']Passed
mixed blank records['record', '', 'end']['record', '', 'end']Passed
Unicode separator is not a record boundary['record\u2028end']['record\u2028end']Passed
empty document[][]Passed
one empty record[]['']Failed
two terminators preserve one blank record['record', '']['record', '']Passed

SHA-256 / 0d3b59a3f859d096cd9d816f3f88e9ad14fab97deb86839ad3cf0917e783a17e

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

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

Case digest / 313e321fe0188f45a7371fd0f38328063c83b77c8ce0d2ab8bffa86bbf09c5d1