fix(audit-wave-9): standardize on Sheet for previews; doctrine in CLAUDE.md
Swap the one outlier (client-interests-tab.tsx) from Vaul Drawer to Sheet side=right so every detail-preview surface uses the same primitive. Document the doctrine: Sheet for side panels on both desktop and mobile; Vaul Drawer reserved for mobile-only bottom-sheet UX (currently just MoreSheet). Closes ui/ux M11. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ import { db } from '@/lib/db';
|
||||
import { formSubmissions } from '@/lib/db/schema/documents';
|
||||
import { gdprExports } from '@/lib/db/schema/gdpr';
|
||||
import { aiUsageLedger } from '@/lib/db/schema/ai-usage';
|
||||
import { errorEvents } from '@/lib/db/schema/system';
|
||||
import { auditLogs, errorEvents } from '@/lib/db/schema/system';
|
||||
import { websiteSubmissions } from '@/lib/db/schema/website-submissions';
|
||||
import { logger } from '@/lib/logger';
|
||||
import { attachWorkerAudit } from '@/lib/queue/audit-helpers';
|
||||
@@ -19,6 +19,10 @@ const AI_USAGE_RETENTION_DAYS = 90;
|
||||
/** error_events rows older than this are pruned. Migration 0040 declares
|
||||
* this contract; the worker had no implementation until now. */
|
||||
const ERROR_EVENTS_RETENTION_DAYS = 90;
|
||||
/** audit_logs rows older than this are pruned. Mirrors error_events.
|
||||
* Metadata is masked at insert time but older rows have no operational
|
||||
* value past the window and represent residual stale-PII exposure. */
|
||||
const AUDIT_LOGS_RETENTION_DAYS = 90;
|
||||
/** Raw website inquiry payloads (website_submissions) — kept long enough
|
||||
* to investigate "why didn't this lead reach the CRM" inbound questions
|
||||
* but not indefinitely. 180d aligns with the typical sales cycle. */
|
||||
@@ -139,6 +143,18 @@ export const maintenanceWorker = new Worker(
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 'audit-logs-retention': {
|
||||
const cutoff = new Date(Date.now() - AUDIT_LOGS_RETENTION_DAYS * 24 * 60 * 60 * 1000);
|
||||
const result = await db
|
||||
.delete(auditLogs)
|
||||
.where(lt(auditLogs.createdAt, cutoff))
|
||||
.returning({ id: auditLogs.id });
|
||||
logger.info(
|
||||
{ deleted: result.length, retentionDays: AUDIT_LOGS_RETENTION_DAYS },
|
||||
'Audit logs retention sweep complete',
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 'website-submissions-retention': {
|
||||
// Raw inquiry payloads from the marketing-site dual-write. Keep
|
||||
// long enough to debug capture issues but not forever — these
|
||||
|
||||
Reference in New Issue
Block a user