Fix email verification flow with enhanced templates and frontend URLs#464
Conversation
…stor in deployment workflows and CloudFormation templates - Introduced new parameters for frontend URLs in deploy-api.yml and deploy-dagster.yml workflows. - Updated prod.yml and staging.yml to include these parameters for production and staging environments. - Added corresponding parameters in CloudFormation templates (api.yaml and dagster.yaml) for consistent configuration. - Enhanced bootstrap.sh to set up SES email identity for transactional emails, ensuring proper email handling. - Updated environment configuration to retrieve frontend URLs from environment variables instead of Secrets Manager.
- Introduced a new base HTML template for transactional emails, improving layout and branding consistency. - Refactored email templates for verification, password reset, and welcome emails to utilize the new structure. - Updated email subject lines for consistency in casing and branding. - Added utility functions for rendering buttons and paragraphs in email content. - Adjusted tests to reflect changes in email subject lines and content structure.
- Changed the default return value in the detect_app_source function from 'roboledger' to 'robosystems' to reflect the main hub designation. - This adjustment ensures consistency in app source detection across the application.
|
@claude please review this PR |
|
Claude finished @jfrench9's task in 2m 29s —— View job PR Review: Fix email verification flowTasks:
Overall this is a well-scoped fix with a clear change chain from CloudFormation → CI/CD → config → email templates. The architecture is correct and the default-URL safety nets are a nice touch. A few issues worth addressing before merge, from most to least critical. Bugs1. Default app fallback is inconsistent — display name and URL mismatchIn all three # ses.py:330, 368, 401
base_url = self.app_urls.get(app, self.app_urls["roboledger"]) # → RoboLedger URL
# ses.py:341, 379, 410
"app_name": app_display_names.get(app, "RoboSystems"), # → "RoboSystems" nameThis would produce an email that says "Thanks for creating a RoboSystems account" with a verification link pointing to roboledger.ai. The test Code Quality2.
|
| # calls don't each make a separate SSM API call (which can fail under load). | ||
| _preloaded_flags = preload_feature_flags() | ||
| if _preloaded_flags: | ||
| print(f"Preloaded {len(_preloaded_flags)} feature flags from SSM") |
| if _preloaded_flags: | ||
| print(f"Preloaded {len(_preloaded_flags)} feature flags from SSM") | ||
| elif os.getenv("ENVIRONMENT", "dev") in ("prod", "staging"): | ||
| print("WARNING: No feature flags loaded from SSM. All flags will use defaults.") |
| print( | ||
| f"WARNING: Parameter store unavailable ({type(_e).__name__}: {_e}). " | ||
| "All feature flags will use defaults (false)." | ||
| ) |
- Introduced a centralized mapping for app display names to improve consistency in email templates. - Updated the default app handling to use 'robosystems' across various email functions. - Adjusted tests to verify the correct fallback to 'robosystems' in email content.
Summary
Fixes the email verification flow by updating the default app source detection, enhancing AWS SES email templates, and wiring frontend URL parameters through the full deployment stack. These changes ensure that verification emails render correctly and link users back to the appropriate frontend application (RoboSystems, RoboLedger, or RoboInvestor).
Key Accomplishments
Email Template & Content Improvements
robosystems/operations/aws/ses.py(~366 lines restructured) for better maintainability and consistent output across all email typesApp Source Detection Fix
detect_app_sourceto'robosystems', correcting misrouted verification flows that relied on an incorrect defaultFrontend URL Configuration Across Deployment Stack
deploy-api,deploy-dagster,prod,staging)api.yaml,dagster.yaml)env.py,parameter_store.py,validation.py)Auth Utilities
Breaking Changes
'robosystems'may affect any downstream logic that relied on the old default.Testing Notes
tests/operations/aws/test_ses.pyandtests/config/test_validation.pyto reflect new email formatting and validation parameter additionsInfrastructure Considerations
🤖 Generated with Claude Code
Branch Info:
bugfix/email-verification-flowmainCo-Authored-By: Claude noreply@anthropic.com