Skip to content

[Due for payment 2026-07-02] [No QA] Reorder unread indicator predicates to short-circuit cheaply #94447

Closed

Description

@mountiny

Problem

getUnreadReportsForUnreadIndicator runs on every Onyx update (report, report-action, NVP, draft) and previously walked every report computing six locals up front — including the expensive getOneTransactionThreadReportID call — before running the cheapest guards. On accounts with 100k reports this took ~1.1s per invocation.

Solution

Reordered the predicates to short-circuit as early as possible with no behavioral change: mute and hidden-for-current-user checks run first, isUnread runs third, and getOneTransactionThreadReportID plus report-action/NVP lookups are deferred behind those rejections. The heaviest predicate (shouldReportBeInOptionList) runs last, only for reports that are unread, non-muted, and non-hidden. This reduces runtime from ~1.1s to ~400ms on 100k-report accounts.

PR

#94424

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    ReviewingHas a PR in review
    InternalRequires API changes or must be handled by Expensify staff
    on Jun 24, 2026
  2. changed the title [-][No QA] Reorder unread indicator predicates to short-circuit cheaply[/-] [+][Due for payment 2026-07-02] [No QA] Reorder unread indicator predicates to short-circuit cheaply[/+] on Jun 25, 2026
  3. melvin-bot commented on Jun 25, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jun 25, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.19-5 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 2026-07-02. 🎊

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

  5. melvin-bot commented on Jun 30, 2026

    @melvin-bot

    @ZhenjaHorbach Eep! 4 days overdue now. Issues have feelings too...

  6. melvin-bot commented on Jul 1, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  7. melvin-bot commented on Jul 1, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  8. mallenexpensify commented on Jul 3, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @ZhenjaHorbach due $250 via NewDot

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

  9. ZhenjaHorbach commented on Jul 4, 2026

    @ZhenjaHorbach
    Contributor

    It's a performance issue
    So I think we don't need a checklist here

  10. garrettmknight commented on Jul 6, 2026

    @garrettmknight
    Contributor

    $250 approved for @ZhenjaHorbach

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 productionDailyKSv2InternalRequires API changes or must be handled by Expensify staffTask

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions