A decade ago, in 2014 some guy named Jeff Tweeted1:
There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors.
Well, somehow this seems applicable here:
The notification counter tells me I have 3 unread notifications. But as you can see in the list, there are 4 that I have not read. The rest below are indeed read, so the count is exactly off-by-one.
This is not because I left a page open and the socket died in the mean time (which usually leaves a disparity between counter and actual inbox messages). This is persistent - the screenshot I took was after reloading the page. I have also tried hard reloading the page as well and doing multiple reloads. It is the same result on any page I try.
In fact, since I started writing this bug report, I got one new message. I have yet to click on any of the others, so the counter now shows 4 but there are 5 things unread (same 4 as before + 1 new one).
Since then, I tried marking the notifications read one by one until I got no counter and yet one of them unread:
Finally, I marked the last one as read and...I am owed an inbox message, I think:
The "refresh" link claims that if I click it, I would get negative one new notifications.
After some experimentation: chat notifications do not add to the counter. Marking them as read still subtracts from the counter.
This is exactly what caused it - in the screenshot I do have a chat reply which is the off-by-one error.
This also means that if you only have new notifications that came from chat, you would never be able to tell until you open the inbox and see them.
1 for the record, that was not original but it is how I first became aware of the quote. Also, felt appropriate to use that exact source.


