FAILURE MAP
← Case archive

FA-48366 / Delimited text / Open access

A null bitmap uses the opposite meaning for set bits · 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 null bitmap uses the opposite meaning for set bits.

VERIFIED REPAIR

Preserve the named invariant at the faulty decision: if bit=='1': out.append(None)

Unsuccessful approach: The alternate implementation still violates the same declared invariant: a null bitmap uses the opposite meaning for set bits.

Case contract

Decode bitmap|comma-payload rows. Bitmap consists of 0 and 1; 1 denotes null and consumes no payload, 0 consumes one payload field. Empty payload encodes zero fields only when bitmap has no zero bits; otherwise it is one empty field. Reject leftover or insufficient values. Return logical cells.

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
    bits,payload=parts
    if any(bit not in '01' for bit in bits): return None
    values=payload.split(',') if payload or '0' in bits else []
    out=[]; cursor=0
    for bit in bits:
        if bit=='0': out.append(None)
        else:
            if cursor>=len(values): return None
            out.append(values[cursor]); cursor+=1
    if cursor!=len(values): return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('010|@,z')), _vary(['@', None, 'z']))
check('all null', solve(_vary('111|')), _vary([None, None, None]))
check('empty text', solve(_vary('0|')), _vary(['']))
check('insufficient', solve(_vary('00|x')), _vary(None))
check('extra', solve(_vary('1|x')), _vary(None))
check('empty bitmap', solve(_vary('|')), _vary([]))
check('invalid bit', solve(_vary('02|x,y')), _vary(None))
check('several nulls', solve(_vary('1101|@')), _vary([None, None, '@', None]))
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
mixedNone['cell', None, 'z']Failed
all nullNone[None, None, None]Failed
empty textNone['']Failed
insufficientNoneNonePassed
extra['x']NoneFailed
empty bitmap[][]Passed
invalid bitNoneNonePassed
several nullsNone[None, None, 'cell', None]Failed

SHA-256 / 37ba8ce0029d5161f5c515ead2b8602a5a81db3c9399a0dbb8120ef8be1123b0

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('|',1)
    if len(parts)!=2: return None
    bits,payload=parts
    if any(bit not in '01' for bit in bits): return None
    values=payload.split(',') if payload or '0' in bits else []
    out=[]; cursor=0
    for bit in bits:
        if bit!='0': out.append('')
        else:
            if cursor>=len(values): return None
            out.append(values[cursor]); cursor+=1
    if cursor!=len(values): return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('010|@,z')), _vary(['@', None, 'z']))
check('all null', solve(_vary('111|')), _vary([None, None, None]))
check('empty text', solve(_vary('0|')), _vary(['']))
check('insufficient', solve(_vary('00|x')), _vary(None))
check('extra', solve(_vary('1|x')), _vary(None))
check('empty bitmap', solve(_vary('|')), _vary([]))
check('invalid bit', solve(_vary('02|x,y')), _vary(None))
check('several nulls', solve(_vary('1101|@')), _vary([None, None, '@', None]))
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
mixed['cell', '', 'z']['cell', None, 'z']Failed
all null['', '', ''][None, None, None]Failed
empty text['']['']Passed
insufficientNoneNonePassed
extraNoneNonePassed
empty bitmap[][]Passed
invalid bitNoneNonePassed
several nulls['', '', 'cell', ''][None, None, 'cell', None]Failed

SHA-256 / d5d9fd86dc8f25b04a43df9ec986638f85886cc1465321026f9a047a799ab28b

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.split('|',1)
    if len(parts)!=2: return None
    bits,payload=parts
    if any(bit not in '01' for bit in bits): return None
    values=payload.split(',') if payload or '0' in bits else []
    out=[]; cursor=0
    for bit in bits:
        if bit=='1': out.append(None)
        else:
            if cursor>=len(values): return None
            out.append(values[cursor]); cursor+=1
    if cursor!=len(values): return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('010|@,z')), _vary(['@', None, 'z']))
check('all null', solve(_vary('111|')), _vary([None, None, None]))
check('empty text', solve(_vary('0|')), _vary(['']))
check('insufficient', solve(_vary('00|x')), _vary(None))
check('extra', solve(_vary('1|x')), _vary(None))
check('empty bitmap', solve(_vary('|')), _vary([]))
check('invalid bit', solve(_vary('02|x,y')), _vary(None))
check('several nulls', solve(_vary('1101|@')), _vary([None, None, '@', None]))
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
mixed['cell', None, 'z']['cell', None, 'z']Passed
all null[None, None, None][None, None, None]Passed
empty text['']['']Passed
insufficientNoneNonePassed
extraNoneNonePassed
empty bitmap[][]Passed
invalid bitNoneNonePassed
several nulls[None, None, 'cell', None][None, None, 'cell', None]Passed

SHA-256 / d3f8627ab8eb91edbe5738cecb9167d26b64fc4108ed0f83767ca3da0d215b85

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

Case digest / 299e0e65fb1b76acfd47eb549dad4359abf6af213fef0ac58b421b5dbda603b3