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

[HOLD for payment 2023-10-13] [$500] mWeb-Conversation-User A in offline typing message, User B is shown "user A is typing" #28063

Closed
2 of 6 tasks
izarutskaya opened this issue Sep 23, 2023 · 30 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Sep 23, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. As user A, tap profile- Preferences
  3. Toggle on forced offline
  4. Open 1:1 with user B
  5. In other device, as user B, open 1:1 with user A
  6. As user A, in offline type messages to user B and note user B conversation page

Expected Result:

User A in offline typing message, User B must not be shown "user A is typing" in conversation page.

Actual Result:

User A in offline typing message, User B is shown "user A is typing" in conversation page.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.73-0

Reproducible in staging?: Y

Reproducible in production?: No "Force offline" mode

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

Notes/Photos/Videos: Any additional supporting documentation

Bug6211463_2user_shown_user_a_typing.mp4
Bug6211463_offline_android_user_a_typing_shown_to_userb.mp4
Bug6211463_1offline_mweb.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause-Internal Team

Slack conversation: @

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01650cee09674fc251
  • Upwork Job ID: 1707005436379205632
  • Last Price Increase: 2023-09-27
@izarutskaya izarutskaya added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 23, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 23, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@OSBotify
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@melvin-bot
Copy link

melvin-bot bot commented Sep 23, 2023

