Today I fixed a couple of issues with incorrect new and unread counts.
The fixes themselves though interesting are less interesting than the debugging method I used to track it down.
This is how I diagnosed the issues
Run multiple browser windows and catch one misbehaving
Once I isolated a bad actor
Open chrome dev tools and run:
Then walk through the
Using this information I was able to discover that
When a topic was deleted we were not notifying the topic tracking state about this happening
When we were reporting “unread” “latest” etc we were not informing topic tracking state if the topic at hand was a PM, causing PMs to corrupt the counts
There may be more edge cases here, but that is the general gist of how I debug it.
MessageBus is working like a champion and never dropping messages or corrupting ordering.