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

[$250] GBR is shown in the LHN when there is nothing when opening the report #58536

Open
1 of 8 tasks
m-natarajan opened this issue Mar 16, 2025 · 21 comments
Open
1 of 8 tasks
Assignees
Labels
AutoAssignerNewDotQuality Used to assign quality issues to engineers Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause

Comments

@m-natarajan
Copy link

m-natarajan commented Mar 16, 2025

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 on HybridApp, is this reproducible on New Expensify Standalone?:
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: @quinthar
Slack conversation (hyperlinked to channel name): #quality

Action Performed:

  1. GBR shows for a workspace chat in the LHN
  2. Click on the chat report

Expected Result:

Theres should be some expense with GBR to take action

Actual Result:

There's nothing to do even scrolling all the way to the top

Workaround:

unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Please check the OP in the slack channel for onyx and screenshots

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021901599228101593179
  • Upwork Job ID: 1901599228101593179
  • Last Price Increase: 2025-03-17
  • Automatic offers:
    • linhvovan29546 | Contributor | 106553226
Issue OwnerCurrent Issue Owner: @
@m-natarajan m-natarajan added AutoAssignerNewDotQuality Used to assign quality issues to engineers Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Needs Reproduction Reproducible steps needed retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause labels Mar 16, 2025
Copy link

melvin-bot bot commented Mar 16, 2025

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

Copy link

melvin-bot bot commented Mar 16, 2025

Triggered auto assignment to @Beamanator (AutoAssignerNewDotQuality)

@melvin-bot melvin-bot bot added the Weekly KSv2 label Mar 16, 2025
@MelvinBot
Copy link

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

@rushatgabhane
Copy link
Member

rushatgabhane commented Mar 16, 2025

i can reproduce the bug. kindly assign it to me.

you should be able to replicate the bug by importing my onyx state -

onyx-state (2).txt

Screen.Recording.2025-03-16.at.21.35.52.mov

@mallenexpensify
Copy link
Contributor

mallenexpensify commented Mar 16, 2025

Assigned to Rushat, added status HIGH cuz it's "part of main flows and affect a subset of users", comment if ya disagree.

@linhvovan29546
Copy link
Contributor

linhvovan29546 commented Mar 17, 2025

Proposal

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

GBR is shown in the LHN when there is nothing when opening the report

What is the root cause of that problem?

The GBP is displayed because, in getReasonAndReportActionThatRequiresAttention, we check whether the report has hasOutstandingChildRequest and all transactions are pending. In this case, since the transactions array is empty, hasOnlyPendingTransactions returns false, leading to the function returning the reason HAS_CHILD_REPORT_AWAITING_ACTION.

const shouldShowGreenDotIndicator = !hasBrickError && requiresAttentionFromCurrentUser(optionItem, optionItem.parentReportAction);

App/src/libs/ReportUtils.ts

Lines 3191 to 3196 in 703cdf4

if (optionOrReport.hasOutstandingChildRequest && !hasOnlyPendingTransactions) {
return {
reason: CONST.REQUIRES_ATTENTION_REASONS.HAS_CHILD_REPORT_AWAITING_ACTION,
reportAction: iouReportActionToApproveOrPay,
};
}

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

We should update the condition to explicitly check whether the transactions array is not empty before returning HAS_CHILD_REPORT_AWAITING_ACTION.

App/src/libs/ReportUtils.ts

Lines 3191 to 3196 in 703cdf4

if (optionOrReport.hasOutstandingChildRequest && !hasOnlyPendingTransactions) {
return {
reason: CONST.REQUIRES_ATTENTION_REASONS.HAS_CHILD_REPORT_AWAITING_ACTION,
reportAction: iouReportActionToApproveOrPay,
};
}

    if (optionOrReport.hasOutstandingChildRequest && transactions.length > 0 && !hasOnlyPendingTransactions) {
        return {
            reason: CONST.REQUIRES_ATTENTION_REASONS.HAS_CHILD_REPORT_AWAITING_ACTION,
            reportAction: iouReportActionToApproveOrPay,
        };
    }

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

We can write a unit test to ensure that the function does not return HAS_CHILD_REPORT_AWAITING_ACTION in this case.

What alternative solutions did you explore? (Optional)

N/A

@rushatgabhane
Copy link
Member

@linhvovan29546 we are checking for transaction length already, right?

const hasOnlyPendingTransactions = transactions.length > 0 && transactions.every((t) => isExpensifyCardTransaction(t) && isPending(t));

