{"abstract":"A structured table violates the declared record or column contract.","category":"Delimited text","checks":7,"contract":"Append comma rows to existing serialized text. Existing text is either empty or ends in a complete physical record, optionally lacking its final LF. On an empty file emit the supplied header once, followed by new rows. For a nonempty unterminated tail insert exactly one LF before new rows. With no new rows return existing text unchanged.","evaluation_group":"s3-delimited-text-append-table-writer","failed_approach":"The alternate implementation still violates the same declared invariant: an unterminated existing row merges with the first appended row.","family":"s3-delimited-text-append-table-writer-tail-separator","id":"FA-48221","implementations":{"attempt":{"sha256":"bca3a5f8b6ac6b892f2d28723e1ec921d1a7ea8aab892153bdc50f18c067fa73","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    if not data['rows']: return data['existing']\n    text=data['existing']\n    if not text: text=','.join(data['header']) + '\\n'\n    elif not text.endswith('\\n'): text+=','\n    for row in data['rows']:\n        text+=','.join(row)+'\\n'\n    return text\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('new', solve(_vary({'existing': '', 'header': ['a', 'b'], 'rows': [['@', 'x']]})), _vary('a,b\\n@,x\\n'))\ncheck('terminated', solve(_vary({'existing': 'a,b\\nq,z\\n', 'header': ['a', 'b'], 'rows': [['@', 'x']]})), _vary('a,b\\nq,z\\n@,x\\n'))\ncheck('unterminated', solve(_vary({'existing': 'a,b\\nq,z', 'header': ['a', 'b'], 'rows': [['@', 'x']]})), _vary('a,b\\nq,z\\n@,x\\n'))\ncheck('no new', solve(_vary({'existing': 'a,b', 'header': ['a', 'b'], 'rows': []})), _vary('a,b'))\ncheck('empty untouched', solve(_vary({'existing': '', 'header': ['a', 'b'], 'rows': []})), _vary(''))\ncheck('two appended', solve(_vary({'existing': 'a\\n', 'header': ['a'], 'rows': [['@'], ['z']]})), _vary('a\\n@\\nz\\n'))\ncheck('empty cells', solve(_vary({'existing': '', 'header': ['a', 'b'], 'rows': [['', '']]})), _vary('a,b\\n,\\n'))\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":"4846e2e3fbb952a3c5a0233adf046deb4a003ac228d81ed33789d80e5892f03d","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    if not data['rows']: return data['existing']\n    text=data['existing']\n    if not text: text=','.join(data['header']) + '\\n'\n    elif False: text+='\\n'\n    for row in data['rows']:\n        text+=','.join(row)+'\\n'\n    return text\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('new', solve(_vary({'existing': '', 'header': ['a', 'b'], 'rows': [['@', 'x']]})), _vary('a,b\\n@,x\\n'))\ncheck('terminated', solve(_vary({'existing': 'a,b\\nq,z\\n', 'header': ['a', 'b'], 'rows': [['@', 'x']]})), _vary('a,b\\nq,z\\n@,x\\n'))\ncheck('unterminated', solve(_vary({'existing': 'a,b\\nq,z', 'header': ['a', 'b'], 'rows': [['@', 'x']]})), _vary('a,b\\nq,z\\n@,x\\n'))\ncheck('no new', solve(_vary({'existing': 'a,b', 'header': ['a', 'b'], 'rows': []})), _vary('a,b'))\ncheck('empty untouched', solve(_vary({'existing': '', 'header': ['a', 'b'], 'rows': []})), _vary(''))\ncheck('two appended', solve(_vary({'existing': 'a\\n', 'header': ['a'], 'rows': [['@'], ['z']]})), _vary('a\\n@\\nz\\n'))\ncheck('empty cells', solve(_vary({'existing': '', 'header': ['a', 'b'], 'rows': [['', '']]})), _vary('a,b\\n,\\n'))\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":"4f9d1f290e925b7085db66b8d3a79f9cd9b4bcd0eae31270d055d9e2f5fa9010","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    if not data['rows']: return data['existing']\n    text=data['existing']\n    if not text: text=','.join(data['header']) + '\\n'\n    elif not text.endswith('\\n'): text+='\\n'\n    for row in data['rows']:\n        text+=','.join(row)+'\\n'\n    return text\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('new', solve(_vary({'existing': '', 'header': ['a', 'b'], 'rows': [['@', 'x']]})), _vary('a,b\\n@,x\\n'))\ncheck('terminated', solve(_vary({'existing': 'a,b\\nq,z\\n', 'header': ['a', 'b'], 'rows': [['@', 'x']]})), _vary('a,b\\nq,z\\n@,x\\n'))\ncheck('unterminated', solve(_vary({'existing': 'a,b\\nq,z', 'header': ['a', 'b'], 'rows': [['@', 'x']]})), _vary('a,b\\nq,z\\n@,x\\n'))\ncheck('no new', solve(_vary({'existing': 'a,b', 'header': ['a', 'b'], 'rows': []})), _vary('a,b'))\ncheck('empty untouched', solve(_vary({'existing': '', 'header': ['a', 'b'], 'rows': []})), _vary(''))\ncheck('two appended', solve(_vary({'existing': 'a\\n', 'header': ['a'], 'rows': [['@'], ['z']]})), _vary('a\\n@\\nz\\n'))\ncheck('empty cells', solve(_vary({'existing': '', 'header': ['a', 'b'], 'rows': [['', '']]})), _vary('a,b\\n,\\n'))\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-append-table-writer-tail-separator","generated_at":"2026-09-29T14:44:48.789005+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: elif not text.endswith('\\n'): text+='\\n'","root_cause":"An unterminated existing row merges with the first appended row.","sha256":"0f29c903adb04e2f777e001ab1073ecdb71c989c8589fc2e54219597edf0b041","title":"An unterminated existing row merges with the first appended row · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.553,"exit_code":1,"observations":[{"actual":"a,b\ncell,x\n","check":"new","expected":"a,b\ncell,x\n","passed":true},{"actual":"a,b\nq,z\ncell,x\n","check":"terminated","expected":"a,b\nq,z\ncell,x\n","passed":true},{"actual":"a,b\nq,z,cell,x\n","check":"unterminated","expected":"a,b\nq,z\ncell,x\n","passed":false},{"actual":"a,b","check":"no new","expected":"a,b","passed":true},{"actual":"","check":"empty untouched","expected":"","passed":true},{"actual":"a\ncell\nz\n","check":"two appended","expected":"a\ncell\nz\n","passed":true},{"actual":"a,b\n,\n","check":"empty cells","expected":"a,b\n,\n","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"new\", \"actual\": \"a,b\\ncell,x\\n\", \"expected\": \"a,b\\ncell,x\\n\", \"passed\": true}, {\"check\": \"terminated\", \"actual\": \"a,b\\nq,z\\ncell,x\\n\", \"expected\": \"a,b\\nq,z\\ncell,x\\n\", \"passed\": true}, {\"check\": \"unterminated\", \"actual\": \"a,b\\nq,z,cell,x\\n\", \"expected\": \"a,b\\nq,z\\ncell,x\\n\", \"passed\": false}, {\"check\": \"no new\", \"actual\": \"a,b\", \"expected\": \"a,b\", \"passed\": true}, {\"check\": \"empty untouched\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"two appended\", \"actual\": \"a\\ncell\\nz\\n\", \"expected\": \"a\\ncell\\nz\\n\", \"passed\": true}, {\"check\": \"empty cells\", \"actual\": \"a,b\\n,\\n\", \"expected\": \"a,b\\n,\\n\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.579,"exit_code":1,"observations":[{"actual":"a,b\ncell,x\n","check":"new","expected":"a,b\ncell,x\n","passed":true},{"actual":"a,b\nq,z\ncell,x\n","check":"terminated","expected":"a,b\nq,z\ncell,x\n","passed":true},{"actual":"a,b\nq,zcell,x\n","check":"unterminated","expected":"a,b\nq,z\ncell,x\n","passed":false},{"actual":"a,b","check":"no new","expected":"a,b","passed":true},{"actual":"","check":"empty untouched","expected":"","passed":true},{"actual":"a\ncell\nz\n","check":"two appended","expected":"a\ncell\nz\n","passed":true},{"actual":"a,b\n,\n","check":"empty cells","expected":"a,b\n,\n","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"new\", \"actual\": \"a,b\\ncell,x\\n\", \"expected\": \"a,b\\ncell,x\\n\", \"passed\": true}, {\"check\": \"terminated\", \"actual\": \"a,b\\nq,z\\ncell,x\\n\", \"expected\": \"a,b\\nq,z\\ncell,x\\n\", \"passed\": true}, {\"check\": \"unterminated\", \"actual\": \"a,b\\nq,zcell,x\\n\", \"expected\": \"a,b\\nq,z\\ncell,x\\n\", \"passed\": false}, {\"check\": \"no new\", \"actual\": \"a,b\", \"expected\": \"a,b\", \"passed\": true}, {\"check\": \"empty untouched\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"two appended\", \"actual\": \"a\\ncell\\nz\\n\", \"expected\": \"a\\ncell\\nz\\n\", \"passed\": true}, {\"check\": \"empty cells\", \"actual\": \"a,b\\n,\\n\", \"expected\": \"a,b\\n,\\n\", \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.599,"exit_code":0,"observations":[{"actual":"a,b\ncell,x\n","check":"new","expected":"a,b\ncell,x\n","passed":true},{"actual":"a,b\nq,z\ncell,x\n","check":"terminated","expected":"a,b\nq,z\ncell,x\n","passed":true},{"actual":"a,b\nq,z\ncell,x\n","check":"unterminated","expected":"a,b\nq,z\ncell,x\n","passed":true},{"actual":"a,b","check":"no new","expected":"a,b","passed":true},{"actual":"","check":"empty untouched","expected":"","passed":true},{"actual":"a\ncell\nz\n","check":"two appended","expected":"a\ncell\nz\n","passed":true},{"actual":"a,b\n,\n","check":"empty cells","expected":"a,b\n,\n","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"new\", \"actual\": \"a,b\\ncell,x\\n\", \"expected\": \"a,b\\ncell,x\\n\", \"passed\": true}, {\"check\": \"terminated\", \"actual\": \"a,b\\nq,z\\ncell,x\\n\", \"expected\": \"a,b\\nq,z\\ncell,x\\n\", \"passed\": true}, {\"check\": \"unterminated\", \"actual\": \"a,b\\nq,z\\ncell,x\\n\", \"expected\": \"a,b\\nq,z\\ncell,x\\n\", \"passed\": true}, {\"check\": \"no new\", \"actual\": \"a,b\", \"expected\": \"a,b\", \"passed\": true}, {\"check\": \"empty untouched\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"two appended\", \"actual\": \"a\\ncell\\nz\\n\", \"expected\": \"a\\ncell\\nz\\n\", \"passed\": true}, {\"check\": \"empty cells\", \"actual\": \"a,b\\n,\\n\", \"expected\": \"a,b\\n,\\n\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}