FAILURE MAP
← Case archive

FA-48666 / Delimited text / Open access

A row window counts comment and blank physical records · case 01

A structured table violates the declared record or column contract.

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

ROOT CAUSE

A row window counts comment and blank physical records.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: logical+=1

Unsuccessful approach: The alternate implementation still violates the same declared invariant: a row window counts comment and blank physical records.

Case contract

Select a half-open zero-based logical row window [start,stop) from physical comma lines. Column-zero # lines and completely empty physical lines are ignored before numbering; whitespace-only lines remain data. Return [one-based physical line number, split cells] for selected logical 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):
    out=[]; logical=0
    for physical,line in enumerate(data['lines'],1):
        if line=='' or line.startswith('#'): continue
        if data['start']<=logical<data['stop']: out.append([physical,line.split(',')])
        logical=physical
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _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
window[][[4, ['cell', 'x']]]Failed
all[[1, ['cell', 'x']], [2, ['z', 'y']]][[1, ['cell', 'x']], [2, ['z', 'y']]]Passed
space line[[1, [' ']]][[1, [' ']]]Passed
empty window[][]Passed
beyond[][]Passed
indented comment[[1, [' #data']]][[1, [' #data']]]Passed
zero lines[][]Passed

SHA-256 / 4511970cc7c41c414ca21fb44a3ecee179549522577265f799df68c8ac388d6c

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=[]; logical=0
    for physical,line in enumerate(data['lines'],1):
        if line=='' or line.startswith('#'): continue
        if data['start']<=logical<data['stop']: out.append([physical,line.split(',')])
        logical+=physical
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _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
window[][[4, ['cell', 'x']]]Failed
all[[1, ['cell', 'x']], [2, ['z', 'y']]][[1, ['cell', 'x']], [2, ['z', 'y']]]Passed
space line[[1, [' ']]][[1, [' ']]]Passed
empty window[][]Passed
beyond[][]Passed
indented comment[[1, [' #data']]][[1, [' #data']]]Passed
zero lines[][]Passed

SHA-256 / f4eaca5dea765630326de00bcd038d28e11d0be618f5a63dd2ca8c1576fda333

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):
    out=[]; logical=0
    for physical,line in enumerate(data['lines'],1):
        if line=='' or line.startswith('#'): continue
        if data['start']<=logical<data['stop']: out.append([physical,line.split(',')])
        logical+=1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _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
window[[4, ['cell', 'x']]][[4, ['cell', 'x']]]Passed
all[[1, ['cell', 'x']], [2, ['z', 'y']]][[1, ['cell', 'x']], [2, ['z', 'y']]]Passed
space line[[1, [' ']]][[1, [' ']]]Passed
empty window[][]Passed
beyond[][]Passed
indented comment[[1, [' #data']]][[1, [' #data']]]Passed
zero lines[][]Passed

SHA-256 / 7576fa0bf649b7cfb3210efe2fe14c053e61c6dcd92d4a5fb2b8e7bade5dbe37

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

Case digest / a582fe5c6642ac1949d94f7139c9f33312c1e1fdc5db2b2e012f2ce29efd7808