Skip to content

[Due for payment 2026-04-20] [$250] Don't show non-reimbursable reports in the Pay to-do queu #87351

Closed

Description

@JmillsExpensify

Based on this discussion: https://expensify.slack.com/archives/C049HHMV9SM/p1775572675172489.

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022041816085132038141
  • Upwork Job ID: 2041816085132038141
  • Last Price Increase: 2026-04-08
  • Automatic offers:
    • twilight2294 | Contributor | 111039559

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Apr 8, 2026
  2. samranahm commented on Apr 8, 2026

    @samranahm
    Contributor

    I recently worked on this, I'm open to this one too.

    cc:@situchan

  3. MelvinBot commented on Apr 8, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The Pay to-do queue count is driven by isPrimaryPayAction() in ReportPrimaryActionUtils.ts:225-230. The condition explicitly includes reports that have only non-reimbursable transactions:

    (reimbursableSpend !== 0 || (nonReimbursableSpend !== 0 && hasOnlyNonReimbursableTransactions(...)))
    

    The second branch of that OR means any finished expense report where all transactions are non-reimbursable will appear in the Pay queue, even though there is nothing to reimburse.

    Notably, the ForYouSection Pay handler already passes {reimbursable: YES} when navigating to search results (index.tsx:90), so the count and the actual search results are mismatched — the badge shows a number, but the results page filters those reports out.

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

    Remove the non-reimbursable branch from the condition in isPrimaryPayAction() at ReportPrimaryActionUtils.ts:230, changing:

    (reimbursableSpend !== 0 || (nonReimbursableSpend !== 0 && hasOnlyNonReimbursableTransactions(report?.reportID, reportTransactions)))
    

    to simply:

    reimbursableSpend !== 0
    

    This is safe because useNonReimbursablePaymentModal already blocks direct payment for non-reimbursable-only reports, confirming they should not have a Pay action.

    What alternative solutions did you explore? (Optional)

    An alternative would be to filter non-reimbursable reports only in the todo queue logic (todos.ts:67-79) rather than in isPrimaryPayAction itself. However, fixing it at the source (isPrimaryPayAction) is cleaner since the Pay action genuinely does not apply to non-reimbursable-only reports — the payment modal already blocks it.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Apr 8, 2026
  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Apr 8, 2026
  6. melvin-bot commented on Apr 8, 2026

    @melvin-bot

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

  7. changed the title [-]Don't show non-reimbursable reports in the `Pay` to-do queu[/-] [+][$250] Don't show non-reimbursable reports in the `Pay` to-do queu[/+] on Apr 8, 2026
  8. melvin-bot commented on Apr 8, 2026

    @melvin-bot
  9. Abdullahtmk commented on Apr 8, 2026

    @Abdullahtmk

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

    Non-reimbursable expense reports are appearing in the "Pay" to-do queue, but users cannot actually pay these reports since they are marked as non-reimbursable. This creates confusion and clutter in the to-do list.

    What is the root cause of that problem?

    The Pay to-do queue filtering logic (likely in src/libs/ReportUtils.ts or src/libs/TodoUtils.ts) doesn't exclude reports with reimbursable: false when determining which reports should appear in the Pay queue. The filter checks for report state (Outstanding, approved, etc.) but skips the reimbursable status check.

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

    In the to-do queue filter function (likely shouldShowPaymentReminderInTodoList() or similar in src/libs/ReportUtils.ts), add a check to exclude non-reimbursable reports:

    // Before: Only checks report state
    function shouldShowPaymentReminderInTodoList(report: Report): boolean {
        return isOutstandingReport(report) && isReportApproved(report);
    }
    
    // After: Also checks if reimbursable
    function shouldShowPaymentReminderInTodoList(report: Report): boolean {
        return (
            isOutstandingReport(report) && 
            isReportApproved(report) && 
            report.reimbursable !== false // Exclude non-reimbursable
        );
    }

    Or if the logic is in a different filter path (e.g., getReportsToPayQueued() in actions), add the same reimbursable check there.

    What alternative solutions did you explore? (Optional)

    • Show non-reimbursable reports with disabled state: Still clutters the queue
  10. twilight2294 commented on Apr 8, 2026

    @twilight2294
    Contributor

    Proposal

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

    Expense reports where all transactions are non-reimbursable (e.g., company card expenses) appear in the Pay to-do queue, even though there is nothing to reimburse.

    What is the root cause of that problem?

    The Pay to-do queue is populated in todos by checking isPrimaryPayAction() in ReportPrimaryActionUtils. That function returns true for reports with only non-reimbursable transactions due to this condition:

    reimbursableSpend !== 0 || (nonReimbursableSpend !== 0 && hasOnlyNonReimbursableTransactions(...))
    

    The second branch was intentionally added to support "mark as paid" on non-reimbursable reports when viewing them directly. The problem is that the to-do queue also picks these up, creating a misleading Pay count.

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

    Filter out non-reimbursable-only reports in todos when building the reportsToPay list. After the isPrimaryPayAction() check, add a guard that excludes reports where hasOnlyNonReimbursableTransactions() is true:

    if (primaryAction === CONST.REPORT.PRIMARY_ACTIONS.PAY && !hasOnlyNonReimbursableTransactions(report?.reportID, reportTransactions)) {
        reportsToPay.push(report);
    }

    What alternative solutions did you explore? (Optional)

    MelvinBot's proposal removes the non-reimbursable branch from isPrimaryPayAction() entirely. That's over-scoped — the hasOnlyNonReimbursableTransactions branch was intentionally added (commit 55137f357ff) to allow "mark as paid" on non-reimbursable reports when a user views them directly. Gutting it from isPrimaryPayAction() would remove that capability everywhere, not just from the to-do queue. Filtering in todos.ts is more targeted: it fixes the to-do queue without regressing the direct report Pay/mark-as-paid flow.

  11. samarroy84 commented on Apr 8, 2026

    @samarroy84
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2026-04-08 10:47:41 UTC.

    Proposal

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

    Non-reimbursable reports are displayed in the Pay to-do queue

    What is the root cause of that problem?

    if (
    isReportPayer &&
    isExpenseReport &&
    arePaymentsEnabled &&
    isReportFinished &&
    (reimbursableSpend !== 0 || (nonReimbursableSpend !== 0 && hasOnlyNonReimbursableTransactions(report?.reportID, reportTransactions)))
    ) {
    return isSecondaryAction ?? !didExportFail;
    }

    Here, return true if report has only non-reimbursable transactions with non-zero amount.

    So this report is pushed to Pay todo section

    if (
    isPrimaryPayAction({
    report,
    reportTransactions,
    currentUserAccountID,
    currentUserLogin: login,
    bankAccountList,
    policy,
    reportNameValuePairs: reportNameValuePair,
    })
    ) {
    reportsToPay.push(report);
    }

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

    In isPrimaryPayAction function, return false if report has only non-reimbursable transactions and if this is coming from todo section check.

    if this is coming from todo section check.

    We can introduce new isFromTodos flag in isPrimaryPayAction. This way, we don't need to recompute hasOnlyNonReimbursableTransactions in todo section.

    if (
    isReportPayer &&
    isExpenseReport &&
    arePaymentsEnabled &&
    isReportFinished &&
    (reimbursableSpend !== 0 || (nonReimbursableSpend !== 0 && hasOnlyNonReimbursableTransactions(report?.reportID, reportTransactions)))
    ) {
    return isSecondaryAction ?? !didExportFail;
    }

        if (isReportPayer && isExpenseReport && arePaymentsEnabled && isReportFinished) {
            if (reimbursableSpend !== 0) {
                return isSecondaryAction ?? !didExportFail;
            }
            if (hasOnlyNonReimbursableTransactions(report?.reportID, reportTransactions)) {
                return !isFromTodos && nonReimbursableSpend !== 0 && (isSecondaryAction ?? !didExportFail);
            }
        }
    

    My proposal also removes redundant check here by early returning when hasOnlyNonReimbursableTransactions = true and nonReimbursableSpend = 0.

    What alternative solutions did you explore? (Optional)

  12. JasimMalook commented on Apr 8, 2026

    @JasimMalook

    🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

  13. 29 remaining items

  14. brianlee-expensify commented on Apr 13, 2026

    @brianlee-expensify
    Contributor

    @situchan can you confirm whether this GH is a duplicate?

  15. situchan commented on Apr 13, 2026

    @situchan
    Contributor

    @situchan can you confirm whether this GH is a duplicate?

    Not dupe. Different issue

  16. melvin-bot commented on Apr 16, 2026

    @melvin-bot

    @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!

  17. melvin-bot commented on Apr 19, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  18. mallenexpensify commented on Apr 21, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @twilight2294 paid $250 via Upwork
    Contributor+: @situchan due $250 via NewDot

    @situchan plz complete the BZ checklist and tag me in a post once you have. Thx

  19. situchan commented on Apr 21, 2026

    @situchan
    Contributor

    BugZero Checklist:

    • [Contributor] 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: new feature

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/626831

    Regression Test Proposal

    Test:

    1. Create a reimbursable report and approve it
    2. Create a non-reimbursable report and approve it
    3. Go to /search and select Pay from the Todo section
    4. Verify that the non-reimbursable report is not visible in the list

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-ab9c-a66e-8fb4-ca48fb597ca4
  20. situchan commented on Apr 21, 2026

    @situchan
    Contributor

    @mallenexpensify checklist completed

  21. laurenreidexpensify commented on Apr 27, 2026

    @laurenreidexpensify
    Contributor

    $250 approved for @situchan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions