Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.5k stars 2.85k forks source link

[HOLD for payment 2023-04-27] [$1000] Date field allows spaces between the numeric digits, unlike other numeric fields (like Rate) #17280

Closed kavimuru closed 1 year ago

kavimuru commented 1 year ago

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. Go to web Chrome/Android
  2. Go to any workspace
  3. Go to reimburse expenses and try to add a space in the rate field. Notice that it doesn't allow any spaces
  4. Now go to the personal information and date of birth field
  5. Go to year and try to input a number followed by spaces and notice that it allows spaces in the field

Expected Result:

Space should not be allowed in the year field - it should mirror that of the rate input field.

Actual Result:

Spaces are allowed in the year search field between the numeric digits.

Workaround:

unknown

Platforms:

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

Version Number: 1.2.98-2 / v99-4 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

Untitled

https://user-images.githubusercontent.com/43996225/231254245-fdc104a2-d8b3-4b2c-bb7d-22fc4756c3ab.mp4

Expensify/Expensify Issue URL: Issue reported by: @priya-zha Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1681201745994509

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01ecf6260853d6f525
  • Upwork Job ID: 1645992955077120000
  • Last Price Increase: 2023-04-12
MelvinBot commented 1 year ago

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

MelvinBot commented 1 year ago

Bug0 Triage Checklist (Main S/O)

jliexpensify commented 1 year ago

On v99.4 (Mac) and can reproduce. Also occurs on Android (Pixel 3a, v98-2).

This is a minor bug, but I agree that the year field should mirror the rate field, as there aren't spaces in a year.

MelvinBot commented 1 year ago

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

MelvinBot commented 1 year ago

Triggered auto assignment to @trjExpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

MelvinBot commented 1 year ago

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

Prince-Mendiratta commented 1 year ago

Proposal

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

In this issue, we can notice that the space character is allowed when searching for the year, which should not be allowed.

What is the root cause of that problem?

When filtering, we do not sanitize the input provided by the user and directly use whatever is provided. https://github.com/Expensify/App/blob/e8bc6a86f13fd2f5561de5e6251abffa8f890384/src/pages/YearPickerPage.js#L75

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

We should create a regex rule that sanitizes whatever is typed by the user. This can be as simple as /[\D]/g, which will replace and remove anything that is not a digit from the user input. We can filter the results based on that.

Additionally, we can add some more constraints such as the maximum number of characters that the user can enter is 4.

MelvinBot commented 1 year ago

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

aman-atg commented 1 year ago

Proposal

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

The current implementation allows spaces in the year search field between the numeric digits, which is not consistent with other numeric fields in the app like Rate.

What is the root cause of that problem?

The filterYearList function in the YearPickerPage class does not filter out spaces from the input text, resulting in spaces being allowed in the year search field.

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

Modify the filterYearList function in the YearPickerPage class to remove spaces from the input text before filtering the yearOptions list. This can be achieved using the replace method with a regular expression \s/g to remove all spaces from the input text. The filtered text should then be used for filtering the yearOptions list using the _.filter method. here

Eg.

filterYearList(text) {
    // Remove spaces from the input text
    const filteredText = text.replace(/\s/g, '');
    this.setState({
        inputText: filteredText,
        yearOptions: _.filter(this.yearList, year => year.text.includes(filteredText)),
    });
}

What alternative solutions did you explore? (Optional)

jliexpensify commented 1 year ago

Hi @trjExpensify - I've had to reassign as I'm headed OOO for the next 2 weeks. I've verified that the bug occurs in Chrome and Android so you're good to go!

dhairyasenjaliya commented 1 year ago

Proposal

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

What is the root cause of that problem?

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


    filterYearList(text) {
+        const filteredText = text.replace(/ /g, '');
        this.setState({
+            inputText: filteredText,
-            yearOptions: _.filter(this.yearList, year => year.text.includes(text.trim())),
+           yearOptions: _.filter(this.yearList, year => year.text.includes(filteredText)),
        });
    }

Note

@s77rt

gargmegham commented 1 year ago

Proposal

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

