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-07-06] [$1000] Error not displayed for invalid phone number in New Contact Method section #21247

Closed
2 of 6 tasks
kavimuru opened this issue Jun 21, 2023 · 37 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

@kavimuru
Copy link

kavimuru commented Jun 21, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Go to Settings > Profile > Contact Methods
  2. Click "New Contact Method"
  3. Enter an invalid phone number (e.g. +1-212-456ww7890)
  4. No error is displayed

Expected Result:

The app should display an error for invalid phone numbers to ensure consistency

Actual Result:

The app does not display an error for invalid phone numbers in the New Contact Method section.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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.30-0
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):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
screen-capture - 2023-06-15T014547.796.webm

Recording.1051.mp4

Expensify/Expensify Issue URL:
Issue reported by: @tewodrosGirmaA
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1686819848909279

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0193d5a8ad70190344
  • Upwork Job ID: 1671812275847946240
  • Last Price Increase: 2023-06-22
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 21, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 21, 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

@getusha
Copy link
Contributor

getusha commented Jun 21, 2023

I think numbers which have letters in them are in fact valid phone numbers like +1-800-FLOWERS or some letters between. i learned this the hard way after i spent time on this but this may help https://www.quora.com/Why-do-many-public-American-telephone-numbers-have-letters-in-them

@conorpendergrast
Copy link
Contributor

@getusha Maybe, but we don't translate +1-212-456ww7890 into +1-212-456997890. Either way, that's incorrect!

So there are two potential solutions: reject non-numeric phone numbers (ie: show an error when you enter +1-212-456ww7890) or translate the letters into numbers (ie: translate +1-212-456ww7890 into +1-212-456997890`.

I think we can safely use the first solution by validating that field. we seem to reject it on the back-end, as we initially allow that phone number to be entered, and then we silently remove it from the Contact Method list.

@conorpendergrast
Copy link
Contributor

This may have a similar solution to #21230, also reported by @tewodrosGirmaA

@conorpendergrast conorpendergrast added the External Added to denote the issue can be worked on by a contributor label Jun 22, 2023
@melvin-bot melvin-bot bot changed the title Error not displayed for invalid phone number in New Contact Method section [$1000] Error not displayed for invalid phone number in New Contact Method section Jun 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 22, 2023

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

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

melvin-bot bot commented Jun 22, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 22, 2023

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

@getusha
Copy link
Contributor

getusha commented Jun 22, 2023

Proposal

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

Error is not displayed for phone numbers letters between them

What is the root cause of that problem?

The library we are using awesome-phonenumber detects the number as possible/valid phone number since it is a valid email address according to them.

#21247 (comment)

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

We can use Str.isValidPhone() from expensify/common by replacing the + and - between the numbers

if (!_.isEmpty(values.phoneOrEmail) && !(parsePhoneNumber(phoneLogin).possible || Str.isValidEmail(values.phoneOrEmail))) {

// phoneLogin will be pure number and will be validated by the Str utils.
Str.isValidPhone(phoneLogin)

What alternative solutions did you explore? (Optional)

N/A

cc @conorpendergrast @mananjadhav

@mananjadhav
Copy link
Collaborator

mananjadhav commented Jun 22, 2023

Thanks for the proposal @getusha. This looks good to me. As you rightly said, letters is phone numbers is acceptable but as mentioned earlier we don't convert them to digits.

@conorpendergrast We can use @getusha's solution. The linked issue is related to email and not necessarily the same solution.

C+ reviewed  🎀👀🎀

@alexxxwork
Copy link
Contributor

alexxxwork commented Jun 22, 2023

Proposal

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

The form validates telephone numbers with letters in them on add new contact page

What is the root cause of that problem?

The root cause of the problem is that we use awsome-phonenumber lib to check telephone number validity. And this lib uses Google's libphonenumber.
And libphonenumber lib allows using letters instead of numbers in a phone number, as seen here:

https://github.com/google/libphonenumber/blob/b30f7d90154b3148ee7b162f0e236a9cd1fa2229/javascript/i18n/phonenumbers/phonenumberutil.js#L560-L567

and here's the recoding table:
https://github.com/google/libphonenumber/blob/b30f7d90154b3148ee7b162f0e236a9cd1fa2229/javascript/i18n/phonenumbers/phonenumberutil.js#L315-L342

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

We could check if the input number contains letters and replace the number using awsome-phonenumbers methods. We already do it before sending info to backend here:

if (parsedPhoneNumber.possible) {
return parsedPhoneNumber.number.e164 + CONST.SMS.DOMAIN;
}

So we could update number in the form after successful check for validity

@Babur171
Copy link

Firstly, a regex pattern should be defined to validate phone numbers. This pattern should cover the acceptable format and any specific requirements for phone numbers in your system. For example, it might include rules for country codes, area codes, and number length.

Once the regex pattern is defined, it can be applied to the phone number input field in the "New Contact Method" section. This can be done during the form validation process. When the user submits the form or moves to the next field, the phone number should be checked against the regex pattern.

@melvin-bot
Copy link

melvin-bot bot commented Jun 22, 2023

📣 @Babur171! 📣
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. 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.
  2. 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.
  3. 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>

@conorpendergrast
Copy link
Contributor

@mananjadhav Can you do that thang and post to accept the solution? That'll auto-assign the engineer to review and confirm the solution, and assign @getusha. Thank you!

@mananjadhav
Copy link
Collaborator

@conorpendergrast Sorry I missed that, I updated the comment, will it assign then?

@mananjadhav
Copy link
Collaborator

mananjadhav commented Jun 22, 2023

Thanks for the proposal @getusha. This looks good to me. As you rightly said, letters is phone numbers is acceptable but as mentioned earlier we don't convert them to digits.

🎀 👀 🎀 C+ reviewed

@mananjadhav
Copy link
Collaborator

@conorpendergrast Am I doing something wrong? It looks like it didn't assign an engineer.

@conorpendergrast

This comment was marked as duplicate.

@conorpendergrast

This comment was marked as duplicate.

@conorpendergrast
Copy link
Contributor

Ah, that won't work for me anyway because I'm C+ (I checked where we interact with GitHub's webhook on this).

@mananjadhav I don't think it works on comment edits, I think. Can you try posting with just :ribbon: :eyes: :ribbon: which is what we're looking for

@slafortune
Copy link
Contributor

Will the fix in this issue address any invalid field - phone or email? Would you like me to close this as a duplicate?

@mananjadhav
Copy link
Collaborator

I think this will just fix the phone. We can add email here, but I think better to have a separate issue?

🎀 👀 🎀 C+ Reviewed

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

melvin-bot bot commented Jun 23, 2023

📣 @getusha You have been assigned to this job by @jasperhuangg!
Please apply to this job in Upwork 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 📖

@getusha
Copy link
Contributor

getusha commented Jun 23, 2023

PR is up! @mananjadhav @jasperhuangg

@conorpendergrast
Copy link
Contributor

I see the PR has been reviewed and approved by @mananjadhav, currently waiting for review by @jasperhuangg 👍

@melvin-bot
Copy link

melvin-bot bot commented Jun 27, 2023

🎯 ⚡️ Woah @mananjadhav / @getusha, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @getusha got assigned: 2023-06-23 17:22:53 Z
  • when the PR got merged: 2023-06-27 17:08:35 UTC

On to the next one 🚀

@conorpendergrast
Copy link
Contributor

Contracts sent for all three (bug, C and C+), including the 50% urgency bonus for C and C+

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jun 29, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Error not displayed for invalid phone number in New Contact Method section [HOLD for payment 2023-07-06] [$1000] Error not displayed for invalid phone number in New Contact Method section Jun 29, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 29, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 29, 2023

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

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 Jun 29, 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:

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

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Jul 5, 2023
@jasperhuangg
Copy link
Contributor

cc @conorpendergrast it's past 07/06, let's get people paid!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jul 7, 2023
@conorpendergrast
Copy link
Contributor

I agree, everyone got paid!

@mananjadhav We just need the checklist now please

@melvin-bot melvin-bot bot removed the Overdue label Jul 10, 2023
mananjadhav referenced this issue in getusha/App Jul 10, 2023
@mananjadhav
Copy link
Collaborator

Here's the offending PR, which I think caused the bug when resolving merge conflicts here? I've posted a comment here.

I do think it makes sense to add a regression test here so that we don't end up looking at this case again. @conorpendergrast The test steps from the PR are good enough for the regression test.

@conorpendergrast
Copy link
Contributor

Those steps would be:

  1. Go to Settings > Profile > Contact Methods
  2. Click "New Contact Method"
  3. Enter an invalid phone number (e.g. +1-212-456ww7890)
  4. Try to add the phone number
  5. Verify that invalid phone number error is shown.
  6. Verify that no errors appear in the JS console

I'll create a regression test for that today

@conorpendergrast
Copy link
Contributor

Regression test created: https://github.com/Expensify/Expensify/issues/299038

And we're all done!

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