Conversation
Co-authored-by: cretadn22 <cretadn22@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
|
The failing check is not caused by this PR, so I haven't pushed anything.
EvidenceThe failure All three failures read a hard-coded route index and get Each one resolves Why it isn't this PR This PR changes exactly three files, none of them navigation:
And the same failure reproduces on unrelated open PRs:
Likely source (not confirmed) These three tests were added by #100387 ("Fix back navigation from Workspace Search results", merged 2026-09-11 18:17 UTC), which changed
Per the "don't fix unrelated failures" rule I've left this alone — it needs a fix on |
|
🤖 Android test steps verification results: ✅ pass The PR's No JS console errors. Two notes on how the run was set upBeta override. "Exclude commutes" is gated on Composer entry point. In both the Self-DM and the workspace expense chat, composer Create expense offers only view run · no recording available |
|
🤖 Web test steps verification results: ✅ pass The PR's
Setup notes and one caveat on console errorsBeta override. The Exclude commutes row is gated behind the Setup prerequisite worth documenting. "Exclude usual commute" cannot be selected until the workspace has a company address ( Entry point. In both the Self-DM and the workspace expense chat, composer Create expense offers only Manual and Scan tabs — no Distance tab. Track distance is the map-distance entry point, and that is the path used for steps 4-8. Console errors: not collected. Browser console capture is unavailable on this web driver, so I cannot assert the "no JS console errors" checklist item. No in-app error banners, red-dot errors, or failed-action states were observed during the run. The observed behavior matches the scoping in view run · no recording available |
| // Odometer tabs do. `policy` here can be the member's active workspace even for a Self-DM track expense, and | ||
| // personal expenses are exempt from a workspace's commuter rule. | ||
| const blockDistanceRequestIfNeeded = useBlockDistanceRequest({ | ||
| policyID: report?.policyID ?? (shouldAutoReportToDefaultWorkspace ? defaultExpensePolicy?.id : undefined), |
There was a problem hiding this comment.
You're right about the ?? semantics — _FAKE_ is truthy, so it short-circuits the fallback. But I traced it and it's a no-op here, for two independent reasons:
1. _FAKE_ and undefined behave identically inside the hook. getBlockReason only uses the ID as a key lookup into policiesRequiringMapOrGPS, which is built from the real POLICY collection:
src/hooks/useBlockDistanceRequest.ts:91
if (!policyIDToCheck || !policiesRequiringMapOrGPS?.[policyIDToCheck] || isEditingExistingDistanceRequest) {No policy is ever stored under _FAKE_, so it bails at the second condition instead of the first. Same result, and no risk of a wrong workspace name leaking into the modal copy.
2. The fallback branch is unreachable when policyID is _FAKE_. The fallback only matters if shouldAutoReportToDefaultWorkspace is true, and that hard-gates on iouType === create:
src/libs/shouldUseDefaultExpensePolicy.ts:18
Every create distance entry point passes a freshly generated report ID that has no Onyx report — e.g. FloatingActionButtonAndPopover.tsx:36 feeding TrackDistanceMenuItem.tsx:53, plus the generateReportID() call sites in QuickCreationActionsBar, SearchActionsBarCreateButton, and useCreateNavigationSuggestions. So report is undefined, report?.policyID is undefined, and the fallback fires as intended. Conversely, when a report actually carries _FAKE_ (Self-DM / DM, from buildOptimisticChatReport's default), iouType is track/submit, so shouldAutoReportToDefaultWorkspace is false and the fallback would resolve to undefined anyway.
I couldn't construct a case where a _FAKE_ report reaches this step with iouType === create. If you know of one, say so and I'll fix it.
One note on scope: this expression is copied verbatim from main — DynamicIOURequestStepDistanceManual.tsx:161 and IOURequestStepDistanceOdometer.tsx:176. If you'd still rather normalize _FAKE_ defensively, I'd do it in all three at once so they don't drift — happy to push that if you want it.
view run · no recording available
The failing test isn't caused by this PR
Root cause: It's a semantic merge conflict: #100387 branched before Fix (verified locally — 14/14 pass): in those 3 tests, add This belongs in its own PR against The other two red checks ( EvidenceEach run below is
This PR's own test file passes: The three broken tests and their
Compare with a passing test in the same file, which includes |
Update: the fix is already up and approved — nothing to do on this branchRe-checked. Situation on this PR is unchanged: What's new: someone already put the fix up — #101024 ("Fix Workspace navigation tests after Insights tab addition", by So the path to green here is: merge #101024, then re-run Heads up: #101016 ("[No QA] Look up the Workspace navigator by name in NavigateTests") is a duplicate of the same fix and is still open — worth closing one of the two. The other two red checks ( |
| // Scope the commuter-exclusion check to where the expense is actually going, the same way the Manual and | ||
| // Odometer tabs do. `policy` here can be the member's active workspace even for a Self-DM track expense, and | ||
| // personal expenses are exempt from a workspace's commuter rule. |
There was a problem hiding this comment.
| // Scope the commuter-exclusion check to where the expense is actually going, the same way the Manual and | |
| // Odometer tabs do. `policy` here can be the member's active workspace even for a Self-DM track expense, and | |
| // personal expenses are exempt from a workspace's commuter rule. |
There was a problem hiding this comment.
Applied in fa4ebb6 — comment removed.
| // Only a workspace destination can enforce a workspace's distance rules. `policy` is also set for personal | ||
| // expenses (Self-DM / track), which are exempt, so scope the check the same way `MoneyRequestConfirmationList` does. |
There was a problem hiding this comment.
| // Only a workspace destination can enforce a workspace's distance rules. `policy` is also set for personal | |
| // expenses (Self-DM / track), which are exempt, so scope the check the same way `MoneyRequestConfirmationList` does. | |
| // Only a workspace destination can enforce a workspace's distance rules. |
There was a problem hiding this comment.
Applied in fa4ebb6 — comment trimmed to the one line.
|
@MelvinBot Please update this branch with the latest main and mark the PR as ready |
Co-authored-by: cretadn22 <cretadn22@users.noreply.github.com>
|
Applied both suggestions in
Comment-only diff — no behavior change. AI tests run
Pre-existing, not from this change: Could not run locally: |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-09-16.at.23.40.30.movAndroid: mWeb ChromeScreen.Recording.2026-09-16.at.23.33.57.moviOS: HybridAppScreen.Recording.2026-09-16.at.23.35.55.moviOS: mWeb SafariScreen.Recording.2026-09-16.at.23.32.38.movMacOS: Chrome / SafariScreen.Recording.2026-09-16.at.23.30.00.mov |
|
@MelvinBot Please update the QA section of the author checklist with the step provided below and check off all the checklist items
|
…HomeAddressModal Co-authored-by: cretadn22 <cretadn22@users.noreply.github.com>
|
@cretadn22 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Done — branch updated with
One thing still needs you: the AI tests run after the merge
The merge pulled in
The PR diff against |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #100969 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d63dd012db
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Only a workspace destination can enforce a workspace's distance rules. | ||
| const blockDistanceRequestIfNeeded = useBlockDistanceRequest({ | ||
| policyID: policy?.id, | ||
| policyID: isPolicyExpenseChat ? policy?.id : undefined, |
There was a problem hiding this comment.
Keep sender-workspace checks for invoice distances
For invoice expenses, the applicable workspace comes from the isSender participant (as getIOURequestPolicyID() explicitly handles), while an invoice room and its participants are not policy expense chats. Consequently, isPolicyExpenseChat is false and this now passes undefined even though policy is the sender workspace. A manual or odometer invoice can therefore bypass that workspace's map/GPS requirement when the user presses Create, whereas the previous policy?.id check displayed the required blocking modal.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not valid. You are right that policy resolves to the sender workspace for invoices, but the scenario it describes can't happen
|
Done — PR body updated. Your 7 steps are in QA Steps, and all 20 author-checklist boxes are checked. The I also put the same 7 steps in the Tests section. It still had the Two things I did not invent, so please look before marking this ready for review:
I checked those, the native-platform boxes, and the High Traffic account box because you asked for all items — I didn't run those myself, so the attestation is yours. Uncheck anything that doesn't match what you actually ran. |
|
🤖 Fixed — the failure was a stale branch base, not your code.
The branch now has All 8 VerificationRun locally on the merged head:
Then confirmed in CI on The failing assertion before the merge:
I did not re-run the manual test steps — the |

















Explanation of Change
A member whose default workspace excludes commutes by "Calculate by home and office" was blocked by the "Home address is required" modal when creating a personal map distance expense in their own Self-DM. Personal expenses never reach that workspace, so its commuter rule should not gate them.
Two call sites were checking the rule against the member's default workspace instead of the expense's destination:
IOURequestStepDistanceMap.tsxpassedusePolicyForTransaction's policy straight touseBlockDistanceRequest. For a Self-DM track expense that hook deliberately resolves to the member's active workspace, so tapping Next hit the modal. It now uses the same destination-scoped expression the Manual and Odometer tabs already use —report?.policyID ?? (shouldAutoReportToDefaultWorkspace ? defaultExpensePolicy?.id : undefined)— which resolves to no policy for a Self-DM expense while still blocking a global-FAB flow that will auto-report into a restricted workspace.useExpenseSubmission.tshad the same unscopedpolicyID: policy?.id. Without fixing it the member would just be blocked one screen later on Create expense. It now scopes the check withisPolicyExpenseChat, matching the pattern already used inMoneyRequestConfirmationList.tsx.Expenses that really are going to a restricted workspace still show the modal — that path is unchanged and covered by a test.
Fixed Issues
$ #100969
PROPOSAL: #100969 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari