Skip to content

Conversation

@jcscottiii
Copy link
Collaborator

Updates the email worker's sender logic to handle delivery robustly and extends event types to propagate necessary context (ChannelID and Event IDs).

Changes:

  • Event Types: Added ChannelID to EmailJobEvent to ensure the consumer can identify the target channel.
  • Worker Types: Introduced IncomingEmailDeliveryJob to capture the EmailEventID (Pub/Sub message ID) for audit logging. Added sentinel errors (ErrUnrecoverableUserFailureEmailSending, ErrUnrecoverableSystemFailureEmailSending) to distinguish failure modes.
  • Sender Logic: Refactored ProcessMessage to:
    • Use IncomingEmailDeliveryJob for better context.
    • Handle distinct error types: Permanent user errors are recorded and ACKed; transient errors trigger NACKs for retry.
    • Pass EmailEventID and error classification to the ChannelStateManager for precise attempt tracking.
  • Pub/Sub Adapter: Added logging to PublishEmailJob to trace published IDs.

@jcscottiii jcscottiii force-pushed the jcscottiii/email-worker-pt3 branch from b9da33d to f9040df Compare December 29, 2025 21:20
@jcscottiii jcscottiii requested a review from jrobbins January 13, 2026 19:37
@jcscottiii jcscottiii force-pushed the jcscottiii/email-worker-pt2 branch from 404e2d0 to 4cf4293 Compare January 14, 2026 02:16
@jcscottiii jcscottiii force-pushed the jcscottiii/email-worker-pt3 branch from f9040df to 125c271 Compare January 14, 2026 02:16
@jcscottiii jcscottiii force-pushed the jcscottiii/email-worker-pt2 branch from 4cf4293 to 73fcc01 Compare January 14, 2026 16:04
Base automatically changed from jcscottiii/email-worker-pt2 to main January 14, 2026 17:02
Updates the email worker's sender logic to handle delivery robustly and extends
event types to propagate necessary context (ChannelID and Event IDs).

Changes:
- **Event Types**: Added `ChannelID` to `EmailJobEvent` to ensure the consumer
  can identify the target channel.
- **Worker Types**: Introduced `IncomingEmailDeliveryJob` to capture the
  `EmailEventID` (Pub/Sub message ID) for audit logging. Added sentinel errors
  (`ErrUnrecoverableUserFailureEmailSending`, `ErrUnrecoverableSystemFailureEmailSending`)
  to distinguish failure modes.
- **Sender Logic**: Refactored `ProcessMessage` to:
  - Use `IncomingEmailDeliveryJob` for better context.
  - Handle distinct error types: Permanent user errors are recorded and ACKed;
    transient errors trigger NACKs for retry.
  - Pass `EmailEventID` and error classification to the `ChannelStateManager`
    for precise attempt tracking.
- **Pub/Sub Adapter**: Added logging to `PublishEmailJob` to trace published IDs.
@jcscottiii jcscottiii force-pushed the jcscottiii/email-worker-pt3 branch from 125c271 to 57bc192 Compare January 14, 2026 17:07
@jcscottiii jcscottiii added this pull request to the merge queue Jan 14, 2026
Merged via the queue into main with commit 4c04186 Jan 14, 2026
8 checks passed
@jcscottiii jcscottiii deleted the jcscottiii/email-worker-pt3 branch January 14, 2026 18:39
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.

2 participants