The current implementation allows spaces, and characters in the year text input of YearPickerPage. But it should only allow numeric characters

What is the root cause of that problem?

The keyboard type number-pad is not working as expected, because it should have only allowed numbers by default

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

Before modifying the state inside the filterYearList function input text should be formatted just like we're doing in rate input field mentioned in issue description

Example

filterYearList(text) {
        // Remove all non-numeric characters from the input
        const inputYear = text.replace(/[^0-9]/g, '');
        this.setState({
            inputText: inputYear,
            yearOptions: _.filter(this.yearList, year => year.text.includes(inputYear)),
        });
    }
MelvinBot commented 1 year ago

📣 @gargmegham! 📣

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>
gargmegham commented 1 year ago

📣 @gargmegham! 📣

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>

Contributor details Your Expensify account email: meghamgarg@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~0170461d5a03bcee8d

MelvinBot commented 1 year ago

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

s77rt commented 1 year ago

@hayata-suenaga Please remove the Reviewing label. No one is assigned yet.

s77rt commented 1 year ago

@Prince-Mendiratta Thanks for the proposal. Your RCA is correct and the fix looks good to me :+1:.

:ribbon: :eyes: :ribbon: C+ reviewed

cc @hayata-suenaga

Prince-Mendiratta commented 1 year ago

Thank you for your review, @s77rt!

Additionally, we can add some more constraints such as the maximum number of characters that the user can enter is 4.

What are your thoughts on additional constraints?

s77rt commented 1 year ago

@aman-atg Thanks for the proposal. The RCA is correct but the suggested fix is a duplicate and I think we want to remove everything that is not a number and not just spaces.

s77rt commented 1 year ago

@dhairyasenjaliya Thanks for the proposal. The RCA is correct but it's basically a copy-paste even if you agree with someone's RCA you should at least rephrase or give credit to the original writer. As for your concern about replacing other text, we do that already here.

dhairyasenjaliya commented 1 year ago

Hm oky point noted was simple RCA thank you @s77rt

s77rt commented 1 year ago

@gargmegham Thanks for the proposal. I don't think your RCA is exactly correct, the keyboard type is only for virtual keyboard which is working fine.

s77rt commented 1 year ago

@Prince-Mendiratta

What are your thoughts on additional constraints?

The length is already limited to 4 here.

s77rt commented 1 year ago

@hayata-suenaga before assigning @Prince-Mendiratta do you think this should be handled by @ArekChr as a part of https://github.com/Expensify/App/issues/14322? We had a discussion about this bug but we decided to ignore it at that time, I think mostly because we didn't really consider it as a bug and I was not really convinced about the way it was meant to be handled.

I think we should hire @Prince-Mendiratta here since the solution we were going with is slightly different.

Just stating the above for clarity and transparency. cc @ArekChr .

hayata-suenaga commented 1 year ago

@s77rt thank you for the proposal review.

I think we can go with @Prince-Mendiratta. Assigning @Prince-Mendiratta

MelvinBot commented 1 year ago

📣 @Prince-Mendiratta You have been assigned to this job by @hayata-suenaga! 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 📖

Prince-Mendiratta commented 1 year ago

PR is up for review!

Applied in Upwork.

cc @s77rt @hayata-suenaga @trjExpensify

MelvinBot commented 1 year ago

@trjExpensify, @s77rt, @Prince-Mendiratta, @hayata-suenaga Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

s77rt commented 1 year ago

Not overdue. PR deployed to staging 19 hours ago.

MelvinBot commented 1 year ago

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

MelvinBot commented 1 year ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 1.3.2-5 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-04-27. :confetti_ball:

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.

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

trjExpensify commented 1 year ago

Hm, where's the checklist for this? Adding it manually..

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:

Prince-Mendiratta commented 1 year ago

@trjExpensify I'm not too sure about Melvin's flow but maybe the BZ checklist was not triggered as I was not assigned in the PR?

trjExpensify commented 1 year ago

Oh, maybe. I didn't think that had an impact tbh. Payments check in the meantime. I can see the PR was approved on the 13th, so within the timeframe, the slow down on merge was on our side.

Sound about right?

s77rt commented 1 year ago

I don't think bonus applies here, this was merged on 18th.

trjExpensify commented 1 year ago

I don't think bonus applies here, this was merged on 18th.

Yeah, I looked at that, but you were both done and approved on the 13th. After the weekend, the hold up was on us internally to action on the merge. Do you think I'm missing something?

s77rt commented 1 year ago

Regression Test Proposal

  1. Open App
  2. Go to Settings > Profile > Personal Details > Date of birth
  3. Click on the year
  4. Verify you are redirected to the Year picker page
  5. Type in any non digit character e.g. whitespaces, letters or special characters
  6. Verify none of the typed characters are entered in the search box
  7. Type in any digit
  8. Verify the typed digits are entered in the search box, upto 4 digits
s77rt commented 1 year ago

@trjExpensify, @hayata-suenaga did request a change on April 13th so technically it was not 100% ready for merge on April 13th.

Prince-Mendiratta commented 1 year ago

To help with the timeline analysis,

🐛 Issue created at: Tue, 11 Apr 2023 18:20:13 GMT 🧯 Help Wanted at: Wed, 12 Apr 2023 03:31:33 GMT 🕵🏻 Contributor assigned at: Wed, 12 Apr 2023 17:31:52 GMT 🛸 PR created at: Wed, 12 Apr 2023 18:43:00 GMT ✅ C+ Approved at: Thu, 13 Apr 2023 09:21:51 GMT ❗ Changes requested by @hayata-suenaga: Thu, 13 Apr 2023 15:26:39 GMT ✅ Requested changes applied at: Thu, 13 Apr 2023 18:52:34 GMT 🎯 PR merged at: Tue, 18 Apr 2023 18:30:19 GMT ⌛ Business Days Elapsed between assignment and PR merge: 5

I'll leave the decision up to you guys!

trjExpensify commented 1 year ago

Yeah, because the changes were still applied within the timeframe and no further changes were required after that, the delay from the 13th onwards were on us I think.

trjExpensify commented 1 year ago

Okay offers have been sent.

trjExpensify commented 1 year ago

Settled up!

@s77rt re: the regression test, there's this one here in TestRail. Instead of a totally separate one wouldn't we just add to that test script for ease?

Maybe..

  1. ....
  2. Type in any non digit character e.g. whitespaces, letters or special characters
  3. Verify you see an error
  4. ....
s77rt commented 1 year ago

@tjferriss I feel the test won't fit well with those since this one requires attention to the year selection page which none of existing tests mention.

Actually I think we can skip the regression test for this one just to be consist with the types of regression tests on that page.

hayata-suenaga commented 1 year ago

The offending PR has been commented on: I don't think this applies here since it's not a regression. cc @hayata-suenaga

I agree

hayata-suenaga commented 1 year ago

this is on hold for payment

trjExpensify commented 1 year ago

this is on hold for payment

Payment has been made, we're just looking at this regression test.

I feel the test won't fit well with those since this one requires attention to the year selection page which none of existing tests mention.

Ah, wait. The test script has changed since I linked it - likely because it has been recently developed. Okay, so there's this standalone test for DOB now.

So what we could do is insert these two lines before 5 & 6 perhaps?

  1. Type in any non digit character e.g. whitespaces, letters or special characters
  2. Verify you see an error
s77rt commented 1 year ago

@trjExpensify Yes that looks good to me, but step 6 is to verify that the non of the typed characters got inserted (there is no error message)

trjExpensify commented 1 year ago

Oh, so if it's not possible at all to enter them at all (i.e it's a numerical keyboard) then what are we testing for? 😕

trjExpensify commented 1 year ago

Sorry, I interpreted this suggested script as being that these characters are allowed for the input but receive an error on blur (a bit like forms). I just checked this and it's a numerical keyboard, so I think we can forgo this addition to the script - it's extraneous.

Going to close this out!

s77rt commented 1 year ago

@trjExpensify You can still enter any char in Web / Desktop. But I think we can still skip this test.