FA-44931 / Data systems / Open access
Unpivot uses row position instead of the identity column · case 01
Unpivot uses row position instead of the identity column.
ROOT CAUSE
unpivot-presence: Unpivot uses row position instead of the identity column.
VERIFIED REPAIR
Preserve the stated physical representation and operation order: Unpivot selected columns of record dictionaries into [id,column,value] rows. Include explicitly present None values, skip absent columns, respect requested column order and repetitions, and retain parent row order.
Unsuccessful approach: A selected field value is not the parent identity.
Case contract
Unpivot selected columns of record dictionaries into [id,column,value] rows. Include explicitly present None values, skip absent columns, respect requested column order and repetitions, and retain parent row order.
Why this case matters
A bounded deterministic data engine model makes representation and changelog faults reproducible.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
rows,columns=d
result=[]
for row in rows:
ident=rows.index(row)
for column in columns:
if column not in row: continue
result.append([ident,column,row.get(column)])
return result
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('source column order', solve([[{'id': 9, 'a': 1, 'b': 2}], ['b', 'a']]), [[9, 'b', 2], [9, 'a', 1]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 1}], ['a', 'b']]), [[9, 'a', 1]])
check('duplicate column', solve([[{'id': 9, 'a': 1}], ['a', 'a']]), [[9, 'a', 1], [9, 'a', 1]])
check('parent order', solve([[{'id': 9, 'a': 1}, {'id': 2, 'a': 2}], ['a']]), [[9, 'a', 1], [2, 'a', 2]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 1}], []]), [])
elif N == 2:
check('source column order', solve([[{'id': 9, 'a': 2, 'b': 3}], ['b', 'a']]), [[9, 'b', 3], [9, 'a', 2]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 2}], ['a', 'b']]), [[9, 'a', 2]])
check('duplicate column', solve([[{'id': 9, 'a': 2}], ['a', 'a']]), [[9, 'a', 2], [9, 'a', 2]])
check('parent order', solve([[{'id': 9, 'a': 2}, {'id': 2, 'a': 3}], ['a']]), [[9, 'a', 2], [2, 'a', 3]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 2}], []]), [])
elif N == 3:
check('source column order', solve([[{'id': 9, 'a': 3, 'b': 4}], ['b', 'a']]), [[9, 'b', 4], [9, 'a', 3]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 3}], ['a', 'b']]), [[9, 'a', 3]])
check('duplicate column', solve([[{'id': 9, 'a': 3}], ['a', 'a']]), [[9, 'a', 3], [9, 'a', 3]])
check('parent order', solve([[{'id': 9, 'a': 3}, {'id': 2, 'a': 4}], ['a']]), [[9, 'a', 3], [2, 'a', 4]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 3}], []]), [])
elif N == 4:
check('source column order', solve([[{'id': 9, 'a': 4, 'b': 5}], ['b', 'a']]), [[9, 'b', 5], [9, 'a', 4]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 4}], ['a', 'b']]), [[9, 'a', 4]])
check('duplicate column', solve([[{'id': 9, 'a': 4}], ['a', 'a']]), [[9, 'a', 4], [9, 'a', 4]])
check('parent order', solve([[{'id': 9, 'a': 4}, {'id': 2, 'a': 5}], ['a']]), [[9, 'a', 4], [2, 'a', 5]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 4}], []]), [])
elif N == 5:
check('source column order', solve([[{'id': 9, 'a': 5, 'b': 6}], ['b', 'a']]), [[9, 'b', 6], [9, 'a', 5]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 5}], ['a', 'b']]), [[9, 'a', 5]])
check('duplicate column', solve([[{'id': 9, 'a': 5}], ['a', 'a']]), [[9, 'a', 5], [9, 'a', 5]])
check('parent order', solve([[{'id': 9, 'a': 5}, {'id': 2, 'a': 6}], ['a']]), [[9, 'a', 5], [2, 'a', 6]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 5}], []]), [])
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| source column order | [[0, 'b', 2], [0, 'a', 1]] | [[9, 'b', 2], [9, 'a', 1]] | Failed |
| explicit null | [[0, 'a', None]] | [[9, 'a', None]] | Failed |
| missing field | [[0, 'a', 1]] | [[9, 'a', 1]] | Failed |
| duplicate column | [[0, 'a', 1], [0, 'a', 1]] | [[9, 'a', 1], [9, 'a', 1]] | Failed |
| parent order | [[0, 'a', 1], [1, 'a', 2]] | [[9, 'a', 1], [2, 'a', 2]] | Failed |
| zero value | [[0, 'a', 0]] | [[9, 'a', 0]] | Failed |
| empty projection | [] | [] | Passed |
SHA-256 / e9592cf843b7f13bfe483c2537229a755dd2561820328b42525ceed12c6556ff
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
rows,columns=d
result=[]
for row in rows:
ident=row.get(columns[0]) if columns else None
for column in columns:
if column not in row: continue
result.append([ident,column,row.get(column)])
return result
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('source column order', solve([[{'id': 9, 'a': 1, 'b': 2}], ['b', 'a']]), [[9, 'b', 2], [9, 'a', 1]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 1}], ['a', 'b']]), [[9, 'a', 1]])
check('duplicate column', solve([[{'id': 9, 'a': 1}], ['a', 'a']]), [[9, 'a', 1], [9, 'a', 1]])
check('parent order', solve([[{'id': 9, 'a': 1}, {'id': 2, 'a': 2}], ['a']]), [[9, 'a', 1], [2, 'a', 2]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 1}], []]), [])
elif N == 2:
check('source column order', solve([[{'id': 9, 'a': 2, 'b': 3}], ['b', 'a']]), [[9, 'b', 3], [9, 'a', 2]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 2}], ['a', 'b']]), [[9, 'a', 2]])
check('duplicate column', solve([[{'id': 9, 'a': 2}], ['a', 'a']]), [[9, 'a', 2], [9, 'a', 2]])
check('parent order', solve([[{'id': 9, 'a': 2}, {'id': 2, 'a': 3}], ['a']]), [[9, 'a', 2], [2, 'a', 3]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 2}], []]), [])
elif N == 3:
check('source column order', solve([[{'id': 9, 'a': 3, 'b': 4}], ['b', 'a']]), [[9, 'b', 4], [9, 'a', 3]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 3}], ['a', 'b']]), [[9, 'a', 3]])
check('duplicate column', solve([[{'id': 9, 'a': 3}], ['a', 'a']]), [[9, 'a', 3], [9, 'a', 3]])
check('parent order', solve([[{'id': 9, 'a': 3}, {'id': 2, 'a': 4}], ['a']]), [[9, 'a', 3], [2, 'a', 4]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 3}], []]), [])
elif N == 4:
check('source column order', solve([[{'id': 9, 'a': 4, 'b': 5}], ['b', 'a']]), [[9, 'b', 5], [9, 'a', 4]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 4}], ['a', 'b']]), [[9, 'a', 4]])
check('duplicate column', solve([[{'id': 9, 'a': 4}], ['a', 'a']]), [[9, 'a', 4], [9, 'a', 4]])
check('parent order', solve([[{'id': 9, 'a': 4}, {'id': 2, 'a': 5}], ['a']]), [[9, 'a', 4], [2, 'a', 5]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 4}], []]), [])
elif N == 5:
check('source column order', solve([[{'id': 9, 'a': 5, 'b': 6}], ['b', 'a']]), [[9, 'b', 6], [9, 'a', 5]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 5}], ['a', 'b']]), [[9, 'a', 5]])
check('duplicate column', solve([[{'id': 9, 'a': 5}], ['a', 'a']]), [[9, 'a', 5], [9, 'a', 5]])
check('parent order', solve([[{'id': 9, 'a': 5}, {'id': 2, 'a': 6}], ['a']]), [[9, 'a', 5], [2, 'a', 6]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 5}], []]), [])
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| source column order | [[2, 'b', 2], [2, 'a', 1]] | [[9, 'b', 2], [9, 'a', 1]] | Failed |
| explicit null | [[None, 'a', None]] | [[9, 'a', None]] | Failed |
| missing field | [[1, 'a', 1]] | [[9, 'a', 1]] | Failed |
| duplicate column | [[1, 'a', 1], [1, 'a', 1]] | [[9, 'a', 1], [9, 'a', 1]] | Failed |
| parent order | [[1, 'a', 1], [2, 'a', 2]] | [[9, 'a', 1], [2, 'a', 2]] | Failed |
| zero value | [[0, 'a', 0]] | [[9, 'a', 0]] | Failed |
| empty projection | [] | [] | Passed |
SHA-256 / 11663558480a8992c925b0b97501d92a7c12a68ef763fa53a0c3d91f08cb9626
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
rows,columns=d
result=[]
for row in rows:
ident=row['id']
for column in columns:
if column not in row: continue
result.append([ident,column,row.get(column)])
return result
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('source column order', solve([[{'id': 9, 'a': 1, 'b': 2}], ['b', 'a']]), [[9, 'b', 2], [9, 'a', 1]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 1}], ['a', 'b']]), [[9, 'a', 1]])
check('duplicate column', solve([[{'id': 9, 'a': 1}], ['a', 'a']]), [[9, 'a', 1], [9, 'a', 1]])
check('parent order', solve([[{'id': 9, 'a': 1}, {'id': 2, 'a': 2}], ['a']]), [[9, 'a', 1], [2, 'a', 2]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 1}], []]), [])
elif N == 2:
check('source column order', solve([[{'id': 9, 'a': 2, 'b': 3}], ['b', 'a']]), [[9, 'b', 3], [9, 'a', 2]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 2}], ['a', 'b']]), [[9, 'a', 2]])
check('duplicate column', solve([[{'id': 9, 'a': 2}], ['a', 'a']]), [[9, 'a', 2], [9, 'a', 2]])
check('parent order', solve([[{'id': 9, 'a': 2}, {'id': 2, 'a': 3}], ['a']]), [[9, 'a', 2], [2, 'a', 3]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 2}], []]), [])
elif N == 3:
check('source column order', solve([[{'id': 9, 'a': 3, 'b': 4}], ['b', 'a']]), [[9, 'b', 4], [9, 'a', 3]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 3}], ['a', 'b']]), [[9, 'a', 3]])
check('duplicate column', solve([[{'id': 9, 'a': 3}], ['a', 'a']]), [[9, 'a', 3], [9, 'a', 3]])
check('parent order', solve([[{'id': 9, 'a': 3}, {'id': 2, 'a': 4}], ['a']]), [[9, 'a', 3], [2, 'a', 4]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 3}], []]), [])
elif N == 4:
check('source column order', solve([[{'id': 9, 'a': 4, 'b': 5}], ['b', 'a']]), [[9, 'b', 5], [9, 'a', 4]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 4}], ['a', 'b']]), [[9, 'a', 4]])
check('duplicate column', solve([[{'id': 9, 'a': 4}], ['a', 'a']]), [[9, 'a', 4], [9, 'a', 4]])
check('parent order', solve([[{'id': 9, 'a': 4}, {'id': 2, 'a': 5}], ['a']]), [[9, 'a', 4], [2, 'a', 5]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 4}], []]), [])
elif N == 5:
check('source column order', solve([[{'id': 9, 'a': 5, 'b': 6}], ['b', 'a']]), [[9, 'b', 6], [9, 'a', 5]])
check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
check('missing field', solve([[{'id': 9, 'a': 5}], ['a', 'b']]), [[9, 'a', 5]])
check('duplicate column', solve([[{'id': 9, 'a': 5}], ['a', 'a']]), [[9, 'a', 5], [9, 'a', 5]])
check('parent order', solve([[{'id': 9, 'a': 5}, {'id': 2, 'a': 6}], ['a']]), [[9, 'a', 5], [2, 'a', 6]])
check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
check('empty projection', solve([[{'id': 9, 'a': 5}], []]), [])
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| source column order | [[9, 'b', 2], [9, 'a', 1]] | [[9, 'b', 2], [9, 'a', 1]] | Passed |
| explicit null | [[9, 'a', None]] | [[9, 'a', None]] | Passed |
| missing field | [[9, 'a', 1]] | [[9, 'a', 1]] | Passed |
| duplicate column | [[9, 'a', 1], [9, 'a', 1]] | [[9, 'a', 1], [9, 'a', 1]] | Passed |
| parent order | [[9, 'a', 1], [2, 'a', 2]] | [[9, 'a', 1], [2, 'a', 2]] | Passed |
| zero value | [[9, 'a', 0]] | [[9, 'a', 0]] | Passed |
| empty projection | [] | [] | Passed |
SHA-256 / 2592dbe1cfc06f8759d015f54a779497ffd4c343e9df5850a67920e5a3b57bd0
Verification & scope
Offline stipulated semantics over valid small inputs; no performance, concurrency, or production-engine conformance claim. 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:17.108786+00:00.
Case digest / bc2344f6ce0d1867984d0e577fa3cc834f463094c8a4fc0ff038a0d2715702ae