FA-75856 / Chat ordering and read receipts / Open access
Merge server-sequenced messages with local pending sends: pending order · case 01
Unsent messages typed in quick succession appear in random nonce order instead of the order they were written.
ROOT CAUSE
The pending order decision evaluates `key=lambda p: p['nonce']` where the contract requires `key=lambda p: (p['created'], p['nonce'])`.
VERIFIED REPAIR
Use `key=lambda p: (p['created'], p['nonce'])` for the pending order decision and keep every other rule of the model unchanged.
Unsuccessful approach: Ordering by whole seconds still falls back to nonce order for messages written within the same second. The attempted `key=lambda p: (p['created'] // 1000, p['nonce'])` 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['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['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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:aa', 'local:mm', 'local:zz'] | ['local:zz', 'local:mm', 'local:aa'] | Failed |
| 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 / 3cfb11e482b085f02dbd16f58e41a0b0760a0d785c2146b6475b57f8b1064b1c
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['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'] // 1000, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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:aa', 'local:mm', 'local:zz'] | ['local:zz', 'local:mm', 'local:aa'] | Failed |
| 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 / d0569311259ffeaa04ce7114fff0f3b80e02829bec061a1b19fc922a32251587
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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.845628+00:00.
Case digest / e4e12b1dd2fc75330c7d2bc0f22cfcb96aa37aed4be8123a3a62ee659f9f7422