Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2024-07-24] [$250] Empty Entry in LHN with RBR and "Hmm.. It's not there message when clicked #45035

Closed
1 of 6 tasks
m-natarajan opened this issue Jul 9, 2024 · 33 comments
Assignees
Labels
AutoAssignerNewDotQuality Used to assign quality issues to engineers Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Needs Reproduction Reproducible steps needed

Comments

@m-natarajan
Copy link

m-natarajan commented Jul 9, 2024

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:
Reproducible in staging?: Needs reproduction
Reproducible in production?: Needs reproduction
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: @iwiznia
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1720455609916209

Action Performed:

  1. Go to staging.new.expensify.com
  2. Observe LHN

Expected Result:

All reports or IOU displayed with username and message

Actual Result:

One empty entry observed in LHN with RBR and when clicked displays "Hmm... Its not here" message

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

image

image (1)

ReportID Is 1915196065459787

Logs: {
"reportID": "3916529629983126",
"preexistingReportID": "65121290",
"lastReadTime": "2024-07-02 18:08:57.011",
"errorFields": {
"notFound": {
"1719943737548592": "Report not found",
"1720459088807020": "Report not found",
"1720459290281777": "Report not found"
}
},
"participants": {},
"pendingFields": {},
"isOptimisticReport": false
}

Got preexisting report from Auth::openReport, new report was not created ~~ optimisticReportID: '3916529629983126' preexistingReportID: '65121290'
Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01ae00b986e1d955ec
  • Upwork Job ID: 1810728317314423962
  • Last Price Increase: 2024-07-09
  • Automatic offers:
    • brunovjk | Reviewer | 103066501
    • dominictb | Contributor | 103066502
Issue OwnerCurrent Issue Owner: @abekkala / @abekkala
@m-natarajan m-natarajan added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. AutoAssignerNewDotQuality Used to assign quality issues to engineers labels Jul 9, 2024
@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

Copy link

melvin-bot bot commented Jul 9, 2024

Current assignee @iwiznia is eligible for the AutoAssignerNewDotQuality assigner, not assigning anyone new.

Copy link

melvin-bot bot commented Jul 9, 2024

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

@iwiznia iwiznia removed their assignment Jul 9, 2024
@iwiznia iwiznia added AutoAssignerNewDotQuality Used to assign quality issues to engineers and removed AutoAssignerNewDotQuality Used to assign quality issues to engineers labels Jul 9, 2024
Copy link

melvin-bot bot commented Jul 9, 2024

Triggered auto assignment to @jasperhuangg (AutoAssignerNewDotQuality)

@melvin-bot melvin-bot bot added the Weekly KSv2 label Jul 9, 2024
@iwiznia
Copy link
Contributor

iwiznia commented Jul 9, 2024

@m-natarajan, you should not assign the reporter to these issues, it will get someone auto assigned if the label AutoAssignerNewDotQuality is added (that's why I removed my assignment and triggered the auto assigner again)

@puneetlath
Copy link
Contributor

puneetlath commented Jul 9, 2024

The issue here seems to be that the client isn't clearing out the optimistic report for some reason when the back-end returns the pre-existing report. I have four of these reports where they show up in the LHN like this, but when you click on them, you get "report not found".

image

In all four scenarios, there is a preestingReportID in the Onyx object for the report. Example:

{
    "reportID": "3916529629983126",
    "preexistingReportID": "65121290",
    "lastReadTime": "2024-07-02 18:08:57.011",
    "errorFields": {
        "notFound": {
            "1719943737548592": "Report not found",
            "1720459088807020": "Report not found",
            "1720459290281777": "Report not found"
        }
    },
    "participants": {},
    "pendingFields": {},
    "isOptimisticReport": false
}

This indicates that this was an optimistic report that got created and the back-end responded to OpenReport by setting the preexisting report field. At that point, this code or this code should have kicked in to clear the report out of Onyx. For some reason that didn't happen.

I think what we should potentially do is never show reports that have preexistingReportIDs in the LHN as there is no reason for them to be there.

@iwiznia
Copy link
Contributor

iwiznia commented Jul 9, 2024

I think what we should potentially do is never show reports that have preexistingReportIDs in the LHN as there is no reason for them to be there.

This makes sense, but I think I first would want to know why the existing code we have is not working, since as you mention, this allegedly should be handled already.

@puneetlath
Copy link
Contributor

Perhaps the problem is that every time it gets navigated to we are adding another not found item to the error fields object

"errorFields": {
        "notFound": {
            "1719943737548592": "Report not found",
            "1720459088807020": "Report not found",
            "1720459290281777": "Report not found"
        }
    },

And that's what makes it so that it stays in the LHN and is never able to be cleared.

@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label Jul 9, 2024
@melvin-bot melvin-bot bot changed the title Empty Entry in LHN with RBR and "Hmm.. It's not there message when clicked [$250] Empty Entry in LHN with RBR and "Hmm.. It's not there message when clicked Jul 9, 2024
Copy link

melvin-bot bot commented Jul 9, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01ae00b986e1d955ec

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 9, 2024
Copy link

melvin-bot bot commented Jul 9, 2024

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

@melvin-bot melvin-bot bot removed the Weekly KSv2 label Jul 9, 2024
@muttmuure
Copy link
Contributor

@iwiznia I asked @m-natarajan to assign the reporter because they have the most context for the bug and also need to confirm that the bug is fixed.

If you don't want to do that, that's fine, but it would be more helpful to the project if you did.

@brunovjk
Copy link
Contributor

brunovjk commented Jul 9, 2024

I haven't been able to reproduce it yet.

@dominictb
Copy link
Contributor

dominictb commented Jul 10, 2024

Proposal

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

One empty entry observed in LHN with RBR and when clicked displays "Hmm... Its not here" message

What is the root cause of that problem?

The callback to clear the duplicate report is

Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, null);

