Skip to content

[Due for payment 2025-06-12] [$250] Preview shows "Deleted report" when new report is created offline when workflows are disabled #62565

Closed

Description

@jponikarchuk

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.1.49-4
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): applausetester+2e89292@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.4 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Create a workspace and disable Workflows in More features.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Go offline.
  4. Click + > Create report.

Expected Result:

Expense preview will show the empty report preview.

Actual Result:

Expense preview shows "Deleted report" when new report is created offline when workflows are disabled.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021927445253198939393
  • Upwork Job ID: 1927445253198939393
  • Last Price Increase: 2025-05-27
  • Automatic offers:
    • nkdengineer | Contributor | 107491365
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 22, 2025
  2. melvin-bot commented on May 22, 2025

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (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. nkdengineer commented on May 22, 2025

    @nkdengineer
    Contributor

    Proposal

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

    Expense preview shows "Deleted report" when new report is created offline when workflows are disabled.

    What is the root cause of that problem?

    The empty expense report is marked as closed in optimistic data when the workflows are disabled. But backend returns it as open report.

    App/src/libs/ReportUtils.ts

    Lines 5553 to 5558 in 40b31da

    if (isInstantSubmitEnabledLocal && arePaymentsDisabled && isSubmitAndCloseLocal) {
    return {
    stateNum: CONST.REPORT.STATE_NUM.APPROVED,
    statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
    };
    }

    Then offline, the preview is shown as deleted based on this condition.

    } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && isClosedExpenseReportWithNoExpenses) {
    children = <RenderHTML html={`<deleted-action>${translate('parentReportAction.deletedReport')}</deleted-action>`} />;
    } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && canUseTableReportView) {

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

    We should introduce a new param like isEmptyReport for getExpenseReportStateAndStatus

    function buildOptimisticEmptyReport(reportID: string, accountID: number, parentReport: OnyxEntry<Report>, parentReportActionID: string, policy: OnyxEntry<Policy>, timeOfCreation: string) {

    Then we will prevent the close status here if isEmptyReport is true. I checked all cases in this function for empty report in backend and only this case is different from front-end now.

    App/src/libs/ReportUtils.ts

    Lines 5553 to 5558 in 40b31da

    if (isInstantSubmitEnabledLocal && arePaymentsDisabled && isSubmitAndCloseLocal) {
    return {
    stateNum: CONST.REPORT.STATE_NUM.APPROVED,
    statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
    };
    }

    After that we will pass isEmptyReport is true here

    App/src/libs/ReportUtils.ts

    Lines 5644 to 5645 in 40b31da

    function buildOptimisticEmptyReport(reportID: string, accountID: number, parentReport: OnyxEntry<Report>, parentReportActionID: string, policy: OnyxEntry<Policy>, timeOfCreation: string) {
    const {stateNum, statusNum} = getExpenseReportStateAndStatus(policy);

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    Update createNewReport test to correct this scenario

    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.

  4. nyomanjyotisa commented on May 22, 2025

    @nyomanjyotisa
    Member

    Proposal

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

    Preview shows "Deleted report" when new report is created offline when workflows are disabled

    What is the root cause of that problem?

    We use getExpenseReportStateAndStatus on buildOptimisticEmptyReport, which is only valid for buildOptimisticExpenseReport

    App/src/libs/ReportUtils.ts

    Lines 5644 to 5645 in 40b31da

    function buildOptimisticEmptyReport(reportID: string, accountID: number, parentReport: OnyxEntry<Report>, parentReportActionID: string, policy: OnyxEntry<Policy>, timeOfCreation: string) {
    const {stateNum, statusNum} = getExpenseReportStateAndStatus(policy);

    it has this condition which set the status to closed, and it not align with data coming from backend

    App/src/libs/ReportUtils.ts

    Lines 5553 to 5558 in 40b31da

    if (isInstantSubmitEnabledLocal && arePaymentsDisabled && isSubmitAndCloseLocal) {
    return {
    stateNum: CONST.REPORT.STATE_NUM.APPROVED,
    statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
    };
    }

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

    We should create a new get state and status function specifically for empty report getEmptyReportStateAndStatus

    function getEmptyReportStateAndStatus(policy: OnyxEntry<Policy>) {
        const isInstantSubmitEnabledLocal = isInstantSubmitEnabled(policy);
    
        if (isInstantSubmitEnabledLocal) {
            return {
                stateNum: CONST.REPORT.STATE_NUM.SUBMITTED,
                statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED,
            };
        }
    
        return {
            stateNum: CONST.REPORT.STATE_NUM.OPEN,
            statusNum: CONST.REPORT.STATUS_NUM.OPEN,
        };
    }
    

    and use it here

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    update test for createNewReport accordingly, based on above solution

    What alternative solutions did you explore? (Optional)

    None

  5. mallenexpensify commented on May 23, 2025

    @mallenexpensify
    Contributor

    Unable to reproduce, @nkdengineer or @nyomanjyotisa , any idea what I might be going wrong?

    2025-05-22_17-23-45.mp4
    Image
  6. nkdengineer commented on May 23, 2025

    @nkdengineer
    Contributor

    @mallenexpensify Did you disable the workflows feature in this workspace? We can only reproduce if the workflow is disabled.

  7. mallenexpensify commented on May 23, 2025

    @mallenexpensify
    Contributor

    I can't reproduce when I'm offline but.. I get this 'deleted report' blip when I'm online

    2025-05-23_09-48-31.mp4

    Think that's the same bug? Or... would the proposed fix also address what I'm seeing when online? I can gather / send more details, if needed.

  8. nkdengineer commented on May 23, 2025

    @nkdengineer
    Contributor

    Think that's the same bug

    @mallenexpensify Yeah, it's the same bug but not sure why you can't reproduce it offline. I can reproduce it easily

    Screen.Recording.2025-05-24.at.00.11.07.mov
  9. dmkt9 commented on May 25, 2025

    @dmkt9
    Contributor

    Proposal

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

    Expense preview shows "Deleted report" when new report is created offline when workflows are disabled.

    What is the root cause of that problem?

    1. The Report's OptimisticEmptyReport is created here:

      App/src/libs/ReportUtils.ts

      Lines 5693 to 5694 in 526a0e4

      const {stateNum, statusNum} = getExpenseReportStateAndStatus(policy);
      const titleReportField = getTitleReportField(getReportFieldsByPolicyID(policy?.id) ?? {});

    2. When approval is disabled or the workflow is disabled, isSubmitAndCloseLocal = true in getExpenseReportStateAndStatus. This makes the following condition true:

      App/src/libs/ReportUtils.ts

      Lines 5601 to 5606 in 526a0e4

      if (isInstantSubmitEnabledLocal && arePaymentsDisabled && isSubmitAndCloseLocal) {
      return {
      stateNum: CONST.REPORT.STATE_NUM.APPROVED,
      statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
      };
      }

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

    • In the function getExpenseReportStateAndStatus there should be a step to check whether the report contains only nonreimbursable transactions:
    const onlyNonReimbursableTransactions = hasOnlyNonReimbursableTransactions(reportID);
    • Add this condition to the if statement here:
      if (isInstantSubmitEnabledLocal && arePaymentsDisabled && isSubmitAndCloseLocal) {
    if (isInstantSubmitEnabledLocal && arePaymentsDisabled && isSubmitAndCloseLocal && onlyNonReimbursableTransactions)
    • Add reportID parameter to getExpenseReportStateAndStatus function:
      function getExpenseReportStateAndStatus(policy: OnyxEntry<Policy>) {
    function getExpenseReportStateAndStatus(policy: OnyxEntry<Policy>, reportID?: string)
    • And pass reportID from here to getExpenseReportStateAndStatus:
      const {stateNum, statusNum} = getExpenseReportStateAndStatus(policy);
    const {stateNum, statusNum} = getExpenseReportStateAndStatus(policy, reportID);

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    NA

    What alternative solutions did you explore? (Optional)

    NA

    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.

  10. melvin-bot commented on May 27, 2025

    @melvin-bot

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

  11. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 27, 2025
  12. melvin-bot commented on May 27, 2025

    @melvin-bot
  13. 25 remaining items

  14. melvin-bot commented on Jun 5, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  15. melvin-bot commented on Jun 5, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.59-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-06-12. 🎊

    For reference, here are some details about the assignees on this issue:

  16. melvin-bot commented on Jun 5, 2025

    @melvin-bot

    @mananjadhav @mallenexpensify @mananjadhav The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  17. mananjadhav commented on Jun 13, 2025

    @mananjadhav
    Collaborator

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: I couldn't pinpoint to a specific PR for causing this.

    • [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: NA

    • [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:

    Regression Test Proposal

    Precondition:

    • Create a workspace and disable Workflows in More features.

    Test:

    1. Go to staging.new.expensify.com
    2. Go to workspace chat.
    3. Go offline.
    4. Click + > Create report.
    5. Expense preview will show the empty report preview.

    Do we agree 👍 or 👎

  18. mananjadhav commented on Jun 13, 2025

    @mananjadhav
    Collaborator

    @mallenexpensify This is ready for payout.

  19. garrettmknight commented on Jun 13, 2025

    @garrettmknight
    Contributor

    Payment summary:

    Contributor: @nkdengineer $250, paid via Upwork
    Contributor+: @mananjadhav $250 via Newdot

  20. JmillsExpensify commented on Jun 13, 2025

    @JmillsExpensify
    Contributor

    Payment summary:

    Contributor: @nkdengineer $250 via Upwork
    Contributor+: @mananjadhav $250 via New Expensify

  21. garrettmknight commented on Jun 13, 2025

    @garrettmknight
    Contributor

    $250 approved for @mananjadhav

  22. nkdengineer commented on Oct 22, 2025

    @nkdengineer
    Contributor

    Contributor: @nkdengineer $250, paid via Upwork

    @garrettmknight This was not paid out yet, could you please help to double check?

    Thanks in advance 🙏

  23. mallenexpensify commented on Oct 22, 2025

    @mallenexpensify
    Contributor

    hahha, third time is a charm @nkdengineer , you're paid now. Sorry for the hassle.

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions