{"abstract":"An existing \"FWD:\" prefix is not recognised, so forwarded subjects accumulate prefixes.","category":"Email MIME structure","checks":7,"contract":"original {subject, body_type (\"text\" or \"alternative\"), attachments [names], inline [image names]}. Subjects get a \"Fwd: \" prefix unless they already start with \"fwd:\" (case-insensitive). mode \"attach\" produces mixed(text,message/rfc822): the original travels whole, attachments included. mode \"inline\" copies the body: alternative(text,html), with related(html, images...) when the original has inline images (kept only when html exists), or text; original attachments follow in their original order inside mixed(...).","evaluation_group":"w2-email_mime_structure-forward-structure","failed_approach":"Matching \"fwd\" without the colon swallows subjects that merely begin with the word. The attempted `s.lower().startswith('fwd')` still disagrees with a fixture.","family":"w2-email_mime_structure-forward-structure-prefix-detection","id":"FA-76581","implementations":{"attempt":{"sha256":"10efb14f9748cfe60d1a0ec21176915173b97aa221a93f94b242d1974032425a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(original, mode):\n    s = original['subject']\n    subject = s if s.lower().startswith('fwd') else 'Fwd: ' + s\n    if mode == 'attach':\n        return {'subject': subject, 'structure': 'mixed(text,message/rfc822)'}\n    atts = list(original['attachments'])\n    if original['body_type'] == 'alternative':\n        body = 'alternative(text,html)'\n        if original['inline']:\n            body = 'alternative(text,related(html,' + ','.join(original['inline']) + '))'\n    else:\n        body = 'text'\n    if atts:\n        body = 'mixed(' + ','.join([body] + atts) + ')'\n    return {'subject': subject, 'structure': body}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('upper-case existing prefix', ({'subject': 'FWD: plan 1', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 1'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a1.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i1.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c1.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c1.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p1.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p1.gif))', 'subject': 'fwd: y'})], 2: [('upper-case existing prefix', ({'subject': 'FWD: plan 2', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 2'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a2.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i2.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c2.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c2.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p2.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p2.gif))', 'subject': 'fwd: y'})], 3: [('upper-case existing prefix', ({'subject': 'FWD: plan 3', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 3'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a3.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i3.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c3.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c3.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p3.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p3.gif))', 'subject': 'fwd: y'})], 4: [('upper-case existing prefix', ({'subject': 'FWD: plan 4', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 4'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a4.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i4.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c4.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c4.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p4.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p4.gif))', 'subject': 'fwd: y'})], 5: [('upper-case existing prefix', ({'subject': 'FWD: plan 5', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 5'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a5.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i5.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c5.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c5.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p5.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p5.gif))', 'subject': 'fwd: y'})]}\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":"b300b31fce7cd60aa48055a98a16c6ab9199ff54e029ae8c0f56d5102ecfc7d8","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(original, mode):\n    s = original['subject']\n    subject = s if s.startswith('Fwd:') else 'Fwd: ' + s\n    if mode == 'attach':\n        return {'subject': subject, 'structure': 'mixed(text,message/rfc822)'}\n    atts = list(original['attachments'])\n    if original['body_type'] == 'alternative':\n        body = 'alternative(text,html)'\n        if original['inline']:\n            body = 'alternative(text,related(html,' + ','.join(original['inline']) + '))'\n    else:\n        body = 'text'\n    if atts:\n        body = 'mixed(' + ','.join([body] + atts) + ')'\n    return {'subject': subject, 'structure': body}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('upper-case existing prefix', ({'subject': 'FWD: plan 1', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 1'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a1.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i1.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c1.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c1.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p1.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p1.gif))', 'subject': 'fwd: y'})], 2: [('upper-case existing prefix', ({'subject': 'FWD: plan 2', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 2'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a2.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i2.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c2.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c2.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p2.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p2.gif))', 'subject': 'fwd: y'})], 3: [('upper-case existing prefix', ({'subject': 'FWD: plan 3', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 3'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a3.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i3.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c3.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c3.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p3.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p3.gif))', 'subject': 'fwd: y'})], 4: [('upper-case existing prefix', ({'subject': 'FWD: plan 4', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 4'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a4.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i4.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c4.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c4.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p4.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p4.gif))', 'subject': 'fwd: y'})], 5: [('upper-case existing prefix', ({'subject': 'FWD: plan 5', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 5'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a5.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i5.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c5.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c5.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p5.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p5.gif))', 'subject': 'fwd: y'})]}\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":"91da49c453a36293da53758fba9fef12444e4106d3499940762a79aae1e92348","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(original, mode):\n    s = original['subject']\n    subject = s if s[:4].lower() == 'fwd:' else 'Fwd: ' + s\n    if mode == 'attach':\n        return {'subject': subject, 'structure': 'mixed(text,message/rfc822)'}\n    atts = list(original['attachments'])\n    if original['body_type'] == 'alternative':\n        body = 'alternative(text,html)'\n        if original['inline']:\n            body = 'alternative(text,related(html,' + ','.join(original['inline']) + '))'\n    else:\n        body = 'text'\n    if atts:\n        body = 'mixed(' + ','.join([body] + atts) + ')'\n    return {'subject': subject, 'structure': body}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('upper-case existing prefix', ({'subject': 'FWD: plan 1', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 1'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a1.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i1.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c1.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c1.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p1.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p1.gif))', 'subject': 'fwd: y'})], 2: [('upper-case existing prefix', ({'subject': 'FWD: plan 2', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 2'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a2.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i2.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c2.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c2.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p2.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p2.gif))', 'subject': 'fwd: y'})], 3: [('upper-case existing prefix', ({'subject': 'FWD: plan 3', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 3'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a3.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i3.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c3.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c3.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p3.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p3.gif))', 'subject': 'fwd: y'})], 4: [('upper-case existing prefix', ({'subject': 'FWD: plan 4', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 4'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a4.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i4.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c4.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c4.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p4.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p4.gif))', 'subject': 'fwd: y'})], 5: [('upper-case existing prefix', ({'subject': 'FWD: plan 5', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'FWD: plan 5'}), ('subject starting with Fwd as a word', ({'subject': 'Fwd planning review', 'body_type': 'text', 'attachments': [], 'inline': []}, 'inline'), {'structure': 'text', 'subject': 'Fwd: Fwd planning review'}), ('attach mode keeps parts inside', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['a5.pdf'], 'inline': ['logo.png']}, 'attach'), {'structure': 'mixed(text,message/rfc822)', 'subject': 'Fwd: s'}), ('text body with inline images', ({'subject': 's', 'body_type': 'text', 'attachments': ['a.pdf'], 'inline': ['i5.png', 'j.png']}, 'inline'), {'structure': 'mixed(text,a.pdf)', 'subject': 'Fwd: s'}), ('attachment order', ({'subject': 's', 'body_type': 'alternative', 'attachments': ['b.pdf', 'a.doc', 'c5.txt'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),b.pdf,a.doc,c5.txt)', 'subject': 'Fwd: s'}), ('html without inline images', ({'subject': 'Re: x', 'body_type': 'alternative', 'attachments': ['x.pdf'], 'inline': []}, 'inline'), {'structure': 'mixed(alternative(text,html),x.pdf)', 'subject': 'Fwd: Re: x'}), ('html with inline image', ({'subject': 'fwd: y', 'body_type': 'alternative', 'attachments': [], 'inline': ['p5.gif']}, 'inline'), {'structure': 'alternative(text,related(html,p5.gif))', 'subject': 'fwd: y'})]}\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-forward-structure-prefix-detection","generated_at":"2026-09-29T14:49:17.467816+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Forwarding rebuilds a MIME tree; errors duplicate attachments, lose inline images or stack Fwd: prefixes.","repair":"Use `s[:4].lower() == 'fwd:'` for the prefix detection decision and keep every other rule of the model unchanged.","root_cause":"The prefix detection decision evaluates `s.startswith('Fwd:')` where the contract requires `s[:4].lower() == 'fwd:'`.","sha256":"15ca6e8a375b338a6e3ef6d9cd63a5a4fc072ec76971e209d72a389e3cd3f4e6","title":"Assemble the structure of a forwarded message: prefix detection · 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":39.668,"exit_code":1,"observations":[{"actual":{"structure":"text","subject":"FWD: plan 1"},"check":"upper-case existing prefix","expected":{"structure":"text","subject":"FWD: plan 1"},"passed":true},{"actual":{"structure":"text","subject":"Fwd planning review"},"check":"subject starting with Fwd as a word","expected":{"structure":"text","subject":"Fwd: Fwd planning review"},"passed":false},{"actual":{"structure":"mixed(text,message/rfc822)","subject":"Fwd: s"},"check":"attach mode keeps parts inside","expected":{"structure":"mixed(text,message/rfc822)","subject":"Fwd: s"},"passed":true},{"actual":{"structure":"mixed(text,a.pdf)","subject":"Fwd: s"},"check":"text body with inline images","expected":{"structure":"mixed(text,a.pdf)","subject":"Fwd: s"},"passed":true},{"actual":{"structure":"mixed(alternative(text,html),b.pdf,a.doc,c1.txt)","subject":"Fwd: s"},"check":"attachment order","expected":{"structure":"mixed(alternative(text,html),b.pdf,a.doc,c1.txt)","subject":"Fwd: s"},"passed":true},{"actual":{"structure":"mixed(alternative(text,html),x.pdf)","subject":"Fwd: Re: x"},"check":"html without inline images","expected":{"structure":"mixed(alternative(text,html),x.pdf)","subject":"Fwd: Re: x"},"passed":true},{"actual":{"structure":"alternative(text,related(html,p1.gif))","subject":"fwd: y"},"check":"html with inline image","expected":{"structure":"alternative(text,related(html,p1.gif))","subject":"fwd: y"},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"upper-case existing prefix\", \"actual\": {\"subject\": \"FWD: plan 1\", \"structure\": \"text\"}, \"expected\": {\"structure\": \"text\", \"subject\": \"FWD: plan 1\"}, \"passed\": true}, {\"check\": \"subject starting with Fwd as a word\", \"actual\": {\"subject\": \"Fwd planning review\", \"structure\": \"text\"}, \"expected\": {\"structure\": \"text\", \"subject\": \"Fwd: Fwd planning review\"}, \"passed\": false}, {\"check\": \"attach mode keeps parts inside\", \"actual\": {\"subject\": \"Fwd: s\", \"structure\": \"mixed(text,message/rfc822)\"}, \"expected\": {\"structure\": \"mixed(text,message/rfc822)\", \"subject\": \"Fwd: s\"}, \"passed\": true}, {\"check\": \"text body with inline images\", \"actual\": {\"subject\": \"Fwd: s\", \"structure\": \"mixed(text,a.pdf)\"}, \"expected\": {\"structure\": \"mixed(text,a.pdf)\", \"subject\": \"Fwd: s\"}, \"passed\": true}, {\"check\": \"attachment order\", \"actual\": {\"subject\": \"Fwd: s\", \"structure\": \"mixed(alternative(text,html),b.pdf,a.doc,c1.txt)\"}, \"expected\": {\"structure\": \"mixed(alternative(text,html),b.pdf,a.doc,c1.txt)\", \"subject\": \"Fwd: s\"}, \"passed\": true}, {\"check\": \"html without inline images\", \"actual\": {\"subject\": \"Fwd: Re: x\", \"structure\": \"mixed(alternative(text,html),x.pdf)\"}, \"expected\": {\"structure\": \"mixed(alternative(text,html),x.pdf)\", \"subject\": \"Fwd: Re: x\"}, \"passed\": true}, {\"check\": \"html with inline image\", \"actual\": {\"subject\": \"fwd: y\", \"structure\": \"alternative(text,related(html,p1.gif))\"}, \"expected\": {\"structure\": \"alternative(text,related(html,p1.gif))\", \"subject\": \"fwd: y\"}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.87,"exit_code":1,"observations":[{"actual":{"structure":"text","subject":"Fwd: FWD: plan 1"},"check":"upper-case existing prefix","expected":{"structure":"text","subject":"FWD: plan 1"},"passed":false},{"actual":{"structure":"text","subject":"Fwd: Fwd planning review"},"check":"subject starting with Fwd as a word","expected":{"structure":"text","subject":"Fwd: Fwd planning review"},"passed":true},{"actual":{"structure":"mixed(text,message/rfc822)","subject":"Fwd: s"},"check":"attach mode keeps parts inside","expected":{"structure":"mixed(text,message/rfc822)","subject":"Fwd: s"},"passed":true},{"actual":{"structure":"mixed(text,a.pdf)","subject":"Fwd: s"},"check":"text body with inline images","expected":{"structure":"mixed(text,a.pdf)","subject":"Fwd: s"},"passed":true},{"actual":{"structure":"mixed(alternative(text,html),b.pdf,a.doc,c1.txt)","subject":"Fwd: s"},"check":"attachment order","expected":{"structure":"mixed(alternative(text,html),b.pdf,a.doc,c1.txt)","subject":"Fwd: s"},"passed":true},{"actual":{"structure":"mixed(alternative(text,html),x.pdf)","subject":"Fwd: Re: x"},"check":"html without inline images","expected":{"structure":"mixed(alternative(text,html),x.pdf)","subject":"Fwd: Re: x"},"passed":true},{"actual":{"structure":"alternative(text,related(html,p1.gif))","subject":"Fwd: fwd: y"},"check":"html with inline image","expected":{"structure":"alternative(text,related(html,p1.gif))","subject":"fwd: y"},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"upper-case existing prefix\", \"actual\": {\"subject\": \"Fwd: FWD: plan 1\", \"structure\": \"text\"}, \"expected\": {\"structure\": \"text\", \"subject\": \"FWD: plan 1\"}, \"passed\": false}, {\"check\": \"subject starting with Fwd as a word\", \"actual\": {\"subject\": \"Fwd: Fwd planning review\", \"structure\": \"text\"}, \"expected\": {\"structure\": \"text\", \"subject\": \"Fwd: Fwd planning review\"}, \"passed\": true}, {\"check\": \"attach mode keeps parts inside\", \"actual\": {\"subject\": \"Fwd: s\", \"structure\": \"mixed(text,message/rfc822)\"}, \"expected\": {\"structure\": \"mixed(text,message/rfc822)\", \"subject\": \"Fwd: s\"}, \"passed\": true}, {\"check\": \"text body with inline images\", \"actual\": {\"subject\": \"Fwd: s\", \"structure\": \"mixed(text,a.pdf)\"}, \"expected\": {\"structure\": \"mixed(text,a.pdf)\", \"subject\": \"Fwd: s\"}, \"passed\": true}, {\"check\": \"attachment order\", \"actual\": {\"subject\": \"Fwd: s\", \"structure\": \"mixed(alternative(text,html),b.pdf,a.doc,c1.txt)\"}, \"expected\": {\"structure\": \"mixed(alternative(text,html),b.pdf,a.doc,c1.txt)\", \"subject\": \"Fwd: s\"}, \"passed\": true}, {\"check\": \"html without inline images\", \"actual\": {\"subject\": \"Fwd: Re: x\", \"structure\": \"mixed(alternative(text,html),x.pdf)\"}, \"expected\": {\"structure\": \"mixed(alternative(text,html),x.pdf)\", \"subject\": \"Fwd: Re: x\"}, \"passed\": true}, {\"check\": \"html with inline image\", \"actual\": {\"subject\": \"Fwd: fwd: y\", \"structure\": \"alternative(text,related(html,p1.gif))\"}, \"expected\": {\"structure\": \"alternative(text,related(html,p1.gif))\", \"subject\": \"fwd: y\"}, \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.217,"exit_code":0,"observations":[{"actual":{"structure":"text","subject":"FWD: plan 1"},"check":"upper-case existing prefix","expected":{"structure":"text","subject":"FWD: plan 1"},"passed":true},{"actual":{"structure":"text","subject":"Fwd: Fwd planning review"},"check":"subject starting with Fwd as a word","expected":{"structure":"text","subject":"Fwd: Fwd planning review"},"passed":true},{"actual":{"structure":"mixed(text,message/rfc822)","subject":"Fwd: s"},"check":"attach mode keeps parts inside","expected":{"structure":"mixed(text,message/rfc822)","subject":"Fwd: s"},"passed":true},{"actual":{"structure":"mixed(text,a.pdf)","subject":"Fwd: s"},"check":"text body with inline images","expected":{"structure":"mixed(text,a.pdf)","subject":"Fwd: s"},"passed":true},{"actual":{"structure":"mixed(alternative(text,html),b.pdf,a.doc,c1.txt)","subject":"Fwd: s"},"check":"attachment order","expected":{"structure":"mixed(alternative(text,html),b.pdf,a.doc,c1.txt)","subject":"Fwd: s"},"passed":true},{"actual":{"structure":"mixed(alternative(text,html),x.pdf)","subject":"Fwd: Re: x"},"check":"html without inline images","expected":{"structure":"mixed(alternative(text,html),x.pdf)","subject":"Fwd: Re: x"},"passed":true},{"actual":{"structure":"alternative(text,related(html,p1.gif))","subject":"fwd: y"},"check":"html with inline image","expected":{"structure":"alternative(text,related(html,p1.gif))","subject":"fwd: y"},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"upper-case existing prefix\", \"actual\": {\"subject\": \"FWD: plan 1\", \"structure\": \"text\"}, \"expected\": {\"structure\": \"text\", \"subject\": \"FWD: plan 1\"}, \"passed\": true}, {\"check\": \"subject starting with Fwd as a word\", \"actual\": {\"subject\": \"Fwd: Fwd planning review\", \"structure\": \"text\"}, \"expected\": {\"structure\": \"text\", \"subject\": \"Fwd: Fwd planning review\"}, \"passed\": true}, {\"check\": \"attach mode keeps parts inside\", \"actual\": {\"subject\": \"Fwd: s\", \"structure\": \"mixed(text,message/rfc822)\"}, \"expected\": {\"structure\": \"mixed(text,message/rfc822)\", \"subject\": \"Fwd: s\"}, \"passed\": true}, {\"check\": \"text body with inline images\", \"actual\": {\"subject\": \"Fwd: s\", \"structure\": \"mixed(text,a.pdf)\"}, \"expected\": {\"structure\": \"mixed(text,a.pdf)\", \"subject\": \"Fwd: s\"}, \"passed\": true}, {\"check\": \"attachment order\", \"actual\": {\"subject\": \"Fwd: s\", \"structure\": \"mixed(alternative(text,html),b.pdf,a.doc,c1.txt)\"}, \"expected\": {\"structure\": \"mixed(alternative(text,html),b.pdf,a.doc,c1.txt)\", \"subject\": \"Fwd: s\"}, \"passed\": true}, {\"check\": \"html without inline images\", \"actual\": {\"subject\": \"Fwd: Re: x\", \"structure\": \"mixed(alternative(text,html),x.pdf)\"}, \"expected\": {\"structure\": \"mixed(alternative(text,html),x.pdf)\", \"subject\": \"Fwd: Re: x\"}, \"passed\": true}, {\"check\": \"html with inline image\", \"actual\": {\"subject\": \"fwd: y\", \"structure\": \"alternative(text,related(html,p1.gif))\"}, \"expected\": {\"structure\": \"alternative(text,related(html,p1.gif))\", \"subject\": \"fwd: y\"}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}