fix: dedup fund_capture alerts for same-date sibling records and add clear-all

fund_capture alerts for a symbol with multiple capture records sharing one
as_of re-fired every batch cycle: the single comparison-state slot
ping-ponged between sibling evidence URLs, and the pre-check dedup key
never matched the stored buildDedupKey format. Track a seen-set of URLs in
comparison state and align dedup-key construction with buildDedupKey.
Also add alerts.clearAll (hard delete) with an immediate-refresh bell.
This commit is contained in:
Investor Flow Build
2026-08-12 22:39:19 -04:00
parent e5a7ff9f33
commit 0bc7b636e5
6 changed files with 185 additions and 21 deletions
+8
View File
@@ -2085,6 +2085,14 @@ const alertsRouter = router({
return { ok: true };
}),
/** Permanently delete all alert events for the current user. */
clearAll: protectedProcedure
.mutation(async ({ ctx }) => {
const userId = ctx.userId as string;
ctx.db.prepare('DELETE FROM alert_events WHERE user_id = ?').run(userId);
return { ok: true };
}),
/** Get unacknowledged alert count. */
unackedCount: protectedProcedure
.query(async ({ ctx }) => {