{"abstract":"A structured table violates the declared record or column contract.","category":"Delimited text","checks":8,"contract":"Encode a list of text cells as TSV without a terminator. Escape backslashes before introducing backslash-t, backslash-n, backslash-r; preserve empty columns and all other text.","evaluation_group":"s3-delimited-text-escaped-tsv-writer","failed_approach":"Escaping only slash-t misses bare slashes and other escape-looking text.","family":"s3-delimited-text-escaped-tsv-writer-backslash","id":"FA-47416","implementations":{"attempt":{"sha256":"fd2719f2b8b8005b843e97ec1c83bdf0ce1fdaf9aca000bc6bc089f857260d6f","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    out = []\n    for field in data:\n        field = field.replace('\\\\t', '\\\\\\\\t')\n        field = field.replace('\\t', '\\\\t')\n        field = field.replace('\\n', '\\\\n')\n        field = field.replace('\\r', '\\\\r')\n        out.append(field)\n    return '\\t'.join(out)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('all controls', solve(_vary(['@\\t\\n\\r\\\\'])), _vary('@\\\\t\\\\n\\\\r\\\\\\\\'))\ncheck('empty cells', solve(_vary(['', '@', ''])), _vary('\\t@\\t'))\ncheck('literal slash-t', solve(_vary(['\\\\t'])), _vary('\\\\\\\\t'))\ncheck('normal', solve(_vary(['@', 'x'])), _vary('@\\tx'))\ncheck('zero columns', solve(_vary([])), _vary(''))\ncheck('all empty', solve(_vary(['', '', ''])), _vary('\\t\\t'))\ncheck('LF only', solve(_vary(['\\n'])), _vary('\\\\n'))\ncheck('CR only', solve(_vary(['\\r'])), _vary('\\\\r'))\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":"14fae5d1302f1d325a05591c1344a578b7d942e2022f8526dfb67af17f63fddd","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    out = []\n    for field in data:\n        field = field\n        field = field.replace('\\t', '\\\\t')\n        field = field.replace('\\n', '\\\\n')\n        field = field.replace('\\r', '\\\\r')\n        out.append(field)\n    return '\\t'.join(out)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('all controls', solve(_vary(['@\\t\\n\\r\\\\'])), _vary('@\\\\t\\\\n\\\\r\\\\\\\\'))\ncheck('empty cells', solve(_vary(['', '@', ''])), _vary('\\t@\\t'))\ncheck('literal slash-t', solve(_vary(['\\\\t'])), _vary('\\\\\\\\t'))\ncheck('normal', solve(_vary(['@', 'x'])), _vary('@\\tx'))\ncheck('zero columns', solve(_vary([])), _vary(''))\ncheck('all empty', solve(_vary(['', '', ''])), _vary('\\t\\t'))\ncheck('LF only', solve(_vary(['\\n'])), _vary('\\\\n'))\ncheck('CR only', solve(_vary(['\\r'])), _vary('\\\\r'))\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":"cb59a0aeadc5359c537e056b45d1753eb2d79c66b37674bf20822e8768925ba6","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    out = []\n    for field in data:\n        field = field.replace('\\\\', '\\\\\\\\')\n        field = field.replace('\\t', '\\\\t')\n        field = field.replace('\\n', '\\\\n')\n        field = field.replace('\\r', '\\\\r')\n        out.append(field)\n    return '\\t'.join(out)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('all controls', solve(_vary(['@\\t\\n\\r\\\\'])), _vary('@\\\\t\\\\n\\\\r\\\\\\\\'))\ncheck('empty cells', solve(_vary(['', '@', ''])), _vary('\\t@\\t'))\ncheck('literal slash-t', solve(_vary(['\\\\t'])), _vary('\\\\\\\\t'))\ncheck('normal', solve(_vary(['@', 'x'])), _vary('@\\tx'))\ncheck('zero columns', solve(_vary([])), _vary(''))\ncheck('all empty', solve(_vary(['', '', ''])), _vary('\\t\\t'))\ncheck('LF only', solve(_vary(['\\n'])), _vary('\\\\n'))\ncheck('CR only', solve(_vary(['\\r'])), _vary('\\\\r'))\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-escaped-tsv-writer-backslash","generated_at":"2026-09-29T14:44:41.267071+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: field = field.replace('\\\\', '\\\\\\\\')","root_cause":"Existing backslashes are not escaped before control escapes are introduced.","sha256":"24e716ca4bca551dfa71e8db369d83bb56dfc7f32835861e7868a2d0ba0bca80","title":"A TSV writer leaves literal escape prefixes ambiguous · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.735,"exit_code":1,"observations":[{"actual":"cell\\t\\n\\r\\","check":"all controls","expected":"cell\\t\\n\\r\\\\","passed":false},{"actual":"\tcell\t","check":"empty cells","expected":"\tcell\t","passed":true},{"actual":"\\\\t","check":"literal slash-t","expected":"\\\\t","passed":true},{"actual":"cell\tx","check":"normal","expected":"cell\tx","passed":true},{"actual":"","check":"zero columns","expected":"","passed":true},{"actual":"\t\t","check":"all empty","expected":"\t\t","passed":true},{"actual":"\\n","check":"LF only","expected":"\\n","passed":true},{"actual":"\\r","check":"CR only","expected":"\\r","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"all controls\", \"actual\": \"cell\\\\t\\\\n\\\\r\\\\\", \"expected\": \"cell\\\\t\\\\n\\\\r\\\\\\\\\", \"passed\": false}, {\"check\": \"empty cells\", \"actual\": \"\\tcell\\t\", \"expected\": \"\\tcell\\t\", \"passed\": true}, {\"check\": \"literal slash-t\", \"actual\": \"\\\\\\\\t\", \"expected\": \"\\\\\\\\t\", \"passed\": true}, {\"check\": \"normal\", \"actual\": \"cell\\tx\", \"expected\": \"cell\\tx\", \"passed\": true}, {\"check\": \"zero columns\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"all empty\", \"actual\": \"\\t\\t\", \"expected\": \"\\t\\t\", \"passed\": true}, {\"check\": \"LF only\", \"actual\": \"\\\\n\", \"expected\": \"\\\\n\", \"passed\": true}, {\"check\": \"CR only\", \"actual\": \"\\\\r\", \"expected\": \"\\\\r\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":45.379,"exit_code":1,"observations":[{"actual":"cell\\t\\n\\r\\","check":"all controls","expected":"cell\\t\\n\\r\\\\","passed":false},{"actual":"\tcell\t","check":"empty cells","expected":"\tcell\t","passed":true},{"actual":"\\t","check":"literal slash-t","expected":"\\\\t","passed":false},{"actual":"cell\tx","check":"normal","expected":"cell\tx","passed":true},{"actual":"","check":"zero columns","expected":"","passed":true},{"actual":"\t\t","check":"all empty","expected":"\t\t","passed":true},{"actual":"\\n","check":"LF only","expected":"\\n","passed":true},{"actual":"\\r","check":"CR only","expected":"\\r","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"all controls\", \"actual\": \"cell\\\\t\\\\n\\\\r\\\\\", \"expected\": \"cell\\\\t\\\\n\\\\r\\\\\\\\\", \"passed\": false}, {\"check\": \"empty cells\", \"actual\": \"\\tcell\\t\", \"expected\": \"\\tcell\\t\", \"passed\": true}, {\"check\": \"literal slash-t\", \"actual\": \"\\\\t\", \"expected\": \"\\\\\\\\t\", \"passed\": false}, {\"check\": \"normal\", \"actual\": \"cell\\tx\", \"expected\": \"cell\\tx\", \"passed\": true}, {\"check\": \"zero columns\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"all empty\", \"actual\": \"\\t\\t\", \"expected\": \"\\t\\t\", \"passed\": true}, {\"check\": \"LF only\", \"actual\": \"\\\\n\", \"expected\": \"\\\\n\", \"passed\": true}, {\"check\": \"CR only\", \"actual\": \"\\\\r\", \"expected\": \"\\\\r\", \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":45.088,"exit_code":0,"observations":[{"actual":"cell\\t\\n\\r\\\\","check":"all controls","expected":"cell\\t\\n\\r\\\\","passed":true},{"actual":"\tcell\t","check":"empty cells","expected":"\tcell\t","passed":true},{"actual":"\\\\t","check":"literal slash-t","expected":"\\\\t","passed":true},{"actual":"cell\tx","check":"normal","expected":"cell\tx","passed":true},{"actual":"","check":"zero columns","expected":"","passed":true},{"actual":"\t\t","check":"all empty","expected":"\t\t","passed":true},{"actual":"\\n","check":"LF only","expected":"\\n","passed":true},{"actual":"\\r","check":"CR only","expected":"\\r","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"all controls\", \"actual\": \"cell\\\\t\\\\n\\\\r\\\\\\\\\", \"expected\": \"cell\\\\t\\\\n\\\\r\\\\\\\\\", \"passed\": true}, {\"check\": \"empty cells\", \"actual\": \"\\tcell\\t\", \"expected\": \"\\tcell\\t\", \"passed\": true}, {\"check\": \"literal slash-t\", \"actual\": \"\\\\\\\\t\", \"expected\": \"\\\\\\\\t\", \"passed\": true}, {\"check\": \"normal\", \"actual\": \"cell\\tx\", \"expected\": \"cell\\tx\", \"passed\": true}, {\"check\": \"zero columns\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"all empty\", \"actual\": \"\\t\\t\", \"expected\": \"\\t\\t\", \"passed\": true}, {\"check\": \"LF only\", \"actual\": \"\\\\n\", \"expected\": \"\\\\n\", \"passed\": true}, {\"check\": \"CR only\", \"actual\": \"\\\\r\", \"expected\": \"\\\\r\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}