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-08-08] [$1000] Dev: Web - App crashes when trying to unlink secondary contact method #22934

Closed
1 of 6 tasks
kbecciv opened this issue Jul 15, 2023 · 25 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 Jul 15, 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. Open a tab where account A is signed-in
  2. Add secondary contact method B, and do not verify that contact method
  3. Open a new window > Navigate to sign-in page
  4. Enter secondary contact method B & click on the continue button
  5. Click on 'unlink' button
  6. Open email > copy 'validate link' > prefix the link localhost address > press enter

Expected Result:

App shouldn't crash & should unlink the secondary contact method

Actual Result:

App crashes

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.3.40-5
Reproducible in staging?: n
Reproducible in production?: n
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

Screencast.from.2023-07-14.15-40-28.mp4

Expensify/Expensify Issue URL:
Issue reported by: @Natnael-Guchima
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1689338260193289

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0125c02caca7cbee50
  • Upwork Job ID: 1682413664782585856
  • 2023-07-21
  • Automatic offers:
    • mollfpr | Reviewer | 25738337
    • StevenKKC | Contributor | 25738338
    • Natnael-guchima | Reporter | 25738340
@kbecciv kbecciv added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels Jul 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 15, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 15, 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

@ygshbht
Copy link
Contributor

ygshbht commented Jul 16, 2023

Proposal

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

In the current Expensify app, attempting to unlink a secondary contact method leads to an application crash. This unexpected behaviour is triggered under the condition that the secondary contact method is unverified. This issue is particularly associated with the process of secondary contact validation and de-linking.

What is the root cause of that problem?

Investigation points to the translate function, which is used to handle language-specific translations of phrase keys in the application. It appears that when this function doesn't find a phrase key in the language dictionaries, it throws an error that leads to the application crash.

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

A more robust alternative is to utilize the translateIfPhraseKey function which, unlike translate, returns the original message when a matching phrase is not found, rather than throwing an error. This graceful degradation prevents the application from crashing due to an error thrown.

Moreover, the translateIfPhraseKey function seems specifically designed for situations where the phrase keys might be dynamic or potentially non-existent in the language dictionaries, thus making it a more resilient choice.

Therefore, by replacing the translate function with translateIfPhraseKey in the specific code path related to unlinking secondary contact methods, we can avoid this issue and improve the overall robustness of the application.

What alternative solutions did you explore? (Optional)

Alternatively, like others, if the message is pre-translated, we could directly display the message as received. This approach bypasses the application of the translate or translateIfPhraseKey functions for this scenario, streamlining the process and diminishing the possibility of an application crash.

Result:

Studio_Project_V1.mp4

@StevenKKC
Copy link
Contributor

Proposal

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

App crashes when trying to unlink secondary contact method.

What is the root cause of that problem?

If unlink secondary contact method, unlinkLogin function will be called.
In this function, set account.message Onyx data to the translated message. (i.e. Secondary login successfully unlinked!)

{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.ACCOUNT,
value: {
isLoading: false,
message: Localize.translateLocal('unlinkLoginForm.succesfullyUnlinkedLogin'),
},
},

After unlink success, ONYXKEYS.ACCOUNT.MESSAGE will be displayed.

{!_.isEmpty(props.account.message) && (
// DotIndicatorMessage mostly expects onyxData errors so we need to mock an object so that the messages looks similar to prop.account.errors
<DotIndicatorMessage
style={[styles.mb5, styles.flex0]}
type="success"
messages={{0: props.translate(props.account.message)}}
/>
)}

Since props.account.message (i.e. account.message Onyx data) is already translated, and there is no Secondary login successfully unlinked! key in language dictionary, so the error is generated and app crashes.

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

We should store message key to Onyx in order to display proper translated message.

    {
        onyxMethod: Onyx.METHOD.MERGE,
        key: ONYXKEYS.ACCOUNT,
        value: {
            isLoading: false,
-           message: Localize.translateLocal('unlinkLoginForm.succesfullyUnlinkedLogin'),
+           message: 'unlinkLoginForm.succesfullyUnlinkedLogin',
        },
    },

What alternative solutions did you explore? (Optional)

None.

@melvin-bot melvin-bot bot added the Overdue label Jul 17, 2023
@sonialiap
Copy link
Contributor

