Conversation
Pairs with dimagi/open-chat-studio#3175. Covers a new SesInboundStack (S3+SNS receipt action, anymail webhook secret, multi-domain receipt rule), DomainStack extended to loop over EMAIL_INBOUND_DOMAINS, and the fargate task-role IAM additions (sns:ConfirmSubscription, s3:GetObject). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
10-task TDD plan to pair with the 2026-04-28 inbound-email design doc. Each task uses pytest + cdk.assertions.Template for synth-level assertions. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Use stack output references and CDK_REGION instead of hard-coded values that only happen to be correct when APP_NAME=ocs and region=us-east-1. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…in fargate Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The tests/unit/test_ocs_deploy_stack.py file imported a module that doesn't exist (ocs_deploy.ocs_deploy_stack), causing a collection error when running plain `pytest` from the repo root. With it removed, plain `pytest` discovers only ocs_deploy/tests/ and runs all 116 tests cleanly. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Runs the test suite on every pull request and push to main using uv (picks Python from .python-version) and Node 22 (jsii's supported release). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
CloudFormation does not resolve {{resolve:secretsmanager:...}} dynamic
references for AWS::SNS::Subscription.Endpoint, so embedding the webhook
secret in the HTTPS subscription URL fails at deploy with "Invalid
parameter: HTTP(S) Endpoint URL". Subscribe a small Python Lambda to the
topic instead; it fetches the webhook secret from Secrets Manager at
runtime and POSTs the SNS notification to anymail's webhook with HTTP
Basic auth.
Also add an optional ANYMAIL_WEBHOOK_DOMAIN config knob (defaulting to
DOMAIN_NAME) so the webhook host can be pinned independently during the
in-flight domain migration.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Anymail base64-decodes the Authorization header value and string-compares
the decoded result verbatim to ANYMAIL["WEBHOOK_SECRET"] (verified in
django-anymail's get_request_basic_auth + AnymailBasicAuthMixin.validate_request).
The previous Lambda sent base64("<secret>:<secret>") which would only
match if the consumer munged its config the same way. Use the constant
"anymail" username instead so the auth header is standard HTTP Basic and
the Django-side config is a clean f"anymail:{ANYMAIL_WEBHOOK_SECRET}".
README runbook now documents the Django-side WEBHOOK_SECRET format.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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
Adds AWS infrastructure to support inbound email for Open Chat Studio's email channel (dimagi/open-chat-studio#3175).
SesInboundStack: S3 bucket (7-day lifecycle oninbound/, BlockPublicAccess), SNS topic, anymail webhook secret (URL-safe, auto-generated),ReceiptRuleSetwith one rule whose recipients are the configured domains and actions are[S3Action, SnsAction(Base64)], and an HTTPS SNS subscription whose endpoint embeds the secret via a CFN dynamic reference.DomainStackextended to create one DKIM-verifiedEmailIdentityper domain in[EMAIL_DOMAIN] + EMAIL_INBOUND_DOMAINS(CSV, optional).FargateStackconsumes the new resources:sns:ConfirmSubscriptionon the topic ARN,s3:GetObjecton<bucket>/inbound/*, plusANYMAIL_WEBHOOK_SECRETinjected into all task definitions.set-active-receipt-rule-setstep).cdk synth --allclean.Design
Spec:
docs/superpowers/specs/2026-04-28-inbound-email-design.mdPlan:
docs/superpowers/plans/2026-04-28-inbound-email.mdKey decisions: S3+SNS receipt action (supports up to 10 MB attachments; SNS-only caps near 150 KB), one shared receipt rule for all domains, secret embedded via
cdk.SecretValue.secrets_manager(...).unsafe_unwrap(), bucket policy hardened with bothaws:SourceAccountandaws:SourceArnconditions.Test Plan
🤖 Generated with Claude Code