refactor(ses): extract receipt_action_xml from rule_to_xml#327
Merged
vieiralucas merged 1 commit intomainfrom Apr 13, 2026
Merged
refactor(ses): extract receipt_action_xml from rule_to_xml#327vieiralucas merged 1 commit intomainfrom
vieiralucas merged 1 commit intomainfrom
Conversation
The rule_to_xml helper in fakecloud-ses/src/v1.rs had a ~110-line nested match that inlined the XML wire-format of every ReceiptAction variant (S3, SNS, Lambda, Bounce, AddHeader, Stop) directly into the for-loop over rule.actions. Each variant has its own AWS XML element name (S3Action, SNSAction, ...) and its own set of optional fields, so the only shared piece is the enclosing <member> wrapper. Move the match into receipt_action_xml. rule_to_xml drops from 130 lines to 30 and now clearly reads 'serialize the rule-level fields, recipients, then one <member> per action'. Each variant's XML stays exactly the same.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The `rule_to_xml` helper in fakecloud-ses/src/v1.rs had a ~110-line nested `match` that inlined the XML wire-format of every `ReceiptAction` variant (S3, SNS, Lambda, Bounce, AddHeader, Stop) directly into the `for`-loop over `rule.actions`. Each variant has its own AWS XML element name (`S3Action`, `SNSAction`, …) and its own set of optional fields, so the only shared piece is the enclosing `` wrapper.
Move the match into `receipt_action_xml`. `rule_to_xml` drops from 130 lines to 30 and now clearly reads 'serialize the rule-level fields, recipients, then one `` per action'. Each variant's XML stays exactly the same.
Test plan
Summary by cubic
Refactor SES receipt rule serialization by extracting
receipt_action_xmlfromrule_to_xml. The generated XML is unchanged, and the code is shorter and easier to read.ReceiptActionformatting intoreceipt_action_xml;rule_to_xmlnow writes rule fields, recipients, and one<member>per action.Written for commit b032a4a. Summary will update on new commits.