Skip to content

[Due for payment 2026-04-03] [$250] Expense - DEW submit actions show different content when copied #84037

Closed

Description

@lanitochka17

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.28-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #83517
Email or phone of affected tester (no customers): applausetester+ndk80@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an expense.
  4. Open the report.
  5. Click Submit.
  6. Click description, enter applausetester+ndk80@applause.expensifail.com and save it.
  7. Rename report to APPROVE_ERROR.
  8. Click Submit.
  9. Click Approve.
  10. Right click on "failed to submit the report. Add at least one approver as an expense description" system message > Copy to clipboard.
  11. Paste the content.
  12. Right click on "failed to approve. This report cannot be approved" system message > Copy to clipboard.
  13. Paste the content.

Expected Result:

The copied content will be the same as the system message.

Actual Result:

The copied content is different from the system message.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7092797_1772541728343.25.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @sobitneupane
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022028839454503753803
  • Upwork Job ID: 2028839454503753803
  • Last Price Increase: 2026-03-10

Activity

  1. added
    Daily
    Bug
    on Mar 3, 2026
  2. melvin-bot commented on Mar 3, 2026

    @melvin-bot

    Triggered auto assignment to @NicMendonca (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.

  3. MelvinBot commented on Mar 3, 2026

    @MelvinBot
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When a user right-clicks a DEW (Dynamic External Workflow) submit/approve failure system message and selects "Copy to clipboard", the copied text is different from what is displayed on screen. The on-screen message shows a translated string like "failed to submit the report. Add at least one approver as an expense description", but the clipboard receives different (likely empty or raw backend) content.

    What is the root cause of that problem?

    PR #83517 changed how DEW_SUBMIT_FAILED and DEW_APPROVE_FAILED actions are displayed. Previously, these had explicit rendering in PureReportActionItem.tsx using ReportActionItemBasicMessage. The PR removed that explicit handling and moved message construction into getReportActionMessageFragments() in ReportActionsUtils.ts (lines 2306-2319), which builds a translated prefix + error reason from originalMessage.message.

    However, the "Copy Message" handler in ContextMenuActions.tsx (lines 720-1078) was not updated to handle these action types. The copy handler reads from action.message via getActionHtml() (line 207-210), but for DEW actions, action.message is an empty array — the actual error data lives in originalMessage.message. Since there's no explicit DEW_SUBMIT_FAILED/DEW_APPROVE_FAILED case in the copy handler's if-else chain, it falls through to the generic fallback, which copies the raw (empty) action.message content instead of the translated display message.

    Display path: ReportActionItemMessage → getReportActionMessageFragments(translate, action) → reads originalMessage.message → constructs translated message
    Copy path: getActionHtml(reportAction) → reads action.message (empty []) → falls through to generic handler → copies empty/wrong text

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

    Add explicit handlers for DEW_SUBMIT_FAILED and DEW_APPROVE_FAILED in the "Copy Message" if-else chain in ContextMenuActions.tsx (before the generic fallback at line 1067). These handlers should construct the same translated message that getReportActionMessageFragments() produces, using getOriginalMessage() to extract the error reason and translate() to build the full message. The result should be passed through Parser.htmlToText() before copying to strip any HTML tags (since the auto-submit/auto-approve translation strings contain <a> anchor tags).

    What alternative solutions did you explore? (Optional)

    An alternative would be to have the backend populate action.message with the correct text for DEW actions, but this would duplicate logic and still wouldn't produce the translated message. The better approach is to align the copy handler with the display path, as is done for many other action types in the same file.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.

  4. added
    External
    on Mar 3, 2026
  5. added
    Help Wanted
    on Mar 3, 2026
  6. melvin-bot commented on Mar 3, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External)

  7. changed the title [-]Expense - DEW submit actions show different content when copied[/-] [+][$250] Expense - DEW submit actions show different content when copied[/+] on Mar 3, 2026
  8. melvin-bot commented on Mar 3, 2026

    @melvin-bot
  9. babata990725 commented on Mar 3, 2026

    @babata990725

    @MelvinBot implement this

  10. melvin-bot commented on Mar 3, 2026

    @melvin-bot

    📣 @babata990725! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  11. nkdengineer commented on Mar 3, 2026

    @nkdengineer
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The copied content is different from the system message.

    What is the root cause of that problem?

    We displayed a custom message for DEW_SUBMIT_FAILED and DEW_APPROVE_FAILED actions.

    if (isDynamicExternalWorkflowSubmitFailedAction(action)) {
    const originalMessage = getOriginalMessage(action);
    const wasSubmittedViaHarvesting = originalMessage?.harvesting ?? false;
    const message = originalMessage?.message ?? translate('iou.error.genericCreateFailureMessage');
    const failedSubmitReason = wasSubmittedViaHarvesting ? translate('iou.failedToAutoSubmitViaDEW', message) : translate('iou.failedToSubmitViaDEW', message);
    return [{text: failedSubmitReason, html: `<muted-text>${failedSubmitReason}</muted-text>`, type: 'COMMENT'}];
    }
    if (isDynamicExternalWorkflowApproveFailedAction(action)) {
    const originalMessage = getOriginalMessage(action);
    const wasAutoApproveAction = originalMessage?.automaticAction ?? false;
    const message = originalMessage?.message ?? translate('iou.error.genericCreateFailureMessage');
    const failedApproveReason = wasAutoApproveAction ? translate('iou.failedToAutoApproveViaDEW', message) : translate('iou.failedToApproveViaDEW', message);
    return [{text: failedApproveReason, html: `<muted-text>${failedApproveReason}</muted-text>`, type: 'COMMENT'}];
    }
    const actionMessage = action.previousMessage ?? action.message;

    But we don't handle these action types to return the custom message in ContextMenuActions, then by default it returns the original message/html of the action.

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

    1. Update this callback to handle DEW_SUBMIT_FAILED and DEW_APPROVE_FAILED actions. We can follow the same way here to get the message for these actions

    1. We should also handle the same in computeReportNameBasedOnReportAction function to fix the thread report name when repling in the thread of the action

    function computeReportNameBasedOnReportAction(

    OPTIONAL: We can create a util to get the custom message of DEW_SUBMIT_FAILED and DEW_APPROVE_FAILED action. And then use this util function in getReportActionMessageFragments, ContextMenuActions and computeReportNameBasedOnReportAction

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  12. 47 remaining items

  13. melvin-bot commented on Apr 10, 2026

    @melvin-bot

    @sobitneupane Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  14. melvin-bot commented on Apr 14, 2026

    @melvin-bot

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

  15. melvin-bot commented on Apr 16, 2026

    @melvin-bot

    @sobitneupane 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

  16. mallenexpensify commented on Apr 17, 2026

    @mallenexpensify
    Contributor

    @sobitneupane plz complete the BZ checklist and tag me in a post once you have.

  17. melvin-bot commented on Apr 20, 2026

    @melvin-bot

    @sobitneupane 12 days overdue. Walking. Toward. The. Light...

  18. sobitneupane commented on Apr 21, 2026

    @sobitneupane
    Contributor

    Sorry for the delay, @mallenexpensify I have been quite busy this week. If it's okay with you, I will try to get this done by EOW.

  19. twisterdotcom commented on Apr 22, 2026

    @twisterdotcom
    Contributor

    @nkdengineer has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-30e0-a1ac-acb1-426eea9fb684
  20. removed their assignment
    on Apr 24, 2026
  21. sobitneupane commented on Apr 27, 2026

    @sobitneupane
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR: Update how DEW submit actions are displayed #83517 (comment)
      Link to the comment on the Issue: Internal issue

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/630173

    Regression Test Proposal

    Precondition:

    • Log in to an account with a workspace that has a test DEW implementation enabled.

    Test:

    1. Go to workspace chat.
    2. Create an expense.
    3. Open the report.
    4. Click Submit.
    5. Click description, enter your email and save it.
    6. Rename report to APPROVE_ERROR.
    7. Click Submit.
    8. Click Approve.
    9. Right click on "failed to submit the report. Add at least one approver as an expense description" system message > Copy to clipboard.
    10. Paste the content.
    11. Verify that the text matches with text copied in step 9.
    12. Right click on "failed to submit the report. Add at least one approver as an expense description" system message > Reply in thread
    13. Verify that the thread header displays the same as the parent action text
    14. Repeat steps 9 - 13 with "failed to approve. This report cannot be approved" system message
    15. Verify that the text matches with text copied in step 14.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-68ae-a68d-9ade-bc09de777ae4
  22. mallenexpensify commented on Apr 27, 2026

    @mallenexpensify
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR:
      Link to the comment on the Issue:

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal Template
    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    Test:

    Do we agree 👍 or 👎

  23. JmillsExpensify commented on May 24, 2026

    @JmillsExpensify
    Contributor

    $250 approved for @sobitneupane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions