Repository navigation
[Payment due @situchan] Do not treat submitted expense reports on Dynamic External Workflow policies as awaiting first-level approval - #98704
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7b5005ace
ℹ️ 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".
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb SafariMacOS: Chrome / Safaribefore.movafter.mov |
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good for product
|
🎯 @situchan, thanks for reviewing and testing this PR! 🎉 A payment issue will be created for your review once this PR is deployed to production. If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created. |
|
Please confirm this is expected after submitting expense on DEW policy:
|
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
ReviewThe core change is small, correct, and well-scoped: for a DEW expense report the early But the main thing to flag is Where each capability is gated by this predicateFor a non-admin/non-manager submitter on their own submitted DEW report,
So the three behaviors Recommendation: Get an explicit product/backend confirmation that a submitter should lose delete/split/merge/rename/hold on a submitted DEW report. If yes, this approach is correct — consider adding a short unit test asserting one of the non-add gates (e.g. Nits:
I did not test the flow in-app — reproducing it needs a workspace configured with delayed submissions + Dynamic External Workflow + the routed user matching the approver, which the author's attached videos already demonstrate; the logic above is verified against the code. |
Regression scanGood news: the change is tightly scoped to exactly the buggy population, and touches nothing else. The early
The regressions to confirm — within that narrow population, the submitter loses these (all flow from the same shared predicate flipping to "forwarded"):
The first six are the ones Are these true regressions or correct alignment? That depends solely on whether the backend also blocks the submitter from delete/merge/split/rename/hold/move on a submitted DEW report (the same way it rejects add with a 401). I could not verify server behavior here. Two reasons to believe the direction is intended, though:
Recommendation: No unintended blast radius found — the change is correctly confined to the buggy reports. Before merging, get a one-line product/backend confirmation that the submitter should lose delete/merge/split/rename/hold/move on a submitted DEW report (i.e. the backend rejects those too). If yes, this is correct alignment; add a unit test on one non-add gate (e.g. Verification notesAnalysis is against the checked-out branch ( |
Submitter loses split / merge on their own submitted report - backend rejects these. Submitter can no longer rename their own submitted report Submitter can no longer hold their own expense - backend rejects this. So, I think these are all expected. |
mountiny
left a comment
There was a problem hiding this comment.
Ok thanks that looks good to me
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.58-0 🚀
|
|
🤖 No help site changes required. This PR is an internal correctness fix, not a change to any documented user-facing behavior. It updates Why no docs update is needed
Because no changes are required, no draft help site PR was created, and there is nothing to review on the docs side. |
|
Hi @c3024. How can we follow this precondition?
|
|
Hey, does QA have access to any DEW (Dynamic External Workflow) approval mode workspaces? |
|
@c3024 I don't think so |
|
@c3024 Would you be able to check this PR internally on your side? |
|
Checked it off, thanks |
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.4.58-4 🚀
Bundle Size Analysis (Sentry): |
|
🤖 Payment issue created: #99231 |

Explanation of Change
The backend never treats submitted expense reports on Dynamic External Workflow policies as awaiting first-level approval, so it rejects adding expenses to them with a 401. The App gate had no such check, so it reused the submitted report and the request failed. This adds the same exclusion to
isAwaitingFirstLevelApprovalso the App creates a new report instead. ViaisForwardedReport, the exclusion also removes submitted DEW reports from report pickers and the share flow.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/671728
PROPOSAL:
Tests
Requires a workspace with delayed submissions enabled, the Dynamic External Workflow approval mode and routed to user in DEW to be same as the workspace approver.
Screen.Recording.2026-08-17.at.3.41.21.PM.mov
On main/staging/prod branch:
createmoneyrequestonmain.mov
Offline tests
Requires a workspace with delayed submissions enabled, the Dynamic External Workflow approval mode and routed to user in DEW to be same as the workspace approver.
QA Steps
Same as Tests.
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