| index 2251b0662..6dfa6687a 100644 |
| --- a/mail_cli_test.go |
| +++ b/mail_cli_test.go |
| @@ -1026,3 +1026,85 @@ func TestEmailVerbDispatchAndRefusals(t *testing.T) { |
| t.Fatalf("bad app name = %q, want the name gate", out) |
| } |
| } |
| + |
| +// TestPrintEmailStatusNamesADomainWithNoEventDestination: a verified domain |
| +// whose region carries no configuration set emits NO SES events at all, so |
| +// the daily cap, the bounce/complaint thresholds and the automatic pause are |
| +// all inert for it — and the "today: 0/50 sends" line reads exactly the same |
| +// as a quiet day. Every identity verified before a deployment's |
| +// CARLOS_MAIL_SNS_TOPIC_ARN was set is in that state permanently, because |
| +// setting the variable binds nothing retroactively. The record already |
| +// carries config_set and the status door already returns it; this is the one |
| +// view a member with no AWS console has, so it has to say so, and name the |
| +// verb that repairs it. |
| +func TestPrintEmailStatusNamesADomainWithNoEventDestination(t *testing.T) { |
| + var buf bytes.Buffer |
| + printEmailStatus(&buf, apiEmailReply{ |
| + App: "seapointish", DailyCap: 50, Active: true, |
| + Provisioned: &apiEmailProvisioned{KeyID: "AKIA1"}, |
| + Domains: []apiEmailDomain{{ |
| + Domain: "seapointish.bag.oncarlos.com", Kind: "platform", |
| + Regions: map[string]*apiEmailRegionState{ |
| + "eu-west-1": {Status: "verified", ConfigSet: ""}, |
| + }, |
| + }}, |
| + }) |
| + out := buf.String() |
| + if !strings.Contains(out, "no SES event destination") { |
| + t.Fatalf("status output does not say the domain emits no events:\n%s", out) |
| + } |
| + // The consequence, not just the condition: a member reading "no event |
| + // destination" learns nothing unless it also says what stops working. |
| + if !strings.Contains(out, "cap") || !strings.Contains(out, "pause") { |
| + t.Fatalf("status output does not name what is inert without events:\n%s", out) |
| + } |
| + // The no-infra rule (CLAUDE.md): the fix must be a carlos verb, never |
| + // "go look in the AWS console". |
| + if !strings.Contains(out, "carlos email domains add -app seapointish seapointish.bag.oncarlos.com") { |
| + t.Fatalf("status output does not name the verb that repairs it:\n%s", out) |
| + } |
| +} |
| + |
| +// TestPrintEmailStatusStaysQuietWhenEventsAreBound: the symmetric case. A |
| +// domain bound to a configuration set is the healthy shape, and the status |
| +// view must not nag about it — a warning printed on every healthy domain is |
| +// a warning nobody reads on the unhealthy one. |
| +func TestPrintEmailStatusStaysQuietWhenEventsAreBound(t *testing.T) { |
| + var buf bytes.Buffer |
| + printEmailStatus(&buf, apiEmailReply{ |
| + App: "seapointish", DailyCap: 50, Active: true, |
| + Provisioned: &apiEmailProvisioned{KeyID: "AKIA1"}, |
| + Domains: []apiEmailDomain{{ |
| + Domain: "seapointish.bag.oncarlos.com", Kind: "platform", |
| + Regions: map[string]*apiEmailRegionState{ |
| + "eu-west-1": {Status: "verified", ConfigSet: "carlos-bag"}, |
| + }, |
| + }}, |
| + }) |
| + out := buf.String() |
| + if strings.Contains(out, "no SES event destination") { |
| + t.Fatalf("status output warns about a domain that IS bound to a config set:\n%s", out) |
| + } |
| +} |
| + |
| +// TestPrintEmailStatusDoesNotWarnOnAnUnverifiedDomain: a pending or failed |
| +// region has no configuration set yet either, but the reason is that it is |
| +// not finished verifying — telling a member their events are broken while |
| +// the identity is still converging is noise on top of a state they are |
| +// already being told about. |
| +func TestPrintEmailStatusDoesNotWarnOnAnUnverifiedDomain(t *testing.T) { |
| + var buf bytes.Buffer |
| + printEmailStatus(&buf, apiEmailReply{ |
| + App: "seapointish", DailyCap: 50, |
| + Domains: []apiEmailDomain{{ |
| + Domain: "seapointish.bag.oncarlos.com", Kind: "platform", |
| + Regions: map[string]*apiEmailRegionState{ |
| + "eu-west-1": {Status: "pending", ConfigSet: ""}, |
| + }, |
| + }}, |
| + }) |
| + out := buf.String() |
| + if strings.Contains(out, "no SES event destination") { |
| + t.Fatalf("status output warns about events on a still-verifying domain:\n%s", out) |
| + } |
| +} |