{"abstract":"A leading encoding signature is exposed as text, or cleanup also strips matching interior characters.","category":"Encodings","checks":7,"contract":"Decode UTF-8 bytes, removing at most one EF BB BF signature at the start. Preserve every subsequent U+FEFF character; return None for invalid UTF-8.","evaluation_group":"model-c63a7db338adb1d8","failed_approach":"A global replacement deletes U+FEFF characters that are part of the content and removes multiple leading signatures.","family":"parse-leading-bom","id":"FA-201","implementations":{"attempt":{"sha256":"824958450ddf0a061e366b0ebb323b0a74e0aebab07f5eec4f0f4ad04cefdb9a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(data):\n    try:\n        return data.decode('utf-8').replace('\\ufeff', '')\n    except UnicodeDecodeError:\n        return None\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nbom = b'\\xef\\xbb\\xbf'\ntext = 'part' * N\ncheck('leading BOM removed', solve(bom + text.encode()), text)\ncheck('interior character preserved', solve(text.encode() + bom + b'end'), text + '\\ufeffend')\ncheck('only one leading signature consumed', solve(bom + bom + text.encode()), '\\ufeff' + text)\ncheck('signature-only input', solve(bom), '')\ncheck('ordinary UTF-8 retained', solve(('é' * N).encode()), 'é' * N)\ncheck('empty input', solve(b''), '')\ncheck('invalid UTF-8 rejected', solve(bom + b'\\xff'), None)\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":"31a1fbb2215e6eee0f9a48c2bba0152505a3759a733415c48595911dac11ee8e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(data):\n    try:\n        return data.decode('utf-8')\n    except UnicodeDecodeError:\n        return None\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nbom = b'\\xef\\xbb\\xbf'\ntext = 'part' * N\ncheck('leading BOM removed', solve(bom + text.encode()), text)\ncheck('interior character preserved', solve(text.encode() + bom + b'end'), text + '\\ufeffend')\ncheck('only one leading signature consumed', solve(bom + bom + text.encode()), '\\ufeff' + text)\ncheck('signature-only input', solve(bom), '')\ncheck('ordinary UTF-8 retained', solve(('é' * N).encode()), 'é' * N)\ncheck('empty input', solve(b''), '')\ncheck('invalid UTF-8 rejected', solve(bom + b'\\xff'), None)\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":"6d458b9067745a530cf910477020a85169666e2266205f39fc4c0a51267124a1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(data):\n    try:\n        return data.decode('utf-8-sig')\n    except UnicodeDecodeError:\n        return None\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nbom = b'\\xef\\xbb\\xbf'\ntext = 'part' * N\ncheck('leading BOM removed', solve(bom + text.encode()), text)\ncheck('interior character preserved', solve(text.encode() + bom + b'end'), text + '\\ufeffend')\ncheck('only one leading signature consumed', solve(bom + bom + text.encode()), '\\ufeff' + text)\ncheck('signature-only input', solve(bom), '')\ncheck('ordinary UTF-8 retained', solve(('é' * N).encode()), 'é' * N)\ncheck('empty input', solve(b''), '')\ncheck('invalid UTF-8 rejected', solve(bom + b'\\xff'), None)\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":"parse-leading-bom","generated_at":"2026-09-29T14:36:51.041225+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Encoding signatures are positional metadata. Global text cleanup cannot preserve the distinction between metadata and document content.","repair":"Consume one UTF-8 BOM only at byte offset zero, then strictly decode the remaining bytes.","root_cause":"The implementation treats a document-start byte signature as a character to retain or remove everywhere.","sha256":"8e68ddfcd98fbb43f296c5829eca36e27eabf770274be32b804cc85f3993ac7d","title":"BOM cleanup removes a legitimate character inside the document · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":31.152,"exit_code":1,"observations":[{"actual":"part","check":"leading BOM removed","expected":"part","passed":true},{"actual":"partend","check":"interior character preserved","expected":"part﻿end","passed":false},{"actual":"part","check":"only one leading signature consumed","expected":"﻿part","passed":false},{"actual":"","check":"signature-only input","expected":"","passed":true},{"actual":"é","check":"ordinary UTF-8 retained","expected":"é","passed":true},{"actual":"","check":"empty input","expected":"","passed":true},{"actual":null,"check":"invalid UTF-8 rejected","expected":null,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"leading BOM removed\", \"actual\": \"part\", \"expected\": \"part\", \"passed\": true}, {\"check\": \"interior character preserved\", \"actual\": \"partend\", \"expected\": \"part﻿end\", \"passed\": false}, {\"check\": \"only one leading signature consumed\", \"actual\": \"part\", \"expected\": \"﻿part\", \"passed\": false}, {\"check\": \"signature-only input\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"ordinary UTF-8 retained\", \"actual\": \"é\", \"expected\": \"é\", \"passed\": true}, {\"check\": \"empty input\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"invalid UTF-8 rejected\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":29.59,"exit_code":1,"observations":[{"actual":"﻿part","check":"leading BOM removed","expected":"part","passed":false},{"actual":"part﻿end","check":"interior character preserved","expected":"part﻿end","passed":true},{"actual":"﻿﻿part","check":"only one leading signature consumed","expected":"﻿part","passed":false},{"actual":"﻿","check":"signature-only input","expected":"","passed":false},{"actual":"é","check":"ordinary UTF-8 retained","expected":"é","passed":true},{"actual":"","check":"empty input","expected":"","passed":true},{"actual":null,"check":"invalid UTF-8 rejected","expected":null,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"leading BOM removed\", \"actual\": \"﻿part\", \"expected\": \"part\", \"passed\": false}, {\"check\": \"interior character preserved\", \"actual\": \"part﻿end\", \"expected\": \"part﻿end\", \"passed\": true}, {\"check\": \"only one leading signature consumed\", \"actual\": \"﻿﻿part\", \"expected\": \"﻿part\", \"passed\": false}, {\"check\": \"signature-only input\", \"actual\": \"﻿\", \"expected\": \"\", \"passed\": false}, {\"check\": \"ordinary UTF-8 retained\", \"actual\": \"é\", \"expected\": \"é\", \"passed\": true}, {\"check\": \"empty input\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"invalid UTF-8 rejected\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":31.548,"exit_code":0,"observations":[{"actual":"part","check":"leading BOM removed","expected":"part","passed":true},{"actual":"part﻿end","check":"interior character preserved","expected":"part﻿end","passed":true},{"actual":"﻿part","check":"only one leading signature consumed","expected":"﻿part","passed":true},{"actual":"","check":"signature-only input","expected":"","passed":true},{"actual":"é","check":"ordinary UTF-8 retained","expected":"é","passed":true},{"actual":"","check":"empty input","expected":"","passed":true},{"actual":null,"check":"invalid UTF-8 rejected","expected":null,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"leading BOM removed\", \"actual\": \"part\", \"expected\": \"part\", \"passed\": true}, {\"check\": \"interior character preserved\", \"actual\": \"part﻿end\", \"expected\": \"part﻿end\", \"passed\": true}, {\"check\": \"only one leading signature consumed\", \"actual\": \"﻿part\", \"expected\": \"﻿part\", \"passed\": true}, {\"check\": \"signature-only input\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"ordinary UTF-8 retained\", \"actual\": \"é\", \"expected\": \"é\", \"passed\": true}, {\"check\": \"empty input\", \"actual\": \"\", \"expected\": \"\", \"passed\": true}, {\"check\": \"invalid UTF-8 rejected\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}