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-11-30] Chat not loading after redirection from OldDot #31498

Closed
1 of 6 tasks
francoisl opened this issue Nov 17, 2023 · 24 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@francoisl
Copy link
Contributor

francoisl commented Nov 17, 2023

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: v1.4.0-3
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): N/A
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by:
Slack conversation:

Context

We're testing a feature to redirect users that sign up on Expensify Classic (OldDot) to New Expensify. Sometimes, upon being redirected to NewDot, the app doesn't fully load, and the chat view shows the loading animation.

Action Performed:

  1. Open staging.expensify.com
  2. Click on "Email" > enter any email address from a public domain that +classicredirect (that's what enables the redirection for now, while we test). For example: [email protected] > click Next > Join
  3. At that point you'll be redirected to NewDot, and the app should load on the Concierge chat. Sometimes, the Concierge chat doesn't get displayed

The issue doesn't always happen (maybe 1 in 10 times in my personal experience), so you might have to test multiple times in a row with different accounts.

Expected Result:

The Concierge chat should be displayed.

Actual Result:

The Concierge chat is not displayed, there's a loading animation in the chat view instead.

Workaround:

Platforms:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

redirect1.mov

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @kevinksullivan
@francoisl francoisl added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 17, 2023
Copy link

melvin-bot bot commented Nov 17, 2023

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

Copy link

melvin-bot bot commented Nov 17, 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

@koko57
Copy link
Contributor

koko57 commented Nov 17, 2023

I can help with this issue 🙂

@danielrvidal
Copy link
Contributor

@koko57 let us know how we can help diagnose! We're trying to get this one cleared asap.

@roryabraham roryabraham self-assigned this Nov 18, 2023
@roryabraham
Copy link
Contributor

The problem appears to be LogOutPreviousUserPage. If the user wasn't already signed in with a different account, and the page is missing the shouldForceLogin route param, it will just display a spinner forever. Unless I'm missing something this seems like the problem?

@roryabraham
Copy link
Contributor

There are two places in OldDot PHP where this redirection happens AFAICT:

And in neither case is shouldForceLogin included in the URL

@roryabraham
Copy link
Contributor

This is very consistently reproducible for me if you sign in as a new user on OldDot without being signed in to an account on NewDot

@roryabraham
Copy link
Contributor

Ok, I think I've figured out the race condition at play here...

"Happy" path (haven't observed yet)

  1. Redirect from OldDot
  2. PublicScreens mounts.
  3. LoginWithShortLivedAuthToken page renders:
    <RootStack.Screen
    name={SCREENS.TRANSITION_BETWEEN_APPS}
    options={defaultScreenOptions}
    component={LogInWithShortLivedAuthTokenPage}
    />
  4. Session.signInWithShortLivedAuthToken happens
  5. Sign in completes and LoginWithShortLivedAuthToken page renders again, the useEffect runs, and exitTo navigation happens. Note: I think there are potentially multiple reasons this might not happen:
    • As soon as sign-in completes, the PublicScreens will unmount and AuthScreens will mount. I think that consistently happens before LoginWithShortLivedAuthToken re-renders, because it's further up the tree
    • There's nothing in the props.route that will change as a result of calling Session.signInWithShortLivedAuthToken. So even if the component re-renders, the useEffect won't

What actually happens 100% of the time AFAICT

  1. Redirect from OldDot
  2. PublicScreens mounts
  3. LoginWithShortLivedAuthToken page renders:
    <RootStack.Screen
    name={SCREENS.TRANSITION_BETWEEN_APPS}
    options={defaultScreenOptions}
    component={LogInWithShortLivedAuthTokenPage}
    />
  4. Session.signInWithShortLivedAuthToken happens
  5. PublicScreens unmounts and AuthScreens mounts.
  6. LogOutPreviousUserPage renders
    1. [this redundant call to Session.signOutAndRedirectToSignIn() never happens (which, we don't want it to happen anyways...)
    2. shouldForceLogin is false.
    3. So literally nothing else happens and we get an infinite spinner

@roryabraham
Copy link
Contributor

Quick and dirty fix: #31522

However, I think that some work to clean up and simplify this flow would be valuable. We can have only one transition page that works if a user is:

  1. Already signed in
  2. Signed in to the wrong account
  3. Provided an exitTo, or not
  4. etc...

and then we could create E2E tests for all those flows. I noticed a number of redundancies and seemingly unnecessary complexities while looking through this code.

@quinthar
Copy link
Contributor

If this issue only happens when you're already signed in, I think this isn't a blocker

@koko57
Copy link
Contributor

koko57 commented Nov 20, 2023

tried to reproduce the bug many times (with changing the network throttling, being logged in as another user or logged out) but I couldn't reproduce it even once.

I think Rory's right - the user is stuck on LogOutPreviousUserPage.

@koko57
Copy link
Contributor

koko57 commented Nov 20, 2023

@roryabraham in what scenarios shouldForceLogin is sent with the URL?

@roryabraham
Copy link
Contributor

roryabraham commented Nov 21, 2023

All that's left here is C+ payment to @allroundexperts for the PR

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Nov 23, 2023
@melvin-bot melvin-bot bot changed the title Chat not loading after redirection from OldDot [HOLD for payment 2023-11-30] Chat not loading after redirection from OldDot Nov 23, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 23, 2023
Copy link

melvin-bot bot commented Nov 23, 2023

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

Copy link

melvin-bot bot commented Nov 23, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.2-3 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-11-30. 🎊

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:

  • @koko57 does not require payment (Contractor)
  • @allroundexperts does not require payment (Eligible for Manual Requests)

Copy link

melvin-bot bot commented Nov 23, 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:

  • [@allroundexperts] The PR that introduced the bug has been identified. Link to the PR:
  • [@allroundexperts] 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:
  • [@allroundexperts] 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:
  • [@allroundexperts] Determine if we should create a regression test for this bug.
  • [@allroundexperts] 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.
  • [@kevinksullivan] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot removed the Weekly KSv2 label Nov 30, 2023
Copy link

melvin-bot bot commented Dec 5, 2023

@kevinksullivan, @koko57, @allroundexperts, @roryabraham Eep! 4 days overdue now. Issues have feelings too...

1 similar comment
Copy link

melvin-bot bot commented Dec 6, 2023

@kevinksullivan, @koko57, @allroundexperts, @roryabraham Eep! 4 days overdue now. Issues have feelings too...

Copy link

melvin-bot bot commented Dec 8, 2023

@kevinksullivan, @koko57, @allroundexperts, @roryabraham Still overdue 6 days?! Let's take care of this!

@roryabraham
Copy link
Contributor

Friendly bump to process payment here @kevinksullivan

@kevinksullivan
Copy link
Contributor

kevinksullivan commented Dec 11, 2023

Ah it's just @allroundexperts , so summarizing payment:

@allroundexperts
Copy link
Contributor

@kevinksullivan I think it should be $500.

@kevinksullivan
Copy link
Contributor

Thanks @allroundexperts , I'll let you submit the request and close this out.

@JmillsExpensify
Copy link

$500 payment to @allroundexperts based on summary above.

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
Projects
None yet
Development

No branches or pull requests

9 participants