You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Distance - Wrong modal when member without address opens Track distance flow #99711
Version Number: 9.4.63-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:#94316 Email or phone of affected tester (no customers):applausetester+sddd1j1d@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.5 / Chrome App Component: Money Requests
Action Performed:
Precondition:
Log in with Expensifail accounts.
Add an address to workspace.
Enable Distance rates.
Invite another member without address to the workspace.
Go to staging.new.expensify.com
[Member] Go to the invited workspace chat.
[Member] Create a manual distance expense.
[Admin] Go to Distance rates > Settings > Exclude commutes > select Calculate by home and office > Save.
👋 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:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #94316 - "Allow Home and Office Commuter exclusions" by Gonals (High confidence) Related Issues: N/A
Recommendation: ROLL FORWARD
The bug is a two-line condition-ordering mistake in a single new hook; a targeted reorder fixes it, whereas reverting #94316 would tear out an entire 40+ file feature (with a held backend dependency) for a trivial defect.
Assigned: Gonals (PR author), robertjchen, JmillsExpensify, fedirjh (approving reviewers) — already auto-assigned to this issue Labels: No change. DeployBlockerCash is kept (App deploy is blocked). No DeployBlocker label is present, so nothing to remove.
📋 Detailed Analysis
Evidence
PR Allow Home and Office Commuter exclusions #94316 introduces the entire commuter-exclusion guard feature, including the new hook src/hooks/useCommuterExclusionGuard.ts (+87/-23) and its test tests/unit/hooks/useCommuterExclusionGuard.test.ts — the exact code that decides between the "Add Home Address" modal and the "Map or GPS distance required" modal.
The bug reproduces on staging only and is N/A on production because this is a brand-new feature shipped by Allow Home and Office Commuter exclusions #94316 — the feature did not exist before this PR.
The merge date (2026-08-27) matches when the blocker was reported (same day).
Step 3 — the member creates a manual distance expense, which sets NVP_LAST_DISTANCE_EXPENSE_TYPE to DISTANCE_MANUAL.
Step 5 — the member clicks + → Track distance. TrackDistanceMenuItem reads that stale lastDistanceExpenseType and calls the guard with isManualDistanceRequest: trueandisDistanceRequest: true.
In getGuardReason, the first if matches on isManualDistanceRequest and returns 'mapOrGpsRequired', short-circuiting before the homeAddressRequired branch is ever evaluated.
For a HOME_AND_OFFICE policy where the member has no home address, adding the home address is the prerequisite that must be surfaced first, but the broader manual/odometer short-circuit wins, so the wrong ("Map or GPS distance required") modal appears.
The existing unit test at tests/unit/hooks/useCommuterExclusionGuard.test.ts covers isDistanceRequest: truealone (correctly returns homeAddressRequired) but never the isDistanceRequest: true + isManualDistanceRequest: true + home-and-office + no-address combination, which is exactly the gap the bug falls into.
Suggested fix (roll forward)
Evaluate the homeAddressRequired branch before the mapOrGpsRequired branch, so a missing home address on a home-and-office policy takes precedence regardless of the last expense type. Add a unit test for the combined isDistanceRequest + isManualDistanceRequest + home-and-office + missing-address case to lock in the ordering.
Activity
applause-bot commentedon Aug 27, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/74e39f78bc4952582a8e7272b626a6cbfc1b0d64836e75c2bfb623f0e189a813
https://platform.applause.com/services/links/v1/external/e8f946f4cc48a809215a5cb1a023a6e695d91c28d31fd5cc85a6d9c083eea342
melvin-bot commentedon Aug 27, 2026
@Gonals recently merged #94316, but they are OOO right now, so I'll auto-assign someone else.
github-actions commentedon Aug 27, 2026
👋 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:
melvin-bot commentedon Aug 27, 2026
Triggered auto assignment to @jasperhuangg (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon Aug 27, 2026
@robertjchen @JmillsExpensify @fedirjh you have been assigned to this deploy blocker because you reviewed the offending PR: #94316
melvin-bot commentedon Aug 27, 2026
@Gonals you have been assigned to this deploy blocker because you authored the offending PR: #94316
melvin-bot commentedon Aug 27, 2026
💬 A slack conversation has been started in #expensify-open-source
MelvinBot commentedon Aug 27, 2026
🔍 Investigation Summary
Classification: Frontend bug
Causing PR: #94316 - "Allow Home and Office Commuter exclusions" by
Gonals(High confidence)Related Issues: N/A
Recommendation: ROLL FORWARD
The bug is a two-line condition-ordering mistake in a single new hook; a targeted reorder fixes it, whereas reverting #94316 would tear out an entire 40+ file feature (with a held backend dependency) for a trivial defect.
Assigned:
Gonals(PR author),robertjchen,JmillsExpensify,fedirjh(approving reviewers) — already auto-assigned to this issueLabels: No change.
DeployBlockerCashis kept (App deploy is blocked). NoDeployBlockerlabel is present, so nothing to remove.📋 Detailed Analysis
Evidence
src/hooks/useCommuterExclusionGuard.ts(+87/-23) and its testtests/unit/hooks/useCommuterExclusionGuard.test.ts— the exact code that decides between the "Add Home Address" modal and the "Map or GPS distance required" modal.Verification
getGuardReasoninsrc/hooks/useCommuterExclusionGuard.ts#L76-L91.src/pages/inbox/sidebar/FABPopoverContent/menuItems/TrackDistanceMenuItem.tsx#L31-L36, which passesisManualDistanceRequest: lastDistanceExpenseType === CONST.IOU.REQUEST_TYPE.DISTANCE_MANUAL.Root Cause
In
getGuardReasonthe checks run in the wrong precedence order (lines 82-88):Walking the repro:
NVP_LAST_DISTANCE_EXPENSE_TYPEtoDISTANCE_MANUAL.TrackDistanceMenuItemreads that stalelastDistanceExpenseTypeand calls the guard withisManualDistanceRequest: trueandisDistanceRequest: true.getGuardReason, the firstifmatches onisManualDistanceRequestand returns'mapOrGpsRequired', short-circuiting before thehomeAddressRequiredbranch is ever evaluated.For a
HOME_AND_OFFICEpolicy where the member has no home address, adding the home address is the prerequisite that must be surfaced first, but the broader manual/odometer short-circuit wins, so the wrong ("Map or GPS distance required") modal appears.The existing unit test at
tests/unit/hooks/useCommuterExclusionGuard.test.tscoversisDistanceRequest: truealone (correctly returnshomeAddressRequired) but never theisDistanceRequest: true+isManualDistanceRequest: true+ home-and-office + no-address combination, which is exactly the gap the bug falls into.Suggested fix (roll forward)
Evaluate the
homeAddressRequiredbranch before themapOrGpsRequiredbranch, so a missing home address on a home-and-office policy takes precedence regardless of the last expense type. Add a unit test for the combinedisDistanceRequest+isManualDistanceRequest+ home-and-office + missing-address case to lock in the ordering.view run
m-natarajan commentedon Aug 28, 2026
Chrome / v9.4.63-0
N/A for public account
bandicam.2026-08-28.22-42-54-883.mp4
m-natarajan commentedon Aug 28, 2026
N/A for public account
Removed the Deploy Blocker label as per this comment
fedirjh commentedon Sep 7, 2026
This was fixed in #99433.