@linhvovan29546
Copy link
Contributor

Yes, but that is not correct because the transactions are empty, and we expect all transactions to be pending.🤔

@linhvovan29546
Copy link
Contributor

linhvovan29546 commented Mar 17, 2025

So, I think we must ignore that when the transactions are empty. we can remove the condition ( transactions.length > 0) in hasOnlyPendingTransactions and move it to the if statement instead.

@linhvovan29546
Copy link
Contributor

@rushatgabhane This is similar to what we implemented here where we have already checked transactions?.length

const shouldShowNextStep = transactions?.length !== 0 && isFromPaidPolicy && !!optimisticNextStep?.message?.length && !shouldShowStatusBar;

@rushatgabhane
Copy link
Member

@linhvovan29546 's proposal LGTM

🎀 👀 🎀

Copy link

melvin-bot bot commented Mar 17, 2025

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

@rushatgabhane
Copy link
Member

please add external label

@Beamanator Beamanator added the External Added to denote the issue can be worked on by a contributor label Mar 17, 2025
@melvin-bot melvin-bot bot changed the title GBR is shown in the LHN when there is nothing when opening the report [$250] GBR is shown in the LHN when there is nothing when opening the report Mar 17, 2025
Copy link

melvin-bot bot commented Mar 17, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 17, 2025
Copy link

melvin-bot bot commented Mar 17, 2025

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

@melvin-bot melvin-bot bot removed the Weekly KSv2 label Mar 17, 2025
@Beamanator Beamanator removed the Needs Reproduction Reproducible steps needed label Mar 17, 2025
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 17, 2025
Copy link

melvin-bot bot commented Mar 17, 2025

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

@linhvovan29546
Copy link
Contributor

linhvovan29546 commented Mar 17, 2025

Hi @Beamanator @rushatgabhane After running the test, I think my proposal may not be correct because it causes some unit tests to fail. I believe the root cause is that hasOutstandingChildRequest returns true, so we need to investigate why. This issue might need to be fixed on the backend

@rushatgabhane
Copy link
Member

rushatgabhane commented Mar 17, 2025

@linhvovan29546 hasOutstandingChildRequest
is calculated here i believe -

App/src/libs/actions/IOU.ts

Lines 7945 to 7960 in 96edca9

function hasOutstandingChildRequest(chatReport: OnyxTypes.Report, excludedIOUReport: OnyxEntry<OnyxTypes.Report>, policyId?: string) {
const policy = getPolicy(policyId);
if (!policy?.achAccount?.bankAccountID) {
return false;
}
const reportActions = getAllReportActions(chatReport.reportID);
return !!Object.values(reportActions).find((action) => {
const iouReportID = getIOUReportIDFromReportActionPreview(action);
if (iouReportID === excludedIOUReport?.reportID) {
return false;
}
const iouReport = getReportOrDraftReport(iouReportID);
const transactions = getReportTransactions(iouReportID);
return canIOUBePaid(iouReport, chatReport, policy, transactions) || canIOUBePaid(iouReport, chatReport, policy, transactions, true);
});
}

and here

App/src/libs/ReportUtils.ts

Lines 9041 to 9063 in 703cdf4

function getOutstandingChildRequest(iouReport: OnyxInputOrEntry<Report>): OutstandingChildRequest {
if (!iouReport || isEmptyObject(iouReport)) {
return {};
}
if (!isExpenseReport(iouReport)) {
const {reimbursableSpend} = getMoneyRequestSpendBreakdown(iouReport);
return {
hasOutstandingChildRequest: iouReport.managerID === currentUserAccountID && reimbursableSpend !== 0,
};
}
const policy = getPolicy(iouReport.policyID);
const shouldBeManuallySubmitted = isPaidGroupPolicyPolicyUtils(policy) && !policy?.harvesting?.enabled;
if (shouldBeManuallySubmitted) {
return {
hasOutstandingChildRequest: true,
};
}
// We don't need to update hasOutstandingChildRequest in this case
return {};
}

@linhvovan29546
Copy link
Contributor

@rushatgabhane Can you check the onyxData of the OpenReport command so we can determine whether the exact value comes from the BE or FE?

@rushatgabhane
Copy link
Member

the backend does say that hasOutstandingChildRequest is true

Image

@rushatgabhane
Copy link
Member

@Beamanator could you please help us with how hasOutstandingChildRequest is calculated on the backend?

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 Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause
Projects
Status: HIGH
Development

No branches or pull requests

7 participants