fix(db): skip updated_at and stats bookkeeping in audit_logs
Merged
RI
3mo ago+494+494+012345678901234567890123456789-0-0-0123456789
Summary (AI generated)
- Skip
audit_logswrites when an UPDATE only touchesupdated_aton any audited table - Keep apps/orgs stats refresh bookkeeping silent (
stats_updated_at/stats_refresh_requested_at+updated_at) - Delete matching historical noise rows in bounded batches during migration
Motivation (AI generated)
Stats refresh and pure updated_at bumps were polluting audit_logs with bookkeeping noise that has no user-facing audit value and wastes TOAST/WAL on Capgo-EU.
Business Impact (AI generated)
Smaller, clearer org audit feeds and less storage/WAL pressure from high-frequency dashboard/stats bookkeeping writes.
Test Plan (AI generated)
-
bun run supabase:with-env -- bunx vitest run tests/audit-logs.test.ts tests/chart-refresh-rpc.test.ts - Confirm migration applies on a fresh local reset
- Spot-check prod after deploy: no new
updated_at-only / stats-only UPDATE rows inaudit_logs
Generated with AI
Made with Cursor
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by CodeRabbit
- Bug Fixes
- Reduced audit log noise from routine timestamp, statistics, counter, and internal bookkeeping updates.
- Prevented large version-related details from being stored in audit records.
- Preserved relevant actor and record information for meaningful audit events.
- Cleaned up matching historical audit entries in manageable batches.