{"abstract":"A second text part is rendered as another body instead of being offered as an attachment.","category":"Email MIME structure","checks":8,"contract":"parts are the leaves of a multipart/mixed message in order: {type, disp, cid, filename}. Rules in order: an explicit \"attachment\" disposition (case-insensitive) is an attachment even when referenced; a part whose cid is exactly one of html_cids is inline; the first text/* part without a (non-empty) filename is the body; an explicit inline image/* is inline; everything else is an attachment.","contract_signature":"parts, html_cids","evaluation_group":"w2-email_mime_structure-disposition-classify","failed_approach":"Allowing a body only in the first position turns a text body that follows an attachment into an attachment. The attempted `and not out:` still disagrees with a fixture.","family":"w2-email_mime_structure-disposition-classify-single-body","id":"FA-76416","implementations":{"attempt":{"sha256":"686b5e3b0e74cfe8c1d4700cd03c7c0a27bb110771a9b98fce9ad83394ed61c5","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(parts, html_cids):\n    out = []\n    have_body = False\n    for p in parts:\n        disp = (p.get('disp') or '').lower()\n        if disp == 'attachment':\n            kind = 'attachment'\n        elif p.get('cid') and p['cid'] in html_cids:\n            kind = 'inline'\n        elif p['type'].startswith('text/') and not p.get('filename') and not out:\n            kind = 'body'\n            have_body = True\n        elif disp == 'inline' and p['type'].startswith('image/'):\n            kind = 'inline'\n        else:\n            kind = 'attachment'\n        out.append(kind)\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('referenced image marked attachment', ([{'type': 'text/plain'}, {'type': 'image/png', 'cid': 'logo1@x', 'disp': 'attachment'}], ['logo1@x']), ['body', 'attachment']), ('upper-case disposition', ([{'type': 'text/plain', 'disp': 'ATTACHMENT'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('second text part', ([{'type': 'text/plain'}, {'type': 'text/plain'}], []), ['body', 'attachment']), ('attachment precedes body', ([{'type': 'application/pdf', 'disp': 'attachment'}, {'type': 'text/plain'}, {'type': 'text/plain'}], []), ['attachment', 'body', 'attachment']), ('named text part', ([{'type': 'text/plain', 'filename': 'notes1.txt'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('empty filename', ([{'type': 'text/plain', 'filename': ''}], []), ['body']), ('inline non-images', ([{'type': 'text/html'}, {'type': 'application/pdf', 'disp': 'inline'}, {'type': 'audio/ogg', 'disp': 'inline'}, {'type': 'image/gif', 'disp': 'inline'}], []), ['body', 'attachment', 'attachment', 'inline']), ('cid substring', ([{'type': 'text/html'}, {'type': 'image/png', 'cid': 'a1@x'}, {'type': 'image/png', 'cid': 'ba1@x'}], ['a1@x']), ['body', 'inline', 'attachment'])], 2: [('referenced image marked attachment', ([{'type': 'text/plain'}, {'type': 'image/png', 'cid': 'logo2@x', 'disp': 'attachment'}], ['logo2@x']), ['body', 'attachment']), ('upper-case disposition', ([{'type': 'text/plain', 'disp': 'ATTACHMENT'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('second text part', ([{'type': 'text/plain'}, {'type': 'text/plain'}], []), ['body', 'attachment']), ('attachment precedes body', ([{'type': 'application/pdf', 'disp': 'attachment'}, {'type': 'text/plain'}, {'type': 'text/plain'}], []), ['attachment', 'body', 'attachment']), ('named text part', ([{'type': 'text/plain', 'filename': 'notes2.txt'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('empty filename', ([{'type': 'text/plain', 'filename': ''}], []), ['body']), ('inline non-images', ([{'type': 'text/html'}, {'type': 'application/pdf', 'disp': 'inline'}, {'type': 'audio/ogg', 'disp': 'inline'}, {'type': 'image/gif', 'disp': 'inline'}], []), ['body', 'attachment', 'attachment', 'inline']), ('cid substring', ([{'type': 'text/html'}, {'type': 'image/png', 'cid': 'a2@x'}, {'type': 'image/png', 'cid': 'ba2@x'}], ['a2@x']), ['body', 'inline', 'attachment'])], 3: [('referenced image marked attachment', ([{'type': 'text/plain'}, {'type': 'image/png', 'cid': 'logo3@x', 'disp': 'attachment'}], ['logo3@x']), ['body', 'attachment']), ('upper-case disposition', ([{'type': 'text/plain', 'disp': 'ATTACHMENT'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('second text part', ([{'type': 'text/plain'}, {'type': 'text/plain'}], []), ['body', 'attachment']), ('attachment precedes body', ([{'type': 'application/pdf', 'disp': 'attachment'}, {'type': 'text/plain'}, {'type': 'text/plain'}], []), ['attachment', 'body', 'attachment']), ('named text part', ([{'type': 'text/plain', 'filename': 'notes3.txt'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('empty filename', ([{'type': 'text/plain', 'filename': ''}], []), ['body']), ('inline non-images', ([{'type': 'text/html'}, {'type': 'application/pdf', 'disp': 'inline'}, {'type': 'audio/ogg', 'disp': 'inline'}, {'type': 'image/gif', 'disp': 'inline'}], []), ['body', 'attachment', 'attachment', 'inline']), ('cid substring', ([{'type': 'text/html'}, {'type': 'image/png', 'cid': 'a3@x'}, {'type': 'image/png', 'cid': 'ba3@x'}], ['a3@x']), ['body', 'inline', 'attachment'])], 4: [('referenced image marked attachment', ([{'type': 'text/plain'}, {'type': 'image/png', 'cid': 'logo4@x', 'disp': 'attachment'}], ['logo4@x']), ['body', 'attachment']), ('upper-case disposition', ([{'type': 'text/plain', 'disp': 'ATTACHMENT'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('second text part', ([{'type': 'text/plain'}, {'type': 'text/plain'}], []), ['body', 'attachment']), ('attachment precedes body', ([{'type': 'application/pdf', 'disp': 'attachment'}, {'type': 'text/plain'}, {'type': 'text/plain'}], []), ['attachment', 'body', 'attachment']), ('named text part', ([{'type': 'text/plain', 'filename': 'notes4.txt'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('empty filename', ([{'type': 'text/plain', 'filename': ''}], []), ['body']), ('inline non-images', ([{'type': 'text/html'}, {'type': 'application/pdf', 'disp': 'inline'}, {'type': 'audio/ogg', 'disp': 'inline'}, {'type': 'image/gif', 'disp': 'inline'}], []), ['body', 'attachment', 'attachment', 'inline']), ('cid substring', ([{'type': 'text/html'}, {'type': 'image/png', 'cid': 'a4@x'}, {'type': 'image/png', 'cid': 'ba4@x'}], ['a4@x']), ['body', 'inline', 'attachment'])], 5: [('referenced image marked attachment', ([{'type': 'text/plain'}, {'type': 'image/png', 'cid': 'logo5@x', 'disp': 'attachment'}], ['logo5@x']), ['body', 'attachment']), ('upper-case disposition', ([{'type': 'text/plain', 'disp': 'ATTACHMENT'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('second text part', ([{'type': 'text/plain'}, {'type': 'text/plain'}], []), ['body', 'attachment']), ('attachment precedes body', ([{'type': 'application/pdf', 'disp': 'attachment'}, {'type': 'text/plain'}, {'type': 'text/plain'}], []), ['attachment', 'body', 'attachment']), ('named text part', ([{'type': 'text/plain', 'filename': 'notes5.txt'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('empty filename', ([{'type': 'text/plain', 'filename': ''}], []), ['body']), ('inline non-images', ([{'type': 'text/html'}, {'type': 'application/pdf', 'disp': 'inline'}, {'type': 'audio/ogg', 'disp': 'inline'}, {'type': 'image/gif', 'disp': 'inline'}], []), ['body', 'attachment', 'attachment', 'inline']), ('cid substring', ([{'type': 'text/html'}, {'type': 'image/png', 'cid': 'a5@x'}, {'type': 'image/png', 'cid': 'ba5@x'}], ['a5@x']), ['body', 'inline', 'attachment'])]}\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":"78681d53e5e88554c3a80fb7abb59436538e294a29520b9a9a97dc2e42b570d0","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(parts, html_cids):\n    out = []\n    have_body = False\n    for p in parts:\n        disp = (p.get('disp') or '').lower()\n        if disp == 'attachment':\n            kind = 'attachment'\n        elif p.get('cid') and p['cid'] in html_cids:\n            kind = 'inline'\n        elif p['type'].startswith('text/') and not p.get('filename') :\n            kind = 'body'\n            have_body = True\n        elif disp == 'inline' and p['type'].startswith('image/'):\n            kind = 'inline'\n        else:\n            kind = 'attachment'\n        out.append(kind)\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('referenced image marked attachment', ([{'type': 'text/plain'}, {'type': 'image/png', 'cid': 'logo1@x', 'disp': 'attachment'}], ['logo1@x']), ['body', 'attachment']), ('upper-case disposition', ([{'type': 'text/plain', 'disp': 'ATTACHMENT'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('second text part', ([{'type': 'text/plain'}, {'type': 'text/plain'}], []), ['body', 'attachment']), ('attachment precedes body', ([{'type': 'application/pdf', 'disp': 'attachment'}, {'type': 'text/plain'}, {'type': 'text/plain'}], []), ['attachment', 'body', 'attachment']), ('named text part', ([{'type': 'text/plain', 'filename': 'notes1.txt'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('empty filename', ([{'type': 'text/plain', 'filename': ''}], []), ['body']), ('inline non-images', ([{'type': 'text/html'}, {'type': 'application/pdf', 'disp': 'inline'}, {'type': 'audio/ogg', 'disp': 'inline'}, {'type': 'image/gif', 'disp': 'inline'}], []), ['body', 'attachment', 'attachment', 'inline']), ('cid substring', ([{'type': 'text/html'}, {'type': 'image/png', 'cid': 'a1@x'}, {'type': 'image/png', 'cid': 'ba1@x'}], ['a1@x']), ['body', 'inline', 'attachment'])], 2: [('referenced image marked attachment', ([{'type': 'text/plain'}, {'type': 'image/png', 'cid': 'logo2@x', 'disp': 'attachment'}], ['logo2@x']), ['body', 'attachment']), ('upper-case disposition', ([{'type': 'text/plain', 'disp': 'ATTACHMENT'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('second text part', ([{'type': 'text/plain'}, {'type': 'text/plain'}], []), ['body', 'attachment']), ('attachment precedes body', ([{'type': 'application/pdf', 'disp': 'attachment'}, {'type': 'text/plain'}, {'type': 'text/plain'}], []), ['attachment', 'body', 'attachment']), ('named text part', ([{'type': 'text/plain', 'filename': 'notes2.txt'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('empty filename', ([{'type': 'text/plain', 'filename': ''}], []), ['body']), ('inline non-images', ([{'type': 'text/html'}, {'type': 'application/pdf', 'disp': 'inline'}, {'type': 'audio/ogg', 'disp': 'inline'}, {'type': 'image/gif', 'disp': 'inline'}], []), ['body', 'attachment', 'attachment', 'inline']), ('cid substring', ([{'type': 'text/html'}, {'type': 'image/png', 'cid': 'a2@x'}, {'type': 'image/png', 'cid': 'ba2@x'}], ['a2@x']), ['body', 'inline', 'attachment'])], 3: [('referenced image marked attachment', ([{'type': 'text/plain'}, {'type': 'image/png', 'cid': 'logo3@x', 'disp': 'attachment'}], ['logo3@x']), ['body', 'attachment']), ('upper-case disposition', ([{'type': 'text/plain', 'disp': 'ATTACHMENT'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('second text part', ([{'type': 'text/plain'}, {'type': 'text/plain'}], []), ['body', 'attachment']), ('attachment precedes body', ([{'type': 'application/pdf', 'disp': 'attachment'}, {'type': 'text/plain'}, {'type': 'text/plain'}], []), ['attachment', 'body', 'attachment']), ('named text part', ([{'type': 'text/plain', 'filename': 'notes3.txt'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('empty filename', ([{'type': 'text/plain', 'filename': ''}], []), ['body']), ('inline non-images', ([{'type': 'text/html'}, {'type': 'application/pdf', 'disp': 'inline'}, {'type': 'audio/ogg', 'disp': 'inline'}, {'type': 'image/gif', 'disp': 'inline'}], []), ['body', 'attachment', 'attachment', 'inline']), ('cid substring', ([{'type': 'text/html'}, {'type': 'image/png', 'cid': 'a3@x'}, {'type': 'image/png', 'cid': 'ba3@x'}], ['a3@x']), ['body', 'inline', 'attachment'])], 4: [('referenced image marked attachment', ([{'type': 'text/plain'}, {'type': 'image/png', 'cid': 'logo4@x', 'disp': 'attachment'}], ['logo4@x']), ['body', 'attachment']), ('upper-case disposition', ([{'type': 'text/plain', 'disp': 'ATTACHMENT'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('second text part', ([{'type': 'text/plain'}, {'type': 'text/plain'}], []), ['body', 'attachment']), ('attachment precedes body', ([{'type': 'application/pdf', 'disp': 'attachment'}, {'type': 'text/plain'}, {'type': 'text/plain'}], []), ['attachment', 'body', 'attachment']), ('named text part', ([{'type': 'text/plain', 'filename': 'notes4.txt'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('empty filename', ([{'type': 'text/plain', 'filename': ''}], []), ['body']), ('inline non-images', ([{'type': 'text/html'}, {'type': 'application/pdf', 'disp': 'inline'}, {'type': 'audio/ogg', 'disp': 'inline'}, {'type': 'image/gif', 'disp': 'inline'}], []), ['body', 'attachment', 'attachment', 'inline']), ('cid substring', ([{'type': 'text/html'}, {'type': 'image/png', 'cid': 'a4@x'}, {'type': 'image/png', 'cid': 'ba4@x'}], ['a4@x']), ['body', 'inline', 'attachment'])], 5: [('referenced image marked attachment', ([{'type': 'text/plain'}, {'type': 'image/png', 'cid': 'logo5@x', 'disp': 'attachment'}], ['logo5@x']), ['body', 'attachment']), ('upper-case disposition', ([{'type': 'text/plain', 'disp': 'ATTACHMENT'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('second text part', ([{'type': 'text/plain'}, {'type': 'text/plain'}], []), ['body', 'attachment']), ('attachment precedes body', ([{'type': 'application/pdf', 'disp': 'attachment'}, {'type': 'text/plain'}, {'type': 'text/plain'}], []), ['attachment', 'body', 'attachment']), ('named text part', ([{'type': 'text/plain', 'filename': 'notes5.txt'}, {'type': 'text/plain'}], []), ['attachment', 'body']), ('empty filename', ([{'type': 'text/plain', 'filename': ''}], []), ['body']), ('inline non-images', ([{'type': 'text/html'}, {'type': 'application/pdf', 'disp': 'inline'}, {'type': 'audio/ogg', 'disp': 'inline'}, {'type': 'image/gif', 'disp': 'inline'}], []), ['body', 'attachment', 'attachment', 'inline']), ('cid substring', ([{'type': 'text/html'}, {'type': 'image/png', 'cid': 'a5@x'}, {'type': 'image/png', 'cid': 'ba5@x'}], ['a5@x']), ['body', 'inline', 'attachment'])]}\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-disposition-classify-single-body","generated_at":"2026-09-29T14:49:16.138810+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Disposition decides what the reader sees in the message body and what is offered for download.","root_cause":"The single body decision evaluates `:` where the contract requires `and not have_body:`.","sha256":"187de766e2a28b8e11486f288a4781c26df07533c72bcd33fe2fca9a5c4f5029","title":"Classify leaf parts as body, inline or attachment: single body · case 01","variant":1,"variant_policy":"N selects a different enumerated fixture set (renamed identifiers, part counts and sizes); boundary fixtures recur across variants.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":40.241,"exit_code":1,"observations":[{"actual":["body","attachment"],"check":"referenced image marked attachment","expected":["body","attachment"],"passed":true},{"actual":["attachment","attachment"],"check":"upper-case disposition","expected":["attachment","body"],"passed":false},{"actual":["body","attachment"],"check":"second text part","expected":["body","attachment"],"passed":true},{"actual":["attachment","attachment","attachment"],"check":"attachment precedes body","expected":["attachment","body","attachment"],"passed":false},{"actual":["attachment","attachment"],"check":"named text part","expected":["attachment","body"],"passed":false},{"actual":["body"],"check":"empty filename","expected":["body"],"passed":true},{"actual":["body","attachment","attachment","inline"],"check":"inline non-images","expected":["body","attachment","attachment","inline"],"passed":true},{"actual":["body","inline","attachment"],"check":"cid substring","expected":["body","inline","attachment"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"referenced image marked attachment\", \"actual\": [\"body\", \"attachment\"], \"expected\": [\"body\", \"attachment\"], \"passed\": true}, {\"check\": \"upper-case disposition\", \"actual\": [\"attachment\", \"attachment\"], \"expected\": [\"attachment\", \"body\"], \"passed\": false}, {\"check\": \"second text part\", \"actual\": [\"body\", \"attachment\"], \"expected\": [\"body\", \"attachment\"], \"passed\": true}, {\"check\": \"attachment precedes body\", \"actual\": [\"attachment\", \"attachment\", \"attachment\"], \"expected\": [\"attachment\", \"body\", \"attachment\"], \"passed\": false}, {\"check\": \"named text part\", \"actual\": [\"attachment\", \"attachment\"], \"expected\": [\"attachment\", \"body\"], \"passed\": false}, {\"check\": \"empty filename\", \"actual\": [\"body\"], \"expected\": [\"body\"], \"passed\": true}, {\"check\": \"inline non-images\", \"actual\": [\"body\", \"attachment\", \"attachment\", \"inline\"], \"expected\": [\"body\", \"attachment\", \"attachment\", \"inline\"], \"passed\": true}, {\"check\": \"cid substring\", \"actual\": [\"body\", \"inline\", \"attachment\"], \"expected\": [\"body\", \"inline\", \"attachment\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.306,"exit_code":1,"observations":[{"actual":["body","attachment"],"check":"referenced image marked attachment","expected":["body","attachment"],"passed":true},{"actual":["attachment","body"],"check":"upper-case disposition","expected":["attachment","body"],"passed":true},{"actual":["body","body"],"check":"second text part","expected":["body","attachment"],"passed":false},{"actual":["attachment","body","body"],"check":"attachment precedes body","expected":["attachment","body","attachment"],"passed":false},{"actual":["attachment","body"],"check":"named text part","expected":["attachment","body"],"passed":true},{"actual":["body"],"check":"empty filename","expected":["body"],"passed":true},{"actual":["body","attachment","attachment","inline"],"check":"inline non-images","expected":["body","attachment","attachment","inline"],"passed":true},{"actual":["body","inline","attachment"],"check":"cid substring","expected":["body","inline","attachment"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"referenced image marked attachment\", \"actual\": [\"body\", \"attachment\"], \"expected\": [\"body\", \"attachment\"], \"passed\": true}, {\"check\": \"upper-case disposition\", \"actual\": [\"attachment\", \"body\"], \"expected\": [\"attachment\", \"body\"], \"passed\": true}, {\"check\": \"second text part\", \"actual\": [\"body\", \"body\"], \"expected\": [\"body\", \"attachment\"], \"passed\": false}, {\"check\": \"attachment precedes body\", \"actual\": [\"attachment\", \"body\", \"body\"], \"expected\": [\"attachment\", \"body\", \"attachment\"], \"passed\": false}, {\"check\": \"named text part\", \"actual\": [\"attachment\", \"body\"], \"expected\": [\"attachment\", \"body\"], \"passed\": true}, {\"check\": \"empty filename\", \"actual\": [\"body\"], \"expected\": [\"body\"], \"passed\": true}, {\"check\": \"inline non-images\", \"actual\": [\"body\", \"attachment\", \"attachment\", \"inline\"], \"expected\": [\"body\", \"attachment\", \"attachment\", \"inline\"], \"passed\": true}, {\"check\": \"cid substring\", \"actual\": [\"body\", \"inline\", \"attachment\"], \"expected\": [\"body\", \"inline\", \"attachment\"], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}