Skip to content

[Due for payment 2026-07-02] Distance - After changing unit, Exclude commutes field shows the old unit #94267

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 any mile.
  7. Click Save.
  8. Click Unit.
  9. Change it to Kilometers.
  10. Click Exclude commutes.
  11. Click Save.

Expected Result:

After changing unit, Exclude commutes field will update the unit.

Actual Result:

After changing unit, Exclude commutes field shows the old unit.
After clicking Save button without changing the distance, it still shows the old unit.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7188105_1782172863202.22.mp4

View all open jobs on GitHub

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

Activity

  1. added
    DeployBlockerCash
    Bug
    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/8d69c08515c14976124a996831bab9deafedc505acb48e67dc997aecba5477ab

  3. melvin-bot commented on Jun 23, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jun 23, 2026

    @melvin-bot

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

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

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The commuter exclusion stores its own unit snapshot (commuterExclusions.fixedDistanceUnit) captured at save time, and the Settings page summary prefers that snapshot over the live workspace unit. When you later change the workspace distance unit, the snapshot is never updated, so the summary keeps showing the old unit.

    The backend doesn't actually track a per-exclusion unit — SetPolicyCommuterExclusionsParams sends only distance and commuterExclusionMethod. The exclusion distance is implicitly interpreted in the policy's current distance unit, so fixedDistanceUnit is a frontend-only display field that drifts out of sync the moment the unit changes.

    This also explains the second symptom (saving without changing the value doesn't refresh the unit): the exclusion page's onSave short-circuits and never re-persists when the numeric value is unchanged.

    Code references

    The exclusion page's input suffix itself is already correct — it derives from the live workspaceUnit (PolicyCommuterExclusionsPage.tsx:56-68). Only the Settings-page summary is stale.

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

    Stop using the stored fixedDistanceUnit snapshot for display and always derive the unit from the policy's current distance unit (defaultUnit), which is what the backend actually interprets the stored distance against.

    • In PolicyDistanceRatesSettingsPage.tsx:124, change the summary unit from policy.commuterExclusions.fixedDistanceUnit ?? defaultUnit ?? … to use defaultUnit ?? … (the live custom unit).
    • Since fixedDistanceUnit no longer drives any display and is never sent to the backend, consider removing it entirely (the field, the value passed at PolicyCommuterExclusionsPage.tsx:104, and the type) to prevent it drifting out of sync again.

    This makes the summary follow the workspace unit immediately, matching the expected result.

    What alternative solutions did you explore? (Optional)

    Open product question: changing the unit currently keeps the same numeric value (e.g. "5 mi" effectively becomes "5 km") rather than converting it (~8 km). The bug only asks for the displayed unit to update, and the backend has no per-exclusion unit to convert against, so the display fix above is the minimal correct change. If the team wants the value to actually convert on unit change, that's a larger change — likely updating commuterExclusions.fixedDistance (and re-calling the API) inside the unit-change flow in setPolicyDistanceRatesUnit — and should be confirmed with product/backend first.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/94267) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  7. chiragsalian commented on Jun 23, 2026

    @chiragsalian
    Contributor

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

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

  10. changed the title [-]Distance - After changing unit, Exclude commutes field shows the old unit[/-] [+][Due for payment 2026-07-02] Distance - After changing unit, Exclude commutes field shows the old unit[/+] on Jun 25, 2026
  11. melvin-bot commented on Jun 25, 2026

    @melvin-bot

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

  12. melvin-bot commented on Jun 25, 2026

    @melvin-bot

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

  13. melvin-bot commented on Jun 25, 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]

  14. melvin-bot commented on Jun 30, 2026

    @melvin-bot

    @Gonals Eep! 4 days overdue now. Issues have feelings too...

  15. melvin-bot commented on Jul 2, 2026

    @melvin-bot

    @Gonals Still overdue 6 days?! Let's take care of this!

  16. melvin-bot commented on Jul 3, 2026

    @melvin-bot

    @Gonals Still overdue 6 days?! Let's take care of this!

  17. melvin-bot commented on Jul 3, 2026

    @melvin-bot

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

  18. melvin-bot commented on Jul 6, 2026

    @melvin-bot

    @Gonals 10 days overdue. Is anyone even seeing these? Hello?

  19. Gonals commented on Jul 7, 2026

    @Gonals
    Contributor

    This is 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