{"abstract":"Nested multipart containers are flattened, so their children collide with their siblings' numbers.","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":"Flattening only alternatives still collides the alternative's children with later siblings. The attempted `walk(child, prefix if child['type'] == 'multipart/alternative' else prefix + [str(i)])` still disagrees with a fixture.","family":"w2-email_mime_structure-section-numbers-nested-container-number","id":"FA-76376","implementations":{"attempt":{"sha256":"984e48760c2df5d8cc366b550a15b4f6dec81a90c43db12c7a1481212046c8a5","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 if child['type'] == 'multipart/alternative' else 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"},"broken":{"sha256":"319651e2c7d0d184afb70e45da9b9663c8886f00c5da4b9ec0f76d6537cba5b0","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 if child['type'].startswith('multipart/') else 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"},"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-nested-container-number","generated_at":"2026-09-29T14:49:15.829963+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 `walk(child, prefix + [str(i)])` for the nested container number decision and keep every other rule of the model unchanged.","root_cause":"The nested container number decision evaluates `walk(child, prefix if child['type'].startswith('multipart/') else prefix + [str(i)])` where the contract requires `walk(child, prefix + [str(i)])`.","sha256":"3a004a833478f117cbf41c6bf4fbac64d4a4f5fcae62b5a2df9a8cd44c6b7418","title":"Assign IMAP-style section numbers to body parts: nested container number · 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.442,"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","text/plain"],["2","text/html"],["2","application/pdf"]],"check":"alternative inside mixed","expected":[["1.1","text/plain"],["1.2","text/html"],["2","application/pdf"]],"passed":false},{"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":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\", \"text/plain\"], [\"2\", \"text/html\"], [\"2\", \"application/pdf\"]], \"expected\": [[\"1.1\", \"text/plain\"], [\"1.2\", \"text/html\"], [\"2\", \"application/pdf\"]], \"passed\": false}, {\"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\": false}\n"},"broken":{"elapsed_ms":38.433,"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","text/plain"],["2","text/html"],["2","application/pdf"]],"check":"alternative inside mixed","expected":[["1.1","text/plain"],["1.2","text/html"],["2","application/pdf"]],"passed":false},{"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","text/html"],["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":false}],"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\", \"text/plain\"], [\"2\", \"text/html\"], [\"2\", \"application/pdf\"]], \"expected\": [[\"1.1\", \"text/plain\"], [\"1.2\", \"text/html\"], [\"2\", \"application/pdf\"]], \"passed\": false}, {\"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\", \"text/html\"], [\"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\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":40.828,"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"}