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-06-01] [HOLD for payment] [$1000] Workspace - App crashed when delete Workspace on Web #17252

Closed
5 of 6 tasks
kbecciv opened this issue Apr 11, 2023 · 69 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 External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Apr 11, 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. Launch App and login on two device: e.g. Web/Chrome and Android App
  2. Open WS
  3. Add members to WS
  4. Delete WS on web
  5. Check App on Android

Expected Result:

App is not crashed

Actual Result:

App crashed on second device when Delete WS on web.

Workaround:

Unknown

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.2.98.2

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Bug6012947_az_recorder_20230410_185940.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/~01def46407a583e847
  • Upwork Job ID: 1646163735589470208
  • Last Price Increase: 2023-04-26
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 11, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

MelvinBot commented Apr 11, 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

@NicMendonca
Copy link
Contributor

Nice 👍 I tested on Web + iOS FYI

@NicMendonca NicMendonca added the External Added to denote the issue can be worked on by a contributor label Apr 12, 2023
@melvin-bot melvin-bot bot changed the title Workspace - App crashed when delete Workspace on Web [$1000] Workspace - App crashed when delete Workspace on Web Apr 12, 2023
@MelvinBot
Copy link

Job added to Upwork: https://www.upwork.com/jobs/~01def46407a583e847

@MelvinBot
Copy link

Current assignee @NicMendonca is eligible for the External assigner, not assigning anyone new.

@MelvinBot
Copy link

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

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

tienifr commented Apr 12, 2023

Proposal

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

App crashed when user deletes workspace on other device

What is the root cause of that problem?

This line

if (PolicyUtils.isExpensifyTeam(lodashGet(this.props.policy, 'owner'))) {
cause the issue, because:

  • when user deletes the workspace the policy will be empty => lodashGet(this.props.policy, 'owner') return undefined
  • function isExpensifyTeam is executed with parameter undefined
  • Str.extractEmailDomain is called with parameter undefined

Screen Shot 2023-04-11 at 14 34 10

  • cutBefore(email, '@') is called with email undefined

Screen Shot 2023-04-11 at 14 31 37

  • indexOf is executed with parameter undefined

Screen Shot 2023-04-11 at 14 32 57

=> Our App is crashed

Beside, when user deletes a workspace, pusher will set policy_ID to null but still preserve policyMemberList_ID (this should be cleared)

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

Solution 1: Add empty string ('') as the third parameter of lodashGet function
Solution 2: Early return if this.props.policy is empty after this line

data = _.reject(data, (member) => {

Solution 3: We should fix it on BE side to clear policyMemberList_ID when user deletes the WS via pusher.

Additionally, we can move these line

// If this policy is owned by Expensify then show all support (expensify.com or team.expensify.com) emails
if (PolicyUtils.isExpensifyTeam(lodashGet(this.props.policy, 'owner'))) {
return;
}
// We don't want to show guides as policy members unless the user is not a guide. Some customers get confused when they
// see random people added to their policy, but guides having access to the policies help set them up.
const isCurrentUserExpensifyTeam = PolicyUtils.isExpensifyTeam(this.props.currentUserPersonalDetails.login);
outside the reject function. It can improve the performance.

Result

Screen.Recording.2023-04-11.at.14.36.54.mp4

@eh2077
Copy link
Contributor

eh2077 commented Apr 12, 2023

Proposal

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

App is crashed on Manage members page on one device if deleting the same Workspace from the other device.

What is the root cause of that problem?

The root cause is from this line. When the Workspace is deleted from the other device, the value of this.props.policy on the current device is updated to empty object {}. So lodashGet(this.props.policy, 'owner') return undefined and Str.cutBefore return error if str is undefined. See below error stack for information

Screenshot 2023-04-11 at 2 02 31 PM

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

To fix this issue, we can set default value as empty string for lodashGet(this.props.policy, 'owner') in this line, like

if (PolicyUtils.isExpensifyTeam(lodashGet(this.props.policy, 'owner', ''))) {

Then FullPageNotFoundView will be enabled if this.props.policy is empty and thus avoid crashing.

What alternative solutions did you explore? (Optional)

We can also add string undefined check in method PolicyUtils.isExpensifyTeam, Str.extractEmailDomain or Str.cutBefore

@MelvinBot
Copy link

Triggered auto assignment to @youssef-lr (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@s77rt
Copy link
Contributor

s77rt commented Apr 13, 2023

@tienifr Thanks for the proposal. The RCA is arguably accurate but I think there is more.

@s77rt
Copy link
Contributor

s77rt commented Apr 13, 2023

@eh2077 Thanks for the proposal. Your RCA is also about right but I think there is something else to check.

@tienifr
Copy link
Contributor

tienifr commented Apr 13, 2023

@s77rt Thanks for your review, can you elaborate more? You mean we shouldn't show not found page?

@s77rt
Copy link
Contributor

s77rt commented Apr 13, 2023

Both proposals above are somehow right but I think this is also related to the backend. Deleting a workspace will set policy_ID to null (via Pusher) but keep policyMemberList_ID untouched. I think we should clear the policyMemberList too (and then maybe apply a frontend fail-safe fix).

@youssef-lr Would you please check the pusher payload for workspace deletion

@s77rt
Copy link
Contributor

s77rt commented Apr 13, 2023

@tienifr ^

@tienifr
Copy link
Contributor

tienifr commented Apr 13, 2023

Thanks @s77rt. I see your mean, yes we should clear the policyMemberList too. But I think we can handle them independently. What is your thought?

@s77rt
Copy link
Contributor

s77rt commented Apr 13, 2023

@tienifr Clearing policyMemberList is actually enough to fix this issue (at this state) but I think we will apply a frontend fix as well for a slight code improvement (moving this part outside _.reject).

@tienifr
Copy link
Contributor

tienifr commented Apr 13, 2023

sure thanks for your suggestion @s77rt. I updated my proposal as well 🚀

@eh2077

This comment was marked as outdated.

@s77rt

This comment was marked as off-topic.

@melvin-bot melvin-bot bot added the Overdue label Apr 17, 2023
@MelvinBot
Copy link

@youssef-lr, @s77rt, @NicMendonca Whoops! This issue is 2 days overdue. Let's get this updated quick!

@NicMendonca
Copy link
Contributor

@s77rt any feedback on @tienifr's updated proposal?

@tienifr
Copy link
Contributor

tienifr commented May 17, 2023

The PR is ready for review! #19103

@NicMendonca
Copy link
Contributor

Going OOO until June 5th so assigning a buddy to this GH to watch over the issue/ issue payment

@NicMendonca NicMendonca removed the Bug Something is broken. Auto assigns a BugZero manager. label May 23, 2023
@NicMendonca NicMendonca removed their assignment May 23, 2023
@NicMendonca NicMendonca added the Bug Something is broken. Auto assigns a BugZero manager. label May 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 23, 2023

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

@melvin-bot

This comment was marked as duplicate.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels May 25, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment] [$1000] Workspace - App crashed when delete Workspace on Web [HOLD for payment 2023-06-01] [HOLD for payment] [$1000] Workspace - App crashed when delete Workspace on Web May 25, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 25, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.17-5 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-06-01. 🎊

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

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 May 25, 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:

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

@s77rt
Copy link
Contributor

s77rt commented May 25, 2023

The bug was internal (Not clearing policyMemberList after removing a policy). Checklist ^ does not apply in this case.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 31, 2023
@kadiealexander
Copy link
Contributor

kadiealexander commented Jun 1, 2023

Upwork contracts sent to @s77rt and @tienifr.

@s77rt any thoughts on the first few checklist items?

@s77rt
Copy link
Contributor

s77rt commented Jun 1, 2023

@kadiealexander The bug was internal so I don't think we have a E/App PR to blame, but if I have to pinpoint the offending PR it would be #16338 (comment: #16338 (comment)).

Is this eligible for payments? Asking because technically this is an internal issue and it was fixed internally.

@kadiealexander
Copy link
Contributor

I think you both qualify for payment for your work on this PR, but I'll let @youssef-lr make the final call as he has more experience with the issue.

@melvin-bot melvin-bot bot added the Overdue label Jun 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

@youssef-lr, @s77rt, @kadiealexander, @tienifr Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@youssef-lr
Copy link
Contributor

@kadiealexander for this specific issue we only need to pay @tienifr for suggesting the backend fix we implemented.

@melvin-bot melvin-bot bot removed the Overdue label Jun 6, 2023
@kadiealexander
Copy link
Contributor

Thanks @youssef-lr!

@kadiealexander
Copy link
Contributor

I have paid @tienifr.

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 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants