Skip to content

Add correlation IDs to vote processing pipeline#7

Merged
pscheid92 merged 4 commits intomainfrom
add-correlation-ids
Feb 22, 2026
Merged

Add correlation IDs to vote processing pipeline#7
pscheid92 merged 4 commits intomainfrom
add-correlation-ids

Conversation

@pscheid92
Copy link
Owner

@pscheid92 pscheid92 commented Feb 22, 2026

Summary

  • Adds a correlation package (internal/platform/correlation/) with context helpers, ID generation (8-char hex), and a custom slog.Handler wrapper that auto-injects correlation_id into log entries
  • Generates a unique correlation ID at the start of each webhook notification and each ticker refresh iteration
  • Converts all slog.Info/Warn/Error/Debug calls in the vote pipeline to their Context variants so the correlation ID flows through webhook → ProcessMessageRecordVotePublishSentiment

Test plan

  • New unit tests for the correlation package (ID generation, context roundtrip, handler injection)
  • All existing unit tests pass (make test-short)
  • Linter passes (make lint)
  • Run locally with LOG_LEVEL=debug, trigger a vote, verify correlation_id=XXXXXXXX appears consistently across all log lines for that request
  • Full integration test suite (make test)

🤖 Generated with Claude Code

Introduce a correlation package with a custom slog.Handler that
automatically injects correlation_id from context into log entries.
Each webhook notification and ticker refresh gets a unique 8-char
hex ID, enabling end-to-end tracing across webhook receipt, vote
processing, and WebSocket publish.
Verify that webhook handler injects a correlation ID into the context
passed to ProcessMessage. Also allow unpkg.com in connect-src CSP
directive to unblock Centrifuge JS source map fetches.
Without this, the default slog handler ignores context values and
correlation_id never appears in test log output.
The conduit and all its subscriptions were deleted on every graceful
shutdown, requiring users to re-login via OAuth to restore them.
Keeping the conduit alive across restarts lets findOrCreateConduit
reuse it and configureShard update the webhook URL, so existing
subscriptions survive container restarts.
@pscheid92 pscheid92 merged commit 1aef8b1 into main Feb 22, 2026
1 check passed
@pscheid92 pscheid92 deleted the add-correlation-ids branch February 22, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant