{"abstract":"References written as \"CID:\" are not recognised as content-id URLs.","category":"Email MIME structure","checks":6,"contract":"related has params (optional start, with angle brackets) and parts with optional cid values such as \" <img@x> \". Content ids are compared after trimming spaces and angle brackets. The root is the part whose id equals the start id, else the first part. Each reference is a URL; the \"cid:\" scheme is case-insensitive and the rest is percent-decoded. A reference resolves to the first non-root part with an equal id, else None. Result {root, resolved [[ref, index]...], unused: non-root indexes nobody referenced}.","evaluation_group":"w2-email_mime_structure-cid-resolution","failed_approach":"Enumerating two spellings still misses mixed-case schemes. The attempted `ref[:4] in ('cid:', 'CID:')` still disagrees with a fixture.","family":"w2-email_mime_structure-cid-resolution-scheme-case","id":"FA-76471","implementations":{"attempt":{"sha256":"63dbb99dd4af6d485223426c15e6718d48e933948b2f84a8f685e733c0e97934","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom urllib.parse import unquote\nN = 1\nobservations = []\ndef solve(related, html_refs):\n    def norm(c):\n        return (c or '').strip().strip('<>').strip()\n    ids = [norm(p.get('cid')) for p in related['parts']]\n    start = norm(related.get('params', {}).get('start'))\n    root = ids.index(start) if start and start in ids else 0\n    resolved = []\n    used = set()\n    for ref in html_refs:\n        target = unquote(ref[4:]) if ref[:4] in ('cid:', 'CID:') else None\n        hit = None\n        for i, c in enumerate(ids):\n            if i != root and target and c == target:\n                hit = i\n                break\n        if hit is not None:\n            used.add(hit)\n        resolved.append([ref, hit])\n    unused = [i for i in range(len(ids)) if i != root and i not in used]\n    return {'root': root, 'resolved': resolved, 'unused': unused}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic1@x> '}]}, ['cid:pic1@x']), {'resolved': [['cid:pic1@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b1@x>'}]}, ['cid:a%2Bb1%40x']), {'resolved': [['cid:a%2Bb1%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p1@x>'}]}, ['cid:p1@x']), {'resolved': [['cid:p1@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})], 2: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic2@x> '}]}, ['cid:pic2@x']), {'resolved': [['cid:pic2@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b2@x>'}]}, ['cid:a%2Bb2%40x']), {'resolved': [['cid:a%2Bb2%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p2@x>'}]}, ['cid:p2@x']), {'resolved': [['cid:p2@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})], 3: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic3@x> '}]}, ['cid:pic3@x']), {'resolved': [['cid:pic3@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b3@x>'}]}, ['cid:a%2Bb3%40x']), {'resolved': [['cid:a%2Bb3%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p3@x>'}]}, ['cid:p3@x']), {'resolved': [['cid:p3@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})], 4: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic4@x> '}]}, ['cid:pic4@x']), {'resolved': [['cid:pic4@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b4@x>'}]}, ['cid:a%2Bb4%40x']), {'resolved': [['cid:a%2Bb4%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p4@x>'}]}, ['cid:p4@x']), {'resolved': [['cid:p4@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})], 5: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic5@x> '}]}, ['cid:pic5@x']), {'resolved': [['cid:pic5@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b5@x>'}]}, ['cid:a%2Bb5%40x']), {'resolved': [['cid:a%2Bb5%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p5@x>'}]}, ['cid:p5@x']), {'resolved': [['cid:p5@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})]}\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":"aa5761e4bf961fb76278d4bb049ff3944439ba10f7659901d04ab06fe1cdd64d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom urllib.parse import unquote\nN = 1\nobservations = []\ndef solve(related, html_refs):\n    def norm(c):\n        return (c or '').strip().strip('<>').strip()\n    ids = [norm(p.get('cid')) for p in related['parts']]\n    start = norm(related.get('params', {}).get('start'))\n    root = ids.index(start) if start and start in ids else 0\n    resolved = []\n    used = set()\n    for ref in html_refs:\n        target = unquote(ref[4:]) if ref.startswith('cid:') else None\n        hit = None\n        for i, c in enumerate(ids):\n            if i != root and target and c == target:\n                hit = i\n                break\n        if hit is not None:\n            used.add(hit)\n        resolved.append([ref, hit])\n    unused = [i for i in range(len(ids)) if i != root and i not in used]\n    return {'root': root, 'resolved': resolved, 'unused': unused}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic1@x> '}]}, ['cid:pic1@x']), {'resolved': [['cid:pic1@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b1@x>'}]}, ['cid:a%2Bb1%40x']), {'resolved': [['cid:a%2Bb1%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p1@x>'}]}, ['cid:p1@x']), {'resolved': [['cid:p1@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})], 2: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic2@x> '}]}, ['cid:pic2@x']), {'resolved': [['cid:pic2@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b2@x>'}]}, ['cid:a%2Bb2%40x']), {'resolved': [['cid:a%2Bb2%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p2@x>'}]}, ['cid:p2@x']), {'resolved': [['cid:p2@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})], 3: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic3@x> '}]}, ['cid:pic3@x']), {'resolved': [['cid:pic3@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b3@x>'}]}, ['cid:a%2Bb3%40x']), {'resolved': [['cid:a%2Bb3%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p3@x>'}]}, ['cid:p3@x']), {'resolved': [['cid:p3@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})], 4: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic4@x> '}]}, ['cid:pic4@x']), {'resolved': [['cid:pic4@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b4@x>'}]}, ['cid:a%2Bb4%40x']), {'resolved': [['cid:a%2Bb4%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p4@x>'}]}, ['cid:p4@x']), {'resolved': [['cid:p4@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})], 5: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic5@x> '}]}, ['cid:pic5@x']), {'resolved': [['cid:pic5@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b5@x>'}]}, ['cid:a%2Bb5%40x']), {'resolved': [['cid:a%2Bb5%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p5@x>'}]}, ['cid:p5@x']), {'resolved': [['cid:p5@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})]}\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":"4cb75440b3f124aed8eb5ecd5ddc8bb745872d6c02cc6c24872ee2e7cfc85d49","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom urllib.parse import unquote\nN = 1\nobservations = []\ndef solve(related, html_refs):\n    def norm(c):\n        return (c or '').strip().strip('<>').strip()\n    ids = [norm(p.get('cid')) for p in related['parts']]\n    start = norm(related.get('params', {}).get('start'))\n    root = ids.index(start) if start and start in ids else 0\n    resolved = []\n    used = set()\n    for ref in html_refs:\n        target = unquote(ref[4:]) if ref[:4].lower() == 'cid:' else None\n        hit = None\n        for i, c in enumerate(ids):\n            if i != root and target and c == target:\n                hit = i\n                break\n        if hit is not None:\n            used.add(hit)\n        resolved.append([ref, hit])\n    unused = [i for i in range(len(ids)) if i != root and i not in used]\n    return {'root': root, 'resolved': resolved, 'unused': unused}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic1@x> '}]}, ['cid:pic1@x']), {'resolved': [['cid:pic1@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b1@x>'}]}, ['cid:a%2Bb1%40x']), {'resolved': [['cid:a%2Bb1%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p1@x>'}]}, ['cid:p1@x']), {'resolved': [['cid:p1@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})], 2: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic2@x> '}]}, ['cid:pic2@x']), {'resolved': [['cid:pic2@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b2@x>'}]}, ['cid:a%2Bb2%40x']), {'resolved': [['cid:a%2Bb2%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p2@x>'}]}, ['cid:p2@x']), {'resolved': [['cid:p2@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})], 3: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic3@x> '}]}, ['cid:pic3@x']), {'resolved': [['cid:pic3@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b3@x>'}]}, ['cid:a%2Bb3%40x']), {'resolved': [['cid:a%2Bb3%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p3@x>'}]}, ['cid:p3@x']), {'resolved': [['cid:p3@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})], 4: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic4@x> '}]}, ['cid:pic4@x']), {'resolved': [['cid:pic4@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b4@x>'}]}, ['cid:a%2Bb4%40x']), {'resolved': [['cid:a%2Bb4%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p4@x>'}]}, ['cid:p4@x']), {'resolved': [['cid:p4@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})], 5: [('padded content id', ({'parts': [{'cid': '<root@x>'}, {'cid': ' <pic5@x> '}]}, ['cid:pic5@x']), {'resolved': [['cid:pic5@x', 1]], 'root': 0, 'unused': []}), ('scheme casing', ({'parts': [{'cid': '<root@x>'}, {'cid': '<pic@x>'}]}, ['CID:pic@x', 'Cid:pic@x', 'http://pic@x']), {'resolved': [['CID:pic@x', 1], ['Cid:pic@x', 1], ['http://pic@x', None]], 'root': 0, 'unused': []}), ('percent-encoded reference', ({'parts': [{}, {'cid': '<a+b5@x>'}]}, ['cid:a%2Bb5%40x']), {'resolved': [['cid:a%2Bb5%40x', 1]], 'root': 0, 'unused': []}), ('root referenced by itself', ({'params': {'start': '<root@x>'}, 'parts': [{'cid': '<pic@x>'}, {'cid': '<root@x>'}]}, ['cid:root@x', 'cid:pic@x']), {'resolved': [['cid:root@x', None], ['cid:pic@x', 0]], 'root': 1, 'unused': []}), ('no start and an id-less part', ({'params': {}, 'parts': [{'cid': '<doc@x>'}, {}, {'cid': '<p5@x>'}]}, ['cid:p5@x']), {'resolved': [['cid:p5@x', 2]], 'root': 0, 'unused': [1]}), ('unused parts with late root', ({'params': {'start': '<r@x>'}, 'parts': [{'cid': '<a@x>'}, {'cid': '<b@x>'}, {'cid': '<r@x>'}]}, ['cid:a@x']), {'resolved': [['cid:a@x', 0]], 'root': 2, 'unused': [1]})]}\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-cid-resolution-scheme-case","generated_at":"2026-09-29T14:49:16.627690+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Inline images and style sheets in HTML mail are located through Content-ID references.","repair":"Use `ref[:4].lower() == 'cid:'` for the scheme case decision and keep every other rule of the model unchanged.","root_cause":"The scheme case decision evaluates `ref.startswith('cid:')` where the contract requires `ref[:4].lower() == 'cid:'`.","sha256":"f085488bef50ed49fd11d73e5164831e7db8278d4b997f6fdc1525d9dc1c0159","title":"Resolve cid: references inside multipart/related: scheme case · 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.351,"exit_code":1,"observations":[{"actual":{"resolved":[["cid:pic1@x",1]],"root":0,"unused":[]},"check":"padded content id","expected":{"resolved":[["cid:pic1@x",1]],"root":0,"unused":[]},"passed":true},{"actual":{"resolved":[["CID:pic@x",1],["Cid:pic@x",null],["http://pic@x",null]],"root":0,"unused":[]},"check":"scheme casing","expected":{"resolved":[["CID:pic@x",1],["Cid:pic@x",1],["http://pic@x",null]],"root":0,"unused":[]},"passed":false},{"actual":{"resolved":[["cid:a%2Bb1%40x",1]],"root":0,"unused":[]},"check":"percent-encoded reference","expected":{"resolved":[["cid:a%2Bb1%40x",1]],"root":0,"unused":[]},"passed":true},{"actual":{"resolved":[["cid:root@x",null],["cid:pic@x",0]],"root":1,"unused":[]},"check":"root referenced by itself","expected":{"resolved":[["cid:root@x",null],["cid:pic@x",0]],"root":1,"unused":[]},"passed":true},{"actual":{"resolved":[["cid:p1@x",2]],"root":0,"unused":[1]},"check":"no start and an id-less part","expected":{"resolved":[["cid:p1@x",2]],"root":0,"unused":[1]},"passed":true},{"actual":{"resolved":[["cid:a@x",0]],"root":2,"unused":[1]},"check":"unused parts with late root","expected":{"resolved":[["cid:a@x",0]],"root":2,"unused":[1]},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"padded content id\", \"actual\": {\"root\": 0, \"resolved\": [[\"cid:pic1@x\", 1]], \"unused\": []}, \"expected\": {\"resolved\": [[\"cid:pic1@x\", 1]], \"root\": 0, \"unused\": []}, \"passed\": true}, {\"check\": \"scheme casing\", \"actual\": {\"root\": 0, \"resolved\": [[\"CID:pic@x\", 1], [\"Cid:pic@x\", null], [\"http://pic@x\", null]], \"unused\": []}, \"expected\": {\"resolved\": [[\"CID:pic@x\", 1], [\"Cid:pic@x\", 1], [\"http://pic@x\", null]], \"root\": 0, \"unused\": []}, \"passed\": false}, {\"check\": \"percent-encoded reference\", \"actual\": {\"root\": 0, \"resolved\": [[\"cid:a%2Bb1%40x\", 1]], \"unused\": []}, \"expected\": {\"resolved\": [[\"cid:a%2Bb1%40x\", 1]], \"root\": 0, \"unused\": []}, \"passed\": true}, {\"check\": \"root referenced by itself\", \"actual\": {\"root\": 1, \"resolved\": [[\"cid:root@x\", null], [\"cid:pic@x\", 0]], \"unused\": []}, \"expected\": {\"resolved\": [[\"cid:root@x\", null], [\"cid:pic@x\", 0]], \"root\": 1, \"unused\": []}, \"passed\": true}, {\"check\": \"no start and an id-less part\", \"actual\": {\"root\": 0, \"resolved\": [[\"cid:p1@x\", 2]], \"unused\": [1]}, \"expected\": {\"resolved\": [[\"cid:p1@x\", 2]], \"root\": 0, \"unused\": [1]}, \"passed\": true}, {\"check\": \"unused parts with late root\", \"actual\": {\"root\": 2, \"resolved\": [[\"cid:a@x\", 0]], \"unused\": [1]}, \"expected\": {\"resolved\": [[\"cid:a@x\", 0]], \"root\": 2, \"unused\": [1]}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.677,"exit_code":1,"observations":[{"actual":{"resolved":[["cid:pic1@x",1]],"root":0,"unused":[]},"check":"padded content id","expected":{"resolved":[["cid:pic1@x",1]],"root":0,"unused":[]},"passed":true},{"actual":{"resolved":[["CID:pic@x",null],["Cid:pic@x",null],["http://pic@x",null]],"root":0,"unused":[1]},"check":"scheme casing","expected":{"resolved":[["CID:pic@x",1],["Cid:pic@x",1],["http://pic@x",null]],"root":0,"unused":[]},"passed":false},{"actual":{"resolved":[["cid:a%2Bb1%40x",1]],"root":0,"unused":[]},"check":"percent-encoded reference","expected":{"resolved":[["cid:a%2Bb1%40x",1]],"root":0,"unused":[]},"passed":true},{"actual":{"resolved":[["cid:root@x",null],["cid:pic@x",0]],"root":1,"unused":[]},"check":"root referenced by itself","expected":{"resolved":[["cid:root@x",null],["cid:pic@x",0]],"root":1,"unused":[]},"passed":true},{"actual":{"resolved":[["cid:p1@x",2]],"root":0,"unused":[1]},"check":"no start and an id-less part","expected":{"resolved":[["cid:p1@x",2]],"root":0,"unused":[1]},"passed":true},{"actual":{"resolved":[["cid:a@x",0]],"root":2,"unused":[1]},"check":"unused parts with late root","expected":{"resolved":[["cid:a@x",0]],"root":2,"unused":[1]},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"padded content id\", \"actual\": {\"root\": 0, \"resolved\": [[\"cid:pic1@x\", 1]], \"unused\": []}, \"expected\": {\"resolved\": [[\"cid:pic1@x\", 1]], \"root\": 0, \"unused\": []}, \"passed\": true}, {\"check\": \"scheme casing\", \"actual\": {\"root\": 0, \"resolved\": [[\"CID:pic@x\", null], [\"Cid:pic@x\", null], [\"http://pic@x\", null]], \"unused\": [1]}, \"expected\": {\"resolved\": [[\"CID:pic@x\", 1], [\"Cid:pic@x\", 1], [\"http://pic@x\", null]], \"root\": 0, \"unused\": []}, \"passed\": false}, {\"check\": \"percent-encoded reference\", \"actual\": {\"root\": 0, \"resolved\": [[\"cid:a%2Bb1%40x\", 1]], \"unused\": []}, \"expected\": {\"resolved\": [[\"cid:a%2Bb1%40x\", 1]], \"root\": 0, \"unused\": []}, \"passed\": true}, {\"check\": \"root referenced by itself\", \"actual\": {\"root\": 1, \"resolved\": [[\"cid:root@x\", null], [\"cid:pic@x\", 0]], \"unused\": []}, \"expected\": {\"resolved\": [[\"cid:root@x\", null], [\"cid:pic@x\", 0]], \"root\": 1, \"unused\": []}, \"passed\": true}, {\"check\": \"no start and an id-less part\", \"actual\": {\"root\": 0, \"resolved\": [[\"cid:p1@x\", 2]], \"unused\": [1]}, \"expected\": {\"resolved\": [[\"cid:p1@x\", 2]], \"root\": 0, \"unused\": [1]}, \"passed\": true}, {\"check\": \"unused parts with late root\", \"actual\": {\"root\": 2, \"resolved\": [[\"cid:a@x\", 0]], \"unused\": [1]}, \"expected\": {\"resolved\": [[\"cid:a@x\", 0]], \"root\": 2, \"unused\": [1]}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.915,"exit_code":0,"observations":[{"actual":{"resolved":[["cid:pic1@x",1]],"root":0,"unused":[]},"check":"padded content id","expected":{"resolved":[["cid:pic1@x",1]],"root":0,"unused":[]},"passed":true},{"actual":{"resolved":[["CID:pic@x",1],["Cid:pic@x",1],["http://pic@x",null]],"root":0,"unused":[]},"check":"scheme casing","expected":{"resolved":[["CID:pic@x",1],["Cid:pic@x",1],["http://pic@x",null]],"root":0,"unused":[]},"passed":true},{"actual":{"resolved":[["cid:a%2Bb1%40x",1]],"root":0,"unused":[]},"check":"percent-encoded reference","expected":{"resolved":[["cid:a%2Bb1%40x",1]],"root":0,"unused":[]},"passed":true},{"actual":{"resolved":[["cid:root@x",null],["cid:pic@x",0]],"root":1,"unused":[]},"check":"root referenced by itself","expected":{"resolved":[["cid:root@x",null],["cid:pic@x",0]],"root":1,"unused":[]},"passed":true},{"actual":{"resolved":[["cid:p1@x",2]],"root":0,"unused":[1]},"check":"no start and an id-less part","expected":{"resolved":[["cid:p1@x",2]],"root":0,"unused":[1]},"passed":true},{"actual":{"resolved":[["cid:a@x",0]],"root":2,"unused":[1]},"check":"unused parts with late root","expected":{"resolved":[["cid:a@x",0]],"root":2,"unused":[1]},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"padded content id\", \"actual\": {\"root\": 0, \"resolved\": [[\"cid:pic1@x\", 1]], \"unused\": []}, \"expected\": {\"resolved\": [[\"cid:pic1@x\", 1]], \"root\": 0, \"unused\": []}, \"passed\": true}, {\"check\": \"scheme casing\", \"actual\": {\"root\": 0, \"resolved\": [[\"CID:pic@x\", 1], [\"Cid:pic@x\", 1], [\"http://pic@x\", null]], \"unused\": []}, \"expected\": {\"resolved\": [[\"CID:pic@x\", 1], [\"Cid:pic@x\", 1], [\"http://pic@x\", null]], \"root\": 0, \"unused\": []}, \"passed\": true}, {\"check\": \"percent-encoded reference\", \"actual\": {\"root\": 0, \"resolved\": [[\"cid:a%2Bb1%40x\", 1]], \"unused\": []}, \"expected\": {\"resolved\": [[\"cid:a%2Bb1%40x\", 1]], \"root\": 0, \"unused\": []}, \"passed\": true}, {\"check\": \"root referenced by itself\", \"actual\": {\"root\": 1, \"resolved\": [[\"cid:root@x\", null], [\"cid:pic@x\", 0]], \"unused\": []}, \"expected\": {\"resolved\": [[\"cid:root@x\", null], [\"cid:pic@x\", 0]], \"root\": 1, \"unused\": []}, \"passed\": true}, {\"check\": \"no start and an id-less part\", \"actual\": {\"root\": 0, \"resolved\": [[\"cid:p1@x\", 2]], \"unused\": [1]}, \"expected\": {\"resolved\": [[\"cid:p1@x\", 2]], \"root\": 0, \"unused\": [1]}, \"passed\": true}, {\"check\": \"unused parts with late root\", \"actual\": {\"root\": 2, \"resolved\": [[\"cid:a@x\", 0]], \"unused\": [1]}, \"expected\": {\"resolved\": [[\"cid:a@x\", 0]], \"root\": 2, \"unused\": [1]}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}