Parent: #1936
Problem
checkAndMarkDelivery (the documented webhook-delivery-dedup helper in src/selfhost/redis-cache.ts) is exported but never called anywhere in src/. The real webhook dedup path in src/server.ts implements its own get-then-set inline instead of using it: it directly calls webhookCache!.get(\delivery:${deliveryId}`)/webhookCache!.set(`delivery:${deliveryId}`, "1", 300), duplicating (with a deliberate mark-after-success ordering difference) the exact logic checkAndMarkDelivery` already provides.
checkAndMarkDelivery has zero call sites, so it is unreachable dead code that still ships, still gets maintained/reviewed, and creates two divergent implementations of the same dedup logic that can silently drift out of sync (e.g. a future TTL or key-prefix change applied to one and not the other).
Fix
Either:
- Delete
checkAndMarkDelivery from redis-cache.ts — its logic is superseded by the inline implementation in server.ts, which additionally has the correct mark-only-after-success semantics that checkAndMarkDelivery lacks, OR
- Refactor
server.ts's inline block to call it directly so there is one source of truth for webhook delivery dedup (would require first fixing checkAndMarkDelivery's mark-timing to match the correct mark-after-success behavior).
Option 1 is the smaller, safer change given the inline version is already correct and live.
Verification
Parent: #1936
Problem
checkAndMarkDelivery(the documented webhook-delivery-dedup helper insrc/selfhost/redis-cache.ts) is exported but never called anywhere insrc/. The real webhook dedup path insrc/server.tsimplements its own get-then-set inline instead of using it: it directly callswebhookCache!.get(\delivery:${deliveryId}`)/webhookCache!.set(`delivery:${deliveryId}`, "1", 300), duplicating (with a deliberate mark-after-success ordering difference) the exact logiccheckAndMarkDelivery` already provides.checkAndMarkDeliveryhas zero call sites, so it is unreachable dead code that still ships, still gets maintained/reviewed, and creates two divergent implementations of the same dedup logic that can silently drift out of sync (e.g. a future TTL or key-prefix change applied to one and not the other).Fix
Either:
checkAndMarkDeliveryfromredis-cache.ts— its logic is superseded by the inline implementation inserver.ts, which additionally has the correct mark-only-after-success semantics thatcheckAndMarkDeliverylacks, ORserver.ts's inline block to call it directly so there is one source of truth for webhook delivery dedup (would require first fixingcheckAndMarkDelivery's mark-timing to match the correct mark-after-success behavior).Option 1 is the smaller, safer change given the inline version is already correct and live.
Verification
checkAndMarkDeliverystill has zero call sites against currentsrc/(line numbers may have shifted).