FAILURE MAP
← Case archive

FA-47811 / Delimited text / Open access

Alias resolution returns canonical indexes in physical order · 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 permutation is inverted between source and destination coordinate systems.

THE FAILURE

The permutation is inverted between source and destination coordinate systems.

Unsuccessful approach: Sorting destroys the required destination ordering.

Case contract

Resolve comma header names through an alias map, then produce a permutation into required canonical columns. A header name may follow multiple alias hops; cycles reject. Reject two physical columns resolving to one canonical name, unknown names, or missing required names. Return physical indexes in required order.

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):
    resolved = []
    for name in data['header'].split(','):
        seen = set()
        while name in data['aliases']:
            if name in seen: return None
            seen.add(name)
            name = data['aliases'][name]
        if name not in data['required']: return None
        if name in resolved: return None
        resolved.append(name)
    if set(resolved) != set(data['required']): return None
    return [data['required'].index(name) for name in resolved]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('chain', solve(_vary({'header': 'legacy,b', 'aliases': {'legacy': 'old', 'old': 'a'}, 'required': ['a', 'b']})), _vary([0, 1]))
check('reorder', solve(_vary({'header': 'b,@', 'aliases': {'@': 'a'}, 'required': ['a', 'b']})), _vary([1, 0]))
check('cycle', solve(_vary({'header': 'x,b', 'aliases': {'x': 'y', 'y': 'x'}, 'required': ['a', 'b']})), _vary(None))
check('collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a', 'b']})), _vary(None))
check('unknown', solve(_vary({'header': 'a,z', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('missing', solve(_vary({'header': 'a', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('normal', solve(_vary({'header': 'a,b', 'aliases': {}, 'required': ['a', 'b']})), _vary([0, 1]))
check('cycle permutation', solve(_vary({'header': 'b,c,a', 'aliases': {}, 'required': ['a', 'b', 'c']})), _vary([2, 0, 1]))
check('full collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a']})), _vary(None))
check('shared tail', solve(_vary({'header': 'x,y', 'aliases': {'x': 'a', 'y': 'b'}, 'required': ['a', 'b']})), _vary([0, 1]))
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
chain[0, 1][0, 1]Passed
reorder[1, 0][1, 0]Passed
cycleNoneNonePassed
collisionNoneNonePassed
unknownNoneNonePassed
missingNoneNonePassed
normal[0, 1][0, 1]Passed
cycle permutation[1, 2, 0][2, 0, 1]Failed
full collisionNoneNonePassed
shared tail[0, 1][0, 1]Passed

SHA-256 / 05121d97990c92bdcec1f76efb63af86af08e0647aa779cf0274e851a4c5759d

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):
    resolved = []
    for name in data['header'].split(','):
        seen = set()
        while name in data['aliases']:
            if name in seen: return None
            seen.add(name)
            name = data['aliases'][name]
        if name not in data['required']: return None
        if name in resolved: return None
        resolved.append(name)
    if set(resolved) != set(data['required']): return None
    return sorted(resolved.index(name) for name in data['required'])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('chain', solve(_vary({'header': 'legacy,b', 'aliases': {'legacy': 'old', 'old': 'a'}, 'required': ['a', 'b']})), _vary([0, 1]))
check('reorder', solve(_vary({'header': 'b,@', 'aliases': {'@': 'a'}, 'required': ['a', 'b']})), _vary([1, 0]))
check('cycle', solve(_vary({'header': 'x,b', 'aliases': {'x': 'y', 'y': 'x'}, 'required': ['a', 'b']})), _vary(None))
check('collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a', 'b']})), _vary(None))
check('unknown', solve(_vary({'header': 'a,z', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('missing', solve(_vary({'header': 'a', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('normal', solve(_vary({'header': 'a,b', 'aliases': {}, 'required': ['a', 'b']})), _vary([0, 1]))
check('cycle permutation', solve(_vary({'header': 'b,c,a', 'aliases': {}, 'required': ['a', 'b', 'c']})), _vary([2, 0, 1]))
check('full collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a']})), _vary(None))
check('shared tail', solve(_vary({'header': 'x,y', 'aliases': {'x': 'a', 'y': 'b'}, 'required': ['a', 'b']})), _vary([0, 1]))
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
chain[0, 1][0, 1]Passed
reorder[0, 1][1, 0]Failed
cycleNoneNonePassed
collisionNoneNonePassed
unknownNoneNonePassed
missingNoneNonePassed
normal[0, 1][0, 1]Passed
cycle permutation[0, 1, 2][2, 0, 1]Failed
full collisionNoneNonePassed
shared tail[0, 1][0, 1]Passed

SHA-256 / 4423917c7a5db43ca87d6abcc0e31f1f92f3d1b90b6f7ea5570cebf50a96018c

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 10 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:45.019841+00:00.

Case digest / 3e1f4150c28943b7ed2df8274839d2c45c64b7853a4f53ef82293547fb45c8f0