App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Distance - LHN shows "Hidden" report with RBR after dismissing invalid waypoint error

Open IuliiaHerets opened this issue 1 year ago β€’ 18 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: v9.0.24-1 Reproducible in staging?: Y Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp https://expensify.testrail.io/index.php?/tests/view/4885243 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Submit an expense (any type).
  4. Go offline.
  5. Submit a distance expense with invalid waypoints (any random letters can be invalid waypoint).
  6. Go to expense report.
  7. Go online.
  8. Dismiss the "Please select a valid waypoint" error on the expense report (not transaction thread).
  9. Note that LHN shows a "Hidden" report with RBR after dismissing the error on the expense report.

Expected Result:

LHN will not show a "Hidden" report with RBR after dismissing the error on the expense report.

Actual Result:

LHN shows a "Hidden" report with RBR after dismissing the invalid waypoint error on the expense report.

Workaround:

Unknown

Platforms:

  • [x] Android: Native
  • [x] Android: mWeb Chrome
  • [x] iOS: Native
  • [x] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [x] MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/61619e5c-f84f-4d5a-9e8a-0622507f092f

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0134c247d0315476d6
  • Upwork Job ID: 1828546129529773284
  • Last Price Increase: 2024-09-03

IuliiaHerets avatar Aug 24 '24 22:08 IuliiaHerets

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

melvin-bot[bot] avatar Aug 24 '24 22:08 melvin-bot[bot]

We think that this bug might be related to #wave-collect - Release 1

IuliiaHerets avatar Aug 24 '24 22:08 IuliiaHerets

@johncschuster FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

IuliiaHerets avatar Aug 24 '24 22:08 IuliiaHerets

Edited by proposal-police: This proposal was edited at 2024-08-25 07:41:13 UTC.

Proposal

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

Distance - LHN shows "Hidden" report with RBR after dismissing invalid waypoint error

What is the root cause of that problem?

When we dismiss the error we run the below code: https://github.com/Expensify/App/blob/0c8455280c738a5db596f34409a0a3177e682e7f/src/pages/home/report/ReportActionItem.tsx#L939-L943 We invoke Transaction.clearError and ReportActions.clearAllRelatedReportActionErrors function, but inside the ReportActions.clearAllRelatedReportActionErrors function we invoke the clearReportActionErrors function which will delete the optimistic data if the pending action is ADD or the data is from optimistic mean from Onyx https://github.com/Expensify/App/blob/0c8455280c738a5db596f34409a0a3177e682e7f/src/libs/actions/ReportActions.ts#L29-L32 And delete the linkedTransaction if exist https://github.com/Expensify/App/blob/0c8455280c738a5db596f34409a0a3177e682e7f/src/libs/actions/ReportActions.ts#L37 So when we try to get the title inside the LHN, the parentReportAction become undefined because inside the clearReportActionErrors function will delete the optimistic data if the pending action is ADD or the data is from optimistic mean from Onyx https://github.com/Expensify/App/blob/071f11ce1012db7d07eb750d74f58b552eba6144/src/libs/actions/ReportActions.ts#L28-L32

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

