{"abstract":"The ASCII fallback filename replaces the properly decoded extended filename.","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":"Preferring the Content-Type name is the least reliable source of all. The attempted `p.get('ctname') or p.get('fstar') or p.get('fname')` still disagrees with a fixture.","family":"w2-email_mime_structure-attachment-filename-name-precedence","id":"FA-76436","implementations":{"attempt":{"sha256":"f2b1cedfe1dd03dbf1a2bfead4448b7f7d18b83e15870b3d2794bb252cae8450","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('ctname') or p.get('fstar') or p.get('fname') 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"},"broken":{"sha256":"9e32ba28bfd55fce32b39a8afc3b382c8bd0ed2fdafcab9f9ca0aed482b20473","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('fname') or p.get('fstar') 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"},"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-name-precedence","generated_at":"2026-09-29T14:49:16.183615+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 `p.get('fstar') or p.get('fname') or p.get('ctname')` for the name precedence decision and keep every other rule of the model unchanged.","root_cause":"The name precedence decision evaluates `p.get('fname') or p.get('fstar') or p.get('ctname')` where the contract requires `p.get('fstar') or p.get('fname') or p.get('ctname')`.","sha256":"81ce4c6979d4ae4967e500e37dabaf86b5c92e1f00a808d93f9f7c296ff92434","title":"Resolve and de-duplicate attachment file names: name precedence · 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":41.821,"exit_code":1,"observations":[{"actual":["r.pdf"],"check":"extended name wins","expected":["résumé1.pdf"],"passed":false},{"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":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"extended name wins\", \"actual\": [\"r.pdf\"], \"expected\": [\"résumé1.pdf\"], \"passed\": false}, {\"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\": false}\n"},"broken":{"elapsed_ms":39.431,"exit_code":1,"observations":[{"actual":["resume.pdf"],"check":"extended name wins","expected":["résumé1.pdf"],"passed":false},{"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":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"extended name wins\", \"actual\": [\"resume.pdf\"], \"expected\": [\"résumé1.pdf\"], \"passed\": false}, {\"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\": false}\n"},"fixed":{"elapsed_ms":40.474,"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"}