Skip to content

Commit ef4a611

Browse files
committed
Update usage alert email to use App ID #5704
2 parents fbe2444 + 5f1747a commit ef4a611

129 files changed

Lines changed: 643 additions & 519 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/update-email-templates/SKILL.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,17 @@ Follow this workflow whenever updating email templates.
3232
2. Generate `.mjml` from `.mjml.gotemplate`:
3333
- `go run ./scripts/generatemjml/main.go -i resources/authgear/templates`
3434
3. Commit source edits and generated `.mjml` in one commit.
35-
4. In a separate commit, generate non-English translations:
35+
4. Before regenerating non-English translations, delete the changed keys from all non-`en` locale files so the generator knows to recreate them:
36+
- For `en/messages/translation.json` changes, delete the **top-level key** (e.g. `UsageAlert`, not `UsageAlert.Alert.Title`) from all non-`en` `messages/translation.json` files:
37+
- `make templates-translation-json-del-key KEY=<TopLevelKey>`
38+
- For `en/translation.json` subject changes, delete the changed key from all non-`en` `translation.json` files:
39+
- `make translation-json-del-key KEY=<key>`
40+
- Run once per changed top-level key.
41+
5. In a separate commit, generate non-English translations:
3642
- `make -C scripts/python generate-translations`
3743
- `ANTHROPIC_API_KEY` must be set.
3844
- If `ANTHROPIC_API_KEY` is not set, stop and ask the user to run this step.
39-
5. Finally, generate HTML emails:
45+
6. Finally, generate HTML emails:
4046
- `make html-email`
4147

4248
## Commit Boundaries (Required)

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ Use existing repo skills instead of one-off instructions when they fit:
9696
- `dep-audit`
9797
- `new-siteadmin-api`
9898
- `update-portal-ui`**use this before adding or editing any portal UI page** (link components, i18n inline links, FluentUI Text pitfalls)
99-
- `write-e2e-test`
99+
- `update-email-templates`**use this before editing any email template, translation string, or email subject line** (`*.gotemplate`, `messages/translation.json`, `translation.json` subjects)
100+
- `write-e2e-test`**use this before writing, editing, or running e2e tests**
100101
- Repo-local skills for Go tests, Portal GraphQL operations, Go version updates, important-module updates, and vetted-position updates
101102

102103
## Git workflow

cmd/authgear/background/wire_gen.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/cmd/e2e/pkg/wire_gen.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/pkg/testrunner/testcase.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,13 @@ func (tc *TestCase) executeStep(
408408
return nil, state, false
409409
}
410410
if step.SMTPLogOutput != nil {
411-
ok := validateQueryResult(t, Step{
411+
renderedRows, ok := renderTemplateString(t, cmd, prevSteps, step.SMTPLogOutput.Rows)
412+
if !ok {
413+
return nil, state, false
414+
}
415+
ok = validateQueryResult(t, Step{
412416
Name: step.Name,
413-
QueryOutput: step.SMTPLogOutput,
417+
QueryOutput: &QueryOutput{Rows: renderedRows},
414418
}, rows)
415419
if !ok {
416420
return nil, state, false

e2e/tests/usage/project_alert_email_block_delivery.test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ steps:
9191
sleep_for: 2s
9292
- name: query smtp log
9393
action: smtp_log_query
94-
smtp_log_subject: "SMS usage has been blocked (Authgear)"
94+
smtp_log_subject: "SMS usage has been blocked ({{ .AppID }})"
9595
smtp_log_recipient: "usage-alert@example.com"
9696
smtp_log_output:
9797
rows: |
9898
[
9999
{
100-
"subject": "SMS usage has been blocked (Authgear)",
100+
"subject": "SMS usage has been blocked ({{ .AppID }})",
101101
"recipient": "usage-alert@example.com"
102102
}
103103
]

e2e/tests/usage/project_alert_email_delivery.test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ steps:
4747
sleep_for: 2s
4848
- name: query smtp log
4949
action: smtp_log_query
50-
smtp_log_subject: "Your SMS usage has reached 1 (Authgear)"
50+
smtp_log_subject: "Your SMS usage has reached 1 ({{ .AppID }})"
5151
smtp_log_recipient: "usage-alert@example.com"
5252
smtp_log_output:
5353
rows: |
5454
[
5555
{
56-
"subject": "Your SMS usage has reached 1 (Authgear)",
56+
"subject": "Your SMS usage has reached 1 ({{ .AppID }})",
5757
"recipient": "usage-alert@example.com"
5858
}
5959
]

pkg/admin/wire_gen.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)