It's unfortunately only triggered here

if we at the moment is opening that optimistic report (and the composer is rendered). If we're not opening that report, there'll be no listener to the event emitter here and the dup report clearance will never happen.

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

We should not rely on the event emitter's rendering for the dup report clearance.

So we'll use another mechanism to save the draft comment as intended here.

  • In
    DeviceEventEmitter.emit(`switchToPreExistingReport_${report.reportID}`, {
    remove the event emitter, and remove the event listener in ComposerWithSuggestions too.
  • There, get the report draft comment of reportID, we can create a reportDraftComments local variable to store the draft comments in Onyx that's from reportDraftComment_ collection that we'll connect to, then we can get it by key reportID. Or can use Onyx.get(...).then(...
let allReportDraftComments = {};

Onyx.connect({
    key: ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT,
    waitForCollectionCallback: true,
    callback: (value) => {
        allReportDraftComments = value;
    },
});
const draftComment = allReportDraftComments[`${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`];

if (!draftComment) {
    callback();
    return;
}

saveReportDraftComment(report.preexistingReportID, draftComment, callback);

So the difference in approaches here is we don't rely on component rendering and event emitter but we'll update the data in Onyx directly

In the callback we can clear the REPORT_DRAFT_COMMENT of report.reportID too

What alternative solutions did you explore? (Optional)

If the user is on the dupe report route (using this check), use EventEmitter as existing implementation, otherwise use the above direct Onyx get and save implementation.

@dominictb
Copy link
Contributor

What will happen after your changes? Will it show in my LHN? And if I click on it, will it get cleared?

@puneetlath It will get cleared the next time you reload the site (no need to click on it), because handleReportChanged will run for every report upon first Onyx data load.

@brunovjk
Copy link
Contributor

@brunovjk Of course, here's the test branch main...dominictb:epsf-app:fix/45035

Thanks @dominictb, I tested it look good!

I think what we should potentially do is never show reports that have preexistingReportIDs in the LHN as there is no reason for them to be there.

@puneetlath, do you think implementing this would be a good safety measure?

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 10, 2024
Copy link

melvin-bot bot commented Jul 10, 2024

📣 @brunovjk 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Jul 10, 2024

📣 @dominictb 🎉 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 📖

@puneetlath
Copy link
Contributor

Ok let's go with @dominictb. Can you raise a PR today?

@puneetlath, do you think implementing this would be a good safety measure?

I kind of think yes. But maybe it's better to start with these changes and see where they get us. What do you think?

@brunovjk
Copy link
Contributor

Sounds great 😃

@dominictb
Copy link
Contributor

Working on this now!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Weekly KSv2 labels Jul 11, 2024
@melvin-bot melvin-bot bot changed the title [$250] Empty Entry in LHN with RBR and "Hmm.. It's not there message when clicked [HOLD for payment 2024-07-24] [$250] Empty Entry in LHN with RBR and "Hmm.. It's not there message when clicked Jul 17, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 17, 2024
Copy link

melvin-bot bot commented Jul 17, 2024

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

Copy link

melvin-bot bot commented Jul 17, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.7-8 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-07-24. 🎊

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

Copy link

melvin-bot bot commented Jul 17, 2024

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:

  • [@brunovjk] The PR that introduced the bug has been identified. Link to the PR:
  • [@brunovjk] 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:
  • [@brunovjk] 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:
  • [@brunovjk] Determine if we should create a regression test for this bug.
  • [@brunovjk] 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.
  • [@abekkala] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@abekkala
Copy link
Contributor

PAYMENT SUMMARY FOR JULY 24

@abekkala
Copy link
Contributor

@brunovjk please complete checklist above prior to payment date - thanks!

@brunovjk
Copy link
Contributor

  • [@brunovjk] The PR that introduced the bug has been identified. Link to the PR: N/A
  • [@brunovjk] 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: N/A
  • [@brunovjk] 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: N/A
  • [@brunovjk] Determine if we should create a regression test for this bug. No
  • [@brunovjk] 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. N/A

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 23, 2024
@abekkala
Copy link
Contributor

@dominictb and @brunovjk payments sent and contracts ended - thank you! 🎉

@github-project-automation github-project-automation bot moved this from CRITICAL to Done in [#whatsnext] #quality Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoAssignerNewDotQuality Used to assign quality issues to engineers Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Needs Reproduction Reproducible steps needed
Projects
Development

No branches or pull requests

9 participants