fix(parser): support camelCase replyTo in SesMailCommonHeaders by reginaldalfret · Pull Request #8542 · aws-powertools/powertools-lambda-python · GitHub
Skip to content

fix(parser): support camelCase replyTo in SesMailCommonHeaders - #8542

Merged
leandrodamascena merged 3 commits into
aws-powertools:developfrom
reginaldalfret:fix/issue-8523-ses-reply-to-alias
Oct 15, 2026
Merged

leandrodamascena merged 3 commits into
aws-powertools:developfrom
reginaldalfret:fix/issue-8523-ses-reply-to-alias

Conversation

@reginaldalfret

@reginaldalfret reginaldalfret commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Issue number: closes #8523

Summary

Changes

  • Updated SesMailCommonHeaders.reply_to with validation_alias=AliasChoices("replyTo", "reply-to", "reply_to") and serialization_alias="replyTo", ensuring standard SES notifications parse correctly while retaining backward compatibility for any existing usage.
  • Added comprehensive unit tests in tests/unit/parser/_pydantic/test_ses.py covering standard camelCase SES payloads, hyphenated payloads, and keyword argument instantiation.

User experience

In SES email receiving notifications, the mail.commonHeaders object provides the Reply-To addresses under the camelCase key replyTo (matching the SES API specification and SESMail.reply_to in aws_lambda_powertools.utilities.data_classes.ses_event).

Previously, SesMailCommonHeaders in aws_lambda_powertools.utilities.parser.models.ses declared the alias strictly as "reply-to". Consequently, whenever SES payloads containing commonHeaders.replyTo were parsed with SesModel, the reply_to field was ignored and evaluated to None.

With this fix, SES event payloads with commonHeaders.replyTo correctly populate reply_to.

Verification

  • Ran pytest tests/unit/parser/_pydantic/test_ses.py: 2 passed cleanly.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@reginaldalfret
reginaldalfret requested a review from a team as a code owner October 9, 2026 09:02
@boring-cyborg boring-cyborg Bot added the tests label Oct 9, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 9, 2026
@boring-cyborg

boring-cyborg Bot commented Oct 9, 2026

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.96%. Comparing base (2f58434) to head (45a1f0f).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #8542   +/-   ##
========================================
  Coverage    96.96%   96.96%           
========================================
  Files          317      317           
  Lines        15932    15932           
  Branches      1403     1403           
========================================
  Hits         15448    15448           
  Misses         349      349           
  Partials       135      135           

☔ View full report in Codecov by Harness.
📢 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.

@leandrodamascena leandrodamascena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @reginaldalfret! I was able to reproduce the bug and confirm the fix. I pushed a small commit to your branch applying ruff format to the test file so the quality check passes, nothing else changed.

Thanks also to @LuisFigueroaG for the detailed report. Approving!

@leandrodamascena
leandrodamascena merged commit b2e940b into aws-powertools:develop Oct 15, 2026
13 checks passed
@boring-cyborg

boring-cyborg Bot commented Oct 15, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

@powertools-for-aws-oss-automation

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: SesModel ignores the replyTo common header

2 participants