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 2023-07-20] [$1000] [Attachment] shows in LHN even after close error message #19913

Closed
1 of 6 tasks
kavimuru opened this issue May 31, 2023 · 77 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff

Comments

@kavimuru
Copy link

kavimuru commented May 31, 2023

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


Action Performed:

  1. Go to any chat
  2. send any corrupted file
  3. click on X button in Unexpected error message

Expected Result:

should not show [Attachment] in LHN

Actual Result:

in LHN still shows [Attachment] even after close error message

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.21-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
Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2023-05-29.at.11.51.42.AM.mov
Recording.826.mp4

Expensify/Expensify Issue URL:
Issue reported by: @gadhiyamanan
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1685341334486499

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01da8eae4fb504ea71
  • Upwork Job ID: 1664682621010223104
  • Last Price Increase: 2023-06-23
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 31, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 31, 2023

Triggered auto assignment to @isabelastisser (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented May 31, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@therealsujitk
Copy link
Contributor

Proposal

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

The last message in the LHN doesn't get updated when a report action is removed by the user due to an error.

What is the root cause of that problem?

The reason for this is that we are not updating the report's lastMessageText while deleting the report action in Onyx in the function below.

/**
* @param {String} reportID
* @param {Object} reportAction
*/
function clearReportActionErrors(reportID, reportAction) {
if (reportAction.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) {
// Delete the optimistic action
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
[reportAction.reportActionID]: null,
});
// If there's a linked transaction, delete that too
const linkedTransactionID = ReportActionUtils.getLinkedTransactionID(reportID, reportAction.reportActionID);
if (linkedTransactionID) {
Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${linkedTransactionID}`, null);
}
return;
}
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
[reportAction.reportActionID]: {
errors: null,
},
});
}

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

To resolve this issue, we simply update the lastMessageText in this function just like we do while deleting a report action. This is what the function would look like,

/**
 * @param {String} reportID
 * @param {Object} reportAction
 */
function clearReportActionErrors(reportID, reportAction) {
    if (reportAction.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) {
        // Delete the optimistic action
        const optimisticReportAction = {
            [reportAction.reportActionID]: null,
        };
        // Update the report's last message
        const optimisticReport = {
            lastMessageText: '',
            lastVisibleActionCreated: '',
        };

        const lastMessageText = ReportActionsUtils.getLastVisibleMessageText(reportID, optimisticReportAction);
        if (lastMessageText.length > 0) {
            const lastVisibleActionCreated = ReportActionsUtils.getLastVisibleAction(reportID, optimisticReportAction).created;
            optimisticReport.lastMessageText = lastMessageText;
            optimisticReport.lastVisibleActionCreated = lastVisibleActionCreated;
        }

        Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, optimisticReport);
        Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, optimisticReportAction);

        // If there's a linked transaction, delete that too
        const linkedTransactionID = ReportActionsUtils.getLinkedTransactionID(reportID, reportAction.reportActionID);
        if (linkedTransactionID) {
            Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${linkedTransactionID}`, null);
        }

        return;
    }

    Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
        [reportAction.reportActionID]: {
            errors: null,
        },
    });
}

Note: We could optimise this by creating a function in ReportActionsUtils.js to format the last message, this way we will only have to call getLastVisibleAction instead of getLastVisibleMessageText as well.

What alternative solutions did you explore? (Optional)

None.

@isabelastisser
Copy link
Contributor

I tried to reproduce it with multiple corrupt files and couldn't reproduce it. @kavimuru @mananjadhav, can you please attach the corrupt file you used to this issue? I would like to try it before dismissing the bug. Thanks!

@therealsujitk
Copy link
Contributor

therealsujitk commented Jun 2, 2023

@isabelastisser you can find it in the slack discussion, here's the link to the file. I'm still able to reproduce this in staging.

@isabelastisser
Copy link
Contributor

Thanks and yep, I can reproduce it!

@isabelastisser isabelastisser reopened this Jun 2, 2023
@isabelastisser isabelastisser added the External Added to denote the issue can be worked on by a contributor label Jun 2, 2023
@melvin-bot melvin-bot bot changed the title [Attachment] shows in LHN even after close error message [$1000] [Attachment] shows in LHN even after close error message Jun 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

Current assignee @isabelastisser is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

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

@bernhardoj
Copy link
Contributor

bernhardoj commented Jun 3, 2023

We have a same issue here with just a different set of reproduction step (I mentioned specifically about this one here) that gets closed because they can't reproduce it anymore, but I can. I have posted a proposal there which basically the same as @therealsujitk above. Is there any possibility my proposal take precedence over the others? 😄

coincidentally the C+ is the same

@melvin-bot melvin-bot bot added the Overdue label Jun 5, 2023
@isabelastisser
Copy link
Contributor

Not overdue!

@melvin-bot melvin-bot bot removed the Overdue label Jun 5, 2023
@rojiphil
Copy link
Contributor

rojiphil commented Jun 5, 2023

Proposal

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

[Attachment] is shown in LHN even when the uploading of attachment has failed. In case of failure, the LHN should have shown the last successful message.

What is the root cause of that problem?

The root cause of the problem is that we are not updating the message with the last successful one if there is failure in adding a new attachment to the report. If this is taken care of, the LHN will show the last successful message.

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

The proposal is to add failureReport to failureData so that if there is failure in API.write operation, it will use the previous visible message text.
The changes are in addActions function so that this would work for both addAttachment and addComment

We can fix this by updating the lastMessageText in Onyx as follows for the failure case here in Report.js.

+    const prevVisibleMessageText = ReportActionsUtils.getLastVisibleMessageText(reportID);
+    const failureReport = {
+        lastMessageText: prevVisibleMessageText,
+        lastReadTime: currentTime,
+    };
+
     const failureData = [
+        {
+            onyxMethod: Onyx.METHOD.MERGE,
+            key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
+            value: failureReport,
+        },
         {
             onyxMethod: Onyx.METHOD.MERGE,
             key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
             value: _.mapObject(optimisticReportActions, (action) => ({
                 ...action,
                 errors: ErrorUtils.getMicroSecondOnyxError('report.genericAddCommentFailureMessage'),
             })),
         },
     ];

The changes in file here also shows the above changes.

Test Result Video

19913_attachment_in_lhn.mp4

What alternative solutions did you explore? (Optional)

@rojiphil
Copy link
Contributor

rojiphil commented Jun 6, 2023

@isabelastisser I have also updated the proposal with a test video for the fix. Kindly review.

@isabelastisser
Copy link
Contributor

Summary:

We are still receiving and reviewing proposals!

I'm reassigning (SO) because I will be OOO until June 14. Thanks!

Once I return from OOO if the chore is still outstanding, I will take over any remaining action items

@isabelastisser isabelastisser removed their assignment Jun 7, 2023
@isabelastisser isabelastisser added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Jun 7, 2023
@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Jul 6, 2023
@rojiphil
Copy link
Contributor

rojiphil commented Jul 6, 2023

@rushatgabhane PR created here. Kindly review. Thanks.

@isabelastisser
Copy link
Contributor

Thanks @rojiphil!

@rushatgabhane, please review the PR when you can so we can move this along. Thanks!

@isabelastisser
Copy link
Contributor

Bump @rushatgabhane ^

@rojiphil
Copy link
Contributor

@isabelastisser The PR got reviewed and merged on Monday.

@isabelastisser
Copy link
Contributor

@rojiphil was assigned on July 5
The PR was merged on July 10.

I need clarification because we didn't generate the automated message for the payment date.

@rushatgabhane, can you please clarify when the payment should be issued? Could you confirm that this DOES NOT qualify for the 72 hours bonus? Thanks!

@rojiphil
Copy link
Contributor

@isabelastisser @rushatgabhane
This is what I could find out from the details:
Assignment Time: July 06, 2023, 7:44 AM GMT+5:30
Merge Time: July 10, 2023, 7:52 PM GMT+5:30
There were 2 days of the weekend here.
That would mean that this was merged within 3 days.

Wondering why this did not get triggered automatically.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jul 13, 2023
@melvin-bot melvin-bot bot changed the title [$1000] [Attachment] shows in LHN even after close error message [HOLD for payment 2023-07-20] [$1000] [Attachment] shows in LHN even after close error message Jul 13, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 13, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 13, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.39-11 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 2023-07-20. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Jul 13, 2023

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:

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

@rushatgabhane
Copy link
Member

rushatgabhane commented Jul 13, 2023

Agree with @rojiphil #19913 (comment) that this qualifies for a bonus

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 19, 2023
@isabelastisser
Copy link
Contributor

The offers were sent in Upwork, please accept, and I will process the payments.

@rushatgabhane, please complete the BZ checklist asap and I will close this issue. Thanks!

@gadhiyamanan
Copy link
Contributor

@isabelastisser offer accepted, thanks!

@rojiphil
Copy link
Contributor

The offers were sent in Upwork, please accept, and I will process the payments.

@isabelastisser Accepted Offer. Thanks.

@isabelastisser
Copy link
Contributor

Payments were processed in Upwork.

C+ payment will be made via NewDot upon BZ checklist completion. cc @rushatgabhane

@rushatgabhane
Copy link
Member

rushatgabhane commented Jul 23, 2023

  1. The PR that introduced the bug has been identified. Link to the PR: https://github.com/Expensify/App/pull/13118/files#diff-8afe5b71ee0436c21364148c86dadd640f2bff3e3d916addbb1f1f6f7e5b6a43

  2. 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: https://github.com/Expensify/App/pull/13118/files#r1271466486

  3. 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: Not required

  4. Determine if we should create a regression test for this bug. Sure

  5. 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

    1. Click on any chat-based report in LHN to view the report screen.
    2. Click on the actions button on the footer to show the actions menu.
    3. Click 'Add Attachment' and select the corrupted file as attached in the issue. (corrupt pdf download link)
    4. Click on the 'Send` button in the Attachment modal to send the attachment.
    5. Note that the sidebar screen in LHN for this chat report will show '[Attachment]'. Further, the 'Uploading Attachment' chat comes up in the chat report screen.
    6. Once the attachment upload fails due to the corrupt file, we will observe a failure comment with "Unexpected error..."
    7. At this time, verify that the sidebar screen in LHN for this chat report displays the last successful message instead of '[Attachment]'.

@rushatgabhane
Copy link
Member

made a manual request on new dot https://staging.new.expensify.com/r/1523003362514356

@isabelastisser
Copy link
Contributor

[@isabelastisser] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

https://github.com/Expensify/Expensify/issues/302488

all set!

@JmillsExpensify
Copy link

@isabelastisser Can you please summarize the appropriate individual payments for all parties involved in this issue? This is holding up @rushatgabhane's NewDot payments. More information on this compliance process in Slack.

@isabelastisser
Copy link
Contributor

isabelastisser commented Jul 31, 2023

Payment summary:

Issue reported by @gadhiyamanan - $250
C+ review @rushatgabhane - $1000 for review, $500 urgency bonus
Issue fixed by @rojiphil - $1000 for accepted proposal, $500 urgency bonus

@JmillsExpensify
Copy link

Reviewed details for @rushatgabhane. These details are accurate based on summary from Business Reviewer and are now approved for payment in NewDot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests