App icon indicating copy to clipboard operation
App copied to clipboard

HIGH: [UX Reliability] [$500] Random empty chats are showing in LHN in focus mode

Open m-natarajan opened this issue 11 months ago • 48 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: Reproducible in staging?: needs reproduction Reproducible in production?: needs reproduction If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @davidcardoza Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1709737869001459

Action Performed:

  1. Open app and sign in with an account with preference set focus
  2. Look at the LHN

Expected Result:

Should not display any random emptychats

Actual Result:

10s of random empty state chats in the LHN, with no way to remove the chats from the LHN view Note: They seems to be the members of the workspace room I am in

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • [ ] Android: Native
  • [ ] Android: mWeb Chrome
  • [ ] iOS: Native
  • [ ] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [ ] MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence image (1)

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~011e45e5cf4631d0fd
  • Upwork Job ID: 1768690919242297344
  • Last Price Increase: 2024-04-11
  • Automatic offers:
    • s77rt | Reviewer | 0
    • tienifr | Contributor | 0

m-natarajan avatar Mar 15 '24 02:03 m-natarajan

Triggered auto assignment to @CortneyOfstad (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

melvin-bot[bot] avatar Mar 15 '24 02:03 melvin-bot[bot]

I was also experienced this yesterday — getting eyes on this!

Clicking into those blank chats, did remove them, but their creation was unnecessary at least in terms of what I could see in-product

CortneyOfstad avatar Mar 15 '24 17:03 CortneyOfstad

Job added to Upwork: https://www.upwork.com/jobs/~011e45e5cf4631d0fd

melvin-bot[bot] avatar Mar 15 '24 17:03 melvin-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt (External)

melvin-bot[bot] avatar Mar 15 '24 17:03 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

10s of random empty state chats in the LHN, with no way to remove the chats from the LHN view Note: They seems to be the members of the workspace room I am in

What is the root cause of that problem?

In here, if the user is in GSD mode, the "unread" report will always show in LHN, even if it's empty.

That's because the "excluding empty chats" condition is below, in here. So when we detect that the user is in focus mode and the report is unread, we already early return here without considering if the report is empty.

That's why the empty chats will show in LHN in focus mode, but not in default mode.

Now let's look at the isUnread method to check if the report is unread, we're comparing the lastReadTime and lastVisibleActionCreated here, if lastReadTime is less than lastVisibleActionCreated, the report is considered unread. However this didn't take into account the case where it's an empty report and the user never read it. In this case lastReadTime is empty (since the user didn't read it), the lastVisibleActionCreated will be the time the report is created, so lastReadTime is always less than lastVisibleActionCreated and the report is considered unread, while there's nothing in it to be read.

What changes do you think we should make in order to solve the problem?

We should add non-empty chat check to isUnread here. The empty chat check logic can be taken from here. This way, we'll make sure only report that is non-empty can be "unread"

What alternative solutions did you explore? (Optional)

There're other ways to check if the report is empty as well, like checking the length of the chat's reportActions, or check if the reportActions contains only the report creation action.

Also, an alternative solution is:

  • Move the "excluding empty chats" condition here to above the "unread report condition" here.
  • We should double check the conditions below the unread condition as well to make sure that's the order we wanted.

tienifr avatar Mar 16 '24 09:03 tienifr

@tienifr Thanks for the proposal. Your RCA is not correct.

the "unread" report will always show in LHN, even if it's empty

An empty report should not be considered as unread in the first place (there is nothing unread about it)

s77rt avatar Mar 16 '24 16:03 s77rt

@m-natarajan I have a bit of a hard time reproducing this issue. Do you mind sharing a little more about how you achieved this?

Here's what I did to reproduce this issue:

  1. login
  2. go to profile -> preferences -> priority mode
  3. switch priority mode to "#focus"
  4. return to chat

I do have 3-4 chats with other sub-accounts which are empty. As expected, they are not showing up. Only if I create a new chat I see this one empty. As expected, it is hidden as soon as I leave it.

App Version 1.4.53-2

jhohlfeld avatar Mar 16 '24 19:03 jhohlfeld

📣 @jhohlfeld! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Mar 16 '24 19:03 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0137c55e8ae1d137a8

jhohlfeld avatar Mar 16 '24 19:03 jhohlfeld

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Mar 16 '24 19:03 melvin-bot[bot]

@s77rt Thanks for your feedback!

Proposal updated with revised RCA and solution

tienifr avatar Mar 18 '24 11:03 tienifr

@tienifr Thanks for the update. The RCA makes sense and so the solution. Is there a specific case where lastReadTime is empty? (I'm not able to reproduce the bug)

s77rt avatar Mar 18 '24 23:03 s77rt

@tienifr Thanks for the update. The RCA makes sense and so the solution. Is there a specific case where lastReadTime is empty? (I'm not able to reproduce the bug)

@s77rt Please try the following steps:

  1. Logged in as user A
  2. Logged in as user B in another browser
  3. As user B, creates a new empty chat with user A (don't send any message).
  4. As user A, follows the steps in the OP. The report in 3 will show up in user A side with lastReadTime empty (because user A never opens that report) -> the bug happens for user A

tienifr avatar Mar 19 '24 04:03 tienifr

Not really able to reproduce, always getting the lastReadTime same as the lastVisibleActionCreated.

Regarding the unread logic, I have asked in Slack to confirm the expected behaviour in such cases https://expensify.slack.com/archives/C01GTK53T8Q/p1710865076998169

s77rt avatar Mar 19 '24 16:03 s77rt

Not really able to reproduce, always getting the lastReadTime same as the lastVisibleActionCreated.

@s77rt Did you make sure not to open the chat as user A? If you opened it at any point in time, the report will have lastReadTime

tienifr avatar Mar 19 '24 17:03 tienifr

Yes, I even tried creating a chat while signed out. After signing in I still find lastReadTime set. Probably getting the report via pusher, not sure why the last read time is set though. In any case we shall confirm the unread expected behaviour maybe it's expected that new chats appear as unread? (slack thread)

s77rt avatar Mar 20 '24 02:03 s77rt

In any case we shall confirm the unread expected behaviour maybe it's expected that new chats appear as unread? (slack thread)

@s77rt Looks like everyone agrees that the new chats should not appear.

Probably getting the report via pusher, not sure why the last read time is set though.

I tried again today and it looks like the lastReadTime is now set randomly, sometimes it's before lastVisibleActionCreated, sometimes slightly after. It shouldn't be there though since the user didn't read the report at all.

I shouldn't affect the solution here though. Do you think we can move forward?

tienifr avatar Mar 21 '24 16:03 tienifr

@tienifr Often the best thing to do is nothing. Perhaps this is no longer reproducible.

s77rt avatar Mar 21 '24 21:03 s77rt

@m-natarajan Can you please retest if this is still reproducible from your end?

s77rt avatar Mar 21 '24 21:03 s77rt

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Mar 22 '24 16:03 melvin-bot[bot]

@m-natarajan, based on the comment here, can you test to see if this is still reproducible by EOD? Thanks!

CortneyOfstad avatar Mar 22 '24 16:03 CortneyOfstad

@m-natarajan bump on the above ^^ thanks!

CortneyOfstad avatar Mar 25 '24 14:03 CortneyOfstad

Issue not reproducible during KI retests. (First week)

mvtglobally avatar Mar 28 '24 04:03 mvtglobally

Can we close this for now and reopen if this resurface again?

s77rt avatar Mar 28 '24 12:03 s77rt

Sounds good @s77rt 👍

CortneyOfstad avatar Mar 28 '24 19:03 CortneyOfstad

Can we close this for now and reopen if this resurface again?

@CortneyOfstad Please help reopen this issue, this is occurring again here https://github.com/Expensify/App/issues/39558

cc @s77rt

tienifr avatar Apr 08 '24 16:04 tienifr

Agreed. Let's reopen this

s77rt avatar Apr 08 '24 21:04 s77rt

@CortneyOfstad Could you help reopen this issue as per discussion above? Thanks!

tienifr avatar Apr 11 '24 07:04 tienifr

Sorry about that! Reopening now!

CortneyOfstad avatar Apr 11 '24 13:04 CortneyOfstad

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Apr 11 '24 16:04 melvin-bot[bot]