Triggered auto assignment to @joelbettner (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@akinwale
Copy link
Contributor

akinwale commented Sep 23, 2023

Proposal

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

The "user is typing" event is broadcasted by a user's client even if the client has force offline mode enabled.

What is the root cause of that problem?

Pusher sends socket events even if force offline mode is enabled.

function sendEvent(channelName, eventName, payload) {
// Check to see if we are subscribed to this channel before sending the event. Sending client events over channels
// we are not subscribed too will throw errors and cause reconnection attempts. Subscriptions are not instant and
// can happen later than we expect.
if (!isSubscribed(channelName)) {
return;
}
socket.send_event(eventName, payload, channelName);
}

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

Solution 1
Similar to what we have in the bindEventToChannel method, modify the sendEvent method to perform an early return if shouldForceOffline is true.

function sendEvent(channelName, eventName, payload) {
    // Check to see if we are subscribed to this channel before sending the event. Sending client events over channels
    // we are not subscribed too will throw errors and cause reconnection attempts. Subscriptions are not instant and
    // can happen later than we expect.
    if (!isSubscribed(channelName)) {
        return;
    }

+    if (shouldForceOffline) {
+        Log.info('[Pusher] Ignoring a send event because shouldForceOffline = true');
+        return;
+    }

   // ... rest of the method
}

Solution 2
In ReportActionsView, add a useEffect hook to unsubscribe to the pusher channel based on the network.isOffline prop. This, however does not cover all possible pusher events, so Solution 1 is preferable.

const subscribeToReportTypingEvents = () => {
    const didCreateReportSuccessfully = !props.report.pendingFields || (!props.report.pendingFields.addWorkspaceRoom && !props.report.pendingFields.createChat);
    if (!didSubscribeToReportTypingEvents.current && didCreateReportSuccessfully) {
        Report.subscribeToReportTypingEvents(reportID);
        didSubscribeToReportTypingEvents.current = true;
    }
}

useEffect(() => {
    if (network.isOffline) {
        Report.unsubscribeFromReportChannel(reportID);
        didSubscribeToReportTypingEvents.current = true;
        return;
    }
    
    subscribeToReportTypingEvents();
}, [network.isOffline, reportID]);

What alternative solutions did you explore? (Optional)

None.

@joelbettner
Copy link
Contributor

I don't think this is an hourly, since I believe this will only ever happen on staging (I THINK we always hide the TestToolMenu in production...I could be wrong). I don't think this was caused by the recent deploy. I think this has been happening ever since we introduced the Force Offline mode. @izarutskaya is this something that you just came across, or is this test something that happens at every deploy?

@neil-marcellini @roryabraham it looks like you are the two fellas who have the most background in the Force Offline mode. Care to weigh in here?

@mountiny mountiny added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Sep 25, 2023
@mountiny
Copy link
Contributor

Correct, I agree this is not a deploy blocker, also I think @neil-marcellini knows about this problem from before, I believe I remember some slack thread about this specifically.

@melvin-bot melvin-bot bot added the Overdue label Sep 27, 2023
@izarutskaya
Copy link
Author

No, we do not this test at every deploy. This was discovered during another test. Thank you

@NicMendonca NicMendonca added the External Added to denote the issue can be worked on by a contributor label Sep 27, 2023
@melvin-bot melvin-bot bot changed the title mWeb-Conversation-User A in offline typing message, User B is shown "user A is typing" [$500] mWeb-Conversation-User A in offline typing message, User B is shown "user A is typing" Sep 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 27, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01650cee09674fc251

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 27, 2023

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

@NicMendonca
Copy link
Contributor

^ setting as external

@melvin-bot melvin-bot bot removed the Overdue label Sep 27, 2023
@JawadSadiq01
Copy link

JawadSadiq01 commented Sep 27, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.
Conversation-User A in offline typing message, User B is shown "user A is typing".

What is the root cause of that problem?
When "User A" types a message, there is no code that checks either he had activated the Force Offline. After Force Offline activation, when "User A" types message, then on each character typing, an event "debouncedBroadcastUserIsTyping" triggers. After this event triggering, the "USER B" sees that "USER A" is typing.

What changes do you think we should make in order to solve the problem?
You just need to prevent the call of "debouncedBroadcastUserIsTyping", when he set Force Offline.
Just add the below code in ComposerWithSuggestions.js file.

Please see the attachments below, for knowing where to add the below code in ComposerWithSuggestions.js file.

let isForcedOffline = false;

Onyx.connect({
    key: ONYXKEYS.NETWORK,
    callback: (val) => {
        isForcedOffline = val && val.isOffline;
    },
});

On ComposerWithSuggestions.js#216, update the if condition like below

if (newComment && !isForcedOffline) {
   debouncedBroadcastUserIsTyping(reportID);
}
image image

Video Recording
https://drive.google.com/file/d/1G6wSTFZfK1qvSyK2CcB4L4DEIZ_e6WWK/view?usp=drivesdk

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 3, 2023

❌ There was an error making the offer to @ntdiary for the Reviewer role. The BZ member will need to manually hire the contributor. cc @thienlnam

@melvin-bot
Copy link

melvin-bot bot commented Oct 3, 2023

❌ There was an error making the offer to @akinwale for the Contributor role. The BZ member will need to manually hire the contributor. cc @thienlnam

@akinwale
Copy link
Contributor

akinwale commented Oct 4, 2023

@ntdiary My PR is ready for review. Thanks.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 6, 2023
@melvin-bot melvin-bot bot changed the title [$500] mWeb-Conversation-User A in offline typing message, User B is shown "user A is typing" [HOLD for payment 2023-10-13] [$500] mWeb-Conversation-User A in offline typing message, User B is shown "user A is typing" Oct 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.78-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-10-13. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

For reference, here are some details about the assignees on this issue:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@akinwale / @ntdiary] The PR that introduced the bug has been identified. Link to the PR:
  • [@akinwale / @ntdiary] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@akinwale / @ntdiary] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@akinwale / @ntdiary] Determine if we should create a regression test for this bug.
  • [@akinwale / @ntdiary] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@NicMendonca] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 12, 2023
@NicMendonca
Copy link
Contributor

NicMendonca commented Oct 13, 2023

@akinwale @ntdiary bump on BZ check list ^^

Also can you both apply to the job please? https://www.upwork.com/jobs/~01650cee09674fc251

@akinwale
Copy link
Contributor

@akinwale @ntdiary bump on BZ check list ^^

Also can you both apply to the job please? https://www.upwork.com/jobs/~01650cee09674fc251

Applied. Thanks!

I believe it's the C+ that's supposed to complete the BZ check list. Weird that my name is in there. 😅

@ntdiary
Copy link
Contributor

ntdiary commented Oct 13, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

I believe it's the C+ that's supposed to complete the BZ check list. Weird that my name is in there. 😅

I guess it's because you are already in C+ as well. 😄

@NicMendonca
Copy link
Contributor

Payment summary:

Reporter: N/A
Contributor: @akinwale - $750 (paid via upwork)
Contributor +: @ntdiary - $750 (paid via upwork)

@NicMendonca
Copy link
Contributor

Sent you both an offer!

@akinwale
Copy link
Contributor

Sent you both an offer!

Accepted. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Oct 16, 2023
@NicMendonca
Copy link
Contributor

both paid, thank you!

@melvin-bot melvin-bot bot removed the Overdue label Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

9 participants