{"abstract":"A structured table violates the declared record or column contract.","category":"Delimited text","checks":9,"contract":"Apply cell text edits to an unquoted comma row without changing unedited spelling. Edits are [zero-based cell index,replacement text], unique indexes only; replacements cannot contain comma or newline. Compute all source spans before editing and apply from right to left. Out-of-range indexes reject.","evaluation_group":"s3-delimited-text-raw-cell-patches","failed_approach":"The alternate implementation still violates the same declared invariant: cell patches use character-zero as every source start.","family":"s3-delimited-text-raw-cell-patches-patch-origin","id":"FA-48751","implementations":{"attempt":{"sha256":"803668cadf00241bcd6b7727ee85d73882d4f7b1830b71ca89d0a96cda8c4f52","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    text=data['row']; starts=[0]+[i+1 for i,ch in enumerate(text) if ch==',']\n    ends=[i for i,ch in enumerate(text) if ch==',']+[len(text)]\n    seen=set(); patches=[]\n    for index,value in data['edits']:\n        if not 0<=index<len(starts) or index in seen: return None\n        if any(ch in value for ch in ',\\r\\n'): return None\n        seen.add(index); patches.append((index,ends[index],value))\n    for start,end,value in sorted(patches,reverse=True):\n        text=text[:start]+value+text[end:]\n    return text\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('vary lengths', solve(_vary({'row': 'a,bbb,c', 'edits': [[0, '@long'], [2, 'z']]})), _vary('@long,bbb,z'))\ncheck('empty field', solve(_vary({'row': 'a,,b', 'edits': [[1, '@']]})), _vary('a,@,b'))\ncheck('empty replacement', solve(_vary({'row': 'a,b,c', 'edits': [[1, '']]})), _vary('a,,c'))\ncheck('duplicate index', solve(_vary({'row': 'a,b', 'edits': [[0, 'x'], [0, 'y']]})), _vary(None))\ncheck('invalid replacement', solve(_vary({'row': 'a,b', 'edits': [[1, 'x,y']]})), _vary(None))\ncheck('out of range', solve(_vary({'row': 'a,b', 'edits': [[2, 'x']]})), _vary(None))\ncheck('preserve spaces', solve(_vary({'row': ' a , b ', 'edits': [[1, '@']]})), _vary(' a ,@'))\ncheck('unicode', solve(_vary({'row': 'é,😀,x', 'edits': [[1, '@']]})), _vary('é,@,x'))\ncheck('no edits', solve(_vary({'row': '@,x', 'edits': []})), _vary('@,x'))\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":"14f84fdd06daeb0870881de2822dc2e4937a92c179860b4738fa1b652b46e156","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    text=data['row']; starts=[0]+[i+1 for i,ch in enumerate(text) if ch==',']\n    ends=[i for i,ch in enumerate(text) if ch==',']+[len(text)]\n    seen=set(); patches=[]\n    for index,value in data['edits']:\n        if not 0<=index<len(starts) or index in seen: return None\n        if any(ch in value for ch in ',\\r\\n'): return None\n        seen.add(index); patches.append((0,ends[index],value))\n    for start,end,value in sorted(patches,reverse=True):\n        text=text[:start]+value+text[end:]\n    return text\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('vary lengths', solve(_vary({'row': 'a,bbb,c', 'edits': [[0, '@long'], [2, 'z']]})), _vary('@long,bbb,z'))\ncheck('empty field', solve(_vary({'row': 'a,,b', 'edits': [[1, '@']]})), _vary('a,@,b'))\ncheck('empty replacement', solve(_vary({'row': 'a,b,c', 'edits': [[1, '']]})), _vary('a,,c'))\ncheck('duplicate index', solve(_vary({'row': 'a,b', 'edits': [[0, 'x'], [0, 'y']]})), _vary(None))\ncheck('invalid replacement', solve(_vary({'row': 'a,b', 'edits': [[1, 'x,y']]})), _vary(None))\ncheck('out of range', solve(_vary({'row': 'a,b', 'edits': [[2, 'x']]})), _vary(None))\ncheck('preserve spaces', solve(_vary({'row': ' a , b ', 'edits': [[1, '@']]})), _vary(' a ,@'))\ncheck('unicode', solve(_vary({'row': 'é,😀,x', 'edits': [[1, '@']]})), _vary('é,@,x'))\ncheck('no edits', solve(_vary({'row': '@,x', 'edits': []})), _vary('@,x'))\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":"e23f84ea66fae053bc4c869e52195c78fb7a7d544cd7a5a8ba18dd18fc67f595","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    text=data['row']; starts=[0]+[i+1 for i,ch in enumerate(text) if ch==',']\n    ends=[i for i,ch in enumerate(text) if ch==',']+[len(text)]\n    seen=set(); patches=[]\n    for index,value in data['edits']:\n        if not 0<=index<len(starts) or index in seen: return None\n        if any(ch in value for ch in ',\\r\\n'): return None\n        seen.add(index); patches.append((starts[index],ends[index],value))\n    for start,end,value in sorted(patches,reverse=True):\n        text=text[:start]+value+text[end:]\n    return text\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('vary lengths', solve(_vary({'row': 'a,bbb,c', 'edits': [[0, '@long'], [2, 'z']]})), _vary('@long,bbb,z'))\ncheck('empty field', solve(_vary({'row': 'a,,b', 'edits': [[1, '@']]})), _vary('a,@,b'))\ncheck('empty replacement', solve(_vary({'row': 'a,b,c', 'edits': [[1, '']]})), _vary('a,,c'))\ncheck('duplicate index', solve(_vary({'row': 'a,b', 'edits': [[0, 'x'], [0, 'y']]})), _vary(None))\ncheck('invalid replacement', solve(_vary({'row': 'a,b', 'edits': [[1, 'x,y']]})), _vary(None))\ncheck('out of range', solve(_vary({'row': 'a,b', 'edits': [[2, 'x']]})), _vary(None))\ncheck('preserve spaces', solve(_vary({'row': ' a , b ', 'edits': [[1, '@']]})), _vary(' a ,@'))\ncheck('unicode', solve(_vary({'row': 'é,😀,x', 'edits': [[1, '@']]})), _vary('é,@,x'))\ncheck('no edits', solve(_vary({'row': '@,x', 'edits': []})), _vary('@,x'))\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-raw-cell-patches-patch-origin","generated_at":"2026-09-29T14:44:53.687581+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: patches.append((starts[index],ends[index],value))","root_cause":"Cell patches use character-zero as every source start.","sha256":"b9f94ea09da7739ff926129519e34fc8ec12d25532c6a1f812595d6f97d65795","title":"Cell patches use character-zero as every source start · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":49.354,"exit_code":1,"observations":[{"actual":"celllong,z","check":"vary lengths","expected":"celllong,bbb,z","passed":false},{"actual":"acell,b","check":"empty field","expected":"a,cell,b","passed":false},{"actual":"a,c","check":"empty replacement","expected":"a,,c","passed":false},{"actual":null,"check":"duplicate index","expected":null,"passed":true},{"actual":null,"check":"invalid replacement","expected":null,"passed":true},{"actual":null,"check":"out of range","expected":null,"passed":true},{"actual":" cell","check":"preserve spaces","expected":" a ,cell","passed":false},{"actual":"écell,x","check":"unicode","expected":"é,cell,x","passed":false},{"actual":"cell,x","check":"no edits","expected":"cell,x","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"vary lengths\", \"actual\": \"celllong,z\", \"expected\": \"celllong,bbb,z\", \"passed\": false}, {\"check\": \"empty field\", \"actual\": \"acell,b\", \"expected\": \"a,cell,b\", \"passed\": false}, {\"check\": \"empty replacement\", \"actual\": \"a,c\", \"expected\": \"a,,c\", \"passed\": false}, {\"check\": \"duplicate index\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"invalid replacement\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"out of range\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"preserve spaces\", \"actual\": \" cell\", \"expected\": \" a ,cell\", \"passed\": false}, {\"check\": \"unicode\", \"actual\": \"écell,x\", \"expected\": \"é,cell,x\", \"passed\": false}, {\"check\": \"no edits\", \"actual\": \"cell,x\", \"expected\": \"cell,x\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.851,"exit_code":1,"observations":[{"actual":"celllong","check":"vary lengths","expected":"celllong,bbb,z","passed":false},{"actual":"cell,b","check":"empty field","expected":"a,cell,b","passed":false},{"actual":",c","check":"empty replacement","expected":"a,,c","passed":false},{"actual":null,"check":"duplicate index","expected":null,"passed":true},{"actual":null,"check":"invalid replacement","expected":null,"passed":true},{"actual":null,"check":"out of range","expected":null,"passed":true},{"actual":"cell","check":"preserve spaces","expected":" a ,cell","passed":false},{"actual":"cell,x","check":"unicode","expected":"é,cell,x","passed":false},{"actual":"cell,x","check":"no edits","expected":"cell,x","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"vary lengths\", \"actual\": \"celllong\", \"expected\": \"celllong,bbb,z\", \"passed\": false}, {\"check\": \"empty field\", \"actual\": \"cell,b\", \"expected\": \"a,cell,b\", \"passed\": false}, {\"check\": \"empty replacement\", \"actual\": \",c\", \"expected\": \"a,,c\", \"passed\": false}, {\"check\": \"duplicate index\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"invalid replacement\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"out of range\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"preserve spaces\", \"actual\": \"cell\", \"expected\": \" a ,cell\", \"passed\": false}, {\"check\": \"unicode\", \"actual\": \"cell,x\", \"expected\": \"é,cell,x\", \"passed\": false}, {\"check\": \"no edits\", \"actual\": \"cell,x\", \"expected\": \"cell,x\", \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.046,"exit_code":0,"observations":[{"actual":"celllong,bbb,z","check":"vary lengths","expected":"celllong,bbb,z","passed":true},{"actual":"a,cell,b","check":"empty field","expected":"a,cell,b","passed":true},{"actual":"a,,c","check":"empty replacement","expected":"a,,c","passed":true},{"actual":null,"check":"duplicate index","expected":null,"passed":true},{"actual":null,"check":"invalid replacement","expected":null,"passed":true},{"actual":null,"check":"out of range","expected":null,"passed":true},{"actual":" a ,cell","check":"preserve spaces","expected":" a ,cell","passed":true},{"actual":"é,cell,x","check":"unicode","expected":"é,cell,x","passed":true},{"actual":"cell,x","check":"no edits","expected":"cell,x","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"vary lengths\", \"actual\": \"celllong,bbb,z\", \"expected\": \"celllong,bbb,z\", \"passed\": true}, {\"check\": \"empty field\", \"actual\": \"a,cell,b\", \"expected\": \"a,cell,b\", \"passed\": true}, {\"check\": \"empty replacement\", \"actual\": \"a,,c\", \"expected\": \"a,,c\", \"passed\": true}, {\"check\": \"duplicate index\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"invalid replacement\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"out of range\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"preserve spaces\", \"actual\": \" a ,cell\", \"expected\": \" a ,cell\", \"passed\": true}, {\"check\": \"unicode\", \"actual\": \"é,cell,x\", \"expected\": \"é,cell,x\", \"passed\": true}, {\"check\": \"no edits\", \"actual\": \"cell,x\", \"expected\": \"cell,x\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}