{"abstract":"A structured table violates the declared record or column contract.","category":"Delimited text","checks":7,"contract":"Combine a list of tables, each {header:[names], rows:[[cells]]}. Output header is the first-seen union of names, preserving first-seen order. Duplicate names within one input header and row-width mismatches reject. Missing columns in a table become null; explicit empty values remain empty. Return {header,rows}.","evaluation_group":"s3-delimited-text-table-union","failed_approach":"The alternate implementation still violates the same declared invariant: a later table replaces the previously discovered union header.","family":"s3-delimited-text-table-union-union-headers","id":"FA-48606","implementations":{"attempt":{"sha256":"fe6f5e4bee829120e449e24c756a8e07a4fde8ac8e67ed93c12161d5df078246","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\ndef _vary(value):\n    if value == '@END': return 3 + 4*N\n    if isinstance(value, str): return value.replace('@', 'cell' * N)\n    if isinstance(value, list): return [_vary(x) for x in value]\n    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}\n    return value\nN = 1\nobservations = []\ndef solve(data):\n    header=[]\n    for table in data:\n        if len(set(table['header']))!=len(table['header']): return None\n        for name in table['header']:\n            if name not in header: header.insert(0,name)\n    out=[]\n    for table in data:\n        for row in table['rows']:\n            if len(row)!=len(table['header']): return None\n            mapping=dict(zip(table['header'],row))\n            out.append([mapping.get(name) for name in header])\n    return {'header':header,'rows':out}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('union', solve(_vary([{'header': ['b', 'a'], 'rows': [['@', 'x']]}, {'header': ['a', 'c'], 'rows': [['y', 'z']]}])), _vary({'header': ['b', 'a', 'c'], 'rows': [['@', 'x', None], [None, 'y', 'z']]}))\ncheck('reordered', solve(_vary([{'header': ['a', 'b'], 'rows': [['@', 'x']]}, {'header': ['b', 'a'], 'rows': [['z', 'y']]}])), _vary({'header': ['a', 'b'], 'rows': [['@', 'x'], ['y', 'z']]}))\ncheck('duplicate', solve(_vary([{'header': ['a', 'a'], 'rows': []}])), _vary(None))\ncheck('ragged', solve(_vary([{'header': ['a', 'b'], 'rows': [['@']]}])), _vary(None))\ncheck('explicit empty', solve(_vary([{'header': ['a'], 'rows': [['']]}, {'header': ['b'], 'rows': [['@']]}])), _vary({'header': ['a', 'b'], 'rows': [['', None], [None, '@']]}))\ncheck('empty', solve(_vary([])), _vary({'header': [], 'rows': []}))\ncheck('header only', solve(_vary([{'header': ['@'], 'rows': []}])), _vary({'header': ['@'], 'rows': []}))\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"f141c4790d2728f67d6376e59da116ab34b4caedd1fcf4ed99f2dc42e5aec49b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\ndef _vary(value):\n    if value == '@END': return 3 + 4*N\n    if isinstance(value, str): return value.replace('@', 'cell' * N)\n    if isinstance(value, list): return [_vary(x) for x in value]\n    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}\n    return value\nN = 1\nobservations = []\ndef solve(data):\n    header=[]\n    for table in data:\n        if len(set(table['header']))!=len(table['header']): return None\n        for name in table['header']:\n            if name not in header: header=[name]\n    out=[]\n    for table in data:\n        for row in table['rows']:\n            if len(row)!=len(table['header']): return None\n            mapping=dict(zip(table['header'],row))\n            out.append([mapping.get(name) for name in header])\n    return {'header':header,'rows':out}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('union', solve(_vary([{'header': ['b', 'a'], 'rows': [['@', 'x']]}, {'header': ['a', 'c'], 'rows': [['y', 'z']]}])), _vary({'header': ['b', 'a', 'c'], 'rows': [['@', 'x', None], [None, 'y', 'z']]}))\ncheck('reordered', solve(_vary([{'header': ['a', 'b'], 'rows': [['@', 'x']]}, {'header': ['b', 'a'], 'rows': [['z', 'y']]}])), _vary({'header': ['a', 'b'], 'rows': [['@', 'x'], ['y', 'z']]}))\ncheck('duplicate', solve(_vary([{'header': ['a', 'a'], 'rows': []}])), _vary(None))\ncheck('ragged', solve(_vary([{'header': ['a', 'b'], 'rows': [['@']]}])), _vary(None))\ncheck('explicit empty', solve(_vary([{'header': ['a'], 'rows': [['']]}, {'header': ['b'], 'rows': [['@']]}])), _vary({'header': ['a', 'b'], 'rows': [['', None], [None, '@']]}))\ncheck('empty', solve(_vary([])), _vary({'header': [], 'rows': []}))\ncheck('header only', solve(_vary([{'header': ['@'], 'rows': []}])), _vary({'header': ['@'], 'rows': []}))\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"e4872d3961c87210a1ee583e451be27d5b2d67f57f854db1139e988716afa70f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\ndef _vary(value):\n    if value == '@END': return 3 + 4*N\n    if isinstance(value, str): return value.replace('@', 'cell' * N)\n    if isinstance(value, list): return [_vary(x) for x in value]\n    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}\n    return value\nN = 1\nobservations = []\ndef solve(data):\n    header=[]\n    for table in data:\n        if len(set(table['header']))!=len(table['header']): return None\n        for name in table['header']:\n            if name not in header: header.append(name)\n    out=[]\n    for table in data:\n        for row in table['rows']:\n            if len(row)!=len(table['header']): return None\n            mapping=dict(zip(table['header'],row))\n            out.append([mapping.get(name) for name in header])\n    return {'header':header,'rows':out}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('union', solve(_vary([{'header': ['b', 'a'], 'rows': [['@', 'x']]}, {'header': ['a', 'c'], 'rows': [['y', 'z']]}])), _vary({'header': ['b', 'a', 'c'], 'rows': [['@', 'x', None], [None, 'y', 'z']]}))\ncheck('reordered', solve(_vary([{'header': ['a', 'b'], 'rows': [['@', 'x']]}, {'header': ['b', 'a'], 'rows': [['z', 'y']]}])), _vary({'header': ['a', 'b'], 'rows': [['@', 'x'], ['y', 'z']]}))\ncheck('duplicate', solve(_vary([{'header': ['a', 'a'], 'rows': []}])), _vary(None))\ncheck('ragged', solve(_vary([{'header': ['a', 'b'], 'rows': [['@']]}])), _vary(None))\ncheck('explicit empty', solve(_vary([{'header': ['a'], 'rows': [['']]}, {'header': ['b'], 'rows': [['@']]}])), _vary({'header': ['a', 'b'], 'rows': [['', None], [None, '@']]}))\ncheck('empty', solve(_vary([])), _vary({'header': [], 'rows': []}))\ncheck('header only', solve(_vary([{'header': ['@'], 'rows': []}])), _vary({'header': ['@'], 'rows': []}))\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"s3-delimited-text-table-union-union-headers","generated_at":"2026-09-29T14:44:52.219318+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Delimited interchange needs explicit framing, schema and field semantics at ingestion and emission boundaries.","repair":"Preserve the named invariant at the faulty decision: if name not in header: header.append(name)","root_cause":"A later table replaces the previously discovered union header.","sha256":"b6479ce2c36ca14cb6e7a5a4d9b1807c5e0dae609e4cbc90e7e1b2f7fb712871","title":"A later table replaces the previously discovered union header · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.09,"exit_code":1,"observations":[{"actual":{"header":["c","a","b"],"rows":[[null,"x","cell"],["z","y",null]]},"check":"union","expected":{"header":["b","a","c"],"rows":[["cell","x",null],[null,"y","z"]]},"passed":false},{"actual":{"header":["b","a"],"rows":[["x","cell"],["z","y"]]},"check":"reordered","expected":{"header":["a","b"],"rows":[["cell","x"],["y","z"]]},"passed":false},{"actual":null,"check":"duplicate","expected":null,"passed":true},{"actual":null,"check":"ragged","expected":null,"passed":true},{"actual":{"header":["b","a"],"rows":[[null,""],["cell",null]]},"check":"explicit empty","expected":{"header":["a","b"],"rows":[["",null],[null,"cell"]]},"passed":false},{"actual":{"header":[],"rows":[]},"check":"empty","expected":{"header":[],"rows":[]},"passed":true},{"actual":{"header":["cell"],"rows":[]},"check":"header only","expected":{"header":["cell"],"rows":[]},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"union\", \"actual\": {\"header\": [\"c\", \"a\", \"b\"], \"rows\": [[null, \"x\", \"cell\"], [\"z\", \"y\", null]]}, \"expected\": {\"header\": [\"b\", \"a\", \"c\"], \"rows\": [[\"cell\", \"x\", null], [null, \"y\", \"z\"]]}, \"passed\": false}, {\"check\": \"reordered\", \"actual\": {\"header\": [\"b\", \"a\"], \"rows\": [[\"x\", \"cell\"], [\"z\", \"y\"]]}, \"expected\": {\"header\": [\"a\", \"b\"], \"rows\": [[\"cell\", \"x\"], [\"y\", \"z\"]]}, \"passed\": false}, {\"check\": \"duplicate\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"ragged\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"explicit empty\", \"actual\": {\"header\": [\"b\", \"a\"], \"rows\": [[null, \"\"], [\"cell\", null]]}, \"expected\": {\"header\": [\"a\", \"b\"], \"rows\": [[\"\", null], [null, \"cell\"]]}, \"passed\": false}, {\"check\": \"empty\", \"actual\": {\"header\": [], \"rows\": []}, \"expected\": {\"header\": [], \"rows\": []}, \"passed\": true}, {\"check\": \"header only\", \"actual\": {\"header\": [\"cell\"], \"rows\": []}, \"expected\": {\"header\": [\"cell\"], \"rows\": []}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.145,"exit_code":1,"observations":[{"actual":{"header":["c"],"rows":[[null],["z"]]},"check":"union","expected":{"header":["b","a","c"],"rows":[["cell","x",null],[null,"y","z"]]},"passed":false},{"actual":{"header":["a"],"rows":[["cell"],["y"]]},"check":"reordered","expected":{"header":["a","b"],"rows":[["cell","x"],["y","z"]]},"passed":false},{"actual":null,"check":"duplicate","expected":null,"passed":true},{"actual":null,"check":"ragged","expected":null,"passed":true},{"actual":{"header":["b"],"rows":[[null],["cell"]]},"check":"explicit empty","expected":{"header":["a","b"],"rows":[["",null],[null,"cell"]]},"passed":false},{"actual":{"header":[],"rows":[]},"check":"empty","expected":{"header":[],"rows":[]},"passed":true},{"actual":{"header":["cell"],"rows":[]},"check":"header only","expected":{"header":["cell"],"rows":[]},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"union\", \"actual\": {\"header\": [\"c\"], \"rows\": [[null], [\"z\"]]}, \"expected\": {\"header\": [\"b\", \"a\", \"c\"], \"rows\": [[\"cell\", \"x\", null], [null, \"y\", \"z\"]]}, \"passed\": false}, {\"check\": \"reordered\", \"actual\": {\"header\": [\"a\"], \"rows\": [[\"cell\"], [\"y\"]]}, \"expected\": {\"header\": [\"a\", \"b\"], \"rows\": [[\"cell\", \"x\"], [\"y\", \"z\"]]}, \"passed\": false}, {\"check\": \"duplicate\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"ragged\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"explicit empty\", \"actual\": {\"header\": [\"b\"], \"rows\": [[null], [\"cell\"]]}, \"expected\": {\"header\": [\"a\", \"b\"], \"rows\": [[\"\", null], [null, \"cell\"]]}, \"passed\": false}, {\"check\": \"empty\", \"actual\": {\"header\": [], \"rows\": []}, \"expected\": {\"header\": [], \"rows\": []}, \"passed\": true}, {\"check\": \"header only\", \"actual\": {\"header\": [\"cell\"], \"rows\": []}, \"expected\": {\"header\": [\"cell\"], \"rows\": []}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.625,"exit_code":0,"observations":[{"actual":{"header":["b","a","c"],"rows":[["cell","x",null],[null,"y","z"]]},"check":"union","expected":{"header":["b","a","c"],"rows":[["cell","x",null],[null,"y","z"]]},"passed":true},{"actual":{"header":["a","b"],"rows":[["cell","x"],["y","z"]]},"check":"reordered","expected":{"header":["a","b"],"rows":[["cell","x"],["y","z"]]},"passed":true},{"actual":null,"check":"duplicate","expected":null,"passed":true},{"actual":null,"check":"ragged","expected":null,"passed":true},{"actual":{"header":["a","b"],"rows":[["",null],[null,"cell"]]},"check":"explicit empty","expected":{"header":["a","b"],"rows":[["",null],[null,"cell"]]},"passed":true},{"actual":{"header":[],"rows":[]},"check":"empty","expected":{"header":[],"rows":[]},"passed":true},{"actual":{"header":["cell"],"rows":[]},"check":"header only","expected":{"header":["cell"],"rows":[]},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"union\", \"actual\": {\"header\": [\"b\", \"a\", \"c\"], \"rows\": [[\"cell\", \"x\", null], [null, \"y\", \"z\"]]}, \"expected\": {\"header\": [\"b\", \"a\", \"c\"], \"rows\": [[\"cell\", \"x\", null], [null, \"y\", \"z\"]]}, \"passed\": true}, {\"check\": \"reordered\", \"actual\": {\"header\": [\"a\", \"b\"], \"rows\": [[\"cell\", \"x\"], [\"y\", \"z\"]]}, \"expected\": {\"header\": [\"a\", \"b\"], \"rows\": [[\"cell\", \"x\"], [\"y\", \"z\"]]}, \"passed\": true}, {\"check\": \"duplicate\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"ragged\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"explicit empty\", \"actual\": {\"header\": [\"a\", \"b\"], \"rows\": [[\"\", null], [null, \"cell\"]]}, \"expected\": {\"header\": [\"a\", \"b\"], \"rows\": [[\"\", null], [null, \"cell\"]]}, \"passed\": true}, {\"check\": \"empty\", \"actual\": {\"header\": [], \"rows\": []}, \"expected\": {\"header\": [], \"rows\": []}, \"passed\": true}, {\"check\": \"header only\", \"actual\": {\"header\": [\"cell\"], \"rows\": []}, \"expected\": {\"header\": [\"cell\"], \"rows\": []}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}