carlos / platform Public

console: lower-case a rule name mid-sentence, email send category text (R-32)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev e9477883867b4a8c73e0699139c56465f2014ddc parent fcd03a4
6 files changed, +58 −11
  • docs/superpowers/notes/copy-fleet-alerts-1.md +6 −5
  • internal/console/alertcopy_test.go +28 −1
  • internal/console/alertengine_pass.go +20 −2
  • internal/console/alertengine_pass_test.go +2 −2
  • internal/console/alertnotify.go +1 −0
  • internal/host/alertsink.go +1 −1

CI failed — run details

Intent

Human

<task-notification> <task-id>ae3253d9d019a76a8</task-id> <tool-use-id>toolu_01HME2abKAb93XtiJUH6r4fX</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/6112a34e-476e-4b5e-8e07-f93a46fc6d50/tasks/ae3253d9d019a76a8.output</output-file> <status>completed</status> <summary>Agent "Task 9 step 3: apply approved copy" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>**Status:** DONE_WITH_CONCERNS **Commits:** - `720682a2` console: approved alert copy - `fcd03a4a` docs: fleet alerts plan 1 copy deck shows the applied text **Tests:** - All three requested test commands pass: console `Alert|Render|Drain|Engine|Jobs|Step`, host `Alert|Sink|Format|Engine`, and `go test . -run PrintLive`. - `go vet` is clean on console, host, alerting and the root package. - The dash grep over the changed Go files finds one em dash, in an old comment at `alertengine_pass.go:668`. No user-facing string has one. - `TestAlertEmitNoteHasNoFormatErrors` covers every rule ID, every kind and close reason, with and without members, through the email, Slack and webhook renderers. It fails on any `%!`. - That test was written after the code. I showed it can fail by mutation: re-introducing the subject in the no-members branch made the subjectless test fail, and restoring the code made it pass. **Concerns** (the first three need a ruling): 1. Display names go in verbatim, so a title keeps its capital mid-sentence. For example, "No further reports of Box silent on box-9." and "Disk nearly full has cleared on box-1.". 2. Luna's `box.geoip.2` reads "the Location database on %s ...", with a capital L. It is probably a slip, and I applied it as written. 3. `test.failed` and each reason both end in a full stop, so the code drops the reason's stop. The `email` send category has no row and shows as its code. 4. Slack's unsubscribe link uses the deck's `new:footer.unsubscribe.slack` ("Stop alerts to this channel"), because Luna left it alone. Email uses Luna's `link.unsubscribe`. 5. I wrote the box clear sentences for `disk_eta` and `engine_silent` by turning the fire text round, since no approved clear text exists for them. They are marked "derived (R-31)" in the deck. 6. I added `internal/alerting/ruletext.go`. It holds the display name, "how long" and "what to do" lines for the seven box rules, so the console and the box read one copy. **Report:** `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-alerts/.superpowers/sdd/2026-10-30-fleet-alerts-1-engine-connectors/task-9-report.md`</result> <usage><subagent_tokens>186180</subagent_tokens><tool_uses>52</tool_uses><duration_ms>1151772</duration_ms></usage> </task-notification>

