Skip to content

Web UI: year navigator for Spending's by-month grouping - #10

Merged
dfrysinger merged 1 commit into
mainfrom
spending-year-navigator
Jul 10, 2026
Merged

dfrysinger merged 1 commit into
mainfrom
spending-year-navigator

Conversation

@dfrysinger

@dfrysinger dfrysinger commented Jul 10, 2026 •

Copy link
Copy Markdown
Owner

What

When the Spending tab's active subtab groups by month, a single-month date window makes the grouping meaningless (you'd see one row). This switches the navigator to year granularity in that mode: < YYYY > steps by year and scopes the query to whole-calendar-year bounds (YYYY-01-01..YYYY-12-31), so the by-month view shows every month of the selected year. All other subtabs keep month granularity. The custom-range calendar picker is unchanged (seeds from the current year when entered in year mode).

How

  • The summary tab's subtabs descriptor gains yearNav:"month" (the subtab value that triggers year mode).
  • New pure helper yearBounds(y).
  • renderMonthNav computes yearMode and, when active, resolves whole-year bounds and renders year-stepping arrows.
  • renderSubtabs rebuilds the filter row when a yearNav tab's subtab changes, so the navigator re-renders at the correct granularity.

Enforcement

Adds INV-WEBUI-006 to the architecture invariant register with three deterministic guards in tests/test_webui_design_guards.py: a structural check (yearNav:"month" declared), a unit check (yearBounds), and an integration guard that drives the real renderMonthNav against a DOM stub — asserting both the resolved year bounds and that the arrows actually step by year. Design doc updated.

Verification

  • Full suite: 761 passed.
  • Live E2E: confirmed the Spending -> Month subtab renders the year navigator with all months of the year grouped in the table.

Copilot AI 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.

Pull request overview

Adjusts the web UI date navigator so Spending’s group_by=month view uses year-sized windows (and year-stepping arrows) to make month grouping meaningful across the full calendar year, and adds deterministic invariant guards to prevent regressions.

Changes:

  • Add yearNav:"month" to the Spending (summary) tab descriptor to enable year-mode when the month subtab is active.
  • Introduce yearBounds(y) and update renderMonthNav to resolve whole-year bounds and step the navigator by year when in year-mode.
  • Register/enforce INV-WEBUI-006 via docs updates and new/expanded deterministic tests (structural + Node-driven behavioral/integration).
Show a summary per file
File Description
tests/test_webui_design_guards.py Adds INV-WEBUI-006 guards, including a Node integration harness for renderMonthNav year-mode behavior.
src/finance_mcp/webui.py Implements year-mode navigation (helper + wiring) and adds yearNav to the Spending tab config.
docs/design/webui-date-navigation.md Updates design doc to describe year-mode behavior for Spending’s month grouping and references INV-WEBUI-006.
docs/architecture/INVARIANTS.md Registers INV-WEBUI-006 in the invariant table.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment thread src/finance_mcp/webui.py Outdated
Comment on lines +841 to +843
// When a subtab toggles the navigator's granularity (month vs year),
// rebuild the filter row so the navigator re-renders in the right mode.
if (t.subtabs.yearNav) { buildFilters(); load(); return; }

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Good catch — this was a real regression. Fixed: the filter row now rebuilds only when a subtab change crosses the month↔year granularity boundary, and manual filter values (e.g. exclude_income) are captured and re-applied across that rebuild. Non-crossing subtab changes take the fast path and leave manual inputs untouched. Verified across all transitions.

Comment thread docs/architecture/INVARIANTS.md Resolved
When the Spending tab's active subtab groups by month, a single-month
window makes the grouping meaningless. Switch the navigator to year
granularity in that mode: ‹ YYYY › steps by year and scopes the query to
whole-calendar-year bounds (YYYY-01-01..YYYY-12-31), so the by-month view
shows every month of the selected year. Other subtabs keep month
granularity. The custom-range calendar picker is unchanged and seeds from
the current year when entered in year mode.

Adds INV-WEBUI-006 (register + structural and behavioral guards) and
documents the behavior in the date-navigation design doc.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dfrysinger
dfrysinger force-pushed the spending-year-navigator branch from ac70e9d to b909af0 Compare July 10, 2026 21:15
@dfrysinger
dfrysinger merged commit 46c7372 into main Jul 10, 2026
2 checks passed
@dfrysinger
dfrysinger deleted the spending-year-navigator branch July 10, 2026 21:16
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.

2 participants