{"abstract":"The body of an attached single-part message gets the same number as the message part itself.","category":"Email MIME structure","checks":6,"contract":"Returns [section, type] for every non-multipart entity in depth-first order. A single-part message body is section \"1\". Children of a multipart are numbered 1..n under the parent's number (nested multiparts get their own number). A message/rfc822 part is listed itself; if its encapsulated body is multipart, that body's children are numbered directly under the message part (P.1, P.2...); a single-part encapsulated body is P.1.","evaluation_group":"w2-email_mime_structure-section-numbers","failed_approach":"Numbering the encapsulated body 0 is not a valid part specifier. The attempted `else: walk(inner, prefix + ['0'])` still disagrees with a fixture.","family":"w2-email_mime_structure-section-numbers-encapsulated-single","id":"FA-76366","implementations":{"attempt":{"sha256":"042aa3f2394200544d695cbea8e902e05269c31aa799f6f0e4ab5f6fb29a06a6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(tree):\n    out = []\n    def walk(node, prefix):\n        t = node['type']\n        if t.startswith('multipart/'):\n            for i, child in enumerate(node['parts'], 1):\n                walk(child, prefix + [str(i)])\n        elif t == 'message/rfc822':\n            out.append(['.'.join(prefix), t])\n            inner = node['body']\n            if inner['type'].startswith('multipart/'):\n                walk(inner, prefix)\n            else:\n                walk(inner, prefix + ['0'])\n        else:\n            out.append(['.'.join(prefix) or '1', t])\n    walk(tree, [])\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('single part message', ({'type': 'text/plain'},), [['1', 'text/plain']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])], 2: [('single part message', ({'type': 'text/html'},), [['1', 'text/html']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream'], ['3', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])], 3: [('single part message', ({'type': 'application/pdf'},), [['1', 'application/pdf']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream'], ['3', 'application/octet-stream'], ['4', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])], 4: [('single part message', ({'type': 'image/png'},), [['1', 'image/png']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream'], ['3', 'application/octet-stream'], ['4', 'application/octet-stream'], ['5', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])], 5: [('single part message', ({'type': 'text/calendar'},), [['1', 'text/calendar']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream'], ['3', 'application/octet-stream'], ['4', 'application/octet-stream'], ['5', 'application/octet-stream'], ['6', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])]}\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":"ed0649db4ae6400987024526a7d8970566442ef7e314ff31052ba89b7f3a75c7","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(tree):\n    out = []\n    def walk(node, prefix):\n        t = node['type']\n        if t.startswith('multipart/'):\n            for i, child in enumerate(node['parts'], 1):\n                walk(child, prefix + [str(i)])\n        elif t == 'message/rfc822':\n            out.append(['.'.join(prefix), t])\n            inner = node['body']\n            if inner['type'].startswith('multipart/'):\n                walk(inner, prefix)\n            else:\n                walk(inner, prefix)\n        else:\n            out.append(['.'.join(prefix) or '1', t])\n    walk(tree, [])\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('single part message', ({'type': 'text/plain'},), [['1', 'text/plain']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])], 2: [('single part message', ({'type': 'text/html'},), [['1', 'text/html']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream'], ['3', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])], 3: [('single part message', ({'type': 'application/pdf'},), [['1', 'application/pdf']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream'], ['3', 'application/octet-stream'], ['4', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])], 4: [('single part message', ({'type': 'image/png'},), [['1', 'image/png']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream'], ['3', 'application/octet-stream'], ['4', 'application/octet-stream'], ['5', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])], 5: [('single part message', ({'type': 'text/calendar'},), [['1', 'text/calendar']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream'], ['3', 'application/octet-stream'], ['4', 'application/octet-stream'], ['5', 'application/octet-stream'], ['6', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])]}\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":"ad5cec88e1b7ca24cbb6b0d7c8ddb097e26f0e6d7e2472f7788ba4506d953001","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(tree):\n    out = []\n    def walk(node, prefix):\n        t = node['type']\n        if t.startswith('multipart/'):\n            for i, child in enumerate(node['parts'], 1):\n                walk(child, prefix + [str(i)])\n        elif t == 'message/rfc822':\n            out.append(['.'.join(prefix), t])\n            inner = node['body']\n            if inner['type'].startswith('multipart/'):\n                walk(inner, prefix)\n            else:\n                walk(inner, prefix + ['1'])\n        else:\n            out.append(['.'.join(prefix) or '1', t])\n    walk(tree, [])\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('single part message', ({'type': 'text/plain'},), [['1', 'text/plain']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])], 2: [('single part message', ({'type': 'text/html'},), [['1', 'text/html']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream'], ['3', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])], 3: [('single part message', ({'type': 'application/pdf'},), [['1', 'application/pdf']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream'], ['3', 'application/octet-stream'], ['4', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])], 4: [('single part message', ({'type': 'image/png'},), [['1', 'image/png']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream'], ['3', 'application/octet-stream'], ['4', 'application/octet-stream'], ['5', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])], 5: [('single part message', ({'type': 'text/calendar'},), [['1', 'text/calendar']]), ('flat mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}, {'type': 'application/octet-stream'}]},), [['1', 'text/plain'], ['2', 'application/octet-stream'], ['3', 'application/octet-stream'], ['4', 'application/octet-stream'], ['5', 'application/octet-stream'], ['6', 'application/octet-stream']]), ('alternative inside mixed', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}, {'type': 'application/pdf'}]},), [['1.1', 'text/plain'], ['1.2', 'text/html'], ['2', 'application/pdf']]), ('attached multipart message', ({'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'message/rfc822', 'body': {'type': 'multipart/mixed', 'parts': [{'type': 'text/plain'}, {'type': 'image/jpeg'}]}}]},), [['1', 'text/plain'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'image/jpeg']]), ('attached single part message', ({'type': 'multipart/mixed', 'parts': [{'type': 'message/rfc822', 'body': {'type': 'text/plain'}}]},), [['1', 'message/rfc822'], ['1.1', 'text/plain']]), ('related and forwarded alternative', ({'type': 'multipart/mixed', 'parts': [{'type': 'multipart/related', 'parts': [{'type': 'text/html'}, {'type': 'image/gif'}]}, {'type': 'message/rfc822', 'body': {'type': 'multipart/alternative', 'parts': [{'type': 'text/plain'}, {'type': 'text/html'}]}}]},), [['1.1', 'text/html'], ['1.2', 'image/gif'], ['2', 'message/rfc822'], ['2.1', 'text/plain'], ['2.2', 'text/html']])]}\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-section-numbers-encapsulated-single","generated_at":"2026-09-29T14:49:15.533617+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Section numbers are how clients fetch individual parts; off-by-one numbering downloads the wrong attachment.","repair":"Use `else: walk(inner, prefix + ['1'])` for the encapsulated single decision and keep every other rule of the model unchanged.","root_cause":"The encapsulated single decision evaluates `else: walk(inner, prefix)` where the contract requires `else: walk(inner, prefix + ['1'])`.","sha256":"2b21c8e35ae481fe07b1249df01996f422df54a562ea68e349519915001a1f6f","title":"Assign IMAP-style section numbers to body parts: encapsulated single · 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":44.32,"exit_code":1,"observations":[{"actual":[["1","text/plain"]],"check":"single part message","expected":[["1","text/plain"]],"passed":true},{"actual":[["1","text/plain"],["2","application/octet-stream"]],"check":"flat mixed","expected":[["1","text/plain"],["2","application/octet-stream"]],"passed":true},{"actual":[["1.1","text/plain"],["1.2","text/html"],["2","application/pdf"]],"check":"alternative inside mixed","expected":[["1.1","text/plain"],["1.2","text/html"],["2","application/pdf"]],"passed":true},{"actual":[["1","text/plain"],["2","message/rfc822"],["2.1","text/plain"],["2.2","image/jpeg"]],"check":"attached multipart message","expected":[["1","text/plain"],["2","message/rfc822"],["2.1","text/plain"],["2.2","image/jpeg"]],"passed":true},{"actual":[["1","message/rfc822"],["1.0","text/plain"]],"check":"attached single part message","expected":[["1","message/rfc822"],["1.1","text/plain"]],"passed":false},{"actual":[["1.1","text/html"],["1.2","image/gif"],["2","message/rfc822"],["2.1","text/plain"],["2.2","text/html"]],"check":"related and forwarded alternative","expected":[["1.1","text/html"],["1.2","image/gif"],["2","message/rfc822"],["2.1","text/plain"],["2.2","text/html"]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"single part message\", \"actual\": [[\"1\", \"text/plain\"]], \"expected\": [[\"1\", \"text/plain\"]], \"passed\": true}, {\"check\": \"flat mixed\", \"actual\": [[\"1\", \"text/plain\"], [\"2\", \"application/octet-stream\"]], \"expected\": [[\"1\", \"text/plain\"], [\"2\", \"application/octet-stream\"]], \"passed\": true}, {\"check\": \"alternative inside mixed\", \"actual\": [[\"1.1\", \"text/plain\"], [\"1.2\", \"text/html\"], [\"2\", \"application/pdf\"]], \"expected\": [[\"1.1\", \"text/plain\"], [\"1.2\", \"text/html\"], [\"2\", \"application/pdf\"]], \"passed\": true}, {\"check\": \"attached multipart message\", \"actual\": [[\"1\", \"text/plain\"], [\"2\", \"message/rfc822\"], [\"2.1\", \"text/plain\"], [\"2.2\", \"image/jpeg\"]], \"expected\": [[\"1\", \"text/plain\"], [\"2\", \"message/rfc822\"], [\"2.1\", \"text/plain\"], [\"2.2\", \"image/jpeg\"]], \"passed\": true}, {\"check\": \"attached single part message\", \"actual\": [[\"1\", \"message/rfc822\"], [\"1.0\", \"text/plain\"]], \"expected\": [[\"1\", \"message/rfc822\"], [\"1.1\", \"text/plain\"]], \"passed\": false}, {\"check\": \"related and forwarded alternative\", \"actual\": [[\"1.1\", \"text/html\"], [\"1.2\", \"image/gif\"], [\"2\", \"message/rfc822\"], [\"2.1\", \"text/plain\"], [\"2.2\", \"text/html\"]], \"expected\": [[\"1.1\", \"text/html\"], [\"1.2\", \"image/gif\"], [\"2\", \"message/rfc822\"], [\"2.1\", \"text/plain\"], [\"2.2\", \"text/html\"]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.506,"exit_code":1,"observations":[{"actual":[["1","text/plain"]],"check":"single part message","expected":[["1","text/plain"]],"passed":true},{"actual":[["1","text/plain"],["2","application/octet-stream"]],"check":"flat mixed","expected":[["1","text/plain"],["2","application/octet-stream"]],"passed":true},{"actual":[["1.1","text/plain"],["1.2","text/html"],["2","application/pdf"]],"check":"alternative inside mixed","expected":[["1.1","text/plain"],["1.2","text/html"],["2","application/pdf"]],"passed":true},{"actual":[["1","text/plain"],["2","message/rfc822"],["2.1","text/plain"],["2.2","image/jpeg"]],"check":"attached multipart message","expected":[["1","text/plain"],["2","message/rfc822"],["2.1","text/plain"],["2.2","image/jpeg"]],"passed":true},{"actual":[["1","message/rfc822"],["1","text/plain"]],"check":"attached single part message","expected":[["1","message/rfc822"],["1.1","text/plain"]],"passed":false},{"actual":[["1.1","text/html"],["1.2","image/gif"],["2","message/rfc822"],["2.1","text/plain"],["2.2","text/html"]],"check":"related and forwarded alternative","expected":[["1.1","text/html"],["1.2","image/gif"],["2","message/rfc822"],["2.1","text/plain"],["2.2","text/html"]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"single part message\", \"actual\": [[\"1\", \"text/plain\"]], \"expected\": [[\"1\", \"text/plain\"]], \"passed\": true}, {\"check\": \"flat mixed\", \"actual\": [[\"1\", \"text/plain\"], [\"2\", \"application/octet-stream\"]], \"expected\": [[\"1\", \"text/plain\"], [\"2\", \"application/octet-stream\"]], \"passed\": true}, {\"check\": \"alternative inside mixed\", \"actual\": [[\"1.1\", \"text/plain\"], [\"1.2\", \"text/html\"], [\"2\", \"application/pdf\"]], \"expected\": [[\"1.1\", \"text/plain\"], [\"1.2\", \"text/html\"], [\"2\", \"application/pdf\"]], \"passed\": true}, {\"check\": \"attached multipart message\", \"actual\": [[\"1\", \"text/plain\"], [\"2\", \"message/rfc822\"], [\"2.1\", \"text/plain\"], [\"2.2\", \"image/jpeg\"]], \"expected\": [[\"1\", \"text/plain\"], [\"2\", \"message/rfc822\"], [\"2.1\", \"text/plain\"], [\"2.2\", \"image/jpeg\"]], \"passed\": true}, {\"check\": \"attached single part message\", \"actual\": [[\"1\", \"message/rfc822\"], [\"1\", \"text/plain\"]], \"expected\": [[\"1\", \"message/rfc822\"], [\"1.1\", \"text/plain\"]], \"passed\": false}, {\"check\": \"related and forwarded alternative\", \"actual\": [[\"1.1\", \"text/html\"], [\"1.2\", \"image/gif\"], [\"2\", \"message/rfc822\"], [\"2.1\", \"text/plain\"], [\"2.2\", \"text/html\"]], \"expected\": [[\"1.1\", \"text/html\"], [\"1.2\", \"image/gif\"], [\"2\", \"message/rfc822\"], [\"2.1\", \"text/plain\"], [\"2.2\", \"text/html\"]], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":46.404,"exit_code":0,"observations":[{"actual":[["1","text/plain"]],"check":"single part message","expected":[["1","text/plain"]],"passed":true},{"actual":[["1","text/plain"],["2","application/octet-stream"]],"check":"flat mixed","expected":[["1","text/plain"],["2","application/octet-stream"]],"passed":true},{"actual":[["1.1","text/plain"],["1.2","text/html"],["2","application/pdf"]],"check":"alternative inside mixed","expected":[["1.1","text/plain"],["1.2","text/html"],["2","application/pdf"]],"passed":true},{"actual":[["1","text/plain"],["2","message/rfc822"],["2.1","text/plain"],["2.2","image/jpeg"]],"check":"attached multipart message","expected":[["1","text/plain"],["2","message/rfc822"],["2.1","text/plain"],["2.2","image/jpeg"]],"passed":true},{"actual":[["1","message/rfc822"],["1.1","text/plain"]],"check":"attached single part message","expected":[["1","message/rfc822"],["1.1","text/plain"]],"passed":true},{"actual":[["1.1","text/html"],["1.2","image/gif"],["2","message/rfc822"],["2.1","text/plain"],["2.2","text/html"]],"check":"related and forwarded alternative","expected":[["1.1","text/html"],["1.2","image/gif"],["2","message/rfc822"],["2.1","text/plain"],["2.2","text/html"]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"single part message\", \"actual\": [[\"1\", \"text/plain\"]], \"expected\": [[\"1\", \"text/plain\"]], \"passed\": true}, {\"check\": \"flat mixed\", \"actual\": [[\"1\", \"text/plain\"], [\"2\", \"application/octet-stream\"]], \"expected\": [[\"1\", \"text/plain\"], [\"2\", \"application/octet-stream\"]], \"passed\": true}, {\"check\": \"alternative inside mixed\", \"actual\": [[\"1.1\", \"text/plain\"], [\"1.2\", \"text/html\"], [\"2\", \"application/pdf\"]], \"expected\": [[\"1.1\", \"text/plain\"], [\"1.2\", \"text/html\"], [\"2\", \"application/pdf\"]], \"passed\": true}, {\"check\": \"attached multipart message\", \"actual\": [[\"1\", \"text/plain\"], [\"2\", \"message/rfc822\"], [\"2.1\", \"text/plain\"], [\"2.2\", \"image/jpeg\"]], \"expected\": [[\"1\", \"text/plain\"], [\"2\", \"message/rfc822\"], [\"2.1\", \"text/plain\"], [\"2.2\", \"image/jpeg\"]], \"passed\": true}, {\"check\": \"attached single part message\", \"actual\": [[\"1\", \"message/rfc822\"], [\"1.1\", \"text/plain\"]], \"expected\": [[\"1\", \"message/rfc822\"], [\"1.1\", \"text/plain\"]], \"passed\": true}, {\"check\": \"related and forwarded alternative\", \"actual\": [[\"1.1\", \"text/html\"], [\"1.2\", \"image/gif\"], [\"2\", \"message/rfc822\"], [\"2.1\", \"text/plain\"], [\"2.2\", \"text/html\"]], \"expected\": [[\"1.1\", \"text/html\"], [\"1.2\", \"image/gif\"], [\"2\", \"message/rfc822\"], [\"2.1\", \"text/plain\"], [\"2.2\", \"text/html\"]], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}