Skip to content

[HOLD for payment 2024-11-26] [$250] Unable to Act on Report Due to Deleted Workspace, Stuck with RBR in Focus Mode Without Edit Access #50573

Closed

Description

@m-natarajan

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.0.47-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @allgandalf
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1728540959841099

Action Performed:

  1. Submit an expense with violation
  2. Select focus mode in preferences
  3. Delete the Workspace where the expenses was submitted
  4. Observe LHN

Expected Result:

Report in archived status

Actual Result:

See RBR in LHN with the report, but cannot act on it as don't have edit access anymore to that report, but also cannot do anything here, it stays in my LHN

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Screenshot 2024-10-10 at 11 45 49 AM

Recording.642.mp4

Onyx data:

{ "chatReportID": "4695747423350738", "chatType": "", "currency": "INR", "description": "", "errorFields": {}, "hasOutstandingChildRequest": false, "hasOutstandingChildTask": false, "hasParentAccess": true, "isCancelledIOU": false, "isOwnPolicyExpenseChat": false, "isPinned": false, "isWaitingOnBankAccount": false, "lastActionType": "CLOSED", "lastActorAccountID": "16559988", "lastMessageHtml": "closed this report", "lastMessageText": "closed this report", "lastReadSequenceNumber": 0, "lastReadTime": "2024-10-10 06:16:13.007", "lastVisibleActionCreated": "2024-04-08 08:54:26.839", "lastVisibleActionLastModified": "2024-04-08 08:54:26.839", "managerID": 0, "nonReimbursableTotal": 0, "notificationPreference": "hidden", "oldPolicyName": "Whogandalf's Workspace 27", "ownerAccountID": 16559988, "parentReportActionID": "6007246625411673721", "parentReportID": "4695747423350738", "participants": { "16559988": { "hidden": true, "notificationPreference": "hidden" } }, "permissions": [], "policyID": "3DEDDF79F054B00A", "private_isArchived": "2024-07-18 11:24:28.169", "reportID": "4817250283487348", "reportName": "Expense Report #5426340451518743", "stateNum": 2, "statusNum": 2, "total": 0, "type": "expense", "unheldTotal": 0, "welcomeMessage": "", "writeCapability": "all", "isLoadingPrivateNotes": false, "privateNotes": { "16559988": { "note": "" } } }

Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021845769561131002585
  • Upwork Job ID: 1845769561131002585
  • Last Price Increase: 2024-10-21
  • Automatic offers:
    • allgandalf | Reviewer | 104576294
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @sonialiap

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 10, 2024
  2. melvin-bot commented on Oct 10, 2024

    @melvin-bot

    Triggered auto assignment to @sonialiap (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. allgandalf commented on Oct 10, 2024

    @allgandalf
    Contributor

    Note

    Can i be the C+ for this issue @sonialiap , I reported this bug and have prior context

  4. bernhardoj commented on Oct 10, 2024

    @bernhardoj
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-10-17 14:42:26 UTC.

    Proposal

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

    The RBR still shows for deleted workspace chat and its expense report and thread.

    What is the root cause of that problem?

    There are 3 RBRs here. 1 in LHN,

    function getAllReportActionsErrorsAndReportActionThatRequiresAttention(report: OnyxEntry<Report>, reportActions: OnyxEntry<ReportActions>): ReportErrorsAndReportActionThatRequiresAttention {
    const reportActionsArray = Object.values(reportActions ?? {});
    const reportActionErrors: OnyxCommon.ErrorFields = {};
    let reportAction: OnyxEntry<ReportAction>;
    for (const action of reportActionsArray) {
    if (action && !isEmptyObject(action.errors)) {
    Object.assign(reportActionErrors, action.errors);
    if (!reportAction) {
    reportAction = action;
    }
    }
    }
    const parentReportAction: OnyxEntry<ReportAction> =
    !report?.parentReportID || !report?.parentReportActionID ? undefined : allReportActions?.[report.parentReportID ?? '-1']?.[report.parentReportActionID ?? '-1'];
    if (ReportActionUtils.wasActionTakenByCurrentUser(parentReportAction) && ReportActionUtils.isTransactionThread(parentReportAction)) {
    const transactionID = ReportActionUtils.isMoneyRequestAction(parentReportAction) ? ReportActionUtils.getOriginalMessage(parentReportAction)?.IOUTransactionID : null;
    const transaction = allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`];
    if (TransactionUtils.hasMissingSmartscanFields(transaction ?? null) && !ReportUtils.isSettled(transaction?.reportID)) {
    reportActionErrors.smartscan = ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericSmartscanFailureMessage');
    reportAction = undefined;
    }
    } else if ((ReportUtils.isIOUReport(report) || ReportUtils.isExpenseReport(report)) && report?.ownerAccountID === currentUserAccountID) {
    if (ReportUtils.shouldShowRBRForMissingSmartscanFields(report?.reportID ?? '-1') && !ReportUtils.isSettled(report?.reportID)) {
    reportActionErrors.smartscan = ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericSmartscanFailureMessage');
    reportAction = ReportUtils.getReportActionWithMissingSmartscanFields(report?.reportID ?? '-1');
    }
    } else if (ReportUtils.hasSmartscanError(reportActionsArray)) {
    reportActionErrors.smartscan = ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericSmartscanFailureMessage');
    reportAction = ReportUtils.getReportActionWithSmartscanError(reportActionsArray);
    }
    return {
    errors: reportActionErrors,
    reportAction,
    };
    }

    1 in report preview,

    const hasErrors =
    (hasMissingSmartscanFields && !iouSettled) ||
    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    ReportUtils.hasViolations(iouReportID, transactionViolations) ||
    ReportUtils.hasWarningTypeViolations(iouReportID, transactionViolations) ||
    (ReportUtils.isReportOwner(iouReport) && ReportUtils.hasReportViolations(iouReportID)) ||
    ReportUtils.hasActionsWithErrors(iouReportID);

    and 1 in the expense/transaction preview.

    const shouldShowRBR = hasNoticeTypeViolations || hasViolations || hasFieldErrors || (!isFullySettled && !isFullyApproved && isOnHold) || hasDuplicates;

    None of the conditions check for the report archive status. The expense report will stay on the LHN because we always show it if there are errors other than failed receipt.

    const hasErrorsOtherThanFailedReceipt =
    doesTransactionThreadReportHasViolations ||
    doesReportHaveViolations ||
    Object.values(allReportErrors).some((error) => error?.[0] !== Localize.translateLocal('iou.error.genericSmartscanFailureMessage'));
    const isReportInAccessible = report?.errorFields?.notFound;
    if (ReportUtils.isOneTransactionThread(report.reportID, report.parentReportID ?? '0', parentReportAction)) {
    return;
    }
    if (hasErrorsOtherThanFailedReceipt && !isReportInAccessible) {
    reportsToDisplay.push({
    ...report,
    hasErrorsOtherThanFailedReceipt: true,
    });
    return;
    }

    Why do the workspace chat and expense/transaction thread not show even if they have the RBR? The reportActions in `SidebarUtils.getOrderedReportIDs is coming from

    const [allReportActions] = useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS, {selector: (c) => mapOnyxCollectionItems(c, reportActionsSelector)});

    and somehow the selector that was recently added in #49918 returns a wrong array of actions. For the transaction thread, the parent report action here is undefined,

    const parentReportAction: OnyxEntry<ReportAction> =
    !report?.parentReportID || !report?.parentReportActionID ? undefined : allReportActions?.[report.parentReportID ?? '-1']?.[report.parentReportActionID ?? '-1'];

    so, isTransactionThread is always false. It's undefined because we access the allReportActions object without appending the reportActions_ key prefix.

    if (ReportActionUtils.wasActionTakenByCurrentUser(parentReportAction) && ReportActionUtils.isTransactionThread(parentReportAction)) {

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

    We need to check for the report archive status when getting all report errors.

    App/src/libs/ReportUtils.ts

    Lines 6303 to 6318 in 20b7017

    if (ReportActionsUtils.wasActionTakenByCurrentUser(parentReportAction) && ReportActionsUtils.isTransactionThread(parentReportAction)) {
    const transactionID = ReportActionsUtils.isMoneyRequestAction(parentReportAction) ? ReportActionsUtils.getOriginalMessage(parentReportAction)?.IOUTransactionID : null;
    const transaction = allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`];
    if (TransactionUtils.hasMissingSmartscanFields(transaction ?? null) && !isSettled(transaction?.reportID)) {
    reportActionErrors.smartscan = ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericSmartscanFailureMessage');
    reportAction = undefined;
    }
    } else if ((isIOUReport(report) || isExpenseReport(report)) && report?.ownerAccountID === currentUserAccountID) {
    if (shouldShowRBRForMissingSmartscanFields(report?.reportID ?? '-1') && !isSettled(report?.reportID)) {
    reportActionErrors.smartscan = ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericSmartscanFailureMessage');
    reportAction = getReportActionWithMissingSmartscanFields(report?.reportID ?? '-1');
    }
    } else if (hasSmartscanError(reportActionsArray)) {
    reportActionErrors.smartscan = ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericSmartscanFailureMessage');
    reportAction = getReportActionWithSmartscanError(reportActionsArray);
    }

    if (!ReportUtils.isArchivedRoom(report)) {
        ...
    }
    
  5. allgandalf commented on Oct 10, 2024

    @allgandalf
    Contributor

    Note

    Can i be the C+ for this issue @sonialiap , I reported this bug and have prior context

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 14, 2024
  7. melvin-bot commented on Oct 14, 2024

    @melvin-bot
  8. changed the title [-]Unable to Act on Report Due to Deleted Workspace, Stuck with RBR in Focus Mode Without Edit Access[/-] [+][$250] Unable to Act on Report Due to Deleted Workspace, Stuck with RBR in Focus Mode Without Edit Access[/+] on Oct 14, 2024
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 14, 2024
  10. 44 remaining items

  11. melvin-bot commented on Nov 19, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.63-3 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 2024-11-26. 🎊

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

  12. melvin-bot commented on Nov 19, 2024

    @melvin-bot

    @allgandalf @sonialiap @allgandalf 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]

  13. moved this from Bugs and Follow Up Issues to Hold for Payment in #expensify-bugson Nov 19, 2024
  14. sonialiap commented on Nov 25, 2024

    @sonialiap
    Contributor

    @allgandalf please complete the checklist so that I can release the payment for you tomorrow 😊

  15. allgandalf commented on Nov 25, 2024

    @allgandalf
    Contributor

    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
    • 2b. Reported on staging (deploy blocker)
    • 2c. Reported on both staging and production
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:

    Regression Test Proposal

    Precondition:

    • Have a workspace created

    Test:

    1. Open a workspace chat
    2. Submit an expense that will show RBR (for example scan expense with a random image)
    3. Delete the workspace

    Verify the workspace chat doesn't show RBR anymore

    Do we agree 👍 or 👎

  16. allgandalf commented on Nov 25, 2024

    @allgandalf
    Contributor

    @allgandalf please complete the checklist so that I can release the payment for you tomorrow 😊

    Sorry for the delay 😅 , I completed the checklist !

  17. bernhardoj commented on Nov 26, 2024

    @bernhardoj
    Contributor

    Requested in ND.

  18. JmillsExpensify commented on Nov 26, 2024

    @JmillsExpensify
    Contributor

    Waiting for payment summary.

  19. sonialiap commented on Nov 27, 2024

    @sonialiap
    Contributor

    Payment summary:

  20. sonialiap commented on Nov 27, 2024

    @sonialiap
    Contributor

    @JmillsExpensify good to approve the ND request 💰

  21. moved this from Hold for Payment to Done in #expensify-bugson Nov 27, 2024
  22. JmillsExpensify commented on Nov 27, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @bernhardoj

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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions