carlos / platform Public

Probe burst limit: approved copy deck and its gate test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev b9feabfd67999d2dc2c631de9b7c92051bd4b2e1 parent 0fa5f59
2 files changed, +175 −0
  • docs/superpowers/plans/2026-10-31-probe-burst-limit-copy.md +43 −0
  • internal/console/approved_burst_copy_test.go +132 −0

CI failed — run details

diff --git a/docs/superpowers/plans/2026-10-31-probe-burst-limit-copy.md b/docs/superpowers/plans/2026-10-31-probe-burst-limit-copy.md
new file mode 100644
index 000000000..8b9e4b498
--- /dev/null
+++ b/docs/superpowers/plans/2026-10-31-probe-burst-limit-copy.md
@@ -0,0 +1,43 @@
+# Probe burst limit: copy deck
+
+Every new user-facing string of the probe burst limit plan
+(`2026-10-31-probe-burst-limit.md`). The gate is
+`internal/console/approved_burst_copy_test.go`
+(`TestBurstCopyDeckIsApprovedAndApplied`).
+
+Approved 2026-10-31 by Paul in copy review (copy-review skill), all 12 rows unchanged from the draft. The text below is the approved text, verbatim.
+
+The rules (the same as the Protection tab deck,
+`2026-10-30-console-protection-tab-copy.md`):
+
+- One table, columns `| id | where | old | new | checked by | status |`. A row
+ is one line.
+- `where` is a path relative to the repository root, 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. `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 `burstCopyBuilt`) 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 at run time: `{code}` the refusal
+ reference, `{app}` the app name.
+
+| id | where | old | new | checked by | status |
+| --- | --- | --- | --- | --- | --- |
+| PB-C01 | internal/edge/burst_refusal.go (429 body) | (new) | Too many requests for pages that do not exist came from your network. Try again in a few minutes. Reference: {code} | gate | approved |
+| PB-C02 | internal/console/protectiongroups.go (group name) | (new) | Bursts of probes from one address | gate | approved |
+| PB-C03 | internal/console/templates/app_protection.html (switch heading) | (new) | Record only | gate | approved |
+| PB-C04 | internal/console/templates/app_protection.html (switch explanation) | (new) | When this is on, protection records what it would have blocked on this app and blocks nothing. Use it if protection is stopping something real while you fix it. | gate | approved |
+| PB-C05 | internal/console/templates/app_protection.html (turn on button) | (new) | Record only for this app | gate | approved |
+| PB-C06 | internal/console/templates/app_protection.html (turn off button) | (new) | Let protection block again | gate | approved |
+| PB-C07 | internal/console/templates/app_protection.html (notice while on) | (new) | Protection is recording only for this app. Nothing is blocked. | gate | approved |
+| PB-C08 | internal/console/protectionsetting.go (flash, switch saved, on) | (new) | Protection now records only for this app. It takes effect within seconds. | gate | approved |
+| PB-C09 | internal/console/protectionsetting.go (flash, switch saved, off) | (new) | Protection can block on this app again. It takes effect within seconds. | gate | approved |
+| PB-C10 | protection_cmd.go (CLI help) | (new) | carlos protection [--account a] [--app x] [--record-only on|off]: show or set whether protection only records on this app | gate | approved |
+| PB-C11 | protection_cmd.go (CLI result, on) | (new) | Protection records only on {app}. Nothing is blocked. | TestProtectionCmdSetsAndShows | approved |
+| PB-C12 | protection_cmd.go (CLI result, off) | (new) | Protection can block on {app} again. | TestProtectionCmdSetsAndShows | approved |
diff --git a/internal/console/approved_burst_copy_test.go b/internal/console/approved_burst_copy_test.go
new file mode 100644
index 000000000..c2b89e51f
--- /dev/null
+++ b/internal/console/approved_burst_copy_test.go
@@ -0,0 +1,132 @@
+package console
+
+import (
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+// The copy gate of the probe burst limit plan
+// (docs/superpowers/plans/2026-10-31-probe-burst-limit.md). The deck is
+// docs/superpowers/plans/2026-10-31-probe-burst-limit-copy.md, in the same
+// shape as the Protection tab deck (approved_protection_copy_test.go). Its
+// "where" paths are relative to the repository root, because the strings live
+// in several packages, so the gate resolves them from there.
+const (
+ burstCopyRoot = "../.."
+ burstCopyDeckPath = burstCopyRoot + "/docs/superpowers/plans/2026-10-31-probe-burst-limit-copy.md"
+)
+
+// burstCopyBuilt 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 burstCopyBuilt = map[string]bool{
+ // Task 1: the 429 body already lives in internal/edge/burst_refusal.go.
+ "PB-C01": true,
+}
+
+func parseBurstCopyDeck(t *testing.T) []navCopyRow {
+ t.Helper()
+ raw, err := os.ReadFile(burstCopyDeckPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var rows []navCopyRow
+ for _, line := range strings.Split(string(raw), "\n") {
+ if !strings.HasPrefix(line, "| PB-") {
+ 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 TestBurstCopyDeckIsApprovedAndApplied(t *testing.T) {
+ rows := parseBurstCopyDeck(t)
+ if len(rows) < 12 {
+ t.Fatalf("deck parsed %d rows, want at least 12", 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 burstCopyBuilt {
+ if _, ok := byID[id]; !ok {
+ t.Errorf("burstCopyBuilt names %s, which has no deck row", id)
+ }
+ }
+
+ // A named test can live in any package of the repository, so look through
+ // every test file under the root rather than only this package's.
+ var sources string
+ testSources := func() string {
+ if sources == "" {
+ var b strings.Builder
+ err := filepath.WalkDir(burstCopyRoot, func(p string, d os.DirEntry, err error) error {
+ if err != nil {
+ return err
+ }
+ if d.IsDir() && (d.Name() == ".git" || d.Name() == ".superpowers") {
+ return filepath.SkipDir
+ }
+ if d.IsDir() || !strings.HasSuffix(p, "_test.go") {
+ return nil
+ }
+ raw, err := os.ReadFile(p)
+ if err != nil {
+ return err
+ }
+ b.Write(raw)
+ b.WriteByte('\n')
+ return nil
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ sources = b.String()
+ }
+ return sources
+ }
+
+ for _, r := range rows {
+ if !burstCopyBuilt[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(filepath.Join(burstCopyRoot, 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)
+ }
+ }
+}