fix(ses): publish configuration-set events through both send APIs

Merged
CA
3d ago
+4054-492

Summary

Closes #2709.

  • Accept the SESv2 DeliveryStreamArn spelling and the SES v1 DeliveryStreamARN spelling when publishing Firehose events. Match v1 lowercase/camelCase event types without changing their control-plane round trips.
  • Connect successful v1 email, raw, templated, and bulk-templated sends to the existing event processing and delivery bus, releasing SES locks before callbacks. SES appends its documented newline to each Firehose JSON record.
  • Resolve effective raw-message envelopes and explicit/header/default configuration-set selection consistently across both send APIs. Preserve message storage while using validated mailbox addresses in event envelopes and insights.
  • Partition mixed simulator outcomes by recipient, so a bounce or complaint recipient does not cause unrelated recipients to be classified the same way.
  • Add official v1/v2 SDK → SES → Firehose → S3 regressions and repair the previously ignored event-dispatch introspection test.

The supporting envelope/admission changes address concrete regressions found during independent review: raw sends with omitted optional fields, display names, comments/groups, quoted local parts, failed-send side effects, and mixed recipient outcomes. This branch is standalone against upstream main; it does not include the buffered/compressed Firehose series.

Test plan

  • cargo test -p fakecloud-ses — 309 unit tests passed.
  • Focused SES E2Es — 51 distinct tests passed, including the five new official-SDK Firehose tests and the enabled introspection fan-out test. The server was rebuilt from this branch before E2E runs.
  • cargo test -p fakecloud-conformance --test ses — 50 passed.
  • cargo test -p fakecloud-conformance --lib — 94 passed.
  • cargo clippy --workspace --all-targets -- -D warnings.
  • cargo fmt --all --check, documentation counts, and git diff --check.
  • Upstream CI-equivalent workspace test gate passed, with the single WSL-specific test exclusion documented below.
  • Independent code review completed; reported defects were reproduced with regression tests and resolved before publication.

Local verification limitations

The workspace test command used was:

cargo test --workspace \
  --exclude fakecloud-e2e --exclude fakecloud-conformance \
  --exclude fakecloud-tfacc --exclude fakecloud-parity \
  -- --skip data_plane::tests::vpc_link_proxy_resolves_target_nlb_and_attempts_connection

The API Gateway exclusion is local only: on this WSL host an unused localhost port times out, yielding 504 rather than the fixture's expected 502. The exact failure was reproduced on untouched upstream 041ddc563; no test or production code was changed to hide it.

An earlier unrestricted workspace run also encountered missing/unusable Podman, an RDS instance readiness timeout, and eventually the tool's two-hour timeout during Terraform provider acceptance tests. Those environment-heavy suites are separate from upstream's CI workspace test job; affected SES E2E/conformance coverage above passed. Upstream CI remains authoritative for those environments.


Summary by cubic

Publishes configuration-set events through both SES send APIs, so Firehose event delivery now works for v1 sends as well as v2 sends.

  • Accepts both DeliveryStreamArn and DeliveryStreamARN spellings, matches v1 lowercase/camelCase event types, and renders each destination's members in the owning API's spelling without changing control-plane round trips.
  • Routes successful v1 email, raw, templated, and bulk-templated sends through the existing event bus, releasing SES locks before callbacks; v1 bulk-templated sends now report InvalidParameterValue per destination for malformed recipients, matching v2.
  • Resolves raw-message envelopes and explicit/header/default configuration-set selection consistently across both APIs, with an address identity falling through to its domain identity's default; validated mailbox addresses are used in envelopes while message storage is preserved.
  • Partitions mixed simulator outcomes by recipient; the out-of-office mailbox now emits Send + Delivery only, with no Complaint.
  • Encodes subjects as RFC 2047 across the MIME builder, DKIM, and SMTP relay paths to block header injection; raw sends are relayed verbatim.
  • Adds official v1/v2 SDK → SES → Firehose → S3 regression tests and enables the previously ignored event-dispatch introspection test.