Skip to content

[Due for payment 2026-07-24] Expand GBR/RBR with an "action badge" #84764

Closed
2 of 2 issues completed
Closed

Description

@quinthar

Note: Originally discussed in this thread, and formally proposed in this P/S. Most recent discussion is here. Issued moved from E/E repo here.

Strategy:

To expand into the "blue ocean" of untapped customers, we need a tool that is not only more powerful than currently available, but also lower cost. The key to lowering the cost of acquiring and retaining customers is building a product that is intuitive from the very first moment.

Background:

The Inbox is designed to show you what you need to do next. It does that by highlighting reports with actions that need to be taken using a :greenlight: GBR or 🔴 RBR. We recently updated all badge designs in anticipation of this: #81993 (comment). We also recently updated the response of OpenApp/ReconnectApp to return all expense reports that have outstanding GBRs/RBRs.

Problem:

When an average user looks at a GBR/RBR in the Inbox, they often don't realize they are supposed to tap it or why, resulting in low clickthrough, engagement, and conversion.

Solution:

Replace GBR/RBR dots with an "action badge" that replaces the "green/red dot" with a colored "verb" that represents what needs to happen. This makes badge look more like a button (and FullStory shows that people tend to click on badges in the LHN even if they don't understand what they do). The goal of both is that we get greater clickthrough, enabling more people to see and thus engage with the final task the GBR/RBR is promoting. More specifically:

  • Find the logic that chooses whether to render a GBR/RBR dot.
  • Find the cause of the GBR/RBR:
    • If it's a workspace chat, find the oldest report that has a GBR/RBR
    • Otherwise find the oldest error that has a RBR
    • Otherwise check if it's pinned
  • Replace the GBR/RBR dot with a "badge" representing whatever action needs to be taken on that report
    • GBRs: Submit, Approve, Pay
    • RBRs: Fix
  • When the row is pressed, deep link to the report preview or message that caused that GBR/RBR
Image
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. quinthar commented on Mar 10, 2026

    @quinthar
    ContributorAuthor

    @MelvinBot Can you please outline a solution to this, paying particular attention to the performance implications of replacing the GBR/RBR dot calculation with a new one that identifies the oldest report?

  2. aimane-chnaif commented on Mar 10, 2026

    @aimane-chnaif
    Contributor

    Can I be assigned here as continuation of #80810?

  3. quinthar commented on Mar 10, 2026

    @quinthar
    ContributorAuthor

    Done! Does the proposal make sense and do you have a clear idea on how to do it?

  4. MelvinBot commented on Mar 10, 2026

    @MelvinBot
    Contributor

    Proposal

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

    When users see a GBR (green dot) or RBR (red dot) in the Inbox, they often don't realize they're supposed to tap it or understand what action is needed. This results in low clickthrough, engagement, and conversion. The dots need to be replaced with colored "action badges" showing a specific verb (Submit, Approve, Pay, Fix) and, for workspace chats, the badge should represent the action needed on the oldest outstanding expense report. Tapping the row should deep link to that specific report.

    What is the root cause of that problem?

    The current system stores only a binary brickRoadStatus per report — either 'error' (red dot), 'info' (green dot), or undefined (no dot). This is computed in the reportAttributes derived Onyx value (reportAttributes.ts:193-209). While the underlying functions (getReasonAndReportActionThatRequiresAttention and getReasonAndReportActionThatHasRedBrickRoad) already compute the reason for the dot, that reason is discarded — only the boolean error/info status is stored in ReportAttributes and propagated to the UI. The UI in OptionRowLHN.tsx:377-397 then simply renders a colored DotIndicator icon based on that status.

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

    The solution has four layers, each designed to keep the expensive work in the derived value computation (outside the render cycle) and propagate only cheap lookups to the UI:

    Layer 1 — Extend ReportAttributes to store action badge info

    In reportAttributes.ts, after computing brickRoadStatus, also store:

    • actionBadge: the verb to display — one of 'submit', 'approve', 'pay', 'fix', or undefined
    • actionTargetReportID: the reportID that the action refers to (for deep linking)

    The data for GBR badges already exists — getReasonAndReportActionThatRequiresAttention (ReportUtils.ts:4239-4340) returns a reason and reportAction. The mapping is:

    • HAS_CHILD_REPORT_AWAITING_ACTION → call getReportPrimaryAction (ReportPrimaryActionUtils.ts:417-496) on the child report to determine Submit, Approve, or Pay
    • HAS_DEW_APPROVE_FAILED → Approve
    • HAS_MISSING_INVOICE_BANK_ACCOUNT → Pay
    • All other GBR reasons (mentions, tasks, join requests) → no action badge (keep the current green dot or adapt as product decides)

    For RBR, getReasonAndReportActionThatHasRedBrickRoad returns the reason; all RBR reasons map to Fix.

    Layer 2 — Find the oldest report for workspace chats

    For workspace expense chats (isPolicyExpenseChat), the GBR/RBR may aggregate across multiple child expense reports. The issue requires showing the badge for the oldest such report. The approach:

    1. In reportAttributes.ts, after the per-report pass that computes individual report attributes, add a workspace chat aggregation pass (similar to the existing error-propagation pass at lines 234-257).
    2. For each workspace expense chat, iterate its child expense reports (those with matching chatReportID). Filter to those with a non-empty brickRoadStatus. Among those, find the one with the oldest created timestamp.
    3. Call getReportPrimaryAction on that oldest report to determine the verb. Store the result as actionBadge and actionTargetReportID on the workspace chat's ReportAttributes.

    Performance note on "find oldest": This iteration is bounded per-workspace (typically tens of expense reports, not thousands) and runs in the derived value computation (outside React rendering). The derived value uses incremental updates (reportAttributes.ts:260) — after the initial full computation, only changed reports are reprocessed. When a child expense report changes status, the workspace chat's aggregation would need to re-run, but this is a small O(k) operation where k is the number of expense reports per workspace. This matches the existing pattern used for error propagation. To make the child-report lookup efficient, build a Map<chatReportID, Report[]> index during the first pass, avoiding repeated full-collection scans.

    Layer 3 — Propagate badge data through to the UI

    • Extend the ReportAttributes type in DerivedValues.ts to include actionBadge and actionTargetReportID
    • In SidebarUtils.getOptionData (SidebarUtils.ts:794), propagate these new fields to OptionData (alongside the existing brickRoadIndicator)
    • Add actionBadge and actionTargetReportID to the OptionData type
    • In OptionRowLHNData.tsx, include these fields in the useMemo dependency array (following the existing pattern for brickRoadStatus)

    Layer 4 — Replace dots with badge UI in OptionRowLHN

    In OptionRowLHN.tsx:377-397:

    • When actionBadge is set: replace the DotIndicator icon with a small colored badge component showing the verb text. Color it green for Submit/Approve/Pay, red for Fix (matching current GBR/RBR colors).
    • When actionBadge is not set but brickRoadIndicator is: fall back to the current dot rendering (for GBR reasons that don't map to verbs, like unread mentions).
    • On row press: if actionTargetReportID is set, navigate to that report instead of the workspace chat. This would be handled in the onSelectRow callback in SidebarLinksData or the navigation handler.

    Performance summary:

    Concern Mitigation
    "Find oldest" iterates child reports Bounded per-workspace (not per-total-reports), runs in derived value config, not in render
    Incremental updates Existing incremental update system in reportAttributes.ts ensures only changed reports trigger recomputation
    getReportPrimaryAction is called per workspace chat Already called in the existing todos.ts derived value for every expense report — same cost model
    New fields in OptionData Simple property reads (O(1)) in render path; React.memo and deep-equality ref caching in OptionRowLHNData prevent unnecessary re-renders
    useReportAttributes avoids selectors New fields are in the same ReportAttributes object — no additional Onyx subscriptions needed

    What alternative solutions did you explore? (Optional)

    Alternative A — Compute badge in the render path (rejected): Computing the verb in getOptionData or OptionRowLHNData would run per-row per-render, defeating the derived value architecture. The existing pattern explicitly avoids this (see the comment in useReportAttributes.ts:1-17 about avoiding expensive per-update comparisons).

    Alternative B — Use the existing todos derived value (partially useful): The todos.ts derived value already categorizes reports into reportsToSubmit, reportsToApprove, reportsToPay. However, it stores flat arrays without workspace grouping or age ordering, and it doesn't cover RBR cases. It could be extended, but modifying reportAttributes is more natural since that's where brickRoadStatus already lives and flows to the LHN.

    Alternative C — Server-side computation (complementary): The server already computes hasOutstandingChildRequest per workspace chat. A server-side enhancement could return the specific action type and target reportID directly, removing the client-side "find oldest" iteration entirely. This would be the most performant long-term solution and could be done as a follow-up optimization to the client-side approach described above.


    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.

  5. aimane-chnaif commented on Mar 10, 2026

    @aimane-chnaif
    Contributor

    @MelvinBot prepare draft PR based on your main solution.
    Note that previous PR didn't work at all because of this reason.

  6. self-assigned this
    on Mar 10, 2026
  7. MelvinBot commented on Mar 10, 2026

    @MelvinBot
    Contributor

    🤖 Draft PR created: #84771
    Please mark it as "Ready for review" when it is ready for review.

  8. added and removed on Mar 11, 2026
  9. 40 remaining items

  10. melvin-bot commented on Jul 24, 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
  11. mallenexpensify commented on Jul 27, 2026

    @mallenexpensify
    Contributor

    @MelvinBot payment-review, take into account there are multiple contributors/C+ who worked on multiple PRs for this issue and some might have been paid elsewhere. Always return payment suggestions using the format below So I can copy/paste them into a comment.

    Payment Summary

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

    MODE: <closed-no-pr | payment-due>
    JOB_PRICE: 250 # override if the title bounty differs

    Run the C+ payment framework for this issue and post a structured, evidence-cited
    recommendation. Rules:

    • Suggest only — never auto-pay. A human confirms.
    • Every point / adjustment MUST cite a specific comment permalink. No permalink → no point.
    • Round every %→$ result up to the nearest $25: amount = ceil((pct × JOB_PRICE) / 25) × 25.

    If MODE = closed-no-pr:

    1. Run the eligibility gate; if it fails, or the token-saving skip-gate trips
      (<~8 non-bot comments AND no C+ engagement markers, or closed <48h, or spam/invalid),
      return "$0 — skipped" with a one-line reason and STOP.
    2. Bucket the close reason (A/B/C), score the 5 factors 0–10 with permalinks.
    3. Payout = 25% of JOB_PRICE if score ≥ 8, else $0.

    If MODE = payment-due:

    1. Start at 100% of JOB_PRICE.
    2. Decreases: for any regression, read the offending PR + issue and decide if it's
      truly attributable to this author/reviewer. If yes, −50% per verified regression.
      If fault is unclear, DO NOT deduct — flag for human review.
    3. Increases: evaluate the C+ increase framework (multiple PRs, additional fixes,
      scope expansion, core-flow changes, deploy blockers audited, performance,
      test coverage, files touched), each backed by a permalink.

    Output: recommended $ amount, per-line reasoning with permalinks, confidence
    (High/Med/Low), and any manual-review flags.

  12. MelvinBot commented on Jul 27, 2026

    @MelvinBot
    Contributor

    🤖 Payment review — MODE: payment-due, JOB_PRICE: $250. Suggestion only; please confirm before paying.

    Heads-up: the auto-generated Payment Summary mislabels the roles. Both merged PRs on this project were authored by aimane-chnaif — he is the contributor, not a reviewer. The two PRs were reviewed by two different C+, and one reviewer is missing from that summary entirely.

    Reconstructed roles (evidence)

    Already paid elsewhere

    Regressions

    Eight deploy blockers were linked to this project (#85187, #85201, #85659, #85665, #85677, #85744, #85753, #90627). aimane-chnaif audited them and argued none are attributable regressions — the root causes pre-existed in production (BugZero checklist, summary; per-blocker reasoning #85187, #85201). Several of these blockers were closed as their own separately-bountied jobs (e.g. #85677, #85659, #85753), not booked as regressions of these PRs. Per the framework, fault is not clearly attributable → no deduction, but flagged for your confirmation given the volume.


    Recommended payment

    ### Payment Summary
    Contributor: @aimane-chnaif due $250 via Upwork
    Contributor+: @Pujan92 already paid via #85187 — $0 due here
    Contributor+: @hoangzinh due $250 via NewDot (reviewed #85192)
    

    Per-line reasoning:

    🚩 Manual-review flags

    1. hoangzinh is unaccounted for. He reviewed and approved the 2nd merged PR (feat: deep link to report preview or message that caused GBR/RBR #85192) but appears in no payment summary or discussion. Decide whether the review payment for this issue goes to hoangzinh (who did feat: deep link to report preview or message that caused GBR/RBR #85192's review) or stays with the assigned C+ Pujan92.
    2. One job or two? This project shipped as two distinct PRs (badge + deep-link) with two different reviewers. If feat: deep link to report preview or message that caused GBR/RBR #85192 was intended as a separate bounty, the contributor amount for aimane-chnaif may double to $500 — otherwise treat as a single $250 job.
    3. Deploy-blocker audit — confirm you're satisfied none of the 8 linked blockers are attributable regressions before releasing the contributor payment.
  13. mallenexpensify commented on Jul 28, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @aimane-chnaif due $500 via NewDot
    Contributor+: @hoangzinh due $500 via NewDot (reviewed #85192)

    @mountiny does that look accurate. I'm uncertain if @aimane-chnaif should be paid $250, total, for both PRs (I'd love to update documents to more clearly address this ie, "the fix is for the bug, the default price remains if it takes 1 or 3 PRs" (while also including a note about scope increase, fixing multiple bugs and what qualifies as a 'follow up' issue cuz those are due $125, by default)

  14. aimane-chnaif commented on Jul 28, 2026

    @aimane-chnaif
    Contributor

    They're different PRs, each of them are not small/trivial.
    One is to convert GBR/RBR to action badge in LHN.
    Another is to deep link to report action that caused GBR/RBR.

  15. hoangzinh commented on Jul 28, 2026

    @hoangzinh
    Contributor

    Yes. It's not a normal issue. In order to ship this

    #85192 is to deep link to report action that caused GBR/RBR.

    I had to review 2 PRs:

  16. mountiny commented on Jul 28, 2026

    @mountiny
    Contributor

    Yeah i agree this was a larger effort where $500 would be more appropriate

  17. mallenexpensify commented on Jul 30, 2026

    @mallenexpensify
    Contributor

    @hoangzinh , @aimane-chnaif paid, summary updated to $500 above. Thx.

  18. aimane-chnaif commented on Jul 30, 2026

    @aimane-chnaif
    Contributor

    @mallenexpensify can you please replace "via Upwork" phrase with "via NewDot"? Thanks

  19. mountiny commented on Jul 30, 2026

    @mountiny
    Contributor

    Updated

  20. m-natarajan commented on Jul 30, 2026

    @m-natarajan

    @aimane-chnaif This is regarding the Regression test proposal
    Fix badge displayed only after submitting the expense. Is this expected, If so can you please update the test step (Step5)

    Recording.3296.mp4
  21. aimane-chnaif commented on Jul 30, 2026

    @aimane-chnaif
    Contributor

    yes, it's expected as per https://github.com/Expensify/Expensify/issues/640678

    We can update Step 5 to Create and submit expense with violation

  22. laurenreidexpensify commented on Jul 31, 2026

    @laurenreidexpensify
    Contributor

    $500 approved for @hoangzinh

  23. garrettmknight commented on Aug 7, 2026

    @garrettmknight
    Contributor

    $500 approved for @aimane-chnaif

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 productionImprovementItem broken or needs improvement.WeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions