Skip to content

[Due for payment 2026-04-14] [$250] Expense - Distance unit changes when expense is removed from report. #84007

Closed

Description

@nlemma

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.28.0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #74967
Email or phone of affected tester (no customers): ibellicotest+2250@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome
App Component: Money Requests

Action Performed:

Prerequisite: Account has a workspace with "Distance Rates" enabled.
Prerequisite 2: At least one rate created different than default.
Prerequisite 3: Account has Self DM.

  1. Open the staging.new.expensify.com
  2. Navigate to Self DM.
  3. Create a map distance expense with a rate different than default.
  4. Open the report of the just created expense.
  5. Tap on "Report" field and select "Create Report"
  6. Navigate to workspace chat and reopen report.
  7. Note that distance rate and unit weren´t changed.
  8. Tap on "Report" field again and select "Remove from report"
  9. Navigate to Self DM and open report again.
  10. Note that distance rate and unit were changed.

Expected Result:

Distance rate and unit should remain the same after moving a distanc expense to Self DM again.

Actual Result:

Distance rate and unit are changed after a distance track expense is moved to Self DM again.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7092482_1772508434916.Changes.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022028763042155909140
  • Upwork Job ID: 2028763042155909140
  • Last Price Increase: 2026-03-03
  • Automatic offers:
    • FitseTLT | Contributor | 110642887

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 3, 2026
  2. melvin-bot commented on Mar 3, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #74967

  3. melvin-bot commented on Mar 3, 2026

    @melvin-bot

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

  4. melvin-bot commented on Mar 3, 2026

    @melvin-bot

    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.

  5. github-actions commented on Mar 3, 2026

    @github-actions
    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.
  6. OSBotify commented on Mar 3, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #74967 - "Fix - [Unreported] Add distance rate to the distance expenses tracked in selfDM" by @FitseTLT (High confidence)
    Related Issues: None

    Recommendation: REVERT

    PR #74967 introduced a logic error in DistanceRequestUtils.ts that causes distance expenses to lose their custom rate when moved back to Self DM (unreported). The bug is reproducible only on staging (new feature) and blocks the App deploy.

    Labels: DeployBlockerCash label should be kept. This is a frontend bug requiring an App PR revert.

    📋 Detailed Analysis

    Evidence

    The issue reports that distance rate and unit change when a distance expense is removed from a report and moved back to Self DM. This matches exactly with the functionality added in PR #74967, which was merged on 2026-02-28 and is included in the current staging deploy (9.3.28-1).

    The bug report states:

    Verification

    PR #74967 modifies src/libs/DistanceRequestUtils.ts in the getRate() function (lines 382-421). The specific problematic change is on lines 399-404:

    Before PR #74967:

    const customMileageRate = (customUnitRateID && mileageRates?.[customUnitRateID]) || defaultMileageRate;

    After PR #74967:

    const isUnreportedExpense = isExpenseUnreported(transaction);
    const customMileageRate = (customUnitRateID && (mileageRates?.[customUnitRateID] ?? mileageRatesForMovingExpenses?.[customUnitRateID])) || (isUnreportedExpense ? undefined : defaultMileageRate);

    Root Cause

    The logic (isUnreportedExpense ? undefined : defaultMileageRate) is flawed. When an expense is moved back to Self DM (becomes unreported):

    1. The expense has a customUnitRateID from when it was created with a non-default rate
    2. However, that rate may not exist in the Self DM context (no policy)
    3. The lookup mileageRates?.[customUnitRateID] ?? mileageRatesForMovingExpenses?.[customUnitRateID] returns undefined
    4. The fallback logic sees isUnreportedExpense = true and returns undefined instead of falling back to the default rate
    5. This causes the transaction to lose its custom rate and revert to P2P default

    The PR attempted to handle unreported expenses specially but inadvertently broke the case where a previously-reported expense with a custom rate is moved back to Self DM.

    Reproduction

    Following the exact steps from the issue:

    1. Create distance expense with custom rate in Self DM
    2. Move to workspace report → rate preserved (correct)
    3. Move back to Self DM → rate changes to default (BUG)

    The bug affects all platforms (Android App, Windows Chrome, MacOS Chrome/Safari) as reported in the issue.

  7. OSBotify commented on Mar 3, 2026

    @OSBotify
    Contributor

    Label Decision

    DeployBlockerCash: ✅ KEPT (correct)
    DeployBlocker: ❌ Not present (correct)

    This is a frontend bug caused by App PR #74967. The App deploy should remain blocked until this is resolved. The backend deploy can proceed unaffected.


    Next Steps:

    1. @FitseTLT (PR author) should be notified to either:
    2. Once resolved, this will unblock the App staging deploy
  8. 70 remaining items

  9. melvin-bot commented on Apr 7, 2026

    @melvin-bot

    @parasharrajat / @FitseTLT 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]

  10. melvin-bot commented on Apr 7, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  11. mallenexpensify commented on Apr 16, 2026

    @mallenexpensify
    Contributor

    I'm assuming payment will be handled as part of the above and that, if needed, regressions will be taken into account.

    If anyone is due payment for this now, please comment. Otherwise I'll close it once I return to this issue. Thx

  12. FitseTLT commented on Apr 16, 2026

    @FitseTLT
    Contributor

    @mallenexpensify I am due payment here as a c+ it is independent.

  13. mallenexpensify commented on Apr 16, 2026

    @mallenexpensify
    Contributor

    @FitseTLT can you please accept the job below? Please reply here and tag me once you have.
    https://www.upwork.com/jobs/~022044889109394993247

    If anyone else is due payment here, please comment. Thx

  14. FitseTLT commented on Apr 16, 2026

    @FitseTLT
    Contributor

    @mallenexpensify Accepted and no one else is due.

  15. mallenexpensify commented on Apr 16, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @FitseTLT paid via Upwork.

  16. FitseTLT commented on Apr 16, 2026

    @FitseTLT
    Contributor

    @mallenexpensify u should say paid 😄

  17. mallenexpensify commented on Apr 16, 2026

    @mallenexpensify
    Contributor

    Thx, appreciated it @FitseTLT . The main problem is I use text expanders.

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.DailyKSv2EngineeringInternalRequires API changes or must be handled by Expensify staff

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions