Skip to content

UI revamp Phase 3: Home backend (Lumen found, activity, budgets with approvable drafts) - #94

Merged
coderconnoisseur merged 14 commits into
ui-revamp/phase2-homefrom
ui-revamp/phase3-home-backend
Oct 21, 2026
Merged

coderconnoisseur merged 14 commits into
ui-revamp/phase2-homefrom
ui-revamp/phase3-home-backend

Conversation

@coderconnoisseur

Copy link
Copy Markdown
Owner

UI revamp Phase 3: the backend behind Home. Stacked on #92 → #91 → #89. Merge them in that order and retarget each PR to refactor as its parent lands.
Spec: docs/superpowers/specs/2026-10-20-ui-revamp-design.md §4, §8. Plan: docs/superpowers/plans/2026-10-21-ui-revamp-phase3-home-backend.md.

Backend

  • GET /api/home/summary (api/home.py over the pure ai/home_signals.py, no LLM):
    • Lumen found:
      • Possible double charges, the only items with a "you may get back" amount. A vendor you pay most days (3+ charges in 30 days) is a habit, not a duplicate.
      • Receipts to review.
      • Category spikes: ≥30% up on the same day last month and at least ₹1,000 / 5% of last month. Spending only, so refunds can't fake one.
      • Subscription price rises (≥5%, from ai.recurring).
    • Activity:
      • Statement imports, grouped into one line per import.
      • Receipts read.
      • Your approve/reject decisions.
    • Text carries {0} placeholders plus numeric amounts, so every amount shows in the user's currency.
  • Budgets:
    • The new budgets table holds per-category limits. The overall budget is still the profile's monthly_budget.
    • GET/PUT /api/budget.
    • POST /api/budget/draft runs a deterministic draft (mean of the last 3 complete months that had spend, rounded up; needs 2+ months) and files one set_budget proposal per category. Approving it through /api/agent/proposals/{id}/approve upserts the limit, and only a finite positive limit is ever applied. A new draft retires pending ones.
    • Ask Lumen gets a draft_budget tool that files the same approvable proposals.
  • GET /api/review?count=1 returns just the number, for the sidebar badge.

Frontend

  • Lumen found: up to 3 tiles from the summary, with "N things worth a look · ₹X you may get back".
  • Brief: adds "The one thing worth a look: …".
  • Budget card: progress against the monthly budget (left, days, per-day, or "over"), plus category rows.
  • "Draft budget": opens a dialog to approve lines one by one or all at once. It is guarded against double clicks.
  • Activity: comes from the server.
  • Fixes from the backlog: the calendar uses the user's currency symbol, and a refund-heavy month can't flip the brief.
  • Sidebar badge: uses the count endpoint.

Checks

  • Backend: pytest -q gives 950 passed, 15 skipped. That includes 47 new tests:
    • draft rounding and history rules
    • per-user isolation
    • a double approve returning 409 with one row
    • re-drafts retiring stale proposals
    • bad agent payloads returning 422
    • refunds and habits not producing signals
    • UTC Z timestamps
  • Frontend: npm run test:e2e gives 82/82. tsc, lint and build are clean, and /home is static at 17.5 kB of route JS.

Review (whole branch, Opus)

  • Fixed with tests:
    • An agent-filed set_budget with a bad limit could break /api/budget.
    • Drafts built from 2 months of history divided by 3.
    • Refunds faked spikes.
    • A daily coffee showed up as "double charges".
    • The draft dialog double-submitted.
  • Deferred minors are in spec §12:
    • an approval race without a conditional update
    • drafts retiring each other across Home and Ask
    • Activity not refreshing after approvals
    • full-scan cost per visit
    • per-line button names
  • Owner request, logged in §12: make Lumen found and budget drafts smarter about one-off big purchases (median or trimmed mean, planned purchases), measured against an eval set.

Manual check

  • On a demo account: Draft budget → approve all → the Budget card shows the category rows; Lumen found makes sense against the data.

@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lumen Ready Ready Preview Oct 21, 2026 5:32pm UTC

@coderconnoisseur
coderconnoisseur merged commit a10181a into ui-revamp/phase2-home Oct 21, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 0871a785 Deployed Oct 21, 2026 by vercel[bot]
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.

1 participant