Skip to content

Expense - Error submitting expense as approver when member creates report and adds expense #79615

Closed

Description

@mitarachim

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.3.2-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: #78984
Email or phone of affected tester (no customers): sdsnjsoisjnionjisdjos22@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.1 / Chrome
App Component: Search

Action Performed:

Precondition:

  • Create a workspace with admin, non-admin approver and member.

Member:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an empty report.
  4. On the empty report, click Add expense > Create expense.
  5. Create an expense.

Non-admin approver:
6. Open the expense report.
7. Click More > Submit.

Expected Result:

Non-admin approver should be able to submit the report without issue.

Actual Result:

Error submitting expense as non-admin approver when member creates report and adds expense.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7049448_1768429959047.6.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Jan 14, 2026
  2. melvin-bot commented on Jan 14, 2026

    @melvin-bot

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

  3. melvin-bot commented on Jan 14, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jan 14, 2026

    @melvin-bot

    Triggered auto assignment to @JmillsExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  5. github-actions commented on Jan 14, 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. OSBotify commented on Jan 14, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #78984 - "fix: Submit button is not displayed in second report to Approver" by @nkdengineer (High confidence)
    Related Issues: #77882 (original issue that PR #78984 was fixing)

    Recommendation: REVERT

    PR #78984 should be reverted because it incorrectly allows non-admin approvers to see and attempt to submit expense reports. Approvers should approve reports, not submit them. Reports should only be submitted by the report owner (the member who created the expense).

    Labels: Both DeployBlockerCash and DeployBlocker should be kept, as this is a frontend bug that blocks the App deploy.

    Detailed Analysis

    Evidence

    PR #78984 modified the logic in ReportPreviewActionUtils.ts and ReportSecondaryActionUtils.ts to change how the isManager check works when determining who can submit a report.

    Before PR #78984:

    const isManager = report.managerID === currentUserAccountID;

    After PR #78984:

    const submitToAccountID = getSubmitToAccountID(policy, report);
    const isManager = submitToAccountID === currentUserAccountID || report.managerID === currentUserAccountID;

    Verification

    The PR modified these two files:

    • src/libs/ReportPreviewActionUtils.ts (lines 40-41)
    • src/libs/ReportSecondaryActionUtils.ts (line 219)

    These changes directly affect the canSubmit and isSubmitAction functions, which control when the Submit button/action is displayed.

    Root Cause

    The original issue (#77882) reported that the submit button was not showing for approvers on second reports. However, the fix in PR #78984 appears to have misunderstood the requirement:

    • Approvers should be able to APPROVE reports (not submit them)
    • Report owners/submitters should be able to SUBMIT reports

    By broadening the isManager check to include users where getSubmitToAccountID(policy, report) === currentUserAccountID, the PR now allows non-admin approvers to see the Submit option when they should only see the Approve option.

    When a non-admin approver tries to submit a report they did not create, the submission fails because:

    1. The backend expects the report owner to submit the report
    2. The frontend is now incorrectly allowing approvers to attempt submission
    3. This creates a mismatch between frontend permissions and backend validation

    The error occurs in this scenario:

    • Precondition: Workspace with admin, non-admin approver, and member
    • Member creates a report and adds an expense
    • Non-admin approver opens the report, clicks More > Submit
    • Result: Error - the approver should not be able to submit, only approve

    Recommended Fix Approach

    After reverting PR #78984, the correct fix for the original issue (#77882) should:

    1. Ensure approvers see the APPROVE button, not the SUBMIT button
    2. Ensure the report owner/submitter sees the SUBMIT button
    3. Review the distinction between canSubmit and canApprove functions to ensure they are checking the correct permissions
  7. OSBotify commented on Jan 14, 2026

    @OSBotify
    Contributor

    Update to my previous analysis:

    After reviewing the test steps in PR #78984, I can confirm that approvers are intentionally allowed to submit reports on behalf of members in Expensify workflows. However, PR #78984 appears to have enabled this functionality in a scenario where it creates an error.

    The root issue: PR #78984 broadened the condition for showing the submit button to include approvers (via the getSubmitToAccountID check), but this may have exposed a scenario where:

    1. The frontend now allows non-admin approvers to see and click Submit
    2. The backend validation or the submission flow fails for non-admin approvers in specific scenarios (like when the member creates an empty report and adds expenses)

    This is still classified as a Frontend bug because the fix needs to happen in the App repository - either by:

    1. Reverting PR fix: Submit button is not displayed in second report to Approver #78984 and implementing a more careful fix that handles all edge cases
    2. Adding additional frontend validation to prevent the Submit option from showing in problematic scenarios
    3. Or fixing the submission logic to properly handle non-admin approver submissions

    Recommendation remains: REVERT PR #78984 to unblock the deploy, then investigate and implement a proper fix that handles all approval workflow scenarios correctly.

  8. OSBotify commented on Jan 14, 2026

    @OSBotify
    Contributor

    Label Update

    Removed DeployBlocker label because this is a Frontend bug that requires fixing in the App repository (not the backend).

    Keeping DeployBlockerCash because the App deploy should remain blocked until PR #78984 is reverted or a proper fix is implemented.


    Next Steps:

    1. Revert PR fix: Submit button is not displayed in second report to Approver #78984 to unblock the deploy
    2. @nkdengineer (PR author) should investigate why non-admin approvers encounter errors when submitting reports in this specific scenario
    3. Implement a more comprehensive fix that properly handles all approval workflow edge cases
  9. situchan commented on Jan 14, 2026

    @situchan
    Contributor

    @nkdengineer looks like QA team also reproduced #78984 (comment) what I faced before. Can you check?

  10. self-assigned this
    on Jan 15, 2026
  11. mountiny commented on Jan 15, 2026

    @mountiny
    Contributor

    Reverted the offending PR

  12. IuliiaHerets commented on Jan 15, 2026

    @IuliiaHerets

    @mountiny issue not already reproduced on 9.3.2-2 build

    Screen.Recording.2026-01-15.at.21.27.45.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2ReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions