Skip to content

refactor(ses): extract receipt_action_xml from rule_to_xml#327

Merged
vieiralucas merged 1 commit intomainfrom
worktree-cleanup+ses-splits
Apr 13, 2026
Merged

refactor(ses): extract receipt_action_xml from rule_to_xml#327
vieiralucas merged 1 commit intomainfrom
worktree-cleanup+ses-splits

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Apr 13, 2026

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

  • `cargo fmt`
  • `cargo clippy --workspace --all-targets -- -D warnings`
  • `cargo test -p fakecloud-ses` (139 passed)

Summary by cubic

Refactor SES receipt rule serialization by extracting receipt_action_xml from rule_to_xml. The generated XML is unchanged, and the code is shorter and easier to read.

  • Refactors
    • Moved per-ReceiptAction formatting into receipt_action_xml; rule_to_xml now writes rule fields, recipients, and one <member> per action.
    • No behavior change; existing tests pass.

Written for commit b032a4a. Summary will update on new commits.

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.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@vieiralucas vieiralucas merged commit e6a2e70 into main Apr 13, 2026
22 checks passed
@vieiralucas vieiralucas deleted the worktree-cleanup+ses-splits branch April 13, 2026 01:32
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