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 2025-01-21] [$250] Profile - Incorrect Phone Error Displayed Beside Previously Saved Number #54715

Open
4 of 8 tasks
IuliiaHerets opened this issue Jan 1, 2025 · 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 External Added to denote the issue can be worked on by a contributor Overdue

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Jan 1, 2025

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: v9.0.80-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Device used: Mac 13.6/Chrome
App Component: User Settings

Action Performed:

  1. Go to Settings > Profile > Phone Number.
  2. Save a valid phone number with a country code (e.g., +12124567890).
  3. Save a phone number without a country code (e.g., 0945789083).

Expected Result:

The incorrect phone number should be displayed as a placeholder with the error message, or the correct phone number should be erased, showing only the error message to avoid confusion.

Actual Result:

When a valid phone number is saved, it is stored successfully. However, saving an invalid number without a country code shows an error alongside the previously saved correct number, causing user confusion.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6704760_1735724149620.Screen_Recording_2025-01-01_at_1.33.23_AM.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021876820317399092628
  • Upwork Job ID: 1876820317399092628
  • Last Price Increase: 2025-01-08
  • Automatic offers:
    • nkdengineer | Contributor | 105620495
Issue OwnerCurrent Issue Owner: @anmurali
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 1, 2025
Copy link

melvin-bot bot commented Jan 1, 2025

Triggered auto assignment to @anmurali (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@nkdengineer
Copy link
Contributor

nkdengineer commented Jan 1, 2025

Edited by proposal-police: This proposal was edited at 2025-01-01 14:59:02 UTC.

Proposal

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

Profile - Incorrect Phone Error Displayed Beside Previously Saved Number

What is the root cause of that problem?

with the phone number 0945789083 it passed the validate function here

const validate = useCallback(
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.PERSONAL_DETAILS_FORM>): FormInputErrors<typeof ONYXKEYS.FORMS.PERSONAL_DETAILS_FORM> => {
const errors: FormInputErrors<typeof ONYXKEYS.FORMS.PERSONAL_DETAILS_FORM> = {};
if (!ValidationUtils.isRequiredFulfilled(values[INPUT_IDS.PHONE_NUMBER])) {
errors[INPUT_IDS.PHONE_NUMBER] = translate('common.error.fieldRequired');
}
const phoneNumberWithCountryCode = LoginUtils.appendCountryCode(values[INPUT_IDS.PHONE_NUMBER]);
const parsedPhoneNumber = PhoneNumberUtils.parsePhoneNumber(phoneNumberWithCountryCode);
if (!parsedPhoneNumber.possible || !Str.isValidE164Phone(phoneNumberWithCountryCode.slice(0))) {
errors[INPUT_IDS.PHONE_NUMBER] = translate('bankAccount.error.phoneNumber');
}
// Clear the error when the user tries to validate the form and there are errors
if (validateLoginError && !!errors) {
PersonalDetails.clearPhoneNumberError();
}
return errors;
},
[translate, validateLoginError],
);

but on the BE side it returned not a valid number

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

We should update function validate phone number here to match with validate from BE side

Because we are parsing the phone number with the country code here before putting it in the condition while when calling API we pass the value directly without adding country code here

const parsedPhoneNumber = PhoneNumberUtils.parsePhoneNumber(phoneNumberWithCountryCode);

PersonalDetails.updatePhoneNumber(values?.phoneNumber ?? '', currenPhoneNumber);

So when checking the condition, we should not add country code to the parserPhoneNumber function.

      const phoneNumberWithCountryCode = LoginUtils.appendCountryCode(values[INPUT_IDS.PHONE_NUMBER]);
      const parsedPhoneNumber = PhoneNumberUtils.parsePhoneNumber(values[INPUT_IDS.PHONE_NUMBER]);
      if (!parsedPhoneNumber.possible || !Str.isValidE164Phone(phoneNumberWithCountryCode.slice(0))) {
          errors[INPUT_IDS.PHONE_NUMBER] = translate('bankAccount.error.phoneNumber');
      }

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

We should add 0945789083 to invalid phone number in PhoneNumberTest here

const invalidNumbers = ['+165025300001', 'John Doe', '123', '[email protected]'];

    const invalidNumbers = ['+165025300001', 'John Doe', '123', '0945789083', '[email protected]'];

What alternative solutions did you explore? (Optional)

Or we can append country code to phone number before call API

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.

Copy link
Contributor

github-actions bot commented Jan 1, 2025

jerry Your proposal will be dismissed because you did not follow the proposal template.

@melvin-bot melvin-bot bot added the Overdue label Jan 6, 2025
Copy link

melvin-bot bot commented Jan 7, 2025

@anmurali Huh... This is 4 days overdue. Who can take care of this?

@anmurali anmurali added the External Added to denote the issue can be worked on by a contributor label Jan 8, 2025
Copy link

melvin-bot bot commented Jan 8, 2025

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

@melvin-bot melvin-bot bot changed the title Profile - Incorrect Phone Error Displayed Beside Previously Saved Number [$250] Profile - Incorrect Phone Error Displayed Beside Previously Saved Number Jan 8, 2025
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 8, 2025
Copy link

