- Change idx_financing_plans_active to partial index (WHERE active = true)
to avoid useless B-tree index on low-cardinality boolean column
- Scope timingMiddleware to /api routes only (was globally registered,
which caused noise from static asset requests)
- Add unit tests for timing middleware (5 tests covering: next() call,
timing log format, SLOW warning threshold, fast-request path, status code)
Nightshift-Task: perf-regression
Nightshift-Ref: https://github.com/marcus/nightshift
This migration was part of the financing start_date feature (119d53c) but
was not staged by the previous agent.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Data model:
- Migration 003: financing_plans and financing_payments tables
- Plans track total amount, due date, paycheck assignment (1, 2, or split)
- Payments linked to paycheck records, one per period
Payment calculation:
- Auto-calculated: (total - paid_so_far) / remaining_periods
- Split plans halve the per-period amount across both paychecks
- Recalculates each period as payments are made
Financing page (/financing):
- Create/edit/delete plans with name, amount, due date, paycheck assignment
- Progress bar showing paid vs total
- Overdue badge when past due with remaining balance
- Paid-off plans moved to a separate section
Paycheck view:
- New Financing section per column with payment checkbox
- Overdue badge on individual payments
- Running paid/total shown in bill meta
- Financing payments included in remaining balance calculation
- Auto-closes plan and reloads when fully paid off
- Lazy generation works: first interaction generates paycheck and payment records
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Migration 002: variable_amount boolean column on bills (default false)
- Bills form: 'Variable amount' checkbox; amount field becomes optional
'Typical amount' when checked; table shows 'varies (~$X)' and a 〜 badge
- Paycheck view: variable bills show a pencil edit button to enter the
month's actual amount, stored as amount_override on paycheck_bills
- New PATCH /api/paycheck-bills/:id/amount endpoint
- Lazy generation still works: setting an amount on a virtual paycheck
generates it first then saves the override
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All tables per PRD data model with default config seeds.
Migration runner tracks applied migrations in DB.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sets up the full monorepo structure with:
- Multi-stage Dockerfile (client-build + production stages)
- docker-compose.yml for production, docker-compose.dev.yml overlay for development
- Express server (port 3000) with pg pool, health route, and SPA static file serving
- React 18 + Vite client with react-router-dom v6, nav bar, and placeholder page components
- .env.example with PostgreSQL and app config
- Empty db/migrations/ directory for future migrations
- CLAUDE.md updated with development workflow commands
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>