Log event listener errors and keep network noise out of the log ring
A basic group in a live tab stopped showing new messages. Four messages (one with a link, then a read and three replies from another session of the same account) were in the message storage and at the head of the bottom-end history slice, but the dialog's top_message, the history's maxId and read_inbox_max_id stayed on the message before. The chat opens at maxId, so nothing new was shown, and reloading the page did not help: the SharedWorker kept the state and IndexedDB had it persisted. The cause was not established. The read handler writes read_inbox_max_id unconditionally, so none of those updates reached their handlers, or a handler threw, and neither left a trace. EventListenerBase swallowed an exception thrown by a listener without a word. The other listeners still run, but it is logged now ([EVENTS] listener error) to the console and to downloadLogs(). The networkers log every ping, ack and resend, so the worker's log ring held about three minutes and nothing of the incident was left by the time it was looked at. Their entries (prefix -NET-) go to a ring of their own; getLogEntries merges both by time. fillHistoryStorage raised maxId only for a result that is the bottom end. A result that is not (offset_id_offset 5 with 4 newer messages, as the server answered for that group) still extends the bottom-end slice upward when it overlaps its top, and those messages stayed above maxId. maxId now follows the slice and the dialog is reloaded, as it is for a bottom-end result. basicGroupOfflineGap replays the incident against the server with three clients (the web client, another session of the same account, the other member), both live and missed-then-getDifference; both converge. So did differenceTooLong in a signed-in preview with the chat open in a custom folder. None of them reproduced it. Verified on this tree alone (the checkout carries unrelated work): tsc, lint, the full unit suite; the new fill test fails without the fix. The e2e ran against the server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
E
Eduard Kuzmenko committed
5d765837788a20d53072ecb922067993aaa5e373
Parent: a3f94ab