Skip to content

[Payment due @daledah] Add Top tags to the Insights dashboard - #105096

Merged
luacmartins merged 23 commits into
mainfrom
cmartins-insights-top-tags
Nov 17, 2026
Merged

luacmartins merged 23 commits into
mainfrom
cmartins-insights-top-tags

Conversation

@luacmartins

@luacmartins luacmartins commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Rank the top five tags at the selected level. Save the level across devices, keep dependent parents distinct, and carry the scope through Search, comparisons, CSV, Home, and Explain. Reuse the grouping menu and existing full tag-list reads. Show a donut for multiple tags and a bar for one result or comparisons.

Deploy in order: https://github.com/Expensify/Auth/pull/26302 → https://github.com/Expensify/Web-Expensify/pull/57975 → this PR. Tag Details and Biggest changes remain outside this update.

Tag-level popup telemetry follows main: Search-FilterPopupApplySingleSelect → Insights-ControlPopupApply-TagLevel; Search-FilterPopupResetSingleSelect → Insights-ControlPopupReset-TagLevel.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/697454
PROPOSAL:

Tests

  1. Open Insights for a workspace with single-level tags and more than five tagged values plus untagged expenses. Expect a donut with five ranked tags, no level pill, and shares calculated against all spend. Select a date range containing only one tagged value; expect a single bar.
  2. Select a workspace with independent Department and Location lists. Pick Location and Apply; expect level-two values merged across departments. Reset; expect level one.
  3. Select dependent Region and Office lists with Marketing under US and EU. Pick Office; expect separate Marketing rows, secondary parent labels, and parent-aware tooltips. At level three, expect the full ancestor path.
  4. Select workspaces with conflicting level names. Expect positional fallback labels such as Tag level 2. Remove every workspace supporting the saved level; expect level one after complete tag metadata loads.
  5. Reopen Insights on another device. Expect the saved level and other dashboard filters to match.
  6. Change dates, workspaces, and currency. Expect matching totals and no Top tags card when no workspace enables tags. Select a level with no tagged expenses; expect the existing empty state.
  7. Choose Previous period and Average. Expect paired bars for each tag and dependent parent against its corresponding historical group.
  8. Click a tag bar or donut slice and use View on Spend. Expect the selected level and workspace scope; a clicked dependent tag must exclude the same name under another parent. Change advanced filters and reopen the search; expect the exact tag scope to remain.
  9. Download CSV. Expect Tag, Parent, Total, Share of total (%), Expenses, and Currency columns with current-period values and readable ancestors.
  10. Select Top tags on Home, then use Explain on Insights. Expect Home to use the same chart type and saved level, and Concierge to receive the selected level with the dashboard scope.
  11. Repeat the selector and parent-label flows on narrow and wide layouts. Expect readable labels, working Reset/Apply controls, and no new JS console errors.

Offline tests

  1. Load a level online, disconnect, and reopen Insights with the same filters. Expect cached data and the saved level to remain visible.
  2. Select an uncached level or date range offline. Expect the existing offline state, not data from the previous scope.
  3. Open a workspace with partial tag metadata offline. Expect no premature reset of a valid saved level. Reconnect; expect complete levels and the selected chart to load.

QA Steps

  1. Follow Tests 1–11 with the backend dependencies deployed. Expect the same rankings, parent scoping, persistence, comparisons, and exports.
  2. Follow Offline tests 1–3. Expect cached scopes to remain usable and uncached scopes to recover after reconnecting.

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Earlier layout reference Top tags layout
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@luacmartins
luacmartins requested a review from a team October 26, 2026 23:13
@OSBotify

This comment has been minimized.

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/CONST/SENTRY_LABEL.ts 100.00% <ø> (ø)
src/CONST/index.ts 96.15% <ø> (ø)
src/ROUTES.ts 34.83% <100.00%> (ø)
src/components/Charts/utils/getDrawablePieData.ts 100.00% <100.00%> (ø)
src/components/Charts/utils/index.ts 79.32% <100.00%> (-0.30%) ⬇️
src/components/Search/SearchChartView.tsx 91.66% <100.00%> (+90.73%) ⬆️
src/components/Search/SearchList/ListItem/types.ts 100.00% <ø> (ø)
src/components/Search/buildChartSeries.ts 100.00% <100.00%> (ø)
src/components/Search/chartGroupByConfig.ts 87.30% <100.00%> (+1.09%) ⬆️
src/libs/SearchParser/autocompleteParser.js 61.35% <ø> (-0.52%) ⬇️
... and 27 more
... and 9 files with indirect coverage changes

