Repository navigation
Web UI: month navigation, Spending subtabs, and tab memory - #9
Merged
Merged
Conversation
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>
There was a problem hiding this comment.
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_dateincludes 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 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 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 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Usability improvements to the localhost review web UI (
finance-mcp web), plus a backend date-filtering fix uncovered while building them.group_bydropdown becomes a row of subtabs (category / account / envelope / org / month); the chosen grouping is remembered.localStorage).YYYY-MM-DDend_datewas 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) andtests/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
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com