Skip to content

[Due for payment 2026-07-07] Distance rates - Extra decimals are added to the distance after saving the distance #94270

Closed

Description

@applause-bot

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.4.17-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: #92496
Email or phone of affected tester (no customers): applausetester+khcategory19@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Workspace Settings

Action Performed:

Precondition:

  • Log in with Epensifail account.
  • Enable Distance rates.
  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Distance rates.
  3. Click Settings.
  4. Click Exclude commutes.
  5. Click Exclude a fixed distance per claim.
  6. Enter 10.88.
  7. Click Save.

Expected Result:

No extra decimals will be added to the distance after saving the distance.

Actual Result:

Extra decimals are added to the distance after saving the distance.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7188110_1782173171777.24.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7188110

Activity

  1. added
    DeployBlockerCash
    on Jun 23, 2026
  2. applause-bot commented on Jun 23, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/351228b3ac270a6da236417459f4e69b907e1b8cba21947fd6872b5ed1c03ef8

  3. added
    Bug
    on Jun 23, 2026
  4. melvin-bot commented on Jun 23, 2026

    @melvin-bot

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

  5. melvin-bot commented on Jun 23, 2026

    @melvin-bot

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

  6. github-actions commented on Jun 23, 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.
  7. MelvinBot commented on Jun 23, 2026

    @MelvinBot
    Contributor

    Issue Analysis

    Root Cause: The extra decimals are introduced by the backend (Auth), not the App. The App sends the distance exactly as typed — distance: 10.88 with no client-side conversion (DistanceRate.ts:581) — and the optimistic Onyx value is the clean number, which is why the value looks correct until the server responds. As the code comment notes, "the distance unit is owned by the workspace's distance custom unit (Auth resolves it server-side…)" (DistanceRate.ts:525-527). Auth stores the distance canonically in meters and converts back to the workspace unit (miles) on read. 10.88 mi → 17509.72… m → 10.8799999… mi is a classic IEEE-754 round-trip rounding error, and that imprecise value overwrites the clean optimistic value once the server response merges into Onyx.

    The App then renders that value verbatim with no rounding in two places — the settings summary (PolicyDistanceRatesSettingsPage.tsx:123) and the input prefill (PolicyCommuterExclusionsPage.tsx:64) — so whatever Auth returns is shown as-is.

    Recommended Fix: The correct, canonical fix is in Auth (outside this repo) — round the value when converting meters back to the workspace unit before returning it. Since this is a backend change, please escalate to an internal engineer with Auth access to confirm and fix the round-trip conversion in the SetPolicyCommuterExclusions command path.

    Optional App-side mitigation (to unblock the deploy faster): The App could format the distance for display/prefill to strip float noise (e.g. round to a sensible precision before rendering at PolicyDistanceRatesSettingsPage.tsx:123 and PolicyCommuterExclusionsPage.tsx:64). This masks the symptom rather than fixing the stored value, so it should be paired with the Auth fix, not used in place of it.

    Investigation details & evidence chain

    Evidence chain (input → bug → symptom):

    1. User types 10.88; the page parses it with Number(trimmed) → exactly 10.88 (PolicyCommuterExclusionsPage.tsx:92).
    2. setPolicyCommuterExclusions writes that clean number optimistically and sends distance: 10.88 to the API (DistanceRate.ts:541-581). No miles→meters conversion happens client-side.
    3. There is no successData override of fixedDistance — successData only clears pendingFields (DistanceRate.ts:559-567). So the only way the displayed value changes from the clean 10.88 is the policy commuterExclusions data returned in the API response merging over it.
    4. That returned value is the Auth-resolved one (meters→miles), carrying the float precision error → user sees extra decimals.

    Alternative explanations considered & ruled out:

    • Client-side parsing/formatting bug — ruled out: Number("10.88") is exact, and the value is correct optimistically; the change only appears after the server round-trip.
    • Optimistic data wrong — ruled out: optimistic value is the literal clean input.

    Confidence: Medium-High. Strong code evidence + an explicit code comment stating Auth resolves the value server-side. Not confirmed against production logs — the VictoriaLogs MCP server isn't available in this runner, so the exact returned value (e.g. 10.8799999…) couldn't be captured. An internal engineer can confirm by inspecting the SetPolicyCommuterExclusions response for the affected workspace.


    Next Steps: Reply with @MelvinBot implement the App-side display mitigation if you want a draft PR for the temporary frontend fix, or @MelvinBot <feedback> to refine. The real fix belongs in Auth — please loop in an internal engineer with Auth access.

  8. chiragsalian commented on Jun 23, 2026

    @chiragsalian
    Contributor

    Behind a beta, not a blocker. Reassigning to alberto since he's working on it.

  9. added
    Daily
    and removed
    DeployBlockerCash
    Hourly
    on Jun 23, 2026
  10. 8 remaining items

  11. changed the title [-]Distance rates - Extra decimals are added to the distance after saving the distance[/-] [+][Due for payment 2026-07-07] Distance rates - Extra decimals are added to the distance after saving the distance[/+] on Jun 30, 2026
  12. melvin-bot commented on Jun 30, 2026

    @melvin-bot

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

  13. melvin-bot commented on Jun 30, 2026

    @melvin-bot

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

  14. melvin-bot commented on Jun 30, 2026

    @melvin-bot

    @Gonals 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]. If no checklist is needed for this issue, you can click: [no checklist button]

  15. melvin-bot commented on Jul 3, 2026

    @melvin-bot

    @Gonals Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  16. melvin-bot commented on Jul 4, 2026

    @melvin-bot

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

  17. melvin-bot commented on Jul 7, 2026

    @melvin-bot

    @Gonals 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  18. melvin-bot commented on Jul 9, 2026

    @melvin-bot

    @Gonals Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!

  19. Gonals commented on Jul 10, 2026

    @Gonals
    Contributor

    Fixed

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

Metadata

Metadata

Assignees

Labels

BugDailyEngineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions