Skip to content

[No QA] Add Day to the Insights Spend over time group-by options - #102636

Merged
luacmartins merged 1 commit into
mainfrom
claude-addDayGroupByToInsights
Oct 2, 2026
Merged

luacmartins merged 1 commit into
mainfrom
claude-addDayGroupByToInsights

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Adds Day to the Group by options on the Insights "Spend over time" graph.

Insights keeps its own list of allowed group-by values in INSIGHTS_GROUP_BY_OPTIONS. The earlier daily grouping work added Day to Search, but not to this list. Because the dropdown builds its menu from this list, and URL parsing drops any groupBy value that is not in it, Day never showed up in Insights.

This PR:

  • Adds CONST.SEARCH.GROUP_BY.DAY to the start of INSIGHTS_GROUP_BY_OPTIONS, so the menu reads Day, Week, Month, Quarter, Year.
  • Adds DAY to the InsightsFilters['groupBy'] type.
  • Adds unit tests: groupBy:day round-trips through buildInsightsQueryString and parseInsightsFilters, and the headline chart is grouped by day while supporting charts keep their own group-by.

The default stays Month. Translations, chart config, and SearchUIUtils already handle Day, so no other App changes are needed.

Backend dependency: the backend GetInsights command does not support groupBy:day for this graph yet, and returns 400 Invalid groupBy for insights. A companion internal issue tracks that change. Do not merge this PR until the backend change is deployed.

Fixed Issues

$ #102571
PROPOSAL: #102571 (comment)

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  • Verify that no errors appear in the JS console

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 followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and 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 followed the guidelines as stated in the Review Guidelines
  • 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 a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • 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

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

AI Tests

Melvin ran these locally. All passed:

  • npm test on the Insights-related suites (8 suites, 644 tests): insightsFilterParsingTest, insightsQueriesTest, resolveInsightsChartDataTest, resolveDashboardStateTest, useInsightsFilters.test, useInsightDataTest, SearchUIUtilsTest, InsightsControlsTest
  • npm run typecheck
  • npm run lint on changed files
  • npm run fmt (oxfmt) on changed files, with no diff
  • npm run spell-changed

Not run: the full npm test suite and the Storybook smoke test. CI covers them.

A browser check was attempted, but the tester opened the Search "Group by" menu instead of the Insights one, so it does not confirm this change.

Co-authored-by: daledah <daledah@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team September 30, 2026 09:01
@melvin-bot melvin-bot Bot added Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web labels Sep 30, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I created this PR from an upstream branch since I don't have push access to your fork.

To take ownership of this branch and be able to push updates, run:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-addDayGroupByToInsights
git checkout -b claude-addDayGroupByToInsights upstream/claude-addDayGroupByToInsights
git push -u origin claude-addDayGroupByToInsights

Then you can close this PR and open a new one from your fork.

@MelvinBot

MelvinBot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ⚠️ partial

Day now appears in the Insights Group by menu in the right order, and Week and Month still work. Selecting Day and applying it shows a full-page error, which matches the pending backend change; because the PR's Tests section is still a TODO, I tested the linked issue's acceptance criteria.
Spend over time chart grouped by Month

Step Status
Group by menu for Spend over time lists Day, Week, Month, Quarter, Year in that orderThe menu order was exactly Day, Week, Month, Quarter, Year. Month was selected as the default.
Group by dropdown open showing Day, Week, Month, Quarter, Year
✅
Selecting Day and tapping Apply shows daily totals on the graphThe whole Insights dashboard was replaced by "Oops... Something went wrong / Your request could not be completed." This matches the backend rejecting groupBy:day. "Try again" sent the same request and failed again. The error screen also hides the Group by control, so there is no in-page way to switch back. I had to use Troubleshoot → Clear cache and restart to recover.
Full-page error after selecting Day and applying
❌
Existing options (Week, then Month) still workWeek updated the chart (x-axis "Sep 27 - 30, '26", header "Group by: Week"). Month updated the chart (x-axis "Sep '26", header "Group by: Month").
Spend over time chart grouped by Week
Spend over time chart grouped by Month
✅

view run · view recording

@MelvinBot

MelvinBot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ❌ fail

The Insights Group by menu lists Day first, but selecting Day breaks the Spend over time chart because the backend rejects groupBy:day (GetInsights returns jsonCode 400). After that, the Group by control disappears, so there is no way to switch back to Week or Month without reloading.
Insights still in error with no Group by control

Step Status
Group by menu for Spend over time lists Day, Week, Month, Quarter, Year in that orderThe menu order was exactly Day, Week, Month, Quarter, Year. Month was selected as the default.
Group by dropdown open showing Day, Week, Month, Quarter, Year
✅
Selecting Day and clicking Apply shows daily totals on the graphThe Spend over time card was replaced by "Oops... Something went wrong / Your request could not be completed." The GetInsights request returned HTTP 200 with jsonCode 400, so the backend rejected groupBy:day. This matches the pending backend change.
Insights error after selecting Day
❌
Existing options (Week, then Month) still workNot reachable. After the Day error, the Group by control disappears from the page. The error stayed after "Try again", after leaving and returning to Insights, and after changing the date range to "This month". The Day selection appears to persist, so only a reload or cache clear would recover. On Android, Week and Month worked after a cache clear.
Insights still in error with no Group by control
❌

view run · view recording

@daledah

daledah commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot please unhold this PR since Backend is in prod and open this PR

@MelvinBot MelvinBot changed the title [HOLD Backend] Add Day to the Insights Spend over time group-by options Add Day to the Insights Spend over time group-by options Oct 2, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I removed [HOLD Backend] from the PR title.

I couldn't mark the PR ready for review because that action was blocked in my run. daledah, please click Ready for review at the bottom of the PR.

Before you ask for review, fill out the Tests and QA Steps sections. They are still TODO placeholders. The PR body's backend dependency note also still says not to merge. You can remove it now that the backend change is in production.


view run

@daledah

daledah commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and 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 verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • 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).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

iOS: HybridApp
ios-mweb.mov
iOS: mWeb Safari
ios.mov
MacOS: Chrome / Safari
web.mov

@cristipaval
cristipaval marked this pull request as ready for review October 2, 2026 07:34
@cristipaval
cristipaval requested a review from a team as a code owner October 2, 2026 07:34
@melvin-bot
melvin-bot Bot requested review from daledah and removed request for a team October 2, 2026 07:34
@melvin-bot

melvin-bot Bot commented Oct 2, 2026

Copy link
Copy Markdown

@daledah 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]

@melvin-bot
melvin-bot Bot requested review from garrettmknight and removed request for a team October 2, 2026 07:34
@cristipaval
cristipaval requested review from JmillsExpensify and removed request for garrettmknight October 2, 2026 07:34

@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: 5a62c8bc57

ℹ️ 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".

};

const INSIGHTS_GROUP_BY_OPTIONS = [CONST.SEARCH.GROUP_BY.WEEK, CONST.SEARCH.GROUP_BY.MONTH, CONST.SEARCH.GROUP_BY.QUARTER, CONST.SEARCH.GROUP_BY.YEAR] as const;
const INSIGHTS_GROUP_BY_OPTIONS = [CONST.SEARCH.GROUP_BY.DAY, CONST.SEARCH.GROUP_BY.WEEK, CONST.SEARCH.GROUP_BY.MONTH, CONST.SEARCH.GROUP_BY.QUARTER, CONST.SEARCH.GROUP_BY.YEAR] as const;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Wait to expose daily grouping until GetInsights supports it

Until the server-side GetInsights change is deployed, selecting this new item persists groupBy:day; the Insights query builder forwards that value to GetInsights, which currently returns 400 Invalid groupBy for insights (as noted in this commit). Any online user who chooses Day will therefore see the full-page error instead of the dashboard. Gate this option on backend availability or land it together with the backend support.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The BE PR is now on production, and I've tested it thoroughly. The groupBy:day flow is working correctly.

@daledah daledah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

This comment has been minimized.

@JmillsExpensify JmillsExpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM to me as well.

@cristipaval cristipaval changed the title Add Day to the Insights Spend over time group-by options [No QA] Add Day to the Insights Spend over time group-by options Oct 2, 2026

@luacmartins luacmartins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@luacmartins
luacmartins merged commit 320c782 into main Oct 2, 2026
55 of 65 checks passed
@luacmartins
luacmartins deleted the claude-addDayGroupByToInsights branch October 2, 2026 16:20
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

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

@OSBotify

OSBotify commented Oct 2, 2026

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.

@OSBotify OSBotify mentioned this pull request Oct 4, 2026
59 tasks done
@OSBotify

OSBotify commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

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

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

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed. The Day option only appears in the group-by dropdown on the Insights page, which is behind the INSIGHTS_PAGE beta (InsightsPage.tsx:27). Most users can't see it yet, and no existing article sentence is now incorrect.


view run

@OSBotify

OSBotify commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/Julesssss in version: 9.5.2-4 🚀

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

Bundle Size Analysis (Sentry):

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

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants