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-12-07] [$500] Bank-Error does not appear under "Company Website" after entering caps "H" in url #31362

Closed
5 of 6 tasks
izarutskaya opened this issue Nov 15, 2023 · 34 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

@izarutskaya
Copy link

izarutskaya commented Nov 15, 2023

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.3.99-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
Expensify/Expensify Issue URL:
Issue reported by: Applause-Internal Team
Slack conversation: @

Action Performed:

  1. Launch app
  2. Tap profile
  3. Tap Workspaces----Workspace
  4. Tap Bank account---Update to USD currency
  5. Tap Connect manually
  6. Enter all fields
  7. Tap Continue
  8. In company Information page, enter all fields
  9. Tap Company Website
  10. Change url to caps "https://www.applause.expensifail.com"/
    ("H" in caps)
  11. Tap Save&Continue

Expected Result:

In company information page, an error should appear under the "Company Website" input field and the bar below it should turn red.

Actual Result:

In company information page, an error does not appear under the "Company Website" input field and the bar below it is in green instead of red.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6277061_1700039930100.below.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010d45541c5ea54e51
  • Upwork Job ID: 1724767635537690624
  • Last Price Increase: 2023-11-15
  • Automatic offers:
    • akinwale | Reviewer | 27754145
    • esh-g | Contributor | 27754146
@izarutskaya izarutskaya added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 15, 2023
@melvin-bot melvin-bot bot changed the title Bank-Error does not appear under "Company Website" after entering caps "H" in url [$500] Bank-Error does not appear under "Company Website" after entering caps "H" in url Nov 15, 2023
Copy link

melvin-bot bot commented Nov 15, 2023

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

Copy link

melvin-bot bot commented Nov 15, 2023

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

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

melvin-bot bot commented Nov 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

Copy link

melvin-bot bot commented Nov 15, 2023

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

@esh-g
Copy link
Contributor

esh-g commented Nov 15, 2023

Proposal

Please re-state the problem

Bank-Error does not appear under "Company Website" after entering caps "H" in url

What is the root cause of the problem?

We are disabling case sensitivity here:

return new RegExp(`^${URL_REGEX_WITH_REQUIRED_PROTOCOL}$`, 'i').test(url);

What changes should be made?

We should remove the 'i' attribute to enable case sensitivity

@dukenv0307
Copy link
Contributor

dukenv0307 commented Nov 15, 2023

Proposal

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

I think the expectation in the OP is not correct. Website with uppercase characters in it are completely valid websites, in composer we're also allowing uppercase characters. But when saving the website here we should ideally lowercase it so it will show up nicely in other places where the data is used.

(Note: all browsers also does this, if you type the site in uppercase, no error will show, the browser will just convert to lowercase and navigate you to the site)

What is the root cause of that problem?

We're not lowercasing the website before saving to the back-end

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

Lowercase the website before saving to the back-end

To do this, we can add something like this below here

website: values.website.toLowerCase(),

What alternative solutions did you explore? (Optional)

We can consider additionally lowercase the website as soon as the user blurs the website input.

Optionally, we can improve a bit by allowing users to omit the protocol part of the URL and use sanitizeURL method to add the protocol. So users just enter "google.com", it will still work.

@superdev808
Copy link

superdev808 commented Nov 15, 2023

Proposal

Please re-state the problem that we are trying to solve in this
Company WebSite Text Input recognize the H starting url as the valid url but when form submission it's returning the error on Form.

What is the root cause of that problem?
Here are 2 different things we should consider.

  1. How the Company Website validate the inputed url and return the validation error under its text?
    Company Website is using the TextInput component defined in @component library and the way how it is handling the validation is the inputMode prop.
    https://github.com/Expensify/App/blob/8872311253a7b188e7a9c64b9482371432748de5/src/pages/ReimbursementAccount/CompanyStep.js#L211C2-L211C2
    Inside this TextInput component, when the inputMode is url, it's validating if the text value is url or not but that validation is not case sensitive check and that's the reason why the website field doesn't show the error under text input.

  2. How the form validation error (which is showing now) is showing?
    The form is using the custom validation method for the values being changed inside the form. And this validation method is being called when submit button is clicked (by default) and when blur or value change actions happen (based on shouldValidateOnChange and shouldValidateOnBlur properties).

What changes do you think we should make in order to solve the problem?
To show the error under company website text input as mentioned on expected result, we should make the change on TextInput component's validation method when the inputMode is url.

What alternative solutions did you explore? (Optional)
It depends on how the requirement can be defined on product side but if it's fine to allow case insensitive url input, then I am fine with above 2 solutions.

Contributor Details:
Expensify account Email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~0109faf42021ad78b6

Copy link

melvin-bot bot commented Nov 15, 2023

📣 @superdev808! 📣
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>

@sgroh
Copy link

sgroh commented Nov 16, 2023

Proposal

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

After add a "Company Website" that contains uppercase in the protocol (http, https or ftp), i.e: Http, httpS, of FTP; an error should appear under the "Company Website" input field, also the bar below the input should turn red indicating that is an invalid website.

What is the root cause of that problem?

Exists a function called isValidWebsite that applies a REGEX with the insensitive flag activated. Returning true on URL(s) that should be considered invalid.

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

Unfortunately JavaScript do not support have part of the regular expression be case-insensitive. Other languages support it using the (?i:) pattern modifier. On this JavaScript project a case-insensitive modifier is applied to the entire regular expression so to solve the issue one solution is: Add a simple REGEX validation prior the existent return on function isValidWebsite in order to check that the website URL do not have uppercase on the protocol, and return false if positive.

What alternative solutions did you explore? (Optional)

Force the Website URL protocol to be all in lowercase, changing the user input when the focus change, adding this change the function isValidWebsite will receive a "valid" url.

Copy link

melvin-bot bot commented Nov 16, 2023

📣 @sgroh! 📣
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>

@sgroh
Copy link

sgroh commented Nov 16, 2023

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~017353d6513c1319c9?viewMode=1

Copy link

melvin-bot bot commented Nov 16, 2023

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

@superdev808
Copy link

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

Copy link

melvin-bot bot commented Nov 16, 2023

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

@akinwale
Copy link
Contributor

akinwale commented Nov 17, 2023

This is a fairly straightforward issue, and I recommend going with @esh-g's proposal since the validation being performed on the frontend would be consistent with the expected rules for the URL string in the backend. The bankAccount.error.website translation string should also be updated to add more details (eg, Please enter a valid website. The website should be in lowercase.).

🎀 👀 🎀 C+ reviewed.

Copy link

melvin-bot bot commented Nov 17, 2023

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

@dukenv0307
Copy link
Contributor

dukenv0307 commented Nov 17, 2023

@akinwale That'd be inconsistent with the rest of the app, where uppercase characters are allowed, for example in Composer.

cc @AndrewGable

@akinwale
Copy link
Contributor

@akinwale That'd be inconsistent with the rest of the app, where uppercase characters are allowed, for example in Composer.

cc @AndrewGable

In order to maintain this consistency, the validation logic would have to be changed in the backend.

While both proposals are viable approaches to solving the issue, the idea behind my recommendation is to validate early to prevent an unnecessary request from being sent to the backend. Additionally, the autoCapitalize="none" prop can also be added to the text input to reduce the possibility of having uppercase characters in the value unless the user explicitly chooses to use uppercase.

Ultimately, the internal engineer will make a final decision.

@dukenv0307
Copy link
Contributor

In order to maintain this consistency, the validation logic would have to be changed in the backend.

@akinwale with my proposal, there's no change required in the back-end, we'll lowercase it before sending to the back-end (same as what all browsers do)

the idea behind my recommendation is to validate early to prevent an unnecessary request from being sent to the backend

There's no unnecessary request sent to the back-end as well, the website will be lowercased before sending to back-end which is a totally valid request and will not throw any error. What we manage to avoid here, is confusion for the users and more work for them to make sure they type only lowercase, which will happen if we go with the selected proposal.

Imagine if you type an uppercase site address like Http://google.com to Chrome and it says: "Please enter a valid website. The website should be in lowercase". IMO that'd not ideal UX

cc @AndrewGable

@sgroh
Copy link

sgroh commented Nov 17, 2023

Hi @akinwale I understand your point, in my proposal I'm only checking that the protocol (http, https of ftp) do not contains uppercase, not allowing the user post the URL until he/she enter it using lowercase. BTW as the standard explains URLs in general are case-sensitive. So I'm allowing it to have uppercase after the protocol.
So basically my proposal avoid a POST request to the backend with protocols containing uppercase.

@melvin-bot melvin-bot bot added the Overdue label Nov 20, 2023
Copy link

melvin-bot bot commented Nov 20, 2023

@AndrewGable, @akinwale, @MitchExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Nov 20, 2023

📣 @akinwale 🎉 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

Copy link

melvin-bot bot commented Nov 20, 2023

📣 @esh-g 🎉 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 melvin-bot bot removed the Overdue label Nov 20, 2023
@dukenv0307
Copy link
Contributor

@akinwale That'd be inconsistent with the rest of the app, where uppercase characters are allowed, for example in Composer.

@AndrewGable do you have any feedback for this?

Thanks!

@melvin-bot melvin-bot bot added the Overdue label Nov 23, 2023
Copy link

melvin-bot bot commented Nov 24, 2023

@AndrewGable, @akinwale, @MitchExpensify, @esh-g Whoops! This issue is 2 days overdue. Let's get this updated quick!

@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 Overdue Weekly KSv2 labels Nov 27, 2023
@melvin-bot melvin-bot bot changed the title [$500] Bank-Error does not appear under "Company Website" after entering caps "H" in url [HOLD for payment 2023-12-07] [$500] Bank-Error does not appear under "Company Website" after entering caps "H" in url Nov 30, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 30, 2023
Copy link

melvin-bot bot commented Nov 30, 2023

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

Copy link

melvin-bot bot commented Nov 30, 2023

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

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:

Copy link

melvin-bot bot commented Nov 30, 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:

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

@MitchExpensify
Copy link
Contributor

Payment summary:

@dukenv0307
Copy link
Contributor

@akinwale That'd be inconsistent with the rest of the app, where uppercase characters are allowed, for example in Composer.

@AndrewGable do you have any feedback for this?

Thank you!

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Dec 7, 2023
@MitchExpensify
Copy link
Contributor

All paid have you had a chance to review the BZ steps @akinwale ?

@akinwale
Copy link
Contributor

akinwale commented Dec 8, 2023

  • [@akinwale] The PR that introduced the bug has been identified. Link to the PR:
  • [@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:
  • [@akinwale] 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:

Not a regression. The backend has some validation logic for the website field that was not implemented in the frontend.

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

Regression test steps

  • Create a new workspace.
  • Open the workspace settings and select Bank account. Choose to convert the currency to USD if prompted.
  • Start the add bank account flow and select manual setup.
  • Enter a valid routing number (e.g. 011000138) and an account number (e.g. 1100120022) and proceed to the next step
  • Enter a website URL with one or more capital letters, e.g. Https://Test.com
  • Verify that the invalid website error message is displayed below the website URL text input field.

Do we agree 👍 or 👎?

@akinwale
Copy link
Contributor

akinwale commented Dec 8, 2023

All paid have you had a chance to review the BZ steps @akinwale ?

@MitchExpensify Done.

@melvin-bot melvin-bot bot added the Overdue label Dec 11, 2023
@MitchExpensify
Copy link
Contributor

Nice, thanks @akinwale

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