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-10] [$250] "Expense" is showing as a "new comment" when opening the one expense report for the first time #42472

Closed
1 of 6 tasks
m-natarajan opened this issue May 22, 2024 · 40 comments
Assignees
Labels
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

Comments

@m-natarajan
Copy link

m-natarajan commented May 22, 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: 1.4.74-4
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: @puneetlath
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1716320170918369

Action Performed:

  1. Submit a expense report with one expense as an employee
  2. Sign in as a approver of the expense report (shouldn't be signed in before so that you don't have the expense report or transaction thread locally)
  3. Throttle network connection to slow 3G, so that OpenReport takes a little bit to return
  4. Click on the expense report to view the details

Expected Result:

Should not see a green New line like a comment

Actual Result:

"Expense" is showing as a "new comment" with greenline

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

Add any screenshot/video evidence

Recording.102.mp4

Screenshot 2024-05-21 at 3 35 40 PM

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~011a3e7a662efa0b69
  • Upwork Job ID: 1794039154450477056
  • Last Price Increase: 2024-06-07
  • Automatic offers:
    • nkdengineer | Contributor | 102691860
Issue OwnerCurrent Issue Owner: @zanyrenney / @zanyrenney
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 22, 2024
Copy link

melvin-bot bot commented May 22, 2024

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

@nkdengineer
Copy link
Contributor

Proposal

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

"Expense" is showing as a "new comment" with greenline

What is the root cause of that problem?

Before OpenReport API of the expenseReport is called, transaction thread report actions is empty

() => ReportActionsUtils.getCombinedReportActions(allReportActions, transactionThreadReportActions),
[allReportActions, transactionThreadReportActions],

and then we return all report actions of the expense report which contains the IOU action here

if (isEmptyObject(transactionThreadReportActions)) {
return reportActions;
}

So this action is displayed as a action in combine report

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

  1. I see that the logic to calculate reportActionsToDisplay is added in this PR Display total and money request in offline #36657. As this comment, the aim of this to generate created action for money request report if it doesn't exist so I think we should use allReportActions which are all report actions of current report to calculate reportActionsToDisplay firstly and then we will use this to get the combine report actions here. So we should move this block here to before this block and use allReportActions instead of reportActions

// When we are offline before opening an IOU/Expense report,
// the total of the report and sometimes the expense aren't displayed because these actions aren't returned until `OpenReport` API is complete.
// We generate a fake created action here if it doesn't exist to display the total whenever possible because the total just depends on report data
// and we also generate an expense action if the number of expenses in reportActions is less than the total number of expenses
// to display at least one expense action to match the total data.
const reportActionsToDisplay = useMemo(() => {

  1. We should add an extra param in getCombinedReportActions like isCombineReport and then we only return reportActions if transactionThreadReportActions is empty and the report isn't a combine report
if (isEmptyObject(transactionThreadReportActions) && !isCombineReport) {
    return reportActions;
}

if (isEmptyObject(transactionThreadReportActions)) {
return reportActions;
}

  1. Pass !!transactionThreadReportID as isCombineReport param into getCombinedReportActions function
const combinedReportActions = useMemo(
    () => ReportActionsUtils.getCombinedReportActions(reportActionsToDisplay, transactionThreadReportActions, !!transactionThreadReportID),
    [reportActionsToDisplay, transactionThreadReportActions, transactionThreadReportID],
);

() => ReportActionsUtils.getCombinedReportActions(allReportActions, transactionThreadReportActions),
[allReportActions, transactionThreadReportActions],

  1. Finally, pass sortedReportActions={reportActions} here instead of reportActionsToDisplay

sortedReportActions={reportActionsToDisplay}

What alternative solutions did you explore? (Optional)

NA

@zanyrenney
Copy link
Contributor

Adding the external label - looks like NK engineer already has a proposal.

@zanyrenney zanyrenney added the External Added to denote the issue can be worked on by a contributor label May 24, 2024
@melvin-bot melvin-bot bot changed the title "Expense" is showing as a "new comment" when opening the one expense report for the first time [$250] "Expense" is showing as a "new comment" when opening the one expense report for the first time May 24, 2024
Copy link

melvin-bot bot commented May 24, 2024

Job added to Upwork: https://www.upwork.com/jobs/~011a3e7a662efa0b69

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

melvin-bot bot commented May 24, 2024

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

@zanyrenney
Copy link
Contributor

hey there @mollfpr - please can you review the proposal from @nkdengineer above! thanks!

@zanyrenney zanyrenney removed the Bug Something is broken. Auto assigns a BugZero manager. label May 24, 2024
@zanyrenney zanyrenney removed their assignment May 24, 2024
@zanyrenney zanyrenney added the Bug Something is broken. Auto assigns a BugZero manager. label May 24, 2024
Copy link

melvin-bot bot commented May 24, 2024

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

@zanyrenney zanyrenney removed their assignment May 24, 2024
@zanyrenney zanyrenney added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels May 24, 2024
Copy link

melvin-bot bot commented May 24, 2024

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

@zanyrenney
Copy link
Contributor

Hey there! I am going OOO until the 9th of June. Please can you handle this and I will take it back once I return? Thanks!

@zanyrenney zanyrenney self-assigned this May 24, 2024
Copy link

melvin-bot bot commented May 27, 2024

@mollfpr, @lschurr, @zanyrenney Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label May 27, 2024
@lschurr
Copy link
Contributor

lschurr commented May 28, 2024

Bump on this @mollfpr - Can you review the proposal?

@mollfpr
Copy link
Contributor

mollfpr commented May 28, 2024

Looking now!

@melvin-bot melvin-bot bot removed the Overdue label May 28, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 11, 2024
Copy link

melvin-bot bot commented Jun 11, 2024

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

@nkdengineer
Copy link
Contributor

@mollfpr this PR is ready for preview

Copy link

melvin-bot bot commented Jun 28, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jul 3, 2024
@melvin-bot melvin-bot bot changed the title [$250] "Expense" is showing as a "new comment" when opening the one expense report for the first time [HOLD for payment 2024-07-10] [$250] "Expense" is showing as a "new comment" when opening the one expense report for the first time Jul 3, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 3, 2024
Copy link

melvin-bot bot commented Jul 3, 2024

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

Copy link

melvin-bot bot commented Jul 3, 2024

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

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

Copy link

melvin-bot bot commented Jul 3, 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:

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

@lschurr lschurr removed their assignment Jul 9, 2024
@zanyrenney
Copy link
Contributor

zanyrenney commented Jul 10, 2024

payment summary

@mollfpr requires payment through NewDot Manual Requests - owed $250 once comment above is complete.
@nkdengineer requires payment automatic offer (Contributor) - paid $250 on upwork.

@zanyrenney
Copy link
Contributor

@srikarparsi please can you do me a favour and once this checklist is complete, close out the issue?

I am OOO until Tuesday 16th so don't want to keep this open during my OOO if all the steps are complete.

I have also DM'd @mollfpr

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

mollfpr commented Jul 11, 2024

Sorry for the delay 🙏

[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
[@mollfpr] 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:

No specific PR causing the bug.

[@mollfpr] 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:

The regression step should be enough.

[@mollfpr] Determine if we should create a regression test for this bug.
[@mollfpr] 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. Submit an expense report with one expense as an employee
  2. Sign in as an approver of the expense report (shouldn't be signed in before so that you don't have the expense report or transaction thread locally)
  3. Throttle network connection to slow 3G, so that OpenReport takes a little bit to return
  4. Click on the expense report to view the details
  5. Verify that no green New line like a comment
  6. 👍 or 👎

@JmillsExpensify
Copy link

$250 approved for @mollfpr

@melvin-bot melvin-bot bot added the Overdue label Jul 15, 2024
@srikarparsi
Copy link
Contributor

The regression steps look good to me. @zanyrenney once you're back from OOO and you have some time, do you know who's in charge of adding the regression test to TestRail?

@melvin-bot melvin-bot bot removed the Overdue label Jul 15, 2024
@zanyrenney
Copy link
Contributor

Yep, i can add them!

@zanyrenney
Copy link
Contributor

Added, closing! #45595

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 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

7 participants