jedarden
ddd84f53e1
feat(cdc): implement webhook sink batching, retries, and cursor persistence (P5.13.a, miroir-uhj.13.1)
Implements plan §13.13 webhook sink with:
- Time-based batch flushing (batch_flush_ms timer) in addition to size-based (batch_size)
- Exponential backoff retries with jitter, capped by retry_max_s (default 3600s)
- Per-sink cursor persistence on successful ACK only (at-least-once delivery)
- Document body inclusion controlled by include_body sink config
Key changes:
- Added duration_jitter() helper for randomized backoff (±25%)
- Modified background_publisher to use tokio::select! for event + timer handling
- Implemented retry loop in flush_webhook with:
- Initial delay: 100ms
- Exponential multiplier: 2x (max 60s)
- Retries on 5xx, 429, and network errors
- No retry on 4xx client errors (except 429)
- Cursor advances only on 2xx response via internal_queue.persist_cursor()
Closes: miroir-uhj.13.1
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>