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

[Due for payment 2025-02-19] [$250] Distance - Distance and Rate field shows "Pending" after distance rate is deleted #55245

Closed
4 of 8 tasks
vincdargento opened this issue Jan 14, 2025 · 39 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 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@vincdargento
Copy link

vincdargento commented Jan 14, 2025

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: 9.0.85-1
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): Mac 15.0 / Chrome
Issue reported by: Applause Internal Team
Device used: applausetester+140105kh@applause.expensifail.com
App Component: Money Requests

Action Performed:

Precondition:

  • Workspace has at least two distance rates.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Submit a distance expense with a distance rate.
  4. Go to workspace settings > Distance rates.
  5. Delete the distance rate that is used in Step 3.
  6. Go back to workspace chat.
  7. Go to transaction thread of the distance expense.

Expected Result:

Distance and Rate field will show the correct value after distance rate is deleted (production behavior).

Actual Result:

Distance and Rate field shows "Pending" after distance rate is deleted.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021879305543245512119
  • Upwork Job ID: 1879305543245512119
  • Last Price Increase: 2025-01-28
  • Automatic offers:
    • mkzie2 | Contributor | 105976611
Issue OwnerCurrent Issue Owner: @MitchExpensify
@vincdargento vincdargento added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 DeployBlockerCash This issue or pull request should block deployment labels Jan 14, 2025
Copy link

melvin-bot bot commented Jan 14, 2025

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

melvin-bot bot commented Jan 14, 2025

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

Copy link

melvin-bot bot commented Jan 14, 2025

💬 A slack conversation has been started in #expensify-open-source

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Jan 14, 2025
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.

@vincdargento
Copy link
Author

@MitchExpensify 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.

@thienlnam thienlnam added the External Added to denote the issue can be worked on by a contributor label Jan 14, 2025
@melvin-bot melvin-bot bot changed the title Distance - Distance and Rate field shows "Pending" after distance rate is deleted [$250] Distance - Distance and Rate field shows "Pending" after distance rate is deleted Jan 14, 2025
Copy link

melvin-bot bot commented Jan 14, 2025

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

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

melvin-bot bot commented Jan 14, 2025

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

@thienlnam
Copy link
Contributor

Probably not a blocker, in both scenarios the user still needs to manually update the rate and the error message is correct. It just doesn't show the deleted rate anymore

@thienlnam thienlnam added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Jan 15, 2025
@huult
Copy link
Contributor

huult commented Jan 15, 2025

Proposal

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

Distance and Rate field shows "Pending" after distance rate is deleted

What is the root cause of that problem?

This is a backend issue. When we remove a rate, it should also be removed from the customUnits of the policy.

  • Image

As a result, when we handle customMileageRate, it will return undefined because mileageRates does not contain the value of customUnitRateID. This is why the issue occurs.

const customMileageRate = customUnitRateID ? mileageRates?.[customUnitRateID] : defaultMileageRate;

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

To resolve this issue, we need to update the backend to still return the rates of customUnits, either returning the submitted rate or showing the default value after the rate is removed. Something like that.

const customMileageRate = customUnitRateID ? mileageRates?.[customUnitRateID] : defaultMileageRate;

update to:

  const customMileageRate = customUnitRateID ? mileageRates?.[customUnitRateID] ?? defaultMileageRate : defaultMileageRate;

POC:

  • Image

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

We updated the test for this case. If mileageRates?.[customUnitRateID] is undefined, the expected value is defaultMileageRate

What alternative solutions did you explore? (Optional)

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.

@mkzie2
Copy link
Contributor

mkzie2 commented Jan 15, 2025

Proposal

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

Distance and Rate field shows "Pending" after distance rate is deleted.

What is the root cause of that problem?

When we delete the distance rate, it no longer exists in policy data. In production, we will display the default rate and the distance accordingly. But why did this happen in staging?

It comes from here

Previously, we always fallback to defaultMileageRate if mileageRates?.[customUnitRateID] is undefined

Now, we only set customMileageRate to defaultMileageRate if customUnitRateID but in our case, customUnitRateID exists and mileageRates?.[customUnitRateID] is undefined.

const customMileageRate = customUnitRateID ? mileageRates?.[customUnitRateID] : defaultMileageRate;

Then as expected Pending... appears

if (!rate || !currency || !unit) {
return translate('iou.fieldPending');
}

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

We should update the change as we did before this PR

const customUnitRateID = getRateID(transaction) ?? `${CONST.DEFAULT_NUMBER_ID}`;
const customMileageRate = mileageRates?.[customUnitRateID] ?? defaultMileageRate;

const customMileageRate = customUnitRateID ? mileageRates?.[customUnitRateID] : defaultMileageRate;

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

What alternative solutions did you explore? (Optional)

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

⚠️ Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format.

Copy link

melvin-bot bot commented Jan 20, 2025

@Pujan92, @thienlnam, @MitchExpensify Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot added the Overdue label Jan 20, 2025
@MitchExpensify
Copy link
Contributor

@Pujan92 can you check out these proposals as a next step please?

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Feb 4, 2025
@mkzie2
Copy link
Contributor

mkzie2 commented Feb 4, 2025

@Pujan92 The PR is ready.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Feb 12, 2025
@melvin-bot melvin-bot bot changed the title [$250] Distance - Distance and Rate field shows "Pending" after distance rate is deleted [Due for payment 2025-02-19] [$250] Distance - Distance and Rate field shows "Pending" after distance rate is deleted Feb 12, 2025
Copy link

melvin-bot bot commented Feb 12, 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 Feb 12, 2025
Copy link

melvin-bot bot commented Feb 12, 2025

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

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

Copy link

melvin-bot bot commented Feb 12, 2025

@Pujan92 @MitchExpensify @Pujan92 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]

@MitchExpensify
Copy link
Contributor

Payment summary:

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Feb 18, 2025
Copy link

melvin-bot bot commented Feb 21, 2025

@Pujan92, @thienlnam, @MitchExpensify, @mkzie2 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@MitchExpensify
Copy link
Contributor

BugZero Checklist:

  • [Contributor] Classify the bug:
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:
  • [Contributor] 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:

  • [Contributor] 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:

  • [Contributor] 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.

Regression Test Proposal Template
  • [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

Precondition:

Test:

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot removed the Overdue label Feb 23, 2025
@MitchExpensify
Copy link
Contributor

Can you please complete the BZ steps above @Pujan92 ?

@MitchExpensify
Copy link
Contributor

@mkzie2 is paid with contract ended 👍

@Pujan92
Copy link
Contributor

Pujan92 commented Feb 25, 2025

BugZero Checklist:

  • [Contributor] Classify the bug:
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
  • 2b. Reported on staging (deploy blocker)
  • [] 2c. Reported on both staging and production
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] 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: https://github.com/Expensify/App/pull/53852/files#r1969581181

  • [Contributor] 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

  • [Contributor] 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

  1. Go to the workspace chat and create a distance request with a distance rate (not the default distance rate)
  2. Delete the distance rate that is selected above
  3. Go to the transaction detail and verify that the distance rate changes to the default distance rate.

@melvin-bot melvin-bot bot added the Overdue label Feb 26, 2025
Copy link

melvin-bot bot commented Feb 27, 2025

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

@MitchExpensify
Copy link
Contributor

Thanks @Pujan92

@garrettmknight
Copy link
Contributor

$250 approved for @Pujan92

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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

7 participants