carlos / platform Public

Protection tab copy follow-ups: singular headlines, operator empty state, Period label

PT-C50..C57 approved by Paul in copy review 2026-10-31, unchanged from the
draft. The tab says "1 request" when the count a headline names is exactly 1
(watch-only, block-only, mixed with one blocked) and "all of the 1 request"
when the one request checked was caught. The operator page has singular and
single-app headlines and, when nothing has been checked platform-wide, says
counting has not started instead of a headline. The tab's range links carry
the Period label as the Analytics tab's do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev c3eaf7e6c89a8cce3191bb4f227bf94ce22654b0 parent 1d82d7b
5 files changed, +179 −9
  • docs/superpowers/plans/2026-10-30-console-protection-tab-copy.md +13 −0
  • internal/console/approved_protection_copy_test.go +3 −0
  • internal/console/protectionview_test.go +153 −0
  • internal/console/templates/app_protection.html +5 −5
  • internal/console/templates/fleet_protection.html +5 −4
diff --git a/docs/superpowers/plans/2026-10-30-console-protection-tab-copy.md b/docs/superpowers/plans/2026-10-30-console-protection-tab-copy.md
index e166daf4c..eac2a1645 100644
--- a/docs/superpowers/plans/2026-10-30-console-protection-tab-copy.md
+++ b/docs/superpowers/plans/2026-10-30-console-protection-tab-copy.md
@@ -9,6 +9,11 @@ Approved 2026-10-30 by Paul in copy review (copy-review skill), all 38 rows
unchanged from the draft. The text below is the approved text, verbatim.
There are no rows C07 to C09: Paul's ruling cut those strings.
+PT-C50..C57 approved 2026-10-31 by Paul in copy review, unchanged from the
+draft. They are the singular headlines ("1 request" where a count is exactly
+1), the operator page's empty state, and the Period label of the tab's range
+links.
+
The rules (the same as the analytics on-ramp deck,
`2026-10-26-analytics-onramp-copy.md`):
@@ -71,3 +76,11 @@ The rules (the same as the analytics on-ramp deck,
| PT-C41 | templates/fleet_protection.html (headline) | (new) | In the last {days} days, {caught} requests across {apps} apps looked like attacks. | TestFleetProtectionListsApps | approved |
| PT-C42 | templates/fleet_protection.html (table headings) | (new) | Account · App · Caught · Blocked · Share | TestFleetProtectionListsApps | approved |
| PT-C43 | templates/fleet_protection.html (unreadable fleets) | (new) | These fleets' counts could not be read and are left out: {fleets}. | TestFleetProtectionNamesUnreadableFleet | approved |
+| PT-C50 | templates/app_protection.html (watching headline, exactly 1 caught) | (new) | In the last {days} days, 1 request to this app looked like an attack. Protection recorded it and let it through while we check it never stops a real visitor. | TestProtectionTabSingularWatchHeadline | approved |
+| PT-C51 | templates/app_protection.html (blocking headline, exactly 1 blocked) | (new) | In the last {days} days, protection blocked 1 request to this app. | TestProtectionTabSingularBlockHeadline | approved |
+| PT-C52 | templates/app_protection.html (mixed headline, exactly 1 blocked) | (new) | In the last {days} days, protection blocked 1 request to this app and recorded {watched} more. | TestProtectionTabSingularMixedHeadline | approved |
+| PT-C53 | templates/app_protection.html (share, 1 request checked and caught) | (new) | That's all of the 1 request protection checked. | TestProtectionTabSingularShare | approved |
+| PT-C54 | templates/fleet_protection.html (headline, exactly 1 caught in total) | (new) | In the last {days} days, 1 request looked like an attack, to 1 app. | TestFleetProtectionSingularHeadlines | approved |
+| PT-C55 | templates/fleet_protection.html (headline, more than 1 caught, all to one app) | (new) | In the last {days} days, {caught} requests to 1 app looked like attacks. | TestFleetProtectionSingularHeadlines | approved |
+| PT-C56 | templates/fleet_protection.html (no counts yet, replaces the headline) | (new) | No protection counts yet. Counting starts once the servers take the release that adds it, and only while protection is on. | gate | approved |
+| PT-C57 | templates/app_protection.html (aria-label of the range links) | (new) | Period | gate | approved |
diff --git a/internal/console/approved_protection_copy_test.go b/internal/console/approved_protection_copy_test.go
index f614ffc68..9c21a0edc 100644
--- a/internal/console/approved_protection_copy_test.go
+++ b/internal/console/approved_protection_copy_test.go
@@ -29,6 +29,9 @@ var protectionCopyBuilt = map[string]bool{
"PT-C34": true, "PT-C35": true, "PT-C36": true, "PT-C37": true,
// Task 7: the operator page.
"PT-C40": true, "PT-C41": true, "PT-C42": true, "PT-C43": true,
+ // The singular headlines, the operator empty state and the range label.
+ "PT-C50": true, "PT-C51": true, "PT-C52": true, "PT-C53": true,
+ "PT-C54": true, "PT-C55": true, "PT-C56": true, "PT-C57": true,
}
func parseProtectionCopyDeck(t *testing.T) []navCopyRow {
diff --git a/internal/console/protectionview_test.go b/internal/console/protectionview_test.go
index c181620f5..f51e0e226 100644
--- a/internal/console/protectionview_test.go
+++ b/internal/console/protectionview_test.go
@@ -682,3 +682,156 @@ func TestFleetProtectionShowsDaysAndGroups(t *testing.T) {
// names it.
ptWant(t, page, "<th scope=\"row\">"+protectionGroupName("probe/php")+"</th> <td>10</td>")
}
+
+// The singular headlines: the row that names "1 request" is chosen when the
+// count it names is exactly 1, and its plural neighbour for 2.
+func TestProtectionTabSingularWatchHeadline(t *testing.T) {
+ for _, tc := range []struct {
+ watch int64
+ id string
+ fill map[string]string
+ refuse string
+ }{
+ {1, "PT-C50", map[string]string{"days": "7"}, "looked like attacks"},
+ {2, "PT-C02", map[string]string{"days": "7", "caught": "2"}, "looked like an attack."},
+ } {
+ fx, c := ptFixture(t)
+ ptSeed(t, fx, 150, tc.watch, 0, map[string]int64{"probe/php": tc.watch})
+ page := ptPage(t, fx, c, "")
+ ptWant(t, page, ptCopy(t, tc.id, tc.fill))
+ ptRefuse(t, page, tc.refuse)
+ }
+}
+
+func TestProtectionTabSingularBlockHeadline(t *testing.T) {
+ for _, tc := range []struct {
+ block int64
+ id string
+ fill map[string]string
+ }{
+ {1, "PT-C51", map[string]string{"days": "7"}},
+ {2, "PT-C03", map[string]string{"days": "7", "blocked": "2"}},
+ } {
+ fx, c := ptFixture(t)
+ ptSeed(t, fx, 150, 0, tc.block, map[string]int64{"hard/secrets": tc.block})
+ page := ptPage(t, fx, c, "")
+ ptWant(t, page, ptCopy(t, tc.id, tc.fill))
+ if tc.block == 1 {
+ ptRefuse(t, page, "1 requests")
+ }
+ }
+}
+
+func TestProtectionTabSingularMixedHeadline(t *testing.T) {
+ for _, tc := range []struct {
+ block, watch int64
+ id string
+ fill map[string]string
+ }{
+ {1, 5, "PT-C52", map[string]string{"days": "7", "watched": "5"}},
+ {1, 1, "PT-C52", map[string]string{"days": "7", "watched": "1"}},
+ {2, 5, "PT-C04", map[string]string{"days": "7", "blocked": "2", "watched": "5"}},
+ {2, 1, "PT-C04", map[string]string{"days": "7", "blocked": "2", "watched": "1"}},
+ } {
+ fx, c := ptFixture(t)
+ ptSeed(t, fx, 150, tc.watch, tc.block, map[string]int64{"hard/secrets": tc.block, "probe/php": tc.watch})
+ page := ptPage(t, fx, c, "")
+ ptWant(t, page, ptCopy(t, tc.id, tc.fill))
+ if tc.block == 1 {
+ ptRefuse(t, page, "blocked 1 requests")
+ }
+ }
+}
+
+// One request checked and caught is "all of the 1 request", never "100% of
+// the 1 requests"; two checked and one caught keeps the percentage.
+func TestProtectionTabSingularShare(t *testing.T) {
+ for _, tc := range []struct {
+ checked, watch int64
+ want, refuse string
+ }{
+ {1, 1, ptCopy(t, "PT-C53", nil), "That's 100%"},
+ {2, 1, ptCopy(t, "PT-C05", map[string]string{"pct": "50%", "checked": "2"}), "all of the"},
+ {2, 2, ptCopy(t, "PT-C05", map[string]string{"pct": "100%", "checked": "2"}), "all of the"},
+ } {
+ fx, c := ptFixture(t)
+ ptSeed(t, fx, tc.checked, tc.watch, 0, map[string]int64{"probe/php": tc.watch})
+ page := ptPage(t, fx, c, "")
+ ptWant(t, page, tc.want)
+ ptRefuse(t, page, tc.refuse)
+ }
+}
+
+// The range links are a nav named as the Analytics tab names its own.
+func TestProtectionTabRangeNavLabel(t *testing.T) {
+ fx, c := ptFixture(t)
+ ptSeed(t, fx, 40, 0, 0, nil)
+ page := ptPage(t, fx, c, "")
+ ptWant(t, page, `<nav class="an-range" aria-label="`+ptCopy(t, "PT-C57", nil)+`">`)
+}
+
+// fpOneApp is an operator console with the single app shop counted.
+func fpOneApp(t *testing.T, checked, watch, block int64) (*consoleFixture, *http.Client) {
+ t.Helper()
+ fx := newConsoleFixture(t)
+ c := signInOperator(t, fx)
+ fpGuard(t, fx.rel, "box-a", ptHost, "bab", "shop", checked, watch, block)
+ return fx, c
+}
+
+// The operator headline: exactly 1 caught is PT-C54, more than 1 all to one
+// app is PT-C55, and the plural across apps stays PT-C41.
+func TestFleetProtectionSingularHeadlines(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ watch, block int64
+ twoApps bool
+ id string
+ fill map[string]string
+ }{
+ {"one request, watched", 1, 0, false, "PT-C54", map[string]string{"days": "7"}},
+ {"one request, blocked", 0, 1, false, "PT-C54", map[string]string{"days": "7"}},
+ {"two requests, one app", 2, 0, false, "PT-C55", map[string]string{"days": "7", "caught": "2"}},
+ {"mixed, one app", 3, 2, false, "PT-C55", map[string]string{"days": "7", "caught": "5"}},
+ {"one request in each of two apps", 1, 0, true, "PT-C41", map[string]string{"days": "7", "caught": "2", "apps": "2"}},
+ } {
+ fx, c := fpOneApp(t, 100, tc.watch, tc.block)
+ if tc.twoApps {
+ fpGuard(t, fx.rel, "box-a", "blog.example.com", "bab", "blog", 100, 1, 0)
+ }
+ page := fpPage(t, fx, c, "")
+ ptWant(t, page, ptCopy(t, tc.id, tc.fill))
+ if tc.id != "PT-C41" {
+ ptRefuse(t, page, "across")
+ }
+ if tc.id == "PT-C54" {
+ ptRefuse(t, page, "1 requests")
+ }
+ }
+ // 30 days says 30.
+ fx, c := fpOneApp(t, 100, 1, 0)
+ ptWant(t, fpPage(t, fx, c, "?range=30d"), ptCopy(t, "PT-C54", map[string]string{"days": "30"}))
+}
+
+// One request checked and caught across the platform is "all of the 1
+// request" on the operator page too.
+func TestFleetProtectionSingularShare(t *testing.T) {
+ fx, c := fpOneApp(t, 1, 1, 0)
+ page := fpPage(t, fx, c, "")
+ ptWant(t, page, ptCopy(t, "PT-C53", nil))
+ ptRefuse(t, page, "That's 100%")
+}
+
+// Nothing checked anywhere is PT-C56 in place of the headline, with no
+// headline, share or zeros beside it; the first counted request ends it.
+func TestFleetProtectionNoCountsYet(t *testing.T) {
+ fx := newConsoleFixture(t)
+ c := signInOperator(t, fx)
+ page := fpPage(t, fx, c, "")
+ ptWant(t, page, ptCopy(t, "PT-C56", nil))
+ ptRefuse(t, page, ptHeadlineLead, "That's", "<td>")
+
+ fpGuard(t, fx.rel, "box-a", ptHost, "bab", "shop", 100, 0, 0)
+ page = fpPage(t, fx, c, "")
+ ptRefuse(t, page, ptCopy(t, "PT-C56", nil))
+}
diff --git a/internal/console/templates/app_protection.html b/internal/console/templates/app_protection.html
index 023dcb25d..09550d128 100644
--- a/internal/console/templates/app_protection.html
+++ b/internal/console/templates/app_protection.html
@@ -7,7 +7,7 @@
{{with .Protection}}
{{/* Two links rather than a select and a button, as the Analytics tab:
one click, and every view is a URL. */}}
-<nav class="an-range">
+<nav class="an-range" aria-label="Period">
<a href="?range=7d"{{if eq .Range "7d"}} aria-current="page"{{end}}>7 days</a>
<a href="?range=30d"{{if eq .Range "30d"}} aria-current="page"{{end}}>30 days</a>
</nav>
@@ -17,12 +17,12 @@
{{if .Err}}<p class="banner error">{{.Err}}</p>
{{else if not .Sum.Checked}}<p class="an-empty">No protection counts yet for this app. Counting starts once the servers that run it take the release that adds it, and only while protection is on.</p>
{{else}}
-<p class="an-insights"><strong>{{if and .Sum.Watch (not .Sum.Block)}}In the last {{.Days}} days, {{count .Sum.Watch}} requests to this app looked like attacks. Protection is recording them and letting them through while we check it never stops a real visitor.
-{{- else if and .Sum.Block (not .Sum.Watch)}}In the last {{.Days}} days, protection blocked {{count .Sum.Block}} requests to this app.
-{{- else if .Caught}}In the last {{.Days}} days, protection blocked {{count .Sum.Block}} requests to this app and recorded {{count .Sum.Watch}} more.
+<p class="an-insights"><strong>{{if and .Sum.Watch (not .Sum.Block)}}{{if eq .Sum.Watch 1}}In the last {{.Days}} days, 1 request to this app looked like an attack. Protection recorded it and let it through while we check it never stops a real visitor.{{else}}In the last {{.Days}} days, {{count .Sum.Watch}} requests to this app looked like attacks. Protection is recording them and letting them through while we check it never stops a real visitor.{{end}}
+{{- else if and .Sum.Block (not .Sum.Watch)}}{{if eq .Sum.Block 1}}In the last {{.Days}} days, protection blocked 1 request to this app.{{else}}In the last {{.Days}} days, protection blocked {{count .Sum.Block}} requests to this app.{{end}}
+{{- else if .Caught}}{{if eq .Sum.Block 1}}In the last {{.Days}} days, protection blocked 1 request to this app and recorded {{count .Sum.Watch}} more.{{else}}In the last {{.Days}} days, protection blocked {{count .Sum.Block}} requests to this app and recorded {{count .Sum.Watch}} more.{{end}}
{{- else}}Nothing in the last {{.Days}} days looked like an attack.{{end}}</strong></p>
{{if .Caught}}
-<p class="an-quality small">That's {{.Share}} of the {{count .Sum.Checked}} requests protection checked.</p>
+<p class="an-quality small">{{if eq .Sum.Checked 1}}That's all of the 1 request protection checked.{{else}}That's {{.Share}} of the {{count .Sum.Checked}} requests protection checked.{{end}}</p>
{{with .Chart}}
<h3 id="pt-days">Day by day</h3>
{{/* The Analytics chart's markup: a column per day, its bar what was
diff --git a/internal/console/templates/fleet_protection.html b/internal/console/templates/fleet_protection.html
index dc1248b3d..fe924ed2c 100644
--- a/internal/console/templates/fleet_protection.html
+++ b/internal/console/templates/fleet_protection.html
@@ -10,10 +10,11 @@
{{/* A failed read stands alone: no headline, no table and no zeros. */}}
{{if .Err}}<div rst-callout rst-tone="negative"><span rst-callout-ic aria-hidden="true">{{icon "triangle-alert"}}</span><div rst-callout-body><p>{{.Err}}</p></div></div>
{{else}}
-{{/* Nothing checked across the platform says no headline: a count of
- nothing caught would claim requests nobody counted. */}}
-{{if .Sum.Checked}}<p><strong>In the last {{.Days}} days, {{count .Caught}} requests across {{len .Rows}} apps looked like attacks.</strong></p>
-{{if .Caught}}<p co-note>That's {{.Share}} of the {{count .Sum.Checked}} requests protection checked.</p>{{end}}{{end}}
+{{/* Nothing checked across the platform says so and gives no headline: a
+ count of nothing caught would claim requests nobody counted. */}}
+{{if .Sum.Checked}}<p><strong>{{if eq .Caught 1}}In the last {{.Days}} days, 1 request looked like an attack, to 1 app.{{else if and (gt .Caught 1) (eq (len .Rows) 1)}}In the last {{.Days}} days, {{count .Caught}} requests to 1 app looked like attacks.{{else}}In the last {{.Days}} days, {{count .Caught}} requests across {{len .Rows}} apps looked like attacks.{{end}}</strong></p>
+{{if .Caught}}<p co-note>{{if eq .Sum.Checked 1}}That's all of the 1 request protection checked.{{else}}That's {{.Share}} of the {{count .Sum.Checked}} requests protection checked.{{end}}</p>{{end}}
+{{else}}<p>No protection counts yet. Counting starts once the servers take the release that adds it, and only while protection is on.</p>{{end}}
{{if .Unread}}<div rst-callout rst-tone="negative"><span rst-callout-ic aria-hidden="true">{{icon "triangle-alert"}}</span><div rst-callout-body><p>These fleets' counts could not be read and are left out: {{.Unread}}.</p></div></div>{{end}}
<div rst-card class="co-table-wrap">
<table co-table>