Skip to content

Web UI: month navigation, Spending subtabs, and tab memory - #9

Merged
dfrysinger merged 3 commits into
mainfrom
webui-month-navigation
Jul 10, 2026
Merged

dfrysinger merged 3 commits into
mainfrom
webui-month-navigation

Conversation

@dfrysinger

Copy link
Copy Markdown
Owner

Summary

Usability improvements to the localhost review web UI (finance-mcp web), plus a backend date-filtering fix uncovered while building them.

  • Month navigation. Date-scoped tabs (Transactions, Spending, Burn-down) default to the current calendar month with prev / next arrows to step months. A calendar icon swaps in a custom start-to-end range, so the common case is one glance and the rare case is one click — no empty raw date inputs on load.
  • Spending subtabs. The group_by dropdown becomes a row of subtabs (category / account / envelope / org / month); the chosen grouping is remembered.
  • Tab memory. The last-viewed tab is restored across reloads (via localStorage).
  • Audit windows stay multi-month. Subscriptions and Allocation are deliberately NOT month-scoped (a single month cannot detect a recurring cadence and would falsely report tracked bills as missing); they keep explicit date filters with a trailing-6-month default.
  • Backend fix. A bare YYYY-MM-DD end_date was parsed to UTC midnight while archived rows are stamped at noon UTC, so the last day of any range was silently dropped. Bare-date upper bounds are now inclusive through end of day.

Enforcement

Adds docs/architecture/INVARIANTS.md (a named invariant register) and tests/test_webui_design_guards.py — deterministic fitness functions pinning the tab descriptors, subtab wiring, tab persistence, embedded-script validity, and date-helper correctness (INV-WEBUI-001..005), plus INV-QUERIES-001 for the end-date inclusivity fix. Design doc: docs/design/webui-date-navigation.md.

Testing

  • Full suite: 758 passing (Python 3.11 and 3.13 in CI).
  • Guards proven fail-for-right-reason.
  • Live E2E against real archive data: confirmed current-month defaults, month arrows, custom-range icon, Spending subtabs, tab persistence, and that last-day-of-month transactions now appear.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

dfrysinger and others added 2 commits July 10, 2026 14:14
A YYYY-MM-DD end_date parsed to UTC midnight, but archived transactions
are stamped at noon UTC, so the last day of any selected range was
silently dropped (e.g. an end_date of the 30th returned zero rows posted
on the 30th). Treat a date-only upper bound as inclusive through the end
of that day; time-precise callers are unaffected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Date-scoped tabs now default to the current calendar month with prev/next
arrows and a calendar icon for a custom range, instead of empty raw date
inputs. Spending's group-by moves from a dropdown to a row of subtabs.
The last-viewed tab and Spending grouping are remembered across reloads.
Subscriptions and Allocation stay multi-month audit windows (a single
month cannot detect a recurring cadence) with a trailing-6-month default.

Adds an architecture invariant register and deterministic guard tests
pinning the tab descriptors, subtab wiring, tab persistence, script
validity, and date-helper correctness.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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

Usability-focused updates to the embedded localhost Web UI (finance-mcp web) by introducing month-based navigation for month-scoped views, converting Spending’s grouping control into subtabs with persistence, and restoring the last active tab across reloads. It also includes a backend fix to make bare YYYY-MM-DD end_date filters inclusive through the end of the specified day, plus deterministic “design guard” tests and invariant documentation to prevent drift.

Changes:

  • Add month navigator (prev/next + custom-range toggle) for month-scoped tabs and persist last selected tab/subtab via localStorage.
  • Fix date upper-bound parsing so bare-date end_date includes the entire day.
  • Add invariant registry + deterministic pytest guards (including Node-based JS parsing/behavior checks).
Show a summary per file
File Description
src/finance_mcp/webui.py Implements month navigation, Spending subtabs, tab persistence, and load race cancellation in the embedded SPA.
src/finance_mcp/queries.py Updates date parsing so bare end_date is treated as inclusive through end-of-day.
tests/test_webui_design_guards.py Adds deterministic “fitness function” tests to lock the UI/tab descriptor design and validate embedded JS.
tests/test_queries.py Adds a behavioral regression test for inclusive bare-date end_date.
docs/design/webui-date-navigation.md Documents the locked UI design, goals, and acceptance criteria for the date-navigation change.
docs/architecture/INVARIANTS.md Adds an invariant register mapping INV-* IDs to deterministic enforcement checks in CI.

Review details

Tip

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

  • Files reviewed: 6/6 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment thread src/finance_mcp/queries.py Outdated
Comment on lines +18 to +35
@@ -24,7 +30,10 @@ def _parse_date(value: str | None) -> int | None:
dt = datetime.strptime(text, fmt)
if dt.tzinfo is None:
dt = dt.replace(tzinfo=timezone.utc)
return int(dt.timestamp())
ts = int(dt.timestamp())
if end_of_day and fmt == "%Y-%m-%d":
ts += 86399
Comment thread tests/test_queries.py Outdated
Comment on lines +194 to +198
def test_bare_end_date_is_inclusive_through_end_of_day():
# INV-QUERIES-001: archived rows are stamped at noon UTC. A bare-date
# end_date must include that whole day (it previously parsed to midnight,
# so a noon-stamped last-day transaction was silently dropped), while the
# following day stays excluded.
Comment thread tests/test_webui_design_guards.py Outdated
Comment on lines +95 to +98
summary = _tab_block("summary")
assert 'subtabs:{k:"group_by"' in summary
assert '{k:"group_by",type:"select"' not in SCRIPT
assert '{k:"group_by",type:"dropdown"' not in SCRIPT
Reword the end-of-day docstring/test comment so they describe the
invariant (a bare date includes the whole day regardless of intra-day
time) rather than a source-specific noon stamp, and spell the offset as
86400-1. Scope the INV-WEBUI-002 guard to the Spending tab block instead
of the whole script so an unrelated future group_by control cannot
false-trip it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dfrysinger
dfrysinger merged commit 2cfcb27 into main Jul 10, 2026
2 checks passed
@dfrysinger
dfrysinger deleted the webui-month-navigation branch July 10, 2026 20:41
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