Skip to content

Email notification channel#13

Merged
ethanholz merged 12 commits into
omsf:mainfrom
dwhswenson:email-notifier
Jan 27, 2026
Merged

Email notification channel#13
ethanholz merged 12 commits into
omsf:mainfrom
dwhswenson:email-notifier

Conversation

@dwhswenson
Copy link
Copy Markdown
Member

@dwhswenson dwhswenson commented Jan 23, 2026

This PR will add email (via SES) as a notification channel.

  • Core email notification Python code (render templates for HTML, plaintext, and subject)
  • Terraform module in modules/email_notification to handle the infrastructure (lambda function, IAM including SES permissions, SQS plumbing)
  • Usage in examples/basic
  • Tested examples/basic in actual deployment

Updates:

This involved implementing a significant refactor of the base class in 2ac5070. See commit message on that for details.

Also tried to implement some potentially better error handling for SQS errors. That work starts in 2c4fc89 and following. I'm not yet sure how that will work in practice; I think I need to see the system at work before I can tell whether that is needed.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 98.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.28%. Comparing base (00caf1a) to head (c506adb).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
src/cloud_cron/notifications/base.py 96.66% 1 Missing ⚠️
src/cloud_cron/notifications/email_handler.py 96.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #13      +/-   ##
==========================================
- Coverage   98.39%   98.28%   -0.12%     
==========================================
  Files           8       10       +2     
  Lines         312      408      +96     
==========================================
+ Hits          307      401      +94     
- Misses          5        7       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

We can add this in later if needed; don't want to add it to maintenance
yet.
Note that email addresses (to, from, reply_to) need config and aren't
included here.
@dwhswenson dwhswenson marked this pull request as ready for review January 23, 2026 21:49
@dwhswenson dwhswenson requested a review from Copilot January 23, 2026 21:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds email notification functionality via AWS SES to the cloud-cron framework. It introduces a new notification channel that renders subject, text, and HTML templates using Jinja2 and sends emails through SES.

Changes:

  • Added EmailNotificationHandler Python class for SES email delivery with multi-template rendering
  • Created Terraform module modules/email-notification for infrastructure provisioning
  • Integrated email notifications into the examples/basic example with template files

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/cloud_cron/notifications/email_handler.py New handler class that renders three templates (subject/text/html) and sends via SES
tests/notifications/test_email_handler.py Unit tests for email handler with fake SES client
src/cloud_cron/notifications/init.py Export EmailNotificationHandler in public API
modules/email-notification/main.tf Terraform module creating Lambda, IAM roles/policies, and SQS wiring
modules/email-notification/variables.tf Input variables for sender, recipients, templates, and Lambda config
modules/email-notification/outputs.tf Outputs for Lambda ARN, queue ARN/URL, and subscription ARN
modules/email-notification/README.md Documentation for the email notification module
examples/basic/main.tf Integration of email notification module in example
examples/basic/variables.tf New variables for email sender, recipients, and reply-to
examples/basic/email-notifier/handler.py Lambda handler entry point using EmailNotificationHandler
examples/basic/email-notifier/Dockerfile Container image definition for email notifier Lambda
examples/basic/templates/email-*.txt/.html Example email templates for subject, text, and HTML bodies
PLAN.md Updated Phase 4.2 task descriptions to reflect implementation approach
IDEA.md Clarified email handler design in architecture documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/cloud_cron/notifications/email_handler.py
Comment thread tests/notifications/test_email_handler.py
Comment thread src/cloud_cron/notifications/email_handler.py Outdated
Comment thread examples/basic/email-notifier/Dockerfile Outdated
Comment thread src/cloud_cron/notifications/email_handler.py Outdated
Comment thread modules/email-notification/main.tf
Comment thread src/cloud_cron/notifications/email_handler.py
Comment thread src/cloud_cron/notifications/email_handler.py Outdated
Comment thread modules/email-notification/README.md
Comment thread examples/basic/email-notifier/Dockerfile Outdated
dwhswenson and others added 5 commits January 23, 2026 16:35
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
First, the base class is now named RenderedTemplateNotificationHandler,
because this is specific to cases where we render templates locally.

Second, we always, in principle, work with multiple templates, stored in
a dict. The keys to this dict are usually set in `__init__`, and only
need to be known by the class's `__init__` and the class's `notify`.
This allows us to handle either a single template, as with the print
notifier, or multiple, as with the email notifier.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/basic/email-notifier/handler.py Outdated
Comment thread modules/email-notification/setting-up-ses.md Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@dwhswenson dwhswenson requested a review from ethanholz January 26, 2026 23:23
Copy link
Copy Markdown
Contributor

@ethanholz ethanholz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, especially if we are going to split this off into a PyPI package.

@ethanholz ethanholz merged commit 348a6b0 into omsf:main Jan 27, 2026
3 checks passed
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.

3 participants