{"abstract":"Replacement backslashes become regex instructions.","category":"Regular expressions","checks":4,"contract":"Replace every X with the literal replacement x[1] in x[0].","evaluation_group":"model-d66a56e31e73f881","failed_approach":"The attempted repair handles the primary example but still violates a separate boundary of the same contract.","family":"xp-regex-replacement-literal","id":"FA-3106","implementations":{"attempt":{"sha256":"4c4317c17717a45218d9b61928b08d5b4ff32532892e74bfbbe52d32e187ddb4","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct\nfrom urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit\nfrom email.header import decode_header, make_header\nfrom email.utils import getaddresses\nfrom xml.etree import ElementTree as ET\nimport shlex, string, textwrap\n\nN = 1\nobservations = []\ndef solve(x):\n    try:\n        return re.sub('X',x[1].replace('\\\\','\\\\\\\\'),x[0],count=1)\n    except Exception as exc:\n        return {\"error\": type(exc).__name__}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('boundary 1', solve(['XX', '\\\\n']), '\\\\n\\\\n')\ncheck('boundary 2', solve(['aX', 'z']), 'az')\ncheck('boundary 3', solve(['none', 'x']), 'none')\ncheck('boundary 4', solve(['X', '\\\\g<0>']), '\\\\g<0>')\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":"c8959cb176dfaa138a6f7e59596822a4d2ba44d5e62186c2f33b93f29b9ddc16","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct\nfrom urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit\nfrom email.header import decode_header, make_header\nfrom email.utils import getaddresses\nfrom xml.etree import ElementTree as ET\nimport shlex, string, textwrap\n\nN = 1\nobservations = []\ndef solve(x):\n    try:\n        return re.sub('X',x[1],x[0])\n    except Exception as exc:\n        return {\"error\": type(exc).__name__}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('boundary 1', solve(['XX', '\\\\n']), '\\\\n\\\\n')\ncheck('boundary 2', solve(['aX', 'z']), 'az')\ncheck('boundary 3', solve(['none', 'x']), 'none')\ncheck('boundary 4', solve(['X', '\\\\g<0>']), '\\\\g<0>')\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":"5da2262980ff3cf35f76c32cbad6a4a5957761dc5abb5cbf779423c8d6318d7c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct\nfrom urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit\nfrom email.header import decode_header, make_header\nfrom email.utils import getaddresses\nfrom xml.etree import ElementTree as ET\nimport shlex, string, textwrap\n\nN = 1\nobservations = []\ndef solve(x):\n    try:\n        return re.sub('X',lambda m:x[1],x[0])\n    except Exception as exc:\n        return {\"error\": type(exc).__name__}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('boundary 1', solve(['XX', '\\\\n']), '\\\\n\\\\n')\ncheck('boundary 2', solve(['aX', 'z']), 'az')\ncheck('boundary 3', solve(['none', 'x']), 'none')\ncheck('boundary 4', solve(['X', '\\\\g<0>']), '\\\\g<0>')\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":" 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":"xp-regex-replacement-literal","generated_at":"2026-09-29T14:37:21.399866+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A local executable model for consumers of structured text; oracle values are authored literals, not outputs copied from the repaired implementation.","repair":"Implement the complete stated contract, including the boundary fixtures: Replace every X with the literal replacement x[1] in x[0].","root_cause":"The implementation applies an operation whose text or grammar semantics violate this contract: Replace every X with the literal replacement x[1] in x[0].","sha256":"f9847349de7880df29f6d4ba82782569f3c8a9a094bdf7ba9715f322c3349f16","title":"Replacement backslashes become regex instructions · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":55.717,"exit_code":1,"observations":[{"actual":"\\nX","check":"boundary 1","expected":"\\n\\n","passed":false},{"actual":"az","check":"boundary 2","expected":"az","passed":true},{"actual":"none","check":"boundary 3","expected":"none","passed":true},{"actual":"\\g<0>","check":"boundary 4","expected":"\\g<0>","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"boundary 1\", \"actual\": \"\\\\nX\", \"expected\": \"\\\\n\\\\n\", \"passed\": false}, {\"check\": \"boundary 2\", \"actual\": \"az\", \"expected\": \"az\", \"passed\": true}, {\"check\": \"boundary 3\", \"actual\": \"none\", \"expected\": \"none\", \"passed\": true}, {\"check\": \"boundary 4\", \"actual\": \"\\\\g<0>\", \"expected\": \"\\\\g<0>\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":57.548,"exit_code":1,"observations":[{"actual":"\n\n","check":"boundary 1","expected":"\\n\\n","passed":false},{"actual":"az","check":"boundary 2","expected":"az","passed":true},{"actual":"none","check":"boundary 3","expected":"none","passed":true},{"actual":"X","check":"boundary 4","expected":"\\g<0>","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"boundary 1\", \"actual\": \"\\n\\n\", \"expected\": \"\\\\n\\\\n\", \"passed\": false}, {\"check\": \"boundary 2\", \"actual\": \"az\", \"expected\": \"az\", \"passed\": true}, {\"check\": \"boundary 3\", \"actual\": \"none\", \"expected\": \"none\", \"passed\": true}, {\"check\": \"boundary 4\", \"actual\": \"X\", \"expected\": \"\\\\g<0>\", \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":51.849,"exit_code":0,"observations":[{"actual":"\\n\\n","check":"boundary 1","expected":"\\n\\n","passed":true},{"actual":"az","check":"boundary 2","expected":"az","passed":true},{"actual":"none","check":"boundary 3","expected":"none","passed":true},{"actual":"\\g<0>","check":"boundary 4","expected":"\\g<0>","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"boundary 1\", \"actual\": \"\\\\n\\\\n\", \"expected\": \"\\\\n\\\\n\", \"passed\": true}, {\"check\": \"boundary 2\", \"actual\": \"az\", \"expected\": \"az\", \"passed\": true}, {\"check\": \"boundary 3\", \"actual\": \"none\", \"expected\": \"none\", \"passed\": true}, {\"check\": \"boundary 4\", \"actual\": \"\\\\g<0>\", \"expected\": \"\\\\g<0>\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}