We can remove the report chat from the LHN because when we clear cache and restart, it will disappear from the LHN as it is not exist in the BE

Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${reportAction.childReportID}`, null)

Result

https://github.com/user-attachments/assets/eafbbb72-8eb0-4b43-8e27-8363441fcc0c

What alternative solutions did you explore? (Optional)

NJ-2020 avatar Aug 25 '24 07:08 NJ-2020

Proposal

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

LHN shows a "Hidden" report with RBR after dismissing the invalid waypoint error on the expense report.

What is the root cause of that problem?

When users remove error in expense report, we also delete reportActions related to this

https://github.com/Expensify/App/blob/f58439cfb116abd338dae880088a26725794108e/src/libs/actions/ReportActions.ts#L90-L97

In this case we delete all reportActions in report, so the parentReportActions is undefined

https://github.com/Expensify/App/blob/0c8455280c738a5db596f34409a0a3177e682e7f/src/libs/ReportUtils.ts#L3678

-> The LHN show Hidden

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

If the CREATED action is deleted, we should clear the report too

    if (reportAction.childReportID && ignore !== 'child') {
        const childActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportAction.childReportID}`] ?? {};
        let shouldDeleteReport = false
        Object.values(childActions).forEach((action) => {
            const childErrorKeys = Object.keys(action.errors ?? {}).filter((err) => errorKeys.includes(err));
            if(!shouldDeleteReport && childErrorKeys.length > 0 && action.actionName==='CREATED'){
                shouldDeleteReport = true
            }
            clearAllRelatedReportActionErrors(reportAction.childReportID ?? '-1', action, 'parent', childErrorKeys);
        });
        if(shouldDeleteReport){
            Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${reportAction.childReportID}`, null);
        }
    }

What alternative solutions did you explore? (Optional)

dominictb avatar Aug 26 '24 04:08 dominictb

Proposal

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

LHN shows a "Hidden" report with RBR after dismissing the invalid waypoint error on the expense report.

What is the root cause of that problem?

When we clear the report action error, we call clearAllRelatedReportActionErrors

https://github.com/Expensify/App/blob/f58439cfb116abd338dae880088a26725794108e/src/pages/home/report/ReportActionItem.tsx#L940

Which will clear the report action and the linked transaction if the action has pendingAction is add https://github.com/Expensify/App/blob/f58439cfb116abd338dae880088a26725794108e/src/libs/actions/ReportActions.ts#L28-L40

Then Hidden appears for the transaction thread report in LHN because the parent report action and the linked transaction are cleared

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

We also need to clear the transaction thread report when we clear the linked transaction here

if (linkedTransactionID) {
    Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${linkedTransactionID}`, null);
    Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${reportAction.childReportID}`, null);
}

https://github.com/Expensify/App/blob/f58439cfb116abd338dae880088a26725794108e/src/libs/actions/ReportActions.ts#L36-L40

What alternative solutions did you explore? (Optional)

nkdengineer avatar Aug 26 '24 05:08 nkdengineer

Job added to Upwork: https://www.upwork.com/jobs/~0134c247d0315476d6

melvin-bot[bot] avatar Aug 27 '24 21:08 melvin-bot[bot]

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

melvin-bot[bot] avatar Aug 27 '24 21:08 melvin-bot[bot]

Proposal

Updated

NJ-2020 avatar Aug 28 '24 06:08 NJ-2020

@johncschuster, @getusha Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Sep 02 '24 18:09 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Sep 03 '24 16:09 melvin-bot[bot]

~~@NJ-2020's proposal looks good to me, as it was the first to identify the root cause and provide a working solution. πŸŽ€ πŸ‘€ πŸŽ€ C+ Reviewed.~~

getusha avatar Sep 04 '24 08:09 getusha

Triggered auto assignment to @Gonals, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Sep 04 '24 08:09 melvin-bot[bot]

We can keep the current code, but we can also remove the report chat from LHN because when we clear cache and restart, it will disappear from the LHN as it is not exist in the BE

@getusha I think this solution doesn't identify what we should do or where we should do it. And this proposal is only added the code change without anything after I posted my proposal.

nkdengineer avatar Sep 04 '24 08:09 nkdengineer

I thought it was edited before other proposals, this is what the most recent edit i saw.

Screenshot 2024-09-04 at 2 17 03 in the afternoon

Thanks for flagging @nkdengineer i will re-check

getusha avatar Sep 04 '24 11:09 getusha

@getusha, let me know what you end up deciding!

Gonals avatar Sep 05 '24 10:09 Gonals

@johncschuster @Gonals @getusha this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Sep 07 '24 17:09 melvin-bot[bot]

@getusha bump on the above!

johncschuster avatar Sep 09 '24 21:09 johncschuster

@nkdengineer's proposal looks good to me, has a clear RCA and the solution makes the most sense. πŸŽ€ πŸ‘€ πŸŽ€ C+ Reviewed

getusha avatar Sep 10 '24 08:09 getusha

Current assignee @Gonals is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

melvin-bot[bot] avatar Sep 10 '24 08:09 melvin-bot[bot]

πŸ“£ @nkdengineer πŸŽ‰ An offer has been automatically sent to your Upwork account for the Contributor role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Keep in mind: Code of Conduct | Contributing πŸ“–

melvin-bot[bot] avatar Sep 11 '24 09:09 melvin-bot[bot]

Not overdue. @nkdengineer is working on a PR

johncschuster avatar Sep 12 '24 21:09 johncschuster

This issue has not been updated in over 15 days. @johncschuster, @Gonals, @getusha, @nkdengineer eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

melvin-bot[bot] avatar Oct 07 '24 18:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 15 '24 03:10 melvin-bot[bot]

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

  • https://github.com/Expensify/App/pull/49040

If no regressions arise, payment will be issued on 2024-10-22. :confetti_ball:

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

  • @getusha requires payment through NewDot Manual Requests
  • @nkdengineer requires payment automatic offer (Contributor)

melvin-bot[bot] avatar Oct 15 '24 03:10 melvin-bot[bot]

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [ ] [@getusha] The PR that introduced the bug has been identified. Link to the PR:
  • [ ] [@getusha] 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:
  • [ ] [@getusha] A discussion in #expensify-bugs 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:
  • [ ] [@getusha] Determine if we should create a regression test for this bug.
  • [ ] [@getusha] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [ ] [@johncschuster] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

melvin-bot[bot] avatar Oct 15 '24 03:10 melvin-bot[bot]

Payment Summary:

Contributor: @nkdengineer paid $250 via Upwork - PAID! πŸŽ‰ Contributor+: @getusha due $250 via NewDot - Please request payment after completing the BZ Checklist!

Upwork job here!

johncschuster avatar Oct 22 '24 14:10 johncschuster

@getusha bump on the above! Do we need a regression test for this one?

johncschuster avatar Oct 24 '24 21:10 johncschuster

@johncschuster, @Gonals, @getusha, @nkdengineer Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Oct 28 '24 18:10 melvin-bot[bot]