-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[PAID, WAITING ON SITU FOR CHECKLIST] [$500] Account - Account is not simultaneously signed out on secondary device when closing account #36632
Comments
Job added to Upwork: https://www.upwork.com/jobs/~011fa63892ed79f932 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan ( |
Triggered auto assignment to @jliexpensify ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.When an account is closed on one device, the account does not simultaneously sign out on a secondary device. Additionally, there is no "Account closed successfully" message displayed under the email input field on the secondary device, and there is an error logged in the console. What is the root cause of that problem?The root cause appears to be a lack of real-time session management across multiple devices. The current system does not seem to notify or force logout on all active sessions once an account is closed. This might be due to the session tokens not being invalidated across the system or the secondary device not polling for session validity in real-time. What changes do you think we should make in order to solve the problem?
What alternative solutions did you explore? (Optional)An alternative approach could involve periodically checking the validity of the session token against the server, but this could introduce unnecessary network requests and latency. Maybe do so but with a max retry count. Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job. |
ProposalPlease re-state the problem that we are trying to solve in this issue.What is the root cause of that problem?1. There is console log errorWhen an account is closed, it will return this Onyx update:
It lacks a key property. This code call includes no null check. Line 491 in 20af9e5
2. Account is not signed out before user interacts with the accountThis process is blocked by the first issue 3. There is no 'Account closed successfully' message under email input fieldThis behavior is blocked by the first issue What changes do you think we should make in order to solve the problem?Add a null check to the key property. Line 491 in 20af9e5
to
Why would adding a null check automatically resolve the second and third issues?This is the updated onyx information from the server on the secondary device:
Clearing the Line 124 in 3e77445
The App/src/libs/Navigation/AppNavigator/index.tsx Lines 24 to 30 in 3e77445
In addition to redirecting, it will also trigger necessary cleaning tasks for sign-out. App/src/libs/Navigation/AppNavigator/AuthScreens.tsx Lines 253 to 258 in 3e77445
Why should we not call the signOut function on a secondary device?It will cause an error as the logout API is cancelled, possibly due to a user's removed object that no longer exists. Is there any difference between signing out from
|
clearCache().then(() => { | |
Log.info('Cleared all cache data', true, {}, true); | |
}); | |
Timing.clearData(); |
To
/**
* Put any logic that needs to run when we are signed out here. This can be triggered when the current tab or another tab signs out.
* - Cancels pending network calls - any lingering requests are discarded to prevent unwanted storage writes
* - Clears all current params of the Home route - the login page URL should not contain any parameter
*/
function cleanupSession() {
Pusher.disconnect();
Timers.clearAll();
Welcome.resetReadyCheck();
PriorityMode.resetHasReadRequiredDataFromStorage();
MainQueue.clear();
HttpUtils.cancelPendingRequests();
PersistedRequests.clear();
NetworkConnection.clearReconnectionCallbacks();
SessionUtils.resetDidUserLogInDuringSession();
resetHomeRouteParams();
clearCache().then(() => {
Log.info('Cleared all cache data', true, {}, true);
});
Timing.clearData();
}
This way, cleanup tasks will be consistent for both methods.
What alternative solutions did you explore? (Optional)
Alternative 1 -- add checkCloseAccount check
function playSoundForMessageType(pushJSON: OnyxServerUpdate[]) {
if(checkCloseAccount(pushJSON)){
return;
}
.....
function checkCloseAccount(jsonData) {
return _.some(jsonData, item => item.key === "closeAccount");
}
Alternative 2 -- Provide onyx update return with some key. e.g.
{
"key": "clear"
"onyxMethod": "clear"
},
Result
GMT20240219-125319_Clip_Wildan.M.s.Clip.02_19_2024.mp4
Proposal Updated Add alternative solutions |
ProposalPlease re-state the problem that we are trying to solve in this issue.Account - Account is not simultaneously signed out on secondary device when closing account What is the root cause of that problem?When the second device receives the event What changes do you think we should make in order to solve the problem?We will check if the event include PusherUtils.subscribeToMultiEvent(Pusher.TYPE.MULTIPLE_EVENT_TYPE.ONYX_API_UPDATE, (pushJSON: OnyxServerUpdate[]) => {
+ const onyxCloseAccount = pushJSON.find((update) => update.key === ONYXKEYS.FORMS.CLOSE_ACCOUNT_FORM);
+ if (onyxCloseAccount) {
+ Session.signOutAndRedirectToSignIn();
+ return Onyx.update([onyxCloseAccount]);
+ }
playSoundForMessageType(pushJSON); POC
Screen.Recording.2024-02-17.at.21.46.00.movWhat alternative solutions did you explore? (Optional) |
Thanks for the proposals everyone. |
@situchan my proposal updated with result video. I feel the result cover all of three cases. |
@wildan-m the root cause is still not updated |
@situchan My Proposal updated. It provides further clarification on the underlying issue, enhanced resolution, and the rationale behind avoiding calling |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Waiting on @situchan to re-review |
@jliexpensify, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
reviewing updated proposal today |
@situchan @chiragsalian the PR is ready. |
I'm not 100% sure but I'm pretty sure you would have to request it again once you reopen the account. But why are you testing with the HT account. Won't it be easier to test this issue with non HT accounts. |
Maybe they wanna check this off
I think it's fine as this bug is not related to HT account |
@chiragsalian thank you for the confirmation. I have used my HT account for testing, could you assist me in re-assigning it to the HT account? |
@chiragsalian, please ignore my earlier request. This form is automated to assign tasks promptly. |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.48-0 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 2024-03-14. 🎊 For reference, here are some details about the assignees on this issue:
|
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:
|
@jliexpensify @chiragsalian @situchan seems no regression here? |
Payment Summary |
Paid and job closed, waiting on checklist form Situ. |
Offending PR with comment: https://github.com/Expensify/App/pull/31055/files#r1525621084 |
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: 1.4.42-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers): [email protected]
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
Action Performed:
Expected Result:
Actual Result:
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6381147_1708026494674.Screen_Recording_2024-02-14_at_2.10.57_at_night.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: