Skip to content

[Due for payment 2026-05-07] [$500] Distance - Tax amount field is not zero on confirm page when tax reclaimable on is empty #79867

Closed

Description

@mitarachim

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.3.4-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-3027/folder/13176744/41237171/1131711219
Email or phone of affected tester (no customers): shiubdhibudhsisubhdsi@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.1 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Distance rates and Taxes are enabled.
  • Track tax is enabled in Distance rates settings.
  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Distance rates.
  3. Open the default rate.
  4. Click Tax rate.
  5. Select Tax rate 5% (can be any rate as long as it is not 0%).
  6. Leave Tax reclaimable on empty.
  7. Go to workspace chat.
  8. Click + > Track distance > Manual.
  9. Enter amount > Next.
    → On confirm page, Tax amount field is not zero (0.35).
  10. Click Create expense.
  11. Open the distance expense.
    → Tax amount field is 0.00, which is expected because Tax reclaimable on is empty.

Expected Result:

In Step 9, on confirm page, Tax amount field should be zero because Tax reclaimable on is empty.

Actual Result:

In Step 9, on confirm page, Tax amount field is not zero (0.35) when Tax reclaimable on is empty.

In Step 11, in the transaction thread, Tax amount field is 0.00, which is expected.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7051974_1768666936500.9.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022014773705505397202
  • Upwork Job ID: 2014773705505397202
  • Last Price Increase: 2026-05-04
  • Automatic offers:
    • etCoderDysto | Contributor | 110364206
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 19, 2026
  2. melvin-bot commented on Jan 19, 2026

    @melvin-bot

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

  3. nyomanjyotisa commented on Jan 19, 2026

    @nyomanjyotisa
    Member

    Proposal

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

    Distance - Tax amount field is not zero on confirm page when tax reclaimable on is empty

    What is the root cause of that problem?

    When "Tax reclaimable on" is empty, taxClaimablePercentage is undefined. In getTaxableAmount(), when taxClaimablePercentage is undefined, it defaults to 1 (100%), so tax is calculated on the full amount instead of 0

    const taxClaimablePercentage = customUnitRate.attributes?.taxClaimablePercentage ?? 1;

    This causes the confirm page to show a non-zero tax amount. After creation, the backend sets taxAmount to 0, which is why it shows correctly in the transaction thread

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

    Change the default value from 1 to 0 in getTaxableAmount() when taxClaimablePercentage is undefined, so when "Tax reclaimable on" is empty, the taxable amount is 0 and the tax amount is 0

        const taxClaimablePercentage = customUnitRate.attributes?.taxClaimablePercentage ?? 0;

    const taxClaimablePercentage = customUnitRate.attributes?.taxClaimablePercentage ?? 1;

    What alternative solutions did you explore? (Optional)

    None

  4. etCoderDysto commented on Jan 19, 2026

    @etCoderDysto
    Contributor

    Proposal

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

    Tax amount field is not zero on confirm page when tax reclaimable on is empty

    What is the root cause of that problem?

    In getTaxableAmount function we fallback to "1" when taxClaimablePercentage is undefined. And tax amount will be caculated based on the full distance expense amount

    function getTaxableAmount(policy: OnyxEntry<Policy>, customUnitRateID: string, distance: number) {
    const distanceUnit = getDistanceRateCustomUnit(policy);
    const customUnitRate = getDistanceRateCustomUnitRate(policy, customUnitRateID);
    if (!distanceUnit?.customUnitID || !customUnitRate) {
    return 0;
    }
    const unit = distanceUnit?.attributes?.unit ?? CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES;
    const rate = customUnitRate?.rate ?? CONST.DEFAULT_NUMBER_ID;
    const amount = getDistanceRequestAmount(distance, unit, rate);
    const taxClaimablePercentage = customUnitRate.attributes?.taxClaimablePercentage ?? 1;

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

    we should fall back to CONST.DEFAULT_NUMBER_ID (0) when taxClaimablePercentage is undefined

        const taxClaimablePercentage = customUnitRate.attributes?.taxClaimablePercentage ?? CONST.DEFAULT_NUMBER_ID;
    

    Note:
    The issue was introduced by this PR. One of the issues it was trying to solve is this issue. We have to fix this issue too.

    To fix issue

    1. We can return "0" when taxRateExternalID doesn't exist. This means we return 0 taxable amount when there is no tax associated with the distance rate
    if (!distanceUnit?.customUnitID || !customUnitRate || !customUnitRate?.attributes?.taxRateExternalID) {
            return 0;
        }
    

    Or
    2. We can set the distances rate's customUnitRate.attributes property of the distance rate to empty array from backend, optimistically too when the user deletes a tax rate associated with distance rate.

    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.

  5. yatin-italy commented on Jan 19, 2026

    @yatin-italy

    Proposal

    Restate the problem this issue is trying to solve.

    • The distance confirm page shows tax greater than zero.
    • This happens when “Tax reclaimable on” is empty.
    • The saved expense correctly has zero tax.
    • Preview and saved data do not match.

    What is the root cause of that problem?

    • Some distance rates do not include taxClaimablePercentage.
    • The value is undefined when “Tax reclaimable on” is blank.
    • Tax math then defaults to 100% in the preview.

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

    • Distance rates must always return taxClaimablePercentage.
    • If it is missing, default it to 0%.
    • Do this in the shared accessor so all callers get the same data.

    File: src/libs/PolicyUtils.ts
    Function: getDistanceRateCustomUnitRate

    Code delta (apply verbatim):

    function getDistanceRateCustomUnitRate(policy: OnyxEntry<Policy>, customUnitRateID: string): Rate | undefined {
        const distanceUnit = getDistanceRateCustomUnit(policy);
        const rate = distanceUnit?.rates[customUnitRateID];
        if (!rate) {
            return undefined;
        }
        const taxClaimablePercentage = rate.attributes?.taxClaimablePercentage ?? CONST.DEFAULT_NUMBER_ID;
        return {
            ...rate,
            attributes: {
                ...(rate.attributes ?? {}),
                taxClaimablePercentage,
            },
        };
    }

    What alternative solutions did you explore? (Optional)
    Add a fallback in DistanceRequestUtils.getTaxableAmount. Not chosen. It is late in the flow and duplicates logic.The shared data contract would still be wrong.

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jan 23, 2026
  7. melvin-bot commented on Jan 23, 2026

    @melvin-bot
  8. changed the title [-]Distance - Tax amount field is not zero on confirm page when tax reclaimable on is empty[/-] [+][$250] Distance - Tax amount field is not zero on confirm page when tax reclaimable on is empty[/+] on Jan 23, 2026
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 23, 2026
  10. melvin-bot commented on Jan 23, 2026

    @melvin-bot

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

  11. 81 remaining items

  12. melvin-bot commented on Apr 30, 2026

    @melvin-bot

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

  13. melvin-bot commented on Apr 30, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.64-31 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 2026-05-07. 🎊

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

  14. melvin-bot commented on Apr 30, 2026

    @melvin-bot

    @ZhenjaHorbach @mallenexpensify 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]

  15. ZhenjaHorbach commented on May 4, 2026

    @ZhenjaHorbach
    Contributor

    Can we increase the bounty for this issue?
    Since we cover 2 unrelated issues for this flow
    Plus, we fixed these issues without any regressions

    Proposed amount to increase the price to
    $500

    Multiple PRs - Link to all PRs
    #87911
    #81805

    @chuckdries
    Can you share your thoughts, please?

  16. chuckdries commented on May 4, 2026

    @chuckdries
    Contributor

    Sounds reasonable to me! This one was tricky. Approved.

  17. changed the title [-][Due for payment 2026-05-07] [$250] Distance - Tax amount field is not zero on confirm page when tax reclaimable on is empty[/-] [+][Due for payment 2026-05-07] [$500] Distance - Tax amount field is not zero on confirm page when tax reclaimable on is empty[/+] on May 4, 2026
  18. melvin-bot commented on May 4, 2026

    @melvin-bot

    Upwork job price has been updated to $500

  19. melvin-bot commented on May 6, 2026

    @melvin-bot

    Current assignee @mallenexpensify is eligible for the Awaiting Payment assigner, not assigning anyone new.

  20. ZhenjaHorbach commented on May 7, 2026

    @ZhenjaHorbach
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    https://github.com/Expensify/App/pull/76384/changes#r3200720331

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

    Test:

    Precondition:

    • Distance rates and Taxes are enabled.
    • Track tax is enabled in Distance rates settings.
    1. Open App
    2. Go to workspace settings > Distance rates.
    3. Open the default rate.
    4. Click Tax rate.
    5. Select Tax rate 5% (can be any rate as long as it is not 0%).
    6. Leave Tax reclaimable on empty.
    7. Go to workspace chat.
    8. Click + > Track distance > Manual.
    9. Enter amount > Next.
    10. Verify that Tax amount field is zero on confirmation page
    11. Click Create expense.
    12. Open the distance expense.
    13. Verify that Tax amount field is 0.00

    Precondition:

    For Taxes,

    • Set Set Workspace currency default and Foreign currency default to 5% tax rate.
    • Create 5%, 10% and 15% tax rate.
    • For Distance rates,

    Enable Track tax, and then

    • Create 2 more rates in addition to the default rate - 0.70, 1.00 and 2.00
    • For each distance rate, configure tax rate and tax reclaimable as below:
    • Distance rate 0.70:
    • Tax rate: 5%
    • Tax reclaimable amount: any amount
    • Distance rate 1.00:
    • Tax rate: 10%
    • Tax reclaimable amount: DO NOT enter amount
    • Distance rate 2.00:
    • Tax rate: 15%
    • Tax reclaimable amount: any amount.

    Test 1

    1. Open App
    2. Go to workspace settings > Taxes.
    3. Delete Tax rate 15%.
    4. Go to workspace chat.
    5. Click + > Track distance > Manual.
    6. Enter amount > Next.
    7. Click Rate.
    8. Select Distance rate 1.00.
    9. Click Rate.
    10. Select Distance rate 2.00.
    11. Verify that tax rate is the workspace currency default tax rate (5%)

    Test 2

    1. Open App
    2. Go to workspace settings > Taxes.
    3. Delete Tax rate 15%.
    4. Go to workspace chat.
    5. Click + > Track distance > Manual.
    6. Enter amount > Next.
    7. Click Rate.
    8. Select Distance rate 1.00.
    9. Create the expense
    10. Open the expense
    11. Click on Rate
    12. Select Distance rate 2.00
    13. Verify that tax rate is the workspace currency default tax rate (5%)

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-656a-a720-a3a2-8e33fdd23eb4
  21. mallenexpensify commented on May 8, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @etCoderDysto paid $500 via Upwork ($250 + $250 bonus)
    Contributor+: @ZhenjaHorbach due $500 via NewDot

    ^ Test case created

  22. garrettmknight commented on May 10, 2026

    @garrettmknight
    Contributor

    $500 approved for @ZhenjaHorbach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions