Files
finanzen/backlog/tasks/task-1 - Add-complete-chat-transaction-context.md

3.3 KiB

id, title, status, assignee, created_date, updated_date, labels, dependencies, priority, ordinal
id title status assignee created_date updated_date labels dependencies priority ordinal
TASK-1 Add complete chat transaction context Done
2026-06-15 13:52 2026-06-15 19:54
high 1000

Description

Make the savings chat evaluate every transaction matching the selected date range, account, and basis instead of silently sampling 150/300 rows. This includes exact context totals, a full prompt context for the AI action, and regression coverage for large transaction windows.

Acceptance Criteria

  • #1 Chat context totals count all matching transactions in the selected range, including more than 400 rows
  • #2 Account filtering is applied before counting and summing transactions
  • #3 The chat action no longer accepts or passes maxTransactions and reports the complete transaction count
  • #4 The frontend no longer passes maxTransactions and continues to show exact totals
  • #5 Regression tests, lint, and build verification pass or documented blockers are reported

Implementation Plan

  1. Add Convex test dependencies and Vitest edge-runtime config
  2. Write failing convex-test regression for 450 chat transactions and account filtering
  3. Refactor savingsChat backend to remove maxTransactions and use indexed full scans
  4. Update schema indexes for account+basis filters
  5. Remove frontend maxTransactions arguments
  6. Run focused test, lint, and build verification
  7. Record verification notes and leave task In Progress pending user confirmation

Implementation Notes

RED verified: npx vitest convex/savingsChat.test.ts --run fails because getContext does not return isComplete and still uses limited context shape.

Verification:

  • PASS npx vitest convex/savingsChat.test.ts --run
  • PASS npm run build
  • PASS npx eslint convex/savingsChat.ts convex/savingsChat.test.ts src/pages/SavingsChatPage.tsx vitest.config.ts
  • BLOCKED npm run lint still fails on pre-existing/unrelated files: convex/bank/comdirectProvider.ts, convex/bank/config.ts, src/components/import/TanAwaitDialog.tsx, layout/UI fast-refresh exports, SettingsPage.tsx, and related existing warnings. SavingsChatPage is no longer in the lint output.

Review fix:

  • Added effective-basis fallback for legacy transactions without effectiveMonth by reading bookingDate range and including only rows where effectiveMonth is undefined.
  • Added prompt-context regression coverage via internal.savingsChat.getPromptContext.
  • PASS npx vitest convex/savingsChat.test.ts --run (2 tests)
  • PASS npm run build
  • PASS npx eslint convex/savingsChat.ts convex/savingsChat.test.ts src/pages/SavingsChatPage.tsx vitest.config.ts

Final review:

  • Subagent re-review found no remaining correctness/spec issues.
  • Prior blocker resolved: effective-basis loading now includes rows without effectiveMonth via bookingDate fallback queries.
  • Fresh full npm run lint still fails only on unrelated existing files; no SavingsChatPage issue remains.

Final Summary

Closed as Done after explicit user confirmation to mark all tasks done.