Didn't get to triaging this bug, I'll take a look at it tomorrow!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jul 18, 2023
@sonialiap
Copy link
Contributor

The app isn't crashing for me but I'm not receiving the magic link after step 5 🐛

@melvin-bot melvin-bot bot removed the Overdue label Jul 21, 2023
@sonialiap sonialiap added the External Added to denote the issue can be worked on by a contributor label Jul 21, 2023
@melvin-bot melvin-bot bot changed the title Dev: Web - App crashes when trying to unlink secondary contact method [$1000] Dev: Web - App crashes when trying to unlink secondary contact method Jul 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 21, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0125c02caca7cbee50

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

melvin-bot bot commented Jul 21, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 21, 2023

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

@kameshwarnayak
Copy link
Contributor

Proposal

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

Web - App crashes when trying to unlink secondary contact method

What is the root cause of that problem?

In the unlinkLogin success data we are passing the translated value instead of the phraseKey

message: Localize.translateLocal('unlinkLoginForm.succesfullyUnlinkedLogin'),

Screenshot 2023-07-23 at 11 56 45 AM

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

Instead of passing the translated value, pass the phraseKey. This is the way it is done in entire application. The above line will become

    message: 'unlinkLoginForm.succesfullyUnlinkedLogin',

This is the standard we are following in the entire application. Check the below code

message: 'unlinkLoginForm.linkSent',

Result :

f29ce87d-8a66-45b0-bf6f-de56cdad3816.mp4

What alternative solutions did you explore? (Optional)

None

@melvin-bot melvin-bot bot added the Overdue label Jul 24, 2023
@mollfpr
Copy link
Contributor

mollfpr commented Jul 24, 2023

Thank you guys for the proposals!

I agree we should store localized messages in the Onyx with the phrase key instead the translated message. So the user will have the correct message shown based on their selected language. The proposal from @StevenKKC looks good to me.

🎀 👀 🎀 C+ reviewed!

@melvin-bot
Copy link

melvin-bot bot commented Jul 24, 2023

Triggered auto assignment to @MonilBhavsar, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@MonilBhavsar MonilBhavsar removed the Needs Reproduction Reproducible steps needed label Jul 25, 2023
@MonilBhavsar
Copy link
Contributor

Looks good 👍

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

melvin-bot bot commented Jul 25, 2023

📣 @mollfpr 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

📣 @StevenKKC 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

📣 @Natnael-Guchima 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@Natnael-Guchima
Copy link

Accepted the offer. Thanks👍

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jul 25, 2023
@StevenKKC
Copy link
Contributor

@mollfpr PR #23561 is ready for review.

@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @StevenKKC got assigned: 2023-07-25 10:04:10 Z
  • when the PR got merged: 2023-07-28 12:47:30 UTC
  • days elapsed: 3

On to the next one 🚀

@mollfpr
Copy link
Contributor

mollfpr commented Jul 28, 2023

The C+ approval is on Jul 26, so this is still eligible for the bonus.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 1, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Dev: Web - App crashes when trying to unlink secondary contact method [HOLD for payment 2023-08-08] [$1000] Dev: Web - App crashes when trying to unlink secondary contact method Aug 1, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 1, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 1, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 1, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.48-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-08-08. 🎊

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 Aug 1, 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:

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

@mollfpr
Copy link
Contributor

mollfpr commented Aug 7, 2023

[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:

#15811

[@mollfpr] 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:

https://github.com/Expensify/App/pull/15811/files#r1286197062

[@mollfpr] 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:

We have a checklist to ensure the copy/text is localized correctly in the reviewer checklist. So regression step should be enough.

[@mollfpr] Determine if we should create a regression test for this bug.
[@mollfpr] 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.

(Web only)

  1. Login App
  2. Add a secondary contact method, and do not verify that contact method
  3. Open a new window and navigate to the sign-in page
  4. Enter the secondary contact method & click on the continue button
  5. Click on the 'unlink' button
  6. Open the email and copy the 'validate link'
  7. Prefix the link localhost address and paste it to the address bar
  8. Verify that the app does not crash

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Aug 8, 2023
@sonialiap
Copy link
Contributor

@Natnael-Guchima report $250 - paid ✔️
@StevenKKC fix+bonus $1500 - paid ✔️
@mollfpr review+bonus $1500 - paid ✔️

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