FAILURE MAP
← Case archive

FA-75841 / Chat ordering and read receipts / Open access

Merge server-sequenced messages with local pending sends: server order key · case 01

Messages relayed by a lagging edge node with an earlier wall-clock stamp jump ahead of messages the server sequenced first.

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

ROOT CAUSE

The server order key decision evaluates `key=lambda m: m['ts']` where the contract requires `key=lambda m: m['seq']`.

VERIFIED REPAIR

Use `key=lambda m: m['seq']` for the server order key decision and keep every other rule of the model unchanged.

Unsuccessful approach: Tie-breaking on the sequence only helps equal timestamps; skewed timestamps still override the authoritative sequence. The attempted `key=lambda m: (m['ts'], m['seq'])` still disagrees with a fixture.

Case contract

confirmed holds server messages {id, seq, ts, optional nonce}; the server seq is the only authority for order and a redelivered copy (same seq, possibly another gateway ts) is shown once (first copy kept). pending holds local unsent messages {nonce, created}; a pending message whose nonce was echoed back by any confirmed message is dropped. Result: confirmed ids in seq order, then local:<nonce> for the remaining pending sends ordered by (created, nonce).

Why this case matters

Chat clients render optimistic local sends next to server-ordered history; ordering or echo mistakes show duplicated or jumping bubbles.

1 / The failure

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

N = 1
observations = []
def solve(confirmed, pending):
    seen = set()
    rows = []
    for m in sorted(confirmed, key=lambda m: m['ts']):
        key = m['seq']
        if key in seen:
            continue
        seen.add(key)
        rows.append(m)
    echoed = {m['nonce'] for m in rows if m.get('nonce')}
    tail = sorted((p for p in pending if p['nonce'] not in echoed), key=lambda p: (p['created'], p['nonce']))
    return [m['id'] for m in rows] + ['local:' + p['nonce'] for p in tail]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 1050}, {'id': 'm1', 'seq': 1, 'ts': 1090}, {'id': 'm3', 'seq': 3, 'ts': 1095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 1000}, {'id': 'a', 'seq': 5, 'ts': 2501}, {'id': 'b', 'seq': 6, 'ts': 3600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 1, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 6}], [{'nonce': 'n1', 'created': -4}, {'nonce': 'n2', 'created': 8}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 2100}, {'nonce': 'aa', 'created': 2900}, {'nonce': 'mm', 'created': 2200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c1', 'seq': 1, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c1', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b1', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b1'])], 2: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 2050}, {'id': 'm1', 'seq': 1, 'ts': 2090}, {'id': 'm3', 'seq': 3, 'ts': 2095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 2000}, {'id': 'a', 'seq': 5, 'ts': 3502}, {'id': 'b', 'seq': 6, 'ts': 4600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 2, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 7}], [{'nonce': 'n1', 'created': -3}, {'nonce': 'n2', 'created': 9}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 3100}, {'nonce': 'aa', 'created': 3900}, {'nonce': 'mm', 'created': 3200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c2', 'seq': 2, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c2', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b2', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b2'])], 3: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 3050}, {'id': 'm1', 'seq': 1, 'ts': 3090}, {'id': 'm3', 'seq': 3, 'ts': 3095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 3000}, {'id': 'a', 'seq': 5, 'ts': 4503}, {'id': 'b', 'seq': 6, 'ts': 5600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 3, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 8}], [{'nonce': 'n1', 'created': -2}, {'nonce': 'n2', 'created': 10}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 4100}, {'nonce': 'aa', 'created': 4900}, {'nonce': 'mm', 'created': 4200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c3', 'seq': 3, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c3', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b3', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b3'])], 4: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 4050}, {'id': 'm1', 'seq': 1, 'ts': 4090}, {'id': 'm3', 'seq': 3, 'ts': 4095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 4000}, {'id': 'a', 'seq': 5, 'ts': 5504}, {'id': 'b', 'seq': 6, 'ts': 6600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 4, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 9}], [{'nonce': 'n1', 'created': -1}, {'nonce': 'n2', 'created': 11}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 5100}, {'nonce': 'aa', 'created': 5900}, {'nonce': 'mm', 'created': 5200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c4', 'seq': 4, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c4', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b4', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b4'])], 5: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 5050}, {'id': 'm1', 'seq': 1, 'ts': 5090}, {'id': 'm3', 'seq': 3, 'ts': 5095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 5000}, {'id': 'a', 'seq': 5, 'ts': 6505}, {'id': 'b', 'seq': 6, 'ts': 7600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 5, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 10}], [{'nonce': 'n1', 'created': 0}, {'nonce': 'n2', 'created': 12}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 6100}, {'nonce': 'aa', 'created': 6900}, {'nonce': 'mm', 'created': 6200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c5', 'seq': 5, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c5', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b5', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b5'])]}
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
skewed edge timestamps['m2', 'm1', 'm3']['m1', 'm2', 'm3']Failed
redelivery through another gateway['a', 'b']['a', 'b']Passed
echo of an older send['x', 'y', 'local:n2']['x', 'y', 'local:n2']Passed
pending within one second['local:zz', 'local:mm', 'local:aa']['local:zz', 'local:mm', 'local:aa']Passed
confirmed then pending['c1', 'local:p']['c1', 'local:p']Passed
empty conversation[][]Passed
equal creation times['k', 'local:a', 'local:b1']['k', 'local:a', 'local:b1']Passed

SHA-256 / 94b189052c536e73b47161dae3b1a3e15e358f1f7a747f8ed7e38760df02b37a

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(confirmed, pending):
    seen = set()
    rows = []
    for m in sorted(confirmed, key=lambda m: (m['ts'], m['seq'])):
        key = m['seq']
        if key in seen:
            continue
        seen.add(key)
        rows.append(m)
    echoed = {m['nonce'] for m in rows if m.get('nonce')}
    tail = sorted((p for p in pending if p['nonce'] not in echoed), key=lambda p: (p['created'], p['nonce']))
    return [m['id'] for m in rows] + ['local:' + p['nonce'] for p in tail]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 1050}, {'id': 'm1', 'seq': 1, 'ts': 1090}, {'id': 'm3', 'seq': 3, 'ts': 1095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 1000}, {'id': 'a', 'seq': 5, 'ts': 2501}, {'id': 'b', 'seq': 6, 'ts': 3600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 1, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 6}], [{'nonce': 'n1', 'created': -4}, {'nonce': 'n2', 'created': 8}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 2100}, {'nonce': 'aa', 'created': 2900}, {'nonce': 'mm', 'created': 2200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c1', 'seq': 1, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c1', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b1', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b1'])], 2: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 2050}, {'id': 'm1', 'seq': 1, 'ts': 2090}, {'id': 'm3', 'seq': 3, 'ts': 2095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 2000}, {'id': 'a', 'seq': 5, 'ts': 3502}, {'id': 'b', 'seq': 6, 'ts': 4600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 2, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 7}], [{'nonce': 'n1', 'created': -3}, {'nonce': 'n2', 'created': 9}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 3100}, {'nonce': 'aa', 'created': 3900}, {'nonce': 'mm', 'created': 3200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c2', 'seq': 2, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c2', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b2', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b2'])], 3: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 3050}, {'id': 'm1', 'seq': 1, 'ts': 3090}, {'id': 'm3', 'seq': 3, 'ts': 3095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 3000}, {'id': 'a', 'seq': 5, 'ts': 4503}, {'id': 'b', 'seq': 6, 'ts': 5600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 3, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 8}], [{'nonce': 'n1', 'created': -2}, {'nonce': 'n2', 'created': 10}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 4100}, {'nonce': 'aa', 'created': 4900}, {'nonce': 'mm', 'created': 4200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c3', 'seq': 3, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c3', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b3', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b3'])], 4: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 4050}, {'id': 'm1', 'seq': 1, 'ts': 4090}, {'id': 'm3', 'seq': 3, 'ts': 4095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 4000}, {'id': 'a', 'seq': 5, 'ts': 5504}, {'id': 'b', 'seq': 6, 'ts': 6600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 4, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 9}], [{'nonce': 'n1', 'created': -1}, {'nonce': 'n2', 'created': 11}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 5100}, {'nonce': 'aa', 'created': 5900}, {'nonce': 'mm', 'created': 5200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c4', 'seq': 4, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c4', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b4', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b4'])], 5: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 5050}, {'id': 'm1', 'seq': 1, 'ts': 5090}, {'id': 'm3', 'seq': 3, 'ts': 5095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 5000}, {'id': 'a', 'seq': 5, 'ts': 6505}, {'id': 'b', 'seq': 6, 'ts': 7600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 5, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 10}], [{'nonce': 'n1', 'created': 0}, {'nonce': 'n2', 'created': 12}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 6100}, {'nonce': 'aa', 'created': 6900}, {'nonce': 'mm', 'created': 6200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c5', 'seq': 5, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c5', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b5', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b5'])]}
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
skewed edge timestamps['m2', 'm1', 'm3']['m1', 'm2', 'm3']Failed
redelivery through another gateway['a', 'b']['a', 'b']Passed
echo of an older send['x', 'y', 'local:n2']['x', 'y', 'local:n2']Passed
pending within one second['local:zz', 'local:mm', 'local:aa']['local:zz', 'local:mm', 'local:aa']Passed
confirmed then pending['c1', 'local:p']['c1', 'local:p']Passed
empty conversation[][]Passed
equal creation times['k', 'local:a', 'local:b1']['k', 'local:a', 'local:b1']Passed

SHA-256 / 76c2c29c9f3ae082fd023eccc7bff43c136e31946a06439b394d68d32bb54a80

3 / The verified repair

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

N = 1
observations = []
def solve(confirmed, pending):
    seen = set()
    rows = []
    for m in sorted(confirmed, key=lambda m: m['seq']):
        key = m['seq']
        if key in seen:
            continue
        seen.add(key)
        rows.append(m)
    echoed = {m['nonce'] for m in rows if m.get('nonce')}
    tail = sorted((p for p in pending if p['nonce'] not in echoed), key=lambda p: (p['created'], p['nonce']))
    return [m['id'] for m in rows] + ['local:' + p['nonce'] for p in tail]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 1050}, {'id': 'm1', 'seq': 1, 'ts': 1090}, {'id': 'm3', 'seq': 3, 'ts': 1095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 1000}, {'id': 'a', 'seq': 5, 'ts': 2501}, {'id': 'b', 'seq': 6, 'ts': 3600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 1, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 6}], [{'nonce': 'n1', 'created': -4}, {'nonce': 'n2', 'created': 8}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 2100}, {'nonce': 'aa', 'created': 2900}, {'nonce': 'mm', 'created': 2200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c1', 'seq': 1, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c1', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b1', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b1'])], 2: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 2050}, {'id': 'm1', 'seq': 1, 'ts': 2090}, {'id': 'm3', 'seq': 3, 'ts': 2095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 2000}, {'id': 'a', 'seq': 5, 'ts': 3502}, {'id': 'b', 'seq': 6, 'ts': 4600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 2, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 7}], [{'nonce': 'n1', 'created': -3}, {'nonce': 'n2', 'created': 9}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 3100}, {'nonce': 'aa', 'created': 3900}, {'nonce': 'mm', 'created': 3200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c2', 'seq': 2, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c2', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b2', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b2'])], 3: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 3050}, {'id': 'm1', 'seq': 1, 'ts': 3090}, {'id': 'm3', 'seq': 3, 'ts': 3095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 3000}, {'id': 'a', 'seq': 5, 'ts': 4503}, {'id': 'b', 'seq': 6, 'ts': 5600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 3, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 8}], [{'nonce': 'n1', 'created': -2}, {'nonce': 'n2', 'created': 10}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 4100}, {'nonce': 'aa', 'created': 4900}, {'nonce': 'mm', 'created': 4200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c3', 'seq': 3, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c3', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b3', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b3'])], 4: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 4050}, {'id': 'm1', 'seq': 1, 'ts': 4090}, {'id': 'm3', 'seq': 3, 'ts': 4095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 4000}, {'id': 'a', 'seq': 5, 'ts': 5504}, {'id': 'b', 'seq': 6, 'ts': 6600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 4, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 9}], [{'nonce': 'n1', 'created': -1}, {'nonce': 'n2', 'created': 11}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 5100}, {'nonce': 'aa', 'created': 5900}, {'nonce': 'mm', 'created': 5200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c4', 'seq': 4, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c4', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b4', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b4'])], 5: [('skewed edge timestamps', ([{'id': 'm2', 'seq': 2, 'ts': 5050}, {'id': 'm1', 'seq': 1, 'ts': 5090}, {'id': 'm3', 'seq': 3, 'ts': 5095}], []), ['m1', 'm2', 'm3']), ('redelivery through another gateway', ([{'id': 'a', 'seq': 5, 'ts': 5000}, {'id': 'a', 'seq': 5, 'ts': 6505}, {'id': 'b', 'seq': 6, 'ts': 7600}], []), ['a', 'b']), ('echo of an older send', ([{'id': 'x', 'seq': 1, 'ts': 5, 'nonce': 'n1'}, {'id': 'y', 'seq': 2, 'ts': 10}], [{'nonce': 'n1', 'created': 0}, {'nonce': 'n2', 'created': 12}]), ['x', 'y', 'local:n2']), ('pending within one second', ([], [{'nonce': 'zz', 'created': 6100}, {'nonce': 'aa', 'created': 6900}, {'nonce': 'mm', 'created': 6200}]), ['local:zz', 'local:mm', 'local:aa']), ('confirmed then pending', ([{'id': 'c5', 'seq': 5, 'ts': 10}], [{'nonce': 'p', 'created': 3}]), ['c5', 'local:p']), ('empty conversation', ([], []), []), ('equal creation times', ([{'id': 'k', 'seq': 9, 'ts': 1, 'nonce': 'q'}], [{'nonce': 'b5', 'created': 7}, {'nonce': 'a', 'created': 7}]), ['k', 'local:a', 'local:b5'])]}
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
skewed edge timestamps['m1', 'm2', 'm3']['m1', 'm2', 'm3']Passed
redelivery through another gateway['a', 'b']['a', 'b']Passed
echo of an older send['x', 'y', 'local:n2']['x', 'y', 'local:n2']Passed
pending within one second['local:zz', 'local:mm', 'local:aa']['local:zz', 'local:mm', 'local:aa']Passed
confirmed then pending['c1', 'local:p']['c1', 'local:p']Passed
empty conversation[][]Passed
equal creation times['k', 'local:a', 'local:b1']['k', 'local:a', 'local:b1']Passed

SHA-256 / d651b00fbfb869e50b73cd522cbf91b22092e872cbc5d8983f07290312d640ab

Verification & scope

Stipulated offline chat model; not a complete messaging protocol, client or server implementation. 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:10.585010+00:00.

Case digest / fcaee24da0ef43452c92e88cb89f2155dcf9248795a3bf93271921f2c5fab8b6