--- id: TASK-8 title: Fix savings tool category matching status: In Progress assignee: [] created_date: '2026-06-15 20:10' updated_date: '2026-06-15 20:19' labels: [] dependencies: [] priority: high ordinal: 8000 --- ## Description Make Talk to Savings read-only tools resolve user/model category names like Supermärkte or Lebensmittel und Supermarkt to existing categories such as Lebensmittel & Supermarkt, and surface diagnostics instead of misleading silent zero results. ## Acceptance Criteria - [x] #1 Category filter aliases resolve ampersand/und, casing, punctuation, umlauts, and simple German plural/flexion variants - [x] #2 All savings tools that accept categoryNames use shared resolution diagnostics - [x] #3 Unknown or ambiguous category filters return diagnostics and compact trace summaries instead of silently confident zero results - [x] #4 Regression tests cover Lebensmittel und Supermarkt, Supermärkte, unknown diagnostics, and trace summaries ## Implementation Plan 1. Add failing Convex regression tests for tolerant categoryNames and diagnostics 2. Implement shared category-name normalization and resolver in convex/savingsChat.ts 3. Thread diagnostics through every categoryNames-aware tool output and compact traces 4. Update tool/prompt guidance to avoid confident zero answers on unresolved filters 5. Run focused Vitest, targeted ESLint, and production build ## Implementation Notes Implemented shared tolerant category resolver for savings tools and added diagnostics to categoryNames-aware outputs. Verification passed: npx vitest convex/savingsChat.test.ts --run (20 tests), npx eslint convex/savingsChat.ts convex/savingsChat.test.ts, npm run build (with existing Vite chunk-size warning). Added an additional regression test to preserve the virtual Ohne Kategorie filter while moving categoryNames to resolver-based category IDs. Re-ran focused Vitest, targeted ESLint, and build successfully after this adjustment. Addressed QA review findings: added ASCII transliteration coverage for Supermaerkte, explicit ambiguous category filter coverage, and multi-diagnostic compact trace summaries. Final verification passed: npx vitest convex/savingsChat.test.ts --run (22 tests), npx eslint convex/savingsChat.ts convex/savingsChat.test.ts, npm run build (with existing Vite chunk-size warning).