@luacmartins luacmartins changed the title Add Top tags to the Insights dashboard [HOLD Auth 25892] Add Top tags to the Insights dashboard Oct 29, 2026
@luacmartins
luacmartins marked this pull request as ready for review October 30, 2026 17:32
@luacmartins
luacmartins requested a review from a team as a code owner October 30, 2026 17:32
@luacmartins luacmartins changed the title [HOLD Auth 25892] Add Top tags to the Insights dashboard Add Top tags to the Insights dashboard Oct 30, 2026
@melvin-bot
melvin-bot Bot requested review from Krishna2323 and removed request for a team October 30, 2026 17:32
@melvin-bot

melvin-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown

@Krishna2323 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T17:39:04.223130Z d619f43 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@melvin-bot
melvin-bot Bot requested review from trjExpensify and removed request for a team October 30, 2026 17:32
@luacmartins
luacmartins requested review from a team and daledah and removed request for Krishna2323 October 30, 2026 17:32
@melvin-bot
melvin-bot Bot requested review from joekaufmanexpensify and removed request for a team October 30, 2026 17:32

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d619f4361d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/pages/Insights/dashboardSpecs.ts Resolved
@joekaufmanexpensify

Copy link
Copy Markdown
Contributor

Gonna remove my review here because Tom is heading up the product side of insights.

@joekaufmanexpensify
joekaufmanexpensify removed their request for review October 30, 2026 18:21
@luacmartins
luacmartins requested a review from a team as a code owner October 30, 2026 18:46
@melvin-bot
melvin-bot Bot requested review from Pujan92 and removed request for a team October 30, 2026 18:46
@mhawryluk

mhawryluk commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

when there is a big untagged expense, which makes all tags' percentOfTotal less than 0.05% the pie chart is empty. is this a known issue or is it expected? will the backend send the untagged group?

Zrzut ekranu 2026-11-17 o 14 05 02

@luacmartins

Copy link
Copy Markdown
Contributor Author

Updated

@luacmartins

Copy link
Copy Markdown
Contributor Author

The backend intentionally excludes untagged groups, but their spend still counts toward percentOfTotal. This was a frontend bug: slice visibility now uses plotted totals, while displayed shares stay unchanged.

mhawryluk and others added 2 commits November 17, 2026 17:09
@JmillsExpensify

Copy link
Copy Markdown
Contributor

What's left to get this one merged? Another review from @daledah and then final review from @aldo-expensify?

@luacmartins
luacmartins merged commit 7070bcd into main Nov 17, 2026
47 of 48 checks passed
@luacmartins
luacmartins deleted the cmartins-insights-top-tags branch November 17, 2026 19:32
@github-actions

Copy link
Copy Markdown
Contributor

🚧 luacmartins has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/luacmartins in version: 9.5.41-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

MelvinBot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Help site update needed — this adds a new, non-beta-gated tag-spending visualization and level-selection workflow, which belongs in the existing Insights articles.

No docs PR created: live UI verification was blocked because the available account has no tagged expenses, so I couldn’t confirm the new labels and controls as required. Verification needs an account with tagged expenses and multi-level tags.


view run · view recording

@jponikarchuk

Copy link
Copy Markdown

Deploy Blocker #107216 was identified to be related to this PR.

@m-natarajan

Copy link
Copy Markdown

@luacmartins Could we please have this one validated internally due to the complex requirements involved in executing and validating the test steps?

@Chandkia24

Copy link
Copy Markdown

Deploy Blocker #107283 was identified to be related to this PR.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.5.41-2 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@melvin-bot

melvin-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown

🤖 Payment issue created: #107325

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.