FAILURE MAP
← Case archive

FA-76716 / Email MIME structure / Open access

Reassemble message/partial fragments: first fragment wins · case 01

A retransmitted fragment replaces the one already received, corrupting the reassembled message.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The first fragment wins decision evaluates `g['parts'][f['number']] = f['body']` where the contract requires `g['parts'].setdefault(f['number'], f['body'])`.

VERIFIED REPAIR

Use `g['parts'].setdefault(f['number'], f['body'])` for the first fragment wins decision and keep every other rule of the model unchanged.

Unsuccessful approach: Concatenating duplicates inserts the retransmitted bytes twice. The attempted `g['parts'][f['number']] = g['parts'].get(f['number'], '') + f['body']` still disagrees with a fixture.

Case contract

fragments {id, number, total (optional), body}. Per id: the first fragment with a given number wins; totals seen on fragments must all agree (otherwise "conflict"); without any total the message is "incomplete"; it is "complete" when every number 1..total is present, and its text joins those numbers in order (other numbers are ignored). Result rows [id, status, text or None] sorted by id.

Why this case matters

Large messages split with message/partial must be reassembled exactly once and in order.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(fragments):
    groups = {}
    for f in fragments:
        g = groups.setdefault(f['id'], {'totals': [], 'parts': {}})
        if f.get('total') is not None:
            g['totals'].append(f['total'])
        g['parts'][f['number']] = f['body']
    out = []
    for pid in sorted(groups):
        g = groups[pid]
        if len(set(g['totals'])) > 1:
            out.append([pid, 'conflict', None])
            continue
        if not g['totals']:
            out.append([pid, 'incomplete', None])
            continue
        total = g['totals'][0]
        if all(n in g['parts'] for n in range(1, total + 1)):
            out.append([pid, 'complete', ''.join(g['parts'].get(n, '') for n in range(1, total + 1))])
        else:
            out.append([pid, 'incomplete', None])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD1'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD1']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b1'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '11'}],), [['r', 'complete', '1123']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z1'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one1'}],), [['t', 'complete', 'one1two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z1'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w1', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w1', 'complete', 'solo']])], 2: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD2'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD2']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b2'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '12'}],), [['r', 'complete', '1223']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z2'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one2'}],), [['t', 'complete', 'one2two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z2'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w2', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w2', 'complete', 'solo']])], 3: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD3'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD3']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b3'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '13'}],), [['r', 'complete', '1323']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z3'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one3'}],), [['t', 'complete', 'one3two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z3'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w3', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w3', 'complete', 'solo']])], 4: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD4'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD4']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b4'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '14'}],), [['r', 'complete', '1423']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z4'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one4'}],), [['t', 'complete', 'one4two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z4'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w4', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w4', 'complete', 'solo']])], 5: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD5'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD5']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b5'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '15'}],), [['r', 'complete', '1523']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z5'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one5'}],), [['t', 'complete', 'one5two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z5'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w5', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w5', 'complete', 'solo']])]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
retransmitted fragment[['p', 'complete', 'XXCD1']][['p', 'complete', 'ABCD1']]Failed
no total yet[['q', 'incomplete', None]][['q', 'incomplete', None]]Passed
repeated equal totals[['r', 'complete', '1123']][['r', 'complete', '1123']]Passed
disagreeing totals[['s', 'conflict', None]][['s', 'conflict', None]]Passed
out of order with stray number[['t', 'complete', 'one1two']][['t', 'complete', 'one1two']]Passed
missing middle with stray[['u', 'incomplete', None]][['u', 'incomplete', None]]Passed
two messages[['v', 'incomplete', None], ['w1', 'complete', 'solo']][['v', 'incomplete', None], ['w1', 'complete', 'solo']]Passed

SHA-256 / a0b49e4af637fd4f6dbdedee29d53fc0b64967e8371048e3a10b072c89e4090a

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(fragments):
    groups = {}
    for f in fragments:
        g = groups.setdefault(f['id'], {'totals': [], 'parts': {}})
        if f.get('total') is not None:
            g['totals'].append(f['total'])
        g['parts'][f['number']] = g['parts'].get(f['number'], '') + f['body']
    out = []
    for pid in sorted(groups):
        g = groups[pid]
        if len(set(g['totals'])) > 1:
            out.append([pid, 'conflict', None])
            continue
        if not g['totals']:
            out.append([pid, 'incomplete', None])
            continue
        total = g['totals'][0]
        if all(n in g['parts'] for n in range(1, total + 1)):
            out.append([pid, 'complete', ''.join(g['parts'].get(n, '') for n in range(1, total + 1))])
        else:
            out.append([pid, 'incomplete', None])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD1'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD1']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b1'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '11'}],), [['r', 'complete', '1123']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z1'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one1'}],), [['t', 'complete', 'one1two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z1'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w1', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w1', 'complete', 'solo']])], 2: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD2'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD2']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b2'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '12'}],), [['r', 'complete', '1223']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z2'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one2'}],), [['t', 'complete', 'one2two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z2'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w2', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w2', 'complete', 'solo']])], 3: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD3'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD3']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b3'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '13'}],), [['r', 'complete', '1323']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z3'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one3'}],), [['t', 'complete', 'one3two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z3'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w3', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w3', 'complete', 'solo']])], 4: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD4'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD4']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b4'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '14'}],), [['r', 'complete', '1423']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z4'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one4'}],), [['t', 'complete', 'one4two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z4'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w4', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w4', 'complete', 'solo']])], 5: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD5'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD5']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b5'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '15'}],), [['r', 'complete', '1523']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z5'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one5'}],), [['t', 'complete', 'one5two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z5'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w5', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w5', 'complete', 'solo']])]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
retransmitted fragment[['p', 'complete', 'ABXXCD1']][['p', 'complete', 'ABCD1']]Failed
no total yet[['q', 'incomplete', None]][['q', 'incomplete', None]]Passed
repeated equal totals[['r', 'complete', '1123']][['r', 'complete', '1123']]Passed
disagreeing totals[['s', 'conflict', None]][['s', 'conflict', None]]Passed
out of order with stray number[['t', 'complete', 'one1two']][['t', 'complete', 'one1two']]Passed
missing middle with stray[['u', 'incomplete', None]][['u', 'incomplete', None]]Passed
two messages[['v', 'incomplete', None], ['w1', 'complete', 'solo']][['v', 'incomplete', None], ['w1', 'complete', 'solo']]Passed

SHA-256 / fd935cf9167c6f3e7fa0d68c41030b1b552b314a6cc2c450006d10328430d9ee

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(fragments):
    groups = {}
    for f in fragments:
        g = groups.setdefault(f['id'], {'totals': [], 'parts': {}})
        if f.get('total') is not None:
            g['totals'].append(f['total'])
        g['parts'].setdefault(f['number'], f['body'])
    out = []
    for pid in sorted(groups):
        g = groups[pid]
        if len(set(g['totals'])) > 1:
            out.append([pid, 'conflict', None])
            continue
        if not g['totals']:
            out.append([pid, 'incomplete', None])
            continue
        total = g['totals'][0]
        if all(n in g['parts'] for n in range(1, total + 1)):
            out.append([pid, 'complete', ''.join(g['parts'].get(n, '') for n in range(1, total + 1))])
        else:
            out.append([pid, 'incomplete', None])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD1'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD1']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b1'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '11'}],), [['r', 'complete', '1123']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z1'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one1'}],), [['t', 'complete', 'one1two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z1'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w1', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w1', 'complete', 'solo']])], 2: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD2'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD2']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b2'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '12'}],), [['r', 'complete', '1223']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z2'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one2'}],), [['t', 'complete', 'one2two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z2'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w2', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w2', 'complete', 'solo']])], 3: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD3'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD3']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b3'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '13'}],), [['r', 'complete', '1323']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z3'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one3'}],), [['t', 'complete', 'one3two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z3'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w3', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w3', 'complete', 'solo']])], 4: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD4'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD4']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b4'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '14'}],), [['r', 'complete', '1423']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z4'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one4'}],), [['t', 'complete', 'one4two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z4'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w4', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w4', 'complete', 'solo']])], 5: [('retransmitted fragment', ([{'id': 'p', 'number': 1, 'body': 'AB'}, {'id': 'p', 'number': 2, 'total': 2, 'body': 'CD5'}, {'id': 'p', 'number': 1, 'body': 'XX'}],), [['p', 'complete', 'ABCD5']]), ('no total yet', ([{'id': 'q', 'number': 1, 'body': 'a'}, {'id': 'q', 'number': 2, 'body': 'b5'}],), [['q', 'incomplete', None]]), ('repeated equal totals', ([{'id': 'r', 'number': 2, 'total': 3, 'body': '2'}, {'id': 'r', 'number': 3, 'total': 3, 'body': '3'}, {'id': 'r', 'number': 1, 'body': '15'}],), [['r', 'complete', '1523']]), ('disagreeing totals', ([{'id': 's', 'number': 1, 'total': 3, 'body': 'x'}, {'id': 's', 'number': 2, 'total': 4, 'body': 'y'}, {'id': 's', 'number': 3, 'total': 3, 'body': 'z5'}],), [['s', 'conflict', None]]), ('out of order with stray number', ([{'id': 't', 'number': 2, 'total': 2, 'body': 'two'}, {'id': 't', 'number': 3, 'body': 'junk'}, {'id': 't', 'number': 1, 'body': 'one5'}],), [['t', 'complete', 'one5two']]), ('missing middle with stray', ([{'id': 'u', 'number': 1, 'total': 2, 'body': 'a'}, {'id': 'u', 'number': 5, 'body': 'z5'}],), [['u', 'incomplete', None]]), ('two messages', ([{'id': 'w5', 'number': 1, 'total': 1, 'body': 'solo'}, {'id': 'v', 'number': 1, 'total': 2, 'body': 'half'}],), [['v', 'incomplete', None], ['w5', 'complete', 'solo']])]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
retransmitted fragment[['p', 'complete', 'ABCD1']][['p', 'complete', 'ABCD1']]Passed
no total yet[['q', 'incomplete', None]][['q', 'incomplete', None]]Passed
repeated equal totals[['r', 'complete', '1123']][['r', 'complete', '1123']]Passed
disagreeing totals[['s', 'conflict', None]][['s', 'conflict', None]]Passed
out of order with stray number[['t', 'complete', 'one1two']][['t', 'complete', 'one1two']]Passed
missing middle with stray[['u', 'incomplete', None]][['u', 'incomplete', None]]Passed
two messages[['v', 'incomplete', None], ['w1', 'complete', 'solo']][['v', 'incomplete', None], ['w1', 'complete', 'solo']]Passed

SHA-256 / 7ea7a0afdb84a1976ced4efc4f145ddcb3910927e9390038d35d5315978eaa37

Verification & scope

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.

Observations recorded using Python 3.12.14 at 2026-09-29T14:49:18.758720+00:00.

Case digest / 5e01b2f9cca31765c8bfa21aee559c375036b00b0fc311f0ff06f37fb1ac302b