You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-07-24] Expand GBR/RBR with an "action badge" #84764
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
@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?
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:
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).
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.
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
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.
@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:
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.
Bucket the close reason (A/B/C), score the 5 factors 0–10 with permalinks.
Payout = 25% of JOB_PRICE if score ≥ 8, else $0.
If MODE = payment-due:
Start at 100% of JOB_PRICE.
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.
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.
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.
C+ reviewer of Expensify/App#85192:hoangzinh (not an issue assignee — reviewed the 2nd PR) — approved 2026-03-18. Not mentioned anywhere in the payment discussion.
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:
aimane-chnaif — $250 (contributor, 100% of JOB_PRICE). Authored both merged PRs; no verified attributable regression. Paid via Upwork to match how he was paid as C+ author on the sister issue #85187. Confidence: High.
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.
Deploy-blocker audit — confirm you're satisfied none of the 8 linked blockers are attributable regressions before releasing the contributor payment.
@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)
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.
@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)
Activity
quinthar commentedon Mar 10, 2026
@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?
aimane-chnaif commentedon Mar 10, 2026
Can I be assigned here as continuation of #80810?
quinthar commentedon Mar 10, 2026
Done! Does the proposal make sense and do you have a clear idea on how to do it?
MelvinBot commentedon Mar 10, 2026
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
brickRoadStatusper report — either'error'(red dot),'info'(green dot), orundefined(no dot). This is computed in thereportAttributesderived Onyx value (reportAttributes.ts:193-209). While the underlying functions (getReasonAndReportActionThatRequiresAttentionandgetReasonAndReportActionThatHasRedBrickRoad) already compute the reason for the dot, that reason is discarded — only the boolean error/info status is stored inReportAttributesand propagated to the UI. The UI inOptionRowLHN.tsx:377-397then simply renders a coloredDotIndicatoricon 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
ReportAttributesto store action badge infoIn
reportAttributes.ts, after computingbrickRoadStatus, also store:actionBadge: the verb to display — one of'submit','approve','pay','fix', orundefinedactionTargetReportID: the reportID that the action refers to (for deep linking)The data for GBR badges already exists —
getReasonAndReportActionThatRequiresAttention(ReportUtils.ts:4239-4340) returns areasonandreportAction. The mapping is:HAS_CHILD_REPORT_AWAITING_ACTION→ callgetReportPrimaryAction(ReportPrimaryActionUtils.ts:417-496) on the child report to determineSubmit,Approve, orPayHAS_DEW_APPROVE_FAILED→ApproveHAS_MISSING_INVOICE_BANK_ACCOUNT→PayFor RBR,
getReasonAndReportActionThatHasRedBrickRoadreturns the reason; all RBR reasons map toFix.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: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).chatReportID). Filter to those with a non-emptybrickRoadStatus. Among those, find the one with the oldestcreatedtimestamp.getReportPrimaryActionon that oldest report to determine the verb. Store the result asactionBadgeandactionTargetReportIDon the workspace chat'sReportAttributes.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 aMap<chatReportID, Report[]>index during the first pass, avoiding repeated full-collection scans.Layer 3 — Propagate badge data through to the UI
ReportAttributestype inDerivedValues.tsto includeactionBadgeandactionTargetReportIDSidebarUtils.getOptionData(SidebarUtils.ts:794), propagate these new fields toOptionData(alongside the existingbrickRoadIndicator)actionBadgeandactionTargetReportIDto theOptionDatatypeOptionRowLHNData.tsx, include these fields in theuseMemodependency array (following the existing pattern forbrickRoadStatus)Layer 4 — Replace dots with badge UI in
OptionRowLHNIn
OptionRowLHN.tsx:377-397:actionBadgeis set: replace theDotIndicatoricon 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).actionBadgeis not set butbrickRoadIndicatoris: fall back to the current dot rendering (for GBR reasons that don't map to verbs, like unread mentions).actionTargetReportIDis set, navigate to that report instead of the workspace chat. This would be handled in theonSelectRowcallback inSidebarLinksDataor the navigation handler.Performance summary:
reportAttributes.tsensures only changed reports trigger recomputationgetReportPrimaryActionis called per workspace chattodos.tsderived value for every expense report — same cost modelOptionDataReact.memoand deep-equality ref caching inOptionRowLHNDataprevent unnecessary re-rendersuseReportAttributesavoids selectorsReportAttributesobject — no additional Onyx subscriptions neededWhat alternative solutions did you explore? (Optional)
Alternative A — Compute badge in the render path (rejected): Computing the verb in
getOptionDataorOptionRowLHNDatawould run per-row per-render, defeating the derived value architecture. The existing pattern explicitly avoids this (see the comment inuseReportAttributes.ts:1-17about avoiding expensive per-update comparisons).Alternative B — Use the existing
todosderived value (partially useful): Thetodos.tsderived value already categorizes reports intoreportsToSubmit,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 modifyingreportAttributesis more natural since that's wherebrickRoadStatusalready lives and flows to the LHN.Alternative C — Server-side computation (complementary): The server already computes
hasOutstandingChildRequestper 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 thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.aimane-chnaif commentedon Mar 10, 2026
@MelvinBot prepare draft PR based on your main solution.
Note that previous PR didn't work at all because of this reason.
MelvinBot commentedon Mar 10, 2026
🤖 Draft PR created: #84771
Please mark it as "Ready for review" when it is ready for review.
40 remaining items
melvin-bot commentedon Jul 24, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Jul 27, 2026
@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.
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:
If MODE = closed-no-pr:
(<~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.
If MODE = payment-due:
truly attributable to this author/reviewer. If yes, −50% per verified regression.
If fault is unclear, DO NOT deduct — flag for human review.
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.
MelvinBot commentedon Jul 27, 2026
🤖 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)
aimane-chnaif— authored Expensify/App#85025 (merged 2026-03-12) and Expensify/App#85192 (merged 2026-03-18). Payment requested here.Pujan92(the assigned C+ on this issue) — approved 2026-03-12.hoangzinh(not an issue assignee — reviewed the 2nd PR) — approved 2026-03-18. Not mentioned anywhere in the payment discussion.Already paid elsewhere
Pujan92asked to be paid for reviewing feat: Expand GBR/RBR with an "action badge" #85025 (comment), thenaimane-chnaifnoted he was already paid via Expensify/App#85187 (comment) andPujan92agreed — "All good then". TreatingPujan92as settled → $0 due here.Regressions
Eight deploy blockers were linked to this project (#85187, #85201, #85659, #85665, #85677, #85744, #85753, #90627).
aimane-chnaifaudited 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
Per-line reasoning:
aimane-chnaif— $250 (contributor, 100% of JOB_PRICE). Authored both merged PRs; no verified attributable regression. Paid via Upwork to match how he was paid as C+ author on the sister issue #85187. Confidence: High.Pujan92— $0 here; settled by mutual agreement via [$250] [Due for payment 2026-04-17] LHN - Negative expenses show "Mark as paid" action but "Pay" badge is not visible on LHN. #85187. Confidence: Medium (agreement, not a direct PR-to-payment match).hoangzinh— $250 for reviewing Expensify/App#85192. Confidence: Low — see flag below.🚩 Manual-review flags
hoangzinhis 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 tohoangzinh(who did feat: deep link to report preview or message that caused GBR/RBR #85192's review) or stays with the assigned C+Pujan92.aimane-chnaifmay double to $500 — otherwise treat as a single $250 job.mallenexpensify commentedon Jul 28, 2026
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)
aimane-chnaif commentedon Jul 28, 2026
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.
hoangzinh commentedon Jul 28, 2026
Yes. It's not a normal issue. In order to ship this
I had to review 2 PRs:
mountiny commentedon Jul 28, 2026
Yeah i agree this was a larger effort where $500 would be more appropriate
mallenexpensify commentedon Jul 30, 2026
@hoangzinh , @aimane-chnaif paid, summary updated to $500 above. Thx.
aimane-chnaif commentedon Jul 30, 2026
@mallenexpensify can you please replace "via Upwork" phrase with "via NewDot"? Thanks
mountiny commentedon Jul 30, 2026
Updated
m-natarajan commentedon Jul 30, 2026
@aimane-chnaif This is regarding the
Regression test proposalFix badge displayed only after submitting the expense. Is this expected, If so can you please update the test step (Step5)
Recording.3296.mp4
aimane-chnaif commentedon Jul 30, 2026
yes, it's expected as per https://github.com/Expensify/Expensify/issues/640678
We can update Step 5 to
Create and submit expense with violationlaurenreidexpensify commentedon Jul 31, 2026
$500 approved for @hoangzinh
garrettmknight commentedon Aug 7, 2026
$500 approved for @aimane-chnaif