carlos / platform Public

console: protection tab copy deck, reviewed by Paul

The deck holds the 38 strings of the Protection tab, approved unchanged
by Paul on 2026-10-30. The gate test fails on any pending row or em dash
and checks built rows against their files; nothing is built yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 3234f81543b366cc0c0537fd7ed497631d62c541 parent 7857982
2 files changed, +188 −0
  • docs/superpowers/plans/2026-10-30-console-protection-tab-copy.md +73 −0
  • internal/console/approved_protection_copy_test.go +115 −0
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
new file mode 100644
index 000000000..e166daf4c
--- /dev/null
+++ b/docs/superpowers/plans/2026-10-30-console-protection-tab-copy.md
@@ -0,0 +1,73 @@
+# Console Protection tab: copy deck
+
+Every new user-facing string of the Protection tab plan
+(`2026-10-30-console-protection-tab.md`). The gate is
+`internal/console/approved_protection_copy_test.go`
+(`TestProtectionCopyDeckIsApprovedAndApplied`).
+
+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.
+
+The rules (the same as the analytics on-ramp deck,
+`2026-10-26-analytics-onramp-copy.md`):
+
+- One table, columns `| id | where | old | new | checked by | status |`. A row
+ is one line.
+- `where` is a path relative to `internal/console/`, then a short location
+ note in parentheses. The gate searches the file named by the first token.
+- `new` is the approved text, used verbatim by the task that writes it. It is
+ `(removed)` for a string that goes. `old` is `(new)` for a string that is
+ new.
+- `checked by` is `gate` (a plain string the gate finds literally in the
+ file, once the owning task lists its id in `protectionCopyBuilt`) or the
+ name of the owning task's test, which the gate only checks exists.
+- `status` is `pending`, then `approved` or `removed`. No pending row may
+ reach code or a template.
+- No em dashes in `new`. A full stop and a new sentence instead.
+- Human text only. Error fragments, diagnostics, JSON keys and URLs are not
+ rows.
+- Placeholders in braces are filled by the template: `{days}` the range in
+ days, `{caught}` `{blocked}` `{watched}` `{checked}` request counts, `{pct}`
+ a percentage, `{apps}` an app count, `{fleets}` a list of fleet names.
+
+| id | where | old | new | checked by | status |
+| --- | --- | --- | --- | --- | --- |
+| PT-C01 | templates/appnav.html (tab) | (new) | Protection | gate | approved |
+| PT-C02 | templates/app_protection.html (watching headline) | (new) | In the last {days} days, {caught} requests to this app looked like attacks. Protection is recording them and letting them through while we check it never stops a real visitor. | TestProtectionTabRendersHeadline | approved |
+| PT-C03 | templates/app_protection.html (blocking headline) | (new) | In the last {days} days, protection blocked {blocked} requests to this app. | TestProtectionTabBlockingHeadline | approved |
+| PT-C04 | templates/app_protection.html (mixed headline) | (new) | In the last {days} days, protection blocked {blocked} requests to this app and recorded {watched} more. | TestProtectionTabMixedHeadline | approved |
+| PT-C05 | templates/app_protection.html (share) | (new) | That's {pct} of the {checked} requests protection checked. | TestProtectionTabRendersHeadline | approved |
+| PT-C06 | templates/app_protection.html (nothing caught) | (new) | Nothing in the last {days} days looked like an attack. | TestProtectionTabNothingCaught | approved |
+| PT-C10 | templates/app_protection.html (no counts yet) | (new) | 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. | gate | approved |
+| PT-C11 | templates/app_protection.html (bars heading) | (new) | Day by day | gate | approved |
+| PT-C12 | templates/app_protection.html (legend) | (new) | blocked | gate | approved |
+| PT-C13 | templates/app_protection.html (legend) | (new) | recorded | gate | approved |
+| PT-C14 | templates/app_protection.html (groups heading) | (new) | What they were after | gate | approved |
+| PT-C15 | templates/app_protection.html (logs link) | (new) | See these requests in Logs | gate | approved |
+| PT-C16 | templates/app_protection.html (range) | (new) | 7 days | gate | approved |
+| PT-C17 | templates/app_protection.html (range) | (new) | 30 days | gate | approved |
+| PT-C18 | protection.go (read error) | (new) | Protection counts could not be read just now. Try again in a moment. | gate | approved |
+| PT-C19 | templates/app_protection.html (logs note, 30-day view) | (new) | Logs keep these requests for 7 days, so older ones are counted here but no longer listed. | gate | approved |
+| PT-C20 | protectiongroups.go (group name) | (new) | Paths that try to climb out of the site's folder | gate | approved |
+| PT-C21 | protectiongroups.go (group name) | (new) | Secret files such as .env and .git | gate | approved |
+| PT-C22 | protectiongroups.go (group name) | (new) | Private keys and cloud credentials | gate | approved |
+| PT-C23 | protectiongroups.go (group name) | (new) | Database dumps | gate | approved |
+| PT-C24 | protectiongroups.go (group name) | (new) | Editor and backup copies of PHP files | gate | approved |
+| PT-C25 | protectiongroups.go (group name) | (new) | Admin pages | gate | approved |
+| PT-C26 | protectiongroups.go (group name) | (new) | Old CGI scripts and router pages | gate | approved |
+| PT-C27 | protectiongroups.go (group name) | (new) | Docker and CI config files | gate | approved |
+| PT-C28 | protectiongroups.go (group name) | (new) | Backup and dump files | gate | approved |
+| PT-C29 | protectiongroups.go (group name) | (new) | Java server pages and consoles | gate | approved |
+| PT-C30 | protectiongroups.go (group name) | (new) | Cloud server metadata | gate | approved |
+| PT-C31 | protectiongroups.go (group name) | (new) | PHP framework debug pages | gate | approved |
+| PT-C32 | protectiongroups.go (group name) | (new) | phpMyAdmin | gate | approved |
+| PT-C33 | protectiongroups.go (group name) | (new) | PHP scripts | gate | approved |
+| PT-C34 | protectiongroups.go (group name) | (new) | Server status pages | gate | approved |
+| PT-C35 | protectiongroups.go (group name) | (new) | WordPress logins and admin pages | gate | approved |
+| PT-C36 | protectiongroups.go (other) | (new) | Other | gate | approved |
+| PT-C37 | templates/app_logs.html (protection filter label) | (new) | protection matches | gate | approved |
+| PT-C40 | templates/fleet_protection.html (title) | (new) | Protection | gate | approved |
+| 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 |
diff --git a/internal/console/approved_protection_copy_test.go b/internal/console/approved_protection_copy_test.go
new file mode 100644
index 000000000..ffb7ec656
--- /dev/null
+++ b/internal/console/approved_protection_copy_test.go
@@ -0,0 +1,115 @@
+package console
+
+import (
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+// The copy gate of the console Protection tab plan
+// (docs/superpowers/plans/2026-10-30-console-protection-tab.md). The deck is
+// docs/superpowers/plans/2026-10-30-console-protection-tab-copy.md, in the
+// same shape as the analytics on-ramp deck
+// (approved_analytics_onramp_copy_test.go): one table with the columns id,
+// where, old, new, checked by, status.
+const protectionCopyDeckPath = "../../docs/superpowers/plans/2026-10-30-console-protection-tab-copy.md"
+
+// protectionCopyBuilt is every deck row whose text the code or templates
+// carry. The task that writes a row's text adds its id here in the same
+// commit. From then on a "gate" row's new text must be in its file, and any
+// other row's named test must exist.
+var protectionCopyBuilt = map[string]bool{}
+
+func parseProtectionCopyDeck(t *testing.T) []navCopyRow {
+ t.Helper()
+ raw, err := os.ReadFile(protectionCopyDeckPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var rows []navCopyRow
+ for _, line := range strings.Split(string(raw), "\n") {
+ if !strings.HasPrefix(line, "| PT-") {
+ continue
+ }
+ line = strings.TrimSpace(line)
+ line = strings.TrimSuffix(strings.TrimPrefix(line, "| "), " |")
+ cells := strings.Split(line, " | ")
+ if len(cells) != 6 {
+ t.Fatalf("deck row has %d cells, want 6: %.60q", len(cells), line)
+ }
+ rows = append(rows, navCopyRow{
+ ID: strings.TrimSpace(cells[0]), Where: strings.TrimSpace(cells[1]),
+ Old: strings.TrimSpace(cells[2]), New: strings.TrimSpace(cells[3]),
+ CheckedBy: strings.TrimSpace(cells[4]), Status: strings.TrimSpace(cells[5]),
+ })
+ }
+ return rows
+}
+
+func TestProtectionCopyDeckIsApprovedAndApplied(t *testing.T) {
+ rows := parseProtectionCopyDeck(t)
+ if len(rows) < 38 {
+ t.Fatalf("deck parsed %d rows, want at least 38", len(rows))
+ }
+ byID := map[string]navCopyRow{}
+ for _, r := range rows {
+ if _, dup := byID[r.ID]; dup {
+ t.Errorf("%s appears twice in the deck", r.ID)
+ }
+ byID[r.ID] = r
+ if r.Status != "approved" && r.Status != "removed" {
+ t.Errorf("%s status is %q, want approved or removed", r.ID, r.Status)
+ }
+ if strings.Contains(r.New, "—") {
+ t.Errorf("%s: new text holds an em dash", r.ID)
+ }
+ }
+ for id := range protectionCopyBuilt {
+ if _, ok := byID[id]; !ok {
+ t.Errorf("protectionCopyBuilt names %s, which has no deck row", id)
+ }
+ }
+
+ var sources string
+ testSources := func() string {
+ if sources == "" {
+ var b strings.Builder
+ files, err := filepath.Glob("*_test.go")
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, f := range files {
+ raw, err := os.ReadFile(f)
+ if err != nil {
+ t.Fatal(err)
+ }
+ b.Write(raw)
+ b.WriteByte('\n')
+ }
+ sources = b.String()
+ }
+ return sources
+ }
+
+ for _, r := range rows {
+ if !protectionCopyBuilt[r.ID] {
+ continue
+ }
+ if r.CheckedBy != "gate" {
+ if !strings.Contains(testSources(), "func "+r.CheckedBy+"(") {
+ t.Errorf("%s: its test %s does not exist", r.ID, r.CheckedBy)
+ }
+ continue
+ }
+ file, _, _ := strings.Cut(r.Where, " ")
+ raw, err := os.ReadFile(file)
+ if err != nil {
+ t.Errorf("%s: %v", r.ID, err)
+ continue
+ }
+ if !strings.Contains(navSpace(string(raw)), navSpace(r.New)) {
+ t.Errorf("%s: %s does not contain %q", r.ID, file, r.New)
+ }
+ }
+}