Attributed to this commit: 36.1 g CO₂e (4,582,977 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-fleet-alerts, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/notes/copy-fleet-alerts-1.md b/docs/superpowers/notes/copy-fleet-alerts-1.md
index 9904d20e9..0b4d9a853 100644
--- a/docs/superpowers/notes/copy-fleet-alerts-1.md
+++ b/docs/superpowers/notes/copy-fleet-alerts-1.md
@@ -3,7 +3,7 @@
Every user-facing string of fleet alerts plan 1 (engine and connectors),
for the copy review in Task 9.
-Approved by delegation (Luna pass, controller R-31), applied in 720682a2.
+Approved by delegation (Luna pass, controller R-31), applied in 720682a2. Case and gap fixes by controller ruling R-32, applied in the commit after it.
Groups 1 to 13 show their final text in the `current` column, as it is in
the code. A row ending "Final (Luna)" was rewritten by the Luna pass
@@ -173,10 +173,10 @@ A clear closes an incident. The "gone" variant is used when the incident closed
| key | current | where it shows | notes |
|---|---|---|---|
-| `clear.what` | `%[1]s has cleared on %[2]s.` | A clear's "what is wrong" | `%[1]s` is the rule's display name (group 2), `%[2]s` the subject or all members. Applied as the deck had it, so a title opens the sentence as it is written ("Disk nearly full has cleared on box-1."). |
+| `clear.what` | `%[1]s has cleared on %[2]s.` | A clear's "what is wrong" | `%[1]s` is the rule's display name (group 2), `%[2]s` the subject or all members. The name opens the sentence, so it keeps its capital ("Disk nearly full has cleared on box-1."). |
| `clear.how_long` | `Nothing is wrong now.` | Same | |
| `clear.what_to_do` | `Nothing.` | Same | |
-| `clear.what.gone` | `No further reports of %[1]s on %[2]s.` | A "no further reports" clear | Display name as above. A title mid-sentence keeps its capital ("No further reports of Box silent on box-9."); see the concerns in the Task 9 report. |
+| `clear.what.gone` | `No further reports of %[1]s on %[2]s.` | A "no further reports" clear | Display name as above, but mid-sentence, so its first letter is lower case (R-32): "No further reports of box silent on box-9." A box, host or service name is never changed. The `.none` variant does the same. |
| `clear.what.none` | `%[1]s has cleared.` | A clear when every member is snoozed | derived (R-31): `clear.what` without its subject clause. |
| `clear.what.gone.none` | `No further reports of %[1]s.` | A "no further reports" clear when every member is snoozed | derived (R-31): `clear.what.gone` without its subject clause. |
| `clear.how_long.gone` | `No new change has been reported. The incident may have stopped, or what reported it may have gone.` | Same | Wrong for a flapping incident that went quiet: that one is still reported, only steady. Final (Luna): Covers both gone and flapping incidents. |
@@ -248,12 +248,13 @@ From `alertnotify.go` and `alertdial.go`. The page shows a failed test or a held
| `errAlertTestUnconfirmed` | `This email address is not confirmed yet. Open the confirm link before testing it.` | Error after "Send test" on an unconfirmed email | No `alert test:` prefix any more. |
| `errAlertTestLimit` | `At most 10 tests per hour for one connector. Try again later.` | Error after "Send test" | Final (Luna): Plain rate-limit wording. |
| `errAlertTestReentry` | `Enter this connector's URL again before testing it.` | Error after "Send test" | Final (Luna): Gives the required action. |
-| `new:test.failed` | `The test did not get through: %s.` | Error after "Send test" when the send fails | `%s` is the reason's words from `sendErr.*` or `hold.*`, with the reason's own closing full stop dropped so the line has one. A category with no row (`email`, from a failed mail send) shows as its code. |
+| `new:test.failed` | `The test did not get through: %s.` | Error after "Send test" when the send fails | `%s` is the reason's words from `sendErr.*` or `hold.*`, with the reason's own closing full stop dropped so the line has one. A category with no row shows as its code. |
| `sendErr.refused` | `The address resolves to a private or reserved network.` | A failed send's reason | The address resolved to a private or reserved range. Final (Luna): Explains the refusal without exposing diagnostics. |
| `sendErr.timeout` | `The address did not respond in time.` | Same | Took over 5 seconds. Final (Luna): Human-readable failure reason. |
| `sendErr.connect` | `The connection could not be made.` | Same | Final (Luna): Human-readable failure reason. |
| `sendErr.tls` | `The secure connection failed.` | Same | Final (Luna): Human-readable failure reason. |
| `sendErr.status` | `The address returned HTTP status %d.` | Same | `%d` is the HTTP status returned. Final (Luna): Explains the status code. |
+| `sendErr.email` | `Email delivery failed.` | Same | derived (R-32): the code `email` is a failed mail send; the deck had no row for it. |
| `sendErr.invalid` | `The stored URL is no longer valid.` | Same | The stored URL no longer passes the checks. Final (Luna): Gives the likely action. |
| `hold.needs_reentry` | `The connector needs its URL entered again.` | Why a message is waiting | Final (Luna): Clear held reason. |
| `hold.suspended` | `The connector is suspended.` | Same | Final (Luna): Complete sentence. |
@@ -300,7 +301,7 @@ The box's own alert, for `disk`, `mem`, `cpu`, `lag`, `geoip`, `disk_eta` and `e
| `box.clear.geoip` | `location database on %s is back to normal` | Clear | Final (Luna): Uses the approved display name. |
| `box.clear.default` | `%s has cleared on %s` | Clear for a rule this agent has no text for | First `%s` is the display name or the ID, as for the fire. `disk_eta` and `engine_silent` no longer use it. |
| `box.geoip.1` | `the location database on %s is more than 45 days old` | Fire for `geoip` code 1 | Final (Luna): Uses the approved display name. |
-| `box.geoip.2` | `the Location database on %s expires within 9 days` | Same, code 2 | Final (Luna): Uses the approved display name. |
+| `box.geoip.2` | `the location database on %s expires within 9 days` | Same, code 2 | R-32 (case slip): Luna's row had a capital L. Final (Luna): Uses the approved display name. |
| `box.geoip.3` | `the location database on %s has expired and was removed` | Same, code 3 | Final (Luna): Uses the approved display name. |
| `box.geoip.4` | `%s has not loaded the published location database for over an hour` | Same, code 4 | Final (Luna): Uses the approved display name. |
| `box.geoip.5` | `the location data feed has failed 7 times in a row (seen from %s)` | Same, code 5 | Final (Luna): Removes undefined GeoIP wording. |
diff --git a/internal/console/alertcopy_test.go b/internal/console/alertcopy_test.go
index 4722c64a5..3204f598d 100644
--- a/internal/console/alertcopy_test.go
+++ b/internal/console/alertcopy_test.go
@@ -120,6 +120,33 @@ func TestAlertEmitNoteWithoutMembersNamesNoSubject(t *testing.T) {
}
}
+// A rule's display name opens a sentence in capitals and sits inside one in
+// lower case; a box name is never changed (ruling R-32).
+func TestAlertRuleNameCaseByPosition(t *testing.T) {
+ now := alertT0
+ for _, c := range []struct {
+ rule, box, gone, wantWhat string
+ members []string
+ }{
+ {"box_silent", "Box-9", alertCloseGone, "No further reports of box silent on Box-9.", []string{"Box-9"}},
+ {"cpu", "box-1", alertCloseGone, "No further reports of high CPU use on box-1.", []string{"box-1"}},
+ {"cpu", "", alertCloseGone, "No further reports of high CPU use.", nil},
+ {"disk", "Box-9", alertCloseCleared, "Disk nearly full has cleared on Box-9.", []string{"Box-9"}},
+ {"disk", "", alertCloseCleared, "Disk nearly full has cleared.", nil},
+ {"rule_from_a_newer_box", "box-1", alertCloseGone, "No further reports of rule_from_a_newer_box on box-1.", []string{"box-1"}},
+ } {
+ in := alertIncident{Scope: alertScopeFleet, Rule: c.rule, Level: "incident", Members: c.members, CloseReason: c.gone}
+ if n := alertEmitNote(alertEmit{Incident: in, Kind: alertKindClear}, newAlertSignals(), now); n.What != c.wantWhat {
+ t.Errorf("%s/%s/%s: what = %q, want %q", c.rule, c.box, c.gone, n.What, c.wantWhat)
+ }
+ }
+ // A headline puts the name after a label or first, so it keeps its capital.
+ n := alertNote{Kind: alertKindClear, Rule: "box_silent", Subject: "box-9", Members: []string{"box-9"}}
+ if got := alertHeadline(n); got != "Cleared: Box silent on box-9" {
+ t.Errorf("headline = %q", got)
+ }
+}
+
// A reminder says how long the incident has been open, in whole days.
func TestAlertReminderSaysHowLong(t *testing.T) {
now := alertT0.Add(60 * time.Hour)
@@ -165,7 +192,7 @@ func TestAlertTestFailedWords(t *testing.T) {
"unconfirmed": "The test did not get through: The connector is not confirmed.",
"no seal key": "The test did not get through: The connector key is missing.",
"seal": "The test did not get through: The connector key could not open the stored address.",
- "email": "The test did not get through: email.",
+ "email": "The test did not get through: Email delivery failed.",
} {
if got := alertTestFailed(code).Error(); got != want {
t.Errorf("alertTestFailed(%q) = %q, want %q", code, got, want)
diff --git a/internal/console/alertengine_pass.go b/internal/console/alertengine_pass.go
index ecc91e74c..0368b7ea6 100644
--- a/internal/console/alertengine_pass.go
+++ b/internal/console/alertengine_pass.go
@@ -14,6 +14,8 @@ import (
"strconv"
"strings"
"time"
+ "unicode"
+ "unicode/utf8"
)
// The alert engine (fleet alerts spec §4, §6): one pass a minute, as the
@@ -365,6 +367,11 @@ func alertEmitNote(em alertEmit, sig *alertSignals, now time.Time) alertNote {
if in.CloseReason == alertCloseGone || in.Flapping {
gone = ".gone"
}
+ // "has cleared" opens its sentence; "no further reports of" does
+ // not, so there the name goes in lower case (ruling R-32).
+ if gone != "" {
+ title = alertMidSentence(title)
+ }
if named {
subjects := n.Subject
if len(in.Members) > 1 {
@@ -395,6 +402,17 @@ func alertEmitNote(em alertEmit, sig *alertSignals, now time.Time) alertNote {
return n
}
+// alertMidSentence is a rule's display name placed inside a sentence: its
+// first letter in lower case. Only ever a rule's name; a box, host or
+// service name is a subject and is never touched (ruling R-32).
+func alertMidSentence(title string) string {
+ if title == "" {
+ return title
+ }
+ r, size := utf8.DecodeRuneInString(title)
+ return string(unicode.ToLower(r)) + title[size:]
+}
+
// alertAge is how long an incident has been open, in whole days, or in
// hours for the first day (a reminder is never sent before 24 hours, but the
// word must not be wrong for a clock that is a little early).
@@ -665,8 +683,8 @@ func writeAlertBeatFile(path string, now time.Time) error {
// alertValueText renders one rule's transition value in that rule's own
// unit. Every rule internal/metrics evaluates carries a fraction EXCEPT lag,
// which is keymail relay seconds (see metrics.Rules.LagSecs), and the
-// forecast and the engine's own rules, which carry hours, minutes and days —
-// so a single
+// forecast and the engine's own rules, which carry hours, minutes and days.
+// So a single
// percent formatter for all of them turns the first lag alert to fire into
// "92000%". Used by both operator-facing surfaces: the dashboard's alerts
// table and the alert mail below.
diff --git a/internal/console/alertengine_pass_test.go b/internal/console/alertengine_pass_test.go
index 698aa27c7..5e06a8096 100644
--- a/internal/console/alertengine_pass_test.go
+++ b/internal/console/alertengine_pass_test.go
@@ -337,7 +337,7 @@ func TestEnginePassBoxGoneCloses(t *testing.T) {
}
ef.passAt(t, 6*time.Minute)
got := ef.mailsTo(opA)
- if len(got) != 2 || !strings.Contains(got[1], "No further reports of Disk nearly full on box-1") {
+ if len(got) != 2 || !strings.Contains(got[1], "No further reports of disk nearly full on box-1") {
t.Fatalf("A got %v, want the fire then a no further reports clear", got)
}
if n := ef.count(t, `SELECT COUNT(*) FROM alert_incidents WHERE closed_at IS NOT NULL AND close_reason = 'box gone'`); n != 1 {
@@ -768,7 +768,7 @@ func TestEnginePassHeartbeatPastTheHorizonCloses(t *testing.T) {
t.Fatalf("%d box_silent incidents closed as gone, want 1", n)
}
got := ef.mailsTo(opA)
- if len(got) != 2 || !strings.Contains(got[1], "No further reports of Box silent on box-9") {
+ if len(got) != 2 || !strings.Contains(got[1], "No further reports of box silent on box-9") {
t.Fatalf("A got %v, want the fire then a no further reports clear", got)
}
}
diff --git a/internal/console/alertnotify.go b/internal/console/alertnotify.go
index bd370deb6..1e94b824d 100644
--- a/internal/console/alertnotify.go
+++ b/internal/console/alertnotify.go
@@ -237,6 +237,7 @@ var alertCopy = map[string]string{
"sendErr.tls": "The secure connection failed.",
"sendErr.status": "The address returned HTTP status %d.",
"sendErr.invalid": "The stored URL is no longer valid.",
+ "sendErr.email": "Email delivery failed.",
"hold.needs_reentry": "The connector needs its URL entered again.",
"hold.suspended": "The connector is suspended.",
diff --git a/internal/host/alertsink.go b/internal/host/alertsink.go
index 2aac38bb1..60752708e 100644
--- a/internal/host/alertsink.go
+++ b/internal/host/alertsink.go
@@ -474,7 +474,7 @@ func geoipAlertSentence(ev metrics.Event) string {
case 1:
return fmt.Sprintf("the location database on %s is more than 45 days old", ev.Box)
case 2:
- return fmt.Sprintf("the Location database on %s expires within 9 days", ev.Box)
+ return fmt.Sprintf("the location database on %s expires within 9 days", ev.Box)
case 3:
return fmt.Sprintf("the location database on %s has expired and was removed", ev.Box)
case 4: