Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications can leave a ghostly heading-notification behind #5119

Closed
gnprice opened this issue Nov 10, 2021 · 0 comments
Closed

Notifications can leave a ghostly heading-notification behind #5119

gnprice opened this issue Nov 10, 2021 · 0 comments

Comments

@gnprice
Copy link
Member

gnprice commented Nov 10, 2021

This is an issue that doesn't exist in any released version; it was introduced with the spiffy new form of notification in #4842, and I discovered it later yesterday while preparing some refactors to that code after merge.

The repro recipe is:

  • Have notifications active for several conversations in the same account; e.g., have another user send PMs in two different threads.
  • Go read all those conversations at the same time, e.g. by going to the "Private messages" view in the web app.
  • Expected: The notifications disappear.
  • Actual: The notifications for the individual conversations disappear. But an empty shell of a header notification remains. It looks like this screenshot:
    image
    (which was for a previous bug, fixed before merge, that once it was triggered had the same symptom.)

The root of the issue is that in the new removeNotification we're relying on an assumption that the loop looking for notifications to cancel found exactly one such notification. If it found more than that, the code won't realize if the summary notification should also be cancelled.

@gnprice gnprice self-assigned this Nov 10, 2021
gnprice added a commit to gnprice/zulip-mobile that referenced this issue Nov 10, 2021
If the user reads the last messages in several conversations at once,
and those are their only active notifications -- for example, if they
have a couple of recent PMs in different threads, and visit the
"Private messages" view in the web app -- then it looks from the code
here like we'll delete those individual conversations' notifications,
but not the summary for the group, leaving behind a ghost header.

I noticed this just now from reading the code.  I haven't confirmed
empirically that this indeed happens.  If there's a subtle reason
it doesn't, though, we should resolve this TODO by making that clear.

[Added later: Indeed, confirmed this empirically; filed as zulip#5119.]
gnprice added a commit to gnprice/zulip-mobile that referenced this issue Nov 10, 2021
I added this TODO comment a few commits ago, based on studying the
code, and just now I confirmed that the bug happens empirically:
reading several conversations at once can leave behind a ghost group.
There's also a related bug when the user reads a conversation whose
notification has already been dismissed: if there's just one active
notification remaining, we'll end up dismissing the whole group and
that notification with it.

The root cause of both of these is that we're relying on an assumption
that the loop looking for notifications to cancel found exactly one
such notification.  In fact it may have found fewer or more than that.
This can cause this code to leave the summary notification in place
when it should cancel it, and vice versa.

To fix, while we're looping through the notifications in order to
possibly cancel some, we just note whether there are also any (in
the same group) that we aren't cancelling.

Fixes: zulip#5119
Fixes: zulip#5120
gnprice added a commit to gnprice/zulip-mobile that referenced this issue Nov 11, 2021
If the user reads the last messages in several conversations at once,
and those are their only active notifications -- for example, if they
have a couple of recent PMs in different threads, and visit the
"Private messages" view in the web app -- then it looks from the code
here like we'll delete those individual conversations' notifications,
but not the summary for the group, leaving behind a ghost header.

I noticed this just now from reading the code.  I haven't confirmed
empirically that this indeed happens.  If there's a subtle reason
it doesn't, though, we should resolve this TODO by making that clear.

[Added later: Indeed, confirmed this empirically; filed as zulip#5119.]
gnprice added a commit to gnprice/zulip-mobile that referenced this issue Nov 11, 2021
I added this TODO comment a few commits ago, based on studying the
code, and just now I confirmed that the bug happens empirically:
reading several conversations at once can leave behind a ghost group.
There's also a related bug when the user reads a conversation whose
notification has already been dismissed: if there's just one active
notification remaining, we'll end up dismissing the whole group and
that notification with it.

The root cause of both of these is that we're relying on an assumption
that the loop looking for notifications to cancel found exactly one
such notification.  In fact it may have found fewer or more than that.
This can cause this code to leave the summary notification in place
when it should cancel it, and vice versa.

To fix, while we're looping through the notifications in order to
possibly cancel some, we just note whether there are also any (in
the same group) that we aren't cancelling.

Fixes: zulip#5119
Fixes: zulip#5120
gnprice added a commit to gnprice/zulip-mobile that referenced this issue Nov 16, 2021
If the user reads the last messages in several conversations at once,
and those are their only active notifications -- for example, if they
have a couple of recent PMs in different threads, and visit the
"Private messages" view in the web app -- then it looks from the code
here like we'll delete those individual conversations' notifications,
but not the summary for the group, leaving behind a ghost header.

I noticed this just now from reading the code.  I haven't confirmed
empirically that this indeed happens.  If there's a subtle reason
it doesn't, though, we should resolve this TODO by making that clear.

[Added later: Indeed, confirmed this empirically; filed as zulip#5119.]
gnprice added a commit to gnprice/zulip-mobile that referenced this issue Nov 16, 2021
I added this TODO comment a few commits ago, based on studying the
code, and just now I confirmed that the bug happens empirically:
reading several conversations at once can leave behind a ghost group.
There's also a related bug when the user reads a conversation whose
notification has already been dismissed: if there's just one active
notification remaining, we'll end up dismissing the whole group and
that notification with it.

The root cause of both of these is that we're relying on an assumption
that the loop looking for notifications to cancel found exactly one
such notification.  In fact it may have found fewer or more than that.
This can cause this code to leave the summary notification in place
when it should cancel it, and vice versa.

To fix, while we're looping through the notifications in order to
possibly cancel some, we just note whether there are also any (in
the same group) that we aren't cancelling.

Fixes: zulip#5119
Fixes: zulip#5120
gnprice added a commit to gnprice/zulip-mobile that referenced this issue Nov 16, 2021
If the user reads the last messages in several conversations at once,
and those are their only active notifications -- for example, if they
have a couple of recent PMs in different threads, and visit the
"Private messages" view in the web app -- then it looks from the code
here like we'll delete those individual conversations' notifications,
but not the summary for the group, leaving behind a ghost header.

I noticed this just now from reading the code.  I haven't confirmed
empirically that this indeed happens.  If there's a subtle reason
it doesn't, though, we should resolve this TODO by making that clear.

[Added later: Indeed, confirmed this empirically; filed as zulip#5119.]
chetas411 pushed a commit to chetas411/zulip-mobile that referenced this issue Nov 28, 2021
If the user reads the last messages in several conversations at once,
and those are their only active notifications -- for example, if they
have a couple of recent PMs in different threads, and visit the
"Private messages" view in the web app -- then it looks from the code
here like we'll delete those individual conversations' notifications,
but not the summary for the group, leaving behind a ghost header.

I noticed this just now from reading the code.  I haven't confirmed
empirically that this indeed happens.  If there's a subtle reason
it doesn't, though, we should resolve this TODO by making that clear.

[Added later: Indeed, confirmed this empirically; filed as zulip#5119.]
chetas411 pushed a commit to chetas411/zulip-mobile that referenced this issue Nov 28, 2021
I added this TODO comment a few commits ago, based on studying the
code, and just now I confirmed that the bug happens empirically:
reading several conversations at once can leave behind a ghost group.
There's also a related bug when the user reads a conversation whose
notification has already been dismissed: if there's just one active
notification remaining, we'll end up dismissing the whole group and
that notification with it.

The root cause of both of these is that we're relying on an assumption
that the loop looking for notifications to cancel found exactly one
such notification.  In fact it may have found fewer or more than that.
This can cause this code to leave the summary notification in place
when it should cancel it, and vice versa.

To fix, while we're looping through the notifications in order to
possibly cancel some, we just note whether there are also any (in
the same group) that we aren't cancelling.

Fixes: zulip#5119
Fixes: zulip#5120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant