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 2024-06-20] [HOLD for payment 2024-06-18] [HOLD for payment 2024-06-11] [HOLD for payment 2024-06-06] Distance rates - Default rate input is 0 instead of actual amount for newly created WS #42780

Closed
6 tasks done
m-natarajan opened this issue May 29, 2024 · 25 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering

Comments

@m-natarajan
Copy link

m-natarajan commented May 29, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.4.77-0
Reproducible in staging?: y
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
Expensify/Expensify Issue URL:
Issue reported by: Applause internal team
Slack conversation:

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go offline.
  3. Create a new workspace.
  4. Go to More features.
  5. Enable Distance rates.
  6. Go to Distance rates.
  7. Click on the default rate.
  8. Click Rate.

Expected Result:

The rate amount input will display the actual amount (production behavior).

Actual Result:

The rate amount input displays 0 instead of the actual amount.

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

Bug6495253_1716998312348.20240529_235104.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @JmillsExpensify
@m-natarajan m-natarajan added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. DeployBlocker Indicates it should block deploying the API labels May 29, 2024
Copy link

melvin-bot bot commented May 29, 2024

Triggered auto assignment to @francoisl (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link

melvin-bot bot commented May 29, 2024

Triggered auto assignment to @JmillsExpensify (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.

Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@m-natarajan
Copy link
Author

@JmillsExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@francoisl
Copy link
Contributor

I can still reproduce on the latest version of main. I think the root cause was PR #42426, reverting it locally fixes the issue for me locally.

cc @bernhardoj @ikevin127 if you're around and can think of a fix, otherwise I've got a draft revert PR above ^

@francoisl
Copy link
Contributor

For the default rate 0.655, the updated version of the function calculateAmountLength() returns ... 11, whereas for the rate 0.670 coming from the API when you're online, it returns 3.
validateAmount() is called with amountMaxLength: 10, which is why the function is returning false when you're offline.

image

@ikevin127
Copy link
Contributor

@francoisl If this is a blocker that needs to be handled asap then I'd suggest the revert since the code changes of the PR are minimal, then @bernhardoj won't be time constrained to re-work the solution.

Otherwise I'd wait for their input and possible follow-up fix.

@francoisl francoisl added the Reviewing Has a PR in review label May 29, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Hourly KSv2 labels May 29, 2024
@francoisl
Copy link
Contributor

Sounds good, revert PR is in review.

If it helps, I narrowed the issue a little more, it's now coming from

if (/\D/.test(absAmount)) {
return CONST.IOU.AMOUNT_MAX_LENGTH + 1;
}

because for values with 3 decimals like 0.655, the new absAmount is now 65.5, and so the /\D/.test is now returning true. Before the update, the absAmount would have been 655, and so we didn't return early in that block.

I guess the solution is to change that regex to allow decimal values, but I'll let you guys double-check.

@francoisl francoisl removed DeployBlockerCash This issue or pull request should block deployment DeployBlocker Indicates it should block deploying the API labels May 29, 2024
@kavimuru
Copy link

Fixed in the version 77-3

Screen_Recording_20240530_034428_New.Expensify.1.mp4

@bernhardoj
Copy link
Contributor

@francoisl correctly pointed out the root cause, it's the old regex here.

if (/\D/.test(absAmount)) {
return CONST.IOU.AMOUNT_MAX_LENGTH + 1;
}

The calculation that we did is already correct, but the regex above matches the decimal separator (.) because 0.655 is 65.5 cents which still contains a dot.

The regex above is added in this PR to prevent NaN, Infinity, and number with scientific notation (1+e26). So, I updated the regex to be more specific.

A new PR is here

Copy link

melvin-bot bot commented Jun 4, 2024

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

Copy link

melvin-bot bot commented Jun 4, 2024

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:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 6, 2024
@francoisl francoisl added Reviewing Has a PR in review and removed Awaiting Payment Auto-added when associated PR is deployed to production labels Jun 7, 2024
@francoisl
Copy link
Contributor

The final fix for this was just merged. This was for a regression that was originally handled internally, and then the author and C+ from the initial PR fixed it, so I believe no payment is required.

Copy link

melvin-bot bot commented Jun 11, 2024

Skipping the payment summary for this issue since all the assignees are employees or vendors. If this is incorrect, please manually add the payment summary SO.

@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 11, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-06-11] [HOLD for payment 2024-06-06] Distance rates - Default rate input is 0 instead of actual amount for newly created WS [HOLD for payment 2024-06-18] [HOLD for payment 2024-06-11] [HOLD for payment 2024-06-06] Distance rates - Default rate input is 0 instead of actual amount for newly created WS Jun 11, 2024
Copy link

melvin-bot bot commented Jun 11, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 11, 2024
Copy link

melvin-bot bot commented Jun 11, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.81-11 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 2024-06-18. 🎊

Copy link

melvin-bot bot commented Jun 11, 2024

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:

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

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jun 13, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-06-18] [HOLD for payment 2024-06-11] [HOLD for payment 2024-06-06] Distance rates - Default rate input is 0 instead of actual amount for newly created WS [HOLD for payment 2024-06-20] [HOLD for payment 2024-06-18] [HOLD for payment 2024-06-11] [HOLD for payment 2024-06-06] Distance rates - Default rate input is 0 instead of actual amount for newly created WS Jun 13, 2024
Copy link

melvin-bot bot commented Jun 13, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.82-4 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 2024-06-20. 🎊

Copy link

melvin-bot bot commented Jun 13, 2024

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:

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 18, 2024
Copy link

melvin-bot bot commented Jun 20, 2024

Skipping the payment summary for this issue since all the assignees are employees or vendors. If this is incorrect, please manually add the payment summary SO.

@melvin-bot melvin-bot bot added the Overdue label Jun 20, 2024
Copy link

melvin-bot bot commented Jun 21, 2024

@JmillsExpensify, @francoisl Whoops! This issue is 2 days overdue. Let's get this updated quick!

@francoisl
Copy link
Contributor

Checklist already completed above and no payments required, closing.

@melvin-bot melvin-bot bot removed the Overdue label Jun 21, 2024
@francoisl francoisl removed the Awaiting Payment Auto-added when associated PR is deployed to production label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering
Projects
None yet
Development

No branches or pull requests

6 participants