Problem
Bulk categorization is synchronous with all state in browser / in-process memory (calibrate → preview → bulkUpdateCategories). Long AI calls block the user, are lost on reload/timeout, and hold state only in memory.
Decisions
- Trigger: Manual only — admin clicks "Categorize all" to enqueue job. No cron/auto.
- Naive pre-pass: Suggest only, no auto-apply.
- Completion: Notification → dedicated review/merge UI.
- Sync path: Removed entirely. No fallback wizard; all bulk work via persisted background job.
Proposal
1. Quicker calibration
- Run existing naive
suggestCategoryFromTitle (dictionary + naive search on samples) before AI to pre-fill obvious suggestions instantly in calibration.
- Use smaller AI batches with fewer samples per round for faster feedback / fewer tokens. Naive suggestions are
suggest-only — user still confirms.
2. Async bulk categorization
- Replace in-process flow with pg-boss background job. Enqueued manually per group, processes eligible
general expenses in batches with server-persisted state (retriable, survives reload).
- Job never auto-writes. On completion it notifies user and exposes result for review.
UX (high-level)
- Admin opens Bulk Categorize → sees naive suggestions instantly on sample, calibrates few rows if needed.
- Clicks "Categorize all" → job enqueued, wizard closes. Group shows "Categorization running in background" state.
- On completion: in-app (+ email per preferences) notification → links to dedicated review page (list: current vs suggested, edit/exclude per row, bulk accept) → explicit Confirm to call
bulkUpdateCategories.
Out of scope
Job schema, batch sizing, retry/backoff, concurrency limits — to be decided in implementation.
Acceptance
Problem
Bulk categorization is synchronous with all state in browser / in-process memory (
calibrate→preview→bulkUpdateCategories). Long AI calls block the user, are lost on reload/timeout, and hold state only in memory.Decisions
Proposal
1. Quicker calibration
suggestCategoryFromTitle(dictionary + naive search on samples) before AI to pre-fill obvious suggestions instantly in calibration.suggest-only— user still confirms.2. Async bulk categorization
generalexpenses in batches with server-persisted state (retriable, survives reload).UX (high-level)
bulkUpdateCategories.Out of scope
Job schema, batch sizing, retry/backoff, concurrency limits — to be decided in implementation.
Acceptance