melvin-bot bot commented Jan 8, 2025

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

@akinwale
Copy link
Contributor

akinwale commented Jan 8, 2025

@nkdengineer's proposal looks good here.

🎀👀🎀 C+ reviewed.

Copy link

melvin-bot bot commented Jan 8, 2025

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

@JastiDev
Copy link

JastiDev commented Jan 8, 2025

Proposal

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

When the user save the phone number without using the country code, it displayed the error message with previous correct phone number.

What is the root cause of that problem?

The validator that is offered in the code, it isn't correct.

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

To solve this problem, please check the validator of the code and can add the new logic to validate the country code.

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

N/A

Copy link

melvin-bot bot commented Jan 8, 2025

📣 @JastiDev! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@JastiDev
Copy link

JastiDev commented Jan 8, 2025

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01f5d61eb695cbaec2

Copy link

melvin-bot bot commented Jan 8, 2025

⚠️ Invalid email. Please make sure to create an Expensify account with this email first here.

@JastiDev
Copy link

JastiDev commented Jan 8, 2025

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01f5d61eb695cbaec2

Copy link

melvin-bot bot commented Jan 8, 2025

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@JastiDev
Copy link

JastiDev commented Jan 8, 2025

Proposal

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

When the user save the phone number without using the country code, it displayed the error message with previous correct phone number.

What is the root cause of that problem?

The validator that is offered in the code, it isn't correct.

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

To solve this problem, please check the validator of the code and can add the new logic to validate the country code.

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

N/A

Copy link
Contributor

github-actions bot commented Jan 8, 2025

Yes, this comment contains the proposal template and all mandatory lines are present. Thus, the appropriate action based on the instructions is:

NO_ACTION

@blimpich
Copy link
Contributor

blimpich commented Jan 8, 2025

@nkdengineer @akinwale @JastiDev why have we left the part of the proposal template about automated tests as N/A? This seems like something that should have automated tests. Please either include where (and ideally how) you'd write an automated test for this or explain why its not possible to write an automated test for this.

@akinwale
Copy link
Contributor

akinwale commented Jan 8, 2025

@nkdengineer @akinwale @JastiDev why have we left the part of the proposal template about automated tests as N/A? This seems like something that should have automated tests. Please either include where (and ideally how) you'd write an automated test for this or explain why its not possible to write an automated test for this.

Ah, my bad. I missed this.

@nkdengineer Please update your proposal to include automated tests that should be implemented. See https://expensify.enterprise.slack.com/archives/C01GTK53T8Q/p1733148961659549?thread_ts=1733148961.659549&cid=C01GTK53T8Q for more details.

@nkdengineer
Copy link
Contributor

thanks @blimpich @akinwale, i'll update soon

@nkdengineer
Copy link
Contributor

@blimpich @akinwale i updated the solution and added test

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 9, 2025
Copy link

melvin-bot bot commented Jan 9, 2025

📣 @nkdengineer 🎉 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 📖

@blimpich
Copy link
Contributor

blimpich commented Jan 9, 2025

Looks good! Thank you for adding the automated test in the proposal! 🙂

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Weekly KSv2 labels Jan 9, 2025
@melvin-bot melvin-bot bot changed the title [$250] Profile - Incorrect Phone Error Displayed Beside Previously Saved Number [HOLD for payment 2025-01-21] [$250] Profile - Incorrect Phone Error Displayed Beside Previously Saved Number Jan 14, 2025
Copy link

melvin-bot bot commented Jan 14, 2025

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 14, 2025
Copy link

melvin-bot bot commented Jan 14, 2025

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

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

Copy link

melvin-bot bot commented Jan 14, 2025

@akinwale @anmurali @akinwale The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@akinwale
Copy link
Contributor

BugZero Checklist:

Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [@akinwale] 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: N/A

  • [@akinwale] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A

  • [@akinwale] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

Test:

  1. Launch Expensify.
  2. Navigate to Settings > Profile > Phone number.
  3. Enter a phone number without a country code (e.g. 0945789083).
  4. Click or tap on the Save button.
  5. Verify that an error message indicating that the phone number is not valid is displayed.

Do we agree 👍 or 👎?

@blimpich
Copy link
Contributor

@akinwale we updated a unit test for this didn't we? So we shouldn't need the proposed regression test right?

@akinwale
Copy link
Contributor

@blimpich I've always thought a regression test is always required regardless, but not needing a regression test would make sense in this case. We would need to have the process clarified.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jan 21, 2025
@blimpich
Copy link
Contributor

@akinwale talked internally about this, there are probably situations where we want both a unit test and a regression test, we can handle it on a case by case basis. For this one I think just the unit test is fine

@melvin-bot melvin-bot bot added the Overdue label Jan 23, 2025
Copy link

melvin-bot bot commented Jan 24, 2025

@akinwale, @anmurali, @blimpich, @nkdengineer Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

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 Overdue
Projects
Status: No status
Development

No branches or pull requests

6 participants