{"abstract":"The copy counter is inserted before the first dot, splitting multi-part extensions differently from the contract.","category":"Email MIME structure","checks":8,"contract":"Each part has optional fstar (already decoded filename*), fname (filename) and ctname (Content-Type name) and a type. Precedence is fstar, fname, ctname. Directory components are removed (both \"/\" and \"\\\" separate). An empty name, \".\" or \"..\" becomes \"attachment\" plus an extension by type (.pdf, .png, .txt, else .bin). Names are de-duplicated case-insensitively: the k-th copy gets \" (k)\" before the last extension, or at the end when there is no extension or the name starts with its only dot.","evaluation_group":"w2-email_mime_structure-attachment-filename","failed_approach":"Special-casing single-dot names still splits at the first dot for multi-dot names. The attempted `stem, dot, ext = base.rpartition('.') if base.count('.') == 1 else base.partition('.')` still disagrees with a fixture.","family":"w2-email_mime_structure-attachment-filename-last-extension-suffix","id":"FA-76456","implementations":{"attempt":{"sha256":"0e92368d50c8e7f9ba601c071fcdfb80671ce9d9314587ec25596d20c0f6cb3d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(parts):\n    exts = {'application/pdf': '.pdf', 'image/png': '.png', 'text/plain': '.txt'}\n    used = {}\n    out = []\n    for p in parts:\n        raw = p.get('fstar') or p.get('fname') or p.get('ctname') or ''\n        base = raw.replace('\\\\', '/').split('/')[-1]\n        if base in ('', '.', '..'):\n            base = 'attachment' + exts.get(p['type'], '.bin')\n        key = base.lower()\n        used[key] = used.get(key, 0) + 1\n        if used[key] > 1:\n            stem, dot, ext = base.rpartition('.') if base.count('.') == 1 else base.partition('.')\n            base = (stem + ' (%d).' % used[key] + ext) if dot and stem else base + ' (%d)' % used[key]\n        out.append(base)\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('extended name wins', ([{'fstar': 'résumé1.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé1.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report1.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report1.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report1.PDF', 'type': 'application/pdf'}, {'ctname': 'report1.pdf', 'type': 'application/pdf'}],), ['Report1.PDF', 'report1 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x1.png', 'type': 'image/png'}, {'fname': 'x1.png', 'type': 'image/png'}, {'fname': 'x1.png', 'type': 'image/png'}],), ['x1.png', 'x1 (2).png', 'x1 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])], 2: [('extended name wins', ([{'fstar': 'résumé2.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé2.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report2.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report2.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report2.PDF', 'type': 'application/pdf'}, {'ctname': 'report2.pdf', 'type': 'application/pdf'}],), ['Report2.PDF', 'report2 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x2.png', 'type': 'image/png'}, {'fname': 'x2.png', 'type': 'image/png'}, {'fname': 'x2.png', 'type': 'image/png'}],), ['x2.png', 'x2 (2).png', 'x2 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])], 3: [('extended name wins', ([{'fstar': 'résumé3.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé3.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report3.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report3.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report3.PDF', 'type': 'application/pdf'}, {'ctname': 'report3.pdf', 'type': 'application/pdf'}],), ['Report3.PDF', 'report3 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x3.png', 'type': 'image/png'}, {'fname': 'x3.png', 'type': 'image/png'}, {'fname': 'x3.png', 'type': 'image/png'}],), ['x3.png', 'x3 (2).png', 'x3 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])], 4: [('extended name wins', ([{'fstar': 'résumé4.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé4.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report4.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report4.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report4.PDF', 'type': 'application/pdf'}, {'ctname': 'report4.pdf', 'type': 'application/pdf'}],), ['Report4.PDF', 'report4 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x4.png', 'type': 'image/png'}, {'fname': 'x4.png', 'type': 'image/png'}, {'fname': 'x4.png', 'type': 'image/png'}],), ['x4.png', 'x4 (2).png', 'x4 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])], 5: [('extended name wins', ([{'fstar': 'résumé5.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé5.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report5.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report5.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report5.PDF', 'type': 'application/pdf'}, {'ctname': 'report5.pdf', 'type': 'application/pdf'}],), ['Report5.PDF', 'report5 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x5.png', 'type': 'image/png'}, {'fname': 'x5.png', 'type': 'image/png'}, {'fname': 'x5.png', 'type': 'image/png'}],), ['x5.png', 'x5 (2).png', 'x5 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])]}\nfor _label, _args, _expected in _CASES[N]:\n    check(_label, solve(*_args), _expected)\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":"30b6985d48e7b6e230cecd20e15103b2340f824bb28ffaf14bc7754b967d1e10","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(parts):\n    exts = {'application/pdf': '.pdf', 'image/png': '.png', 'text/plain': '.txt'}\n    used = {}\n    out = []\n    for p in parts:\n        raw = p.get('fstar') or p.get('fname') or p.get('ctname') or ''\n        base = raw.replace('\\\\', '/').split('/')[-1]\n        if base in ('', '.', '..'):\n            base = 'attachment' + exts.get(p['type'], '.bin')\n        key = base.lower()\n        used[key] = used.get(key, 0) + 1\n        if used[key] > 1:\n            stem, dot, ext = base.partition('.')\n            base = (stem + ' (%d).' % used[key] + ext) if dot and stem else base + ' (%d)' % used[key]\n        out.append(base)\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('extended name wins', ([{'fstar': 'résumé1.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé1.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report1.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report1.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report1.PDF', 'type': 'application/pdf'}, {'ctname': 'report1.pdf', 'type': 'application/pdf'}],), ['Report1.PDF', 'report1 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x1.png', 'type': 'image/png'}, {'fname': 'x1.png', 'type': 'image/png'}, {'fname': 'x1.png', 'type': 'image/png'}],), ['x1.png', 'x1 (2).png', 'x1 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])], 2: [('extended name wins', ([{'fstar': 'résumé2.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé2.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report2.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report2.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report2.PDF', 'type': 'application/pdf'}, {'ctname': 'report2.pdf', 'type': 'application/pdf'}],), ['Report2.PDF', 'report2 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x2.png', 'type': 'image/png'}, {'fname': 'x2.png', 'type': 'image/png'}, {'fname': 'x2.png', 'type': 'image/png'}],), ['x2.png', 'x2 (2).png', 'x2 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])], 3: [('extended name wins', ([{'fstar': 'résumé3.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé3.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report3.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report3.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report3.PDF', 'type': 'application/pdf'}, {'ctname': 'report3.pdf', 'type': 'application/pdf'}],), ['Report3.PDF', 'report3 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x3.png', 'type': 'image/png'}, {'fname': 'x3.png', 'type': 'image/png'}, {'fname': 'x3.png', 'type': 'image/png'}],), ['x3.png', 'x3 (2).png', 'x3 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])], 4: [('extended name wins', ([{'fstar': 'résumé4.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé4.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report4.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report4.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report4.PDF', 'type': 'application/pdf'}, {'ctname': 'report4.pdf', 'type': 'application/pdf'}],), ['Report4.PDF', 'report4 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x4.png', 'type': 'image/png'}, {'fname': 'x4.png', 'type': 'image/png'}, {'fname': 'x4.png', 'type': 'image/png'}],), ['x4.png', 'x4 (2).png', 'x4 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])], 5: [('extended name wins', ([{'fstar': 'résumé5.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé5.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report5.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report5.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report5.PDF', 'type': 'application/pdf'}, {'ctname': 'report5.pdf', 'type': 'application/pdf'}],), ['Report5.PDF', 'report5 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x5.png', 'type': 'image/png'}, {'fname': 'x5.png', 'type': 'image/png'}, {'fname': 'x5.png', 'type': 'image/png'}],), ['x5.png', 'x5 (2).png', 'x5 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])]}\nfor _label, _args, _expected in _CASES[N]:\n    check(_label, solve(*_args), _expected)\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":"1d6c1d8f7b811741c661df82a23e61f0bc8447645eee6b8ea7e98117a34e1da9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(parts):\n    exts = {'application/pdf': '.pdf', 'image/png': '.png', 'text/plain': '.txt'}\n    used = {}\n    out = []\n    for p in parts:\n        raw = p.get('fstar') or p.get('fname') or p.get('ctname') or ''\n        base = raw.replace('\\\\', '/').split('/')[-1]\n        if base in ('', '.', '..'):\n            base = 'attachment' + exts.get(p['type'], '.bin')\n        key = base.lower()\n        used[key] = used.get(key, 0) + 1\n        if used[key] > 1:\n            stem, dot, ext = base.rpartition('.')\n            base = (stem + ' (%d).' % used[key] + ext) if dot and stem else base + ' (%d)' % used[key]\n        out.append(base)\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('extended name wins', ([{'fstar': 'résumé1.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé1.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report1.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report1.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report1.PDF', 'type': 'application/pdf'}, {'ctname': 'report1.pdf', 'type': 'application/pdf'}],), ['Report1.PDF', 'report1 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x1.png', 'type': 'image/png'}, {'fname': 'x1.png', 'type': 'image/png'}, {'fname': 'x1.png', 'type': 'image/png'}],), ['x1.png', 'x1 (2).png', 'x1 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])], 2: [('extended name wins', ([{'fstar': 'résumé2.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé2.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report2.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report2.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report2.PDF', 'type': 'application/pdf'}, {'ctname': 'report2.pdf', 'type': 'application/pdf'}],), ['Report2.PDF', 'report2 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x2.png', 'type': 'image/png'}, {'fname': 'x2.png', 'type': 'image/png'}, {'fname': 'x2.png', 'type': 'image/png'}],), ['x2.png', 'x2 (2).png', 'x2 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])], 3: [('extended name wins', ([{'fstar': 'résumé3.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé3.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report3.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report3.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report3.PDF', 'type': 'application/pdf'}, {'ctname': 'report3.pdf', 'type': 'application/pdf'}],), ['Report3.PDF', 'report3 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x3.png', 'type': 'image/png'}, {'fname': 'x3.png', 'type': 'image/png'}, {'fname': 'x3.png', 'type': 'image/png'}],), ['x3.png', 'x3 (2).png', 'x3 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])], 4: [('extended name wins', ([{'fstar': 'résumé4.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé4.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report4.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report4.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report4.PDF', 'type': 'application/pdf'}, {'ctname': 'report4.pdf', 'type': 'application/pdf'}],), ['Report4.PDF', 'report4 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x4.png', 'type': 'image/png'}, {'fname': 'x4.png', 'type': 'image/png'}, {'fname': 'x4.png', 'type': 'image/png'}],), ['x4.png', 'x4 (2).png', 'x4 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])], 5: [('extended name wins', ([{'fstar': 'résumé5.pdf', 'fname': 'resume.pdf', 'ctname': 'r.pdf', 'type': 'application/pdf'}],), ['résumé5.pdf']), ('windows path', ([{'fname': 'C:\\\\Users\\\\bo\\\\report5.docx', 'type': 'application/msword'}, {'fname': '../../etc/passwd', 'type': 'text/plain'}],), ['report5.docx', 'passwd']), ('dot names', ([{'fname': '..', 'type': 'image/png'}, {'fname': '.', 'type': 'text/plain'}],), ['attachment.png', 'attachment.txt']), ('case-insensitive duplicates', ([{'fname': 'Report5.PDF', 'type': 'application/pdf'}, {'ctname': 'report5.pdf', 'type': 'application/pdf'}],), ['Report5.PDF', 'report5 (2).pdf']), ('multi-dot duplicate', ([{'fname': 'archive.tar.gz', 'type': 'application/gzip'}, {'fname': 'archive.tar.gz', 'type': 'application/gzip'}],), ['archive.tar.gz', 'archive.tar (2).gz']), ('dotfile and short stem', ([{'fname': '.profile', 'type': 'text/plain'}, {'fname': '.profile', 'type': 'text/plain'}, {'fname': 'a.pdf', 'type': 'application/pdf'}, {'fname': 'a.pdf', 'type': 'application/pdf'}],), ['.profile', '.profile (2)', 'a.pdf', 'a (2).pdf']), ('third copy', ([{'fname': 'x5.png', 'type': 'image/png'}, {'fname': 'x5.png', 'type': 'image/png'}, {'fname': 'x5.png', 'type': 'image/png'}],), ['x5.png', 'x5 (2).png', 'x5 (3).png']), ('no name at all', ([{'type': 'application/zip'}, {'type': 'application/pdf'}],), ['attachment.bin', 'attachment.pdf'])]}\nfor _label, _args, _expected in _CASES[N]:\n    check(_label, solve(*_args), _expected)\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":"Stipulated offline model over pre-parsed MIME dictionaries; not a conforming MIME parser, generator or mail client. 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":"w2-email_mime_structure-attachment-filename-last-extension-suffix","generated_at":"2026-09-29T14:49:16.509897+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Attachment names end up on disk; wrong names overwrite files, leak paths or confuse users.","repair":"Use `stem, dot, ext = base.rpartition('.')` for the last extension suffix decision and keep every other rule of the model unchanged.","root_cause":"The last extension suffix decision evaluates `stem, dot, ext = base.partition('.')` where the contract requires `stem, dot, ext = base.rpartition('.')`.","sha256":"8f7f431cb7cd4de1113b6e1d033cca3f4518ade360eacb432199f09c0b3da5fc","title":"Resolve and de-duplicate attachment file names: last extension suffix · case 01","variant":1,"variant_policy":"N selects a different enumerated fixture set (renamed identifiers, part counts and sizes); boundary fixtures recur across variants.","verification":{"attempt":{"elapsed_ms":40.208,"exit_code":1,"observations":[{"actual":["résumé1.pdf"],"check":"extended name wins","expected":["résumé1.pdf"],"passed":true},{"actual":["report1.docx","passwd"],"check":"windows path","expected":["report1.docx","passwd"],"passed":true},{"actual":["attachment.png","attachment.txt"],"check":"dot names","expected":["attachment.png","attachment.txt"],"passed":true},{"actual":["Report1.PDF","report1 (2).pdf"],"check":"case-insensitive duplicates","expected":["Report1.PDF","report1 (2).pdf"],"passed":true},{"actual":["archive.tar.gz","archive (2).tar.gz"],"check":"multi-dot duplicate","expected":["archive.tar.gz","archive.tar (2).gz"],"passed":false},{"actual":[".profile",".profile (2)","a.pdf","a (2).pdf"],"check":"dotfile and short stem","expected":[".profile",".profile (2)","a.pdf","a (2).pdf"],"passed":true},{"actual":["x1.png","x1 (2).png","x1 (3).png"],"check":"third copy","expected":["x1.png","x1 (2).png","x1 (3).png"],"passed":true},{"actual":["attachment.bin","attachment.pdf"],"check":"no name at all","expected":["attachment.bin","attachment.pdf"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"extended name wins\", \"actual\": [\"résumé1.pdf\"], \"expected\": [\"résumé1.pdf\"], \"passed\": true}, {\"check\": \"windows path\", \"actual\": [\"report1.docx\", \"passwd\"], \"expected\": [\"report1.docx\", \"passwd\"], \"passed\": true}, {\"check\": \"dot names\", \"actual\": [\"attachment.png\", \"attachment.txt\"], \"expected\": [\"attachment.png\", \"attachment.txt\"], \"passed\": true}, {\"check\": \"case-insensitive duplicates\", \"actual\": [\"Report1.PDF\", \"report1 (2).pdf\"], \"expected\": [\"Report1.PDF\", \"report1 (2).pdf\"], \"passed\": true}, {\"check\": \"multi-dot duplicate\", \"actual\": [\"archive.tar.gz\", \"archive (2).tar.gz\"], \"expected\": [\"archive.tar.gz\", \"archive.tar (2).gz\"], \"passed\": false}, {\"check\": \"dotfile and short stem\", \"actual\": [\".profile\", \".profile (2)\", \"a.pdf\", \"a (2).pdf\"], \"expected\": [\".profile\", \".profile (2)\", \"a.pdf\", \"a (2).pdf\"], \"passed\": true}, {\"check\": \"third copy\", \"actual\": [\"x1.png\", \"x1 (2).png\", \"x1 (3).png\"], \"expected\": [\"x1.png\", \"x1 (2).png\", \"x1 (3).png\"], \"passed\": true}, {\"check\": \"no name at all\", \"actual\": [\"attachment.bin\", \"attachment.pdf\"], \"expected\": [\"attachment.bin\", \"attachment.pdf\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.786,"exit_code":1,"observations":[{"actual":["résumé1.pdf"],"check":"extended name wins","expected":["résumé1.pdf"],"passed":true},{"actual":["report1.docx","passwd"],"check":"windows path","expected":["report1.docx","passwd"],"passed":true},{"actual":["attachment.png","attachment.txt"],"check":"dot names","expected":["attachment.png","attachment.txt"],"passed":true},{"actual":["Report1.PDF","report1 (2).pdf"],"check":"case-insensitive duplicates","expected":["Report1.PDF","report1 (2).pdf"],"passed":true},{"actual":["archive.tar.gz","archive (2).tar.gz"],"check":"multi-dot duplicate","expected":["archive.tar.gz","archive.tar (2).gz"],"passed":false},{"actual":[".profile",".profile (2)","a.pdf","a (2).pdf"],"check":"dotfile and short stem","expected":[".profile",".profile (2)","a.pdf","a (2).pdf"],"passed":true},{"actual":["x1.png","x1 (2).png","x1 (3).png"],"check":"third copy","expected":["x1.png","x1 (2).png","x1 (3).png"],"passed":true},{"actual":["attachment.bin","attachment.pdf"],"check":"no name at all","expected":["attachment.bin","attachment.pdf"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"extended name wins\", \"actual\": [\"résumé1.pdf\"], \"expected\": [\"résumé1.pdf\"], \"passed\": true}, {\"check\": \"windows path\", \"actual\": [\"report1.docx\", \"passwd\"], \"expected\": [\"report1.docx\", \"passwd\"], \"passed\": true}, {\"check\": \"dot names\", \"actual\": [\"attachment.png\", \"attachment.txt\"], \"expected\": [\"attachment.png\", \"attachment.txt\"], \"passed\": true}, {\"check\": \"case-insensitive duplicates\", \"actual\": [\"Report1.PDF\", \"report1 (2).pdf\"], \"expected\": [\"Report1.PDF\", \"report1 (2).pdf\"], \"passed\": true}, {\"check\": \"multi-dot duplicate\", \"actual\": [\"archive.tar.gz\", \"archive (2).tar.gz\"], \"expected\": [\"archive.tar.gz\", \"archive.tar (2).gz\"], \"passed\": false}, {\"check\": \"dotfile and short stem\", \"actual\": [\".profile\", \".profile (2)\", \"a.pdf\", \"a (2).pdf\"], \"expected\": [\".profile\", \".profile (2)\", \"a.pdf\", \"a (2).pdf\"], \"passed\": true}, {\"check\": \"third copy\", \"actual\": [\"x1.png\", \"x1 (2).png\", \"x1 (3).png\"], \"expected\": [\"x1.png\", \"x1 (2).png\", \"x1 (3).png\"], \"passed\": true}, {\"check\": \"no name at all\", \"actual\": [\"attachment.bin\", \"attachment.pdf\"], \"expected\": [\"attachment.bin\", \"attachment.pdf\"], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.864,"exit_code":0,"observations":[{"actual":["résumé1.pdf"],"check":"extended name wins","expected":["résumé1.pdf"],"passed":true},{"actual":["report1.docx","passwd"],"check":"windows path","expected":["report1.docx","passwd"],"passed":true},{"actual":["attachment.png","attachment.txt"],"check":"dot names","expected":["attachment.png","attachment.txt"],"passed":true},{"actual":["Report1.PDF","report1 (2).pdf"],"check":"case-insensitive duplicates","expected":["Report1.PDF","report1 (2).pdf"],"passed":true},{"actual":["archive.tar.gz","archive.tar (2).gz"],"check":"multi-dot duplicate","expected":["archive.tar.gz","archive.tar (2).gz"],"passed":true},{"actual":[".profile",".profile (2)","a.pdf","a (2).pdf"],"check":"dotfile and short stem","expected":[".profile",".profile (2)","a.pdf","a (2).pdf"],"passed":true},{"actual":["x1.png","x1 (2).png","x1 (3).png"],"check":"third copy","expected":["x1.png","x1 (2).png","x1 (3).png"],"passed":true},{"actual":["attachment.bin","attachment.pdf"],"check":"no name at all","expected":["attachment.bin","attachment.pdf"],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"extended name wins\", \"actual\": [\"résumé1.pdf\"], \"expected\": [\"résumé1.pdf\"], \"passed\": true}, {\"check\": \"windows path\", \"actual\": [\"report1.docx\", \"passwd\"], \"expected\": [\"report1.docx\", \"passwd\"], \"passed\": true}, {\"check\": \"dot names\", \"actual\": [\"attachment.png\", \"attachment.txt\"], \"expected\": [\"attachment.png\", \"attachment.txt\"], \"passed\": true}, {\"check\": \"case-insensitive duplicates\", \"actual\": [\"Report1.PDF\", \"report1 (2).pdf\"], \"expected\": [\"Report1.PDF\", \"report1 (2).pdf\"], \"passed\": true}, {\"check\": \"multi-dot duplicate\", \"actual\": [\"archive.tar.gz\", \"archive.tar (2).gz\"], \"expected\": [\"archive.tar.gz\", \"archive.tar (2).gz\"], \"passed\": true}, {\"check\": \"dotfile and short stem\", \"actual\": [\".profile\", \".profile (2)\", \"a.pdf\", \"a (2).pdf\"], \"expected\": [\".profile\", \".profile (2)\", \"a.pdf\", \"a (2).pdf\"], \"passed\": true}, {\"check\": \"third copy\", \"actual\": [\"x1.png\", \"x1 (2).png\", \"x1 (3).png\"], \"expected\": [\"x1.png\", \"x1 (2).png\", \"x1 (3).png\"], \"passed\": true}, {\"check\": \"no name at all\", \"actual\": [\"attachment.bin\", \"attachment.pdf\"], \"expected\": [\"attachment.bin\", \"attachment.pdf\"], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}