copy: edge protection Plan 2 approved (Paul, 2026-10-25), docs entry for carlos explain
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
3 files changed,
+44
−43
approved_edge_protect_copy_test.go+26 −30docs/site/cli.md+4 −0docs/superpowers/plans/2026-10-25-edge-protection-2-copy.md+14 −13
diff --git a/approved_edge_protect_copy_test.go b/approved_edge_protect_copy_test.go| index d30ca2af5..f67b5118a 100644 |
| --- a/approved_edge_protect_copy_test.go |
| +++ b/approved_edge_protect_copy_test.go |
| @@ -24,40 +24,34 @@ import ( |
| // names; |
| // - TestEdgeProtectWiredCopyIsPendingAndApplied: a wired id is a pending, |
| // non-docs row whose text is in its file; |
| -// - TestEdgeProtectCopyAccounted: every id but the docs row is built or |
| -// wired, once. |
| +// - TestEdgeProtectCopyAccounted: every id is built or wired, once; |
| +// - TestEdgeProtectCopyNoneWired: nothing is wired, the review being done. |
| const edgeProtectCopyRecordPath = "docs/superpowers/plans/2026-10-25-edge-protection-2-copy.md" |
| var edgeProtectCopyIDPattern = regexp.MustCompile(`^EP-[0-9]+$`) |
| -// edgeProtectDocsID is the one docs row. Docs are public the moment the site |
| -// syncs, so the row is written only once approved, and never wired. |
| -const edgeProtectDocsID = "EP-3" |
| - |
| -// edgeProtectCopyIDs is the record's inventory, pinned: EP-1 to EP-13. |
| +// edgeProtectCopyIDs is the record's inventory, pinned: EP-1 to EP-14. |
| var edgeProtectCopyIDs = func() []string { |
| - ids := make([]string, 0, 13) |
| - for i := 1; i <= 13; i++ { |
| + ids := make([]string, 0, 14) |
| + for i := 1; i <= 14; i++ { |
| ids = append(ids, "EP-"+strconv.Itoa(i)) |
| } |
| return ids |
| }() |
| // edgeProtectCopyBuilt is every id whose approved text the code or docs |
| -// carry. The task that writes a row's text adds its id here in the same |
| -// commit, once Paul has approved the row. It is empty while the copy review |
| -// is still to come, so the two built-copy tests run over nothing until then. |
| -var edgeProtectCopyBuilt = []string{} |
| +// carry: all fourteen since Paul's copy review of 2026-10-25, which approved |
| +// every row unedited. EP-3 is the docs entry in docs/site/cli.md and EP-14 is |
| +// the `explain` line of the top-level usage in main.go. |
| +var edgeProtectCopyBuilt = []string{ |
| + "EP-1", "EP-2", "EP-3", "EP-4", "EP-5", "EP-6", "EP-7", "EP-8", "EP-9", "EP-10", "EP-11", "EP-12", "EP-13", "EP-14", |
| +} |
| // edgeProtectCopyWired is every id whose PENDING text the code already |
| // carries, so the branch can be built and tested before the copy review. |
| -// The branch does not merge until every row is approved and built. The |
| -// review moves each id from here to edgeProtectCopyBuilt, applying Paul's |
| -// edits in the same commit. EP-3 is a docs row and is never wired. |
| -var edgeProtectCopyWired = []string{ |
| - "EP-1", // the block page, internal/edge/guard.go |
| - "EP-2", "EP-4", "EP-5", "EP-6", "EP-7", "EP-8", "EP-9", "EP-10", "EP-11", "EP-12", "EP-13", // carlos explain |
| -} |
| +// It is empty now the review is done: each id moved to edgeProtectCopyBuilt |
| +// when its row was approved. The gate stays for the next plan's copy. |
| +var edgeProtectCopyWired = []string{} |
| func mustParseEdgeProtectRecord(t *testing.T) []copyRow { |
| t.Helper() |
| @@ -138,9 +132,9 @@ func TestEdgeProtectWiredCopyIsPendingAndApplied(t *testing.T) { |
| reportAll(t, checkEdgeProtectWired(rows, edgeProtectCopyWired, edgeProtectCopyBuilt)) |
| } |
| -// checkEdgeProtectAccounted: every id in the inventory but the docs row is in |
| -// exactly one of built and wired, and the docs row is in neither while it is |
| -// pending (Task 6 writes it, once approved, and adds it to built). |
| +// checkEdgeProtectAccounted: every id in the inventory is in exactly one of |
| +// built and wired. The docs row is no exception now that it is approved and |
| +// written. |
| func checkEdgeProtectAccounted(ids, built, wired []string) []string { |
| count := map[string]int{} |
| for _, id := range built { |
| @@ -151,12 +145,6 @@ func checkEdgeProtectAccounted(ids, built, wired []string) []string { |
| } |
| var out []string |
| for _, id := range ids { |
| - if id == edgeProtectDocsID { |
| - if n := count[id]; n > 1 { |
| - out = append(out, fmt.Sprintf("%s is named %d times in built and wired", id, n)) |
| - } |
| - continue |
| - } |
| if n := count[id]; n != 1 { |
| out = append(out, fmt.Sprintf("%s is named %d times across edgeProtectCopyBuilt and edgeProtectCopyWired, want exactly 1", id, n)) |
| } |
| @@ -168,6 +156,14 @@ func TestEdgeProtectCopyAccounted(t *testing.T) { |
| reportAll(t, checkEdgeProtectAccounted(edgeProtectCopyIDs, edgeProtectCopyBuilt, edgeProtectCopyWired)) |
| } |
| +// The copy review is over: no pending text is left wired, so every string |
| +// the code speaks is an approved, built row. |
| +func TestEdgeProtectCopyNoneWired(t *testing.T) { |
| + if len(edgeProtectCopyWired) != 0 { |
| + t.Errorf("edgeProtectCopyWired = %q, want empty: the copy review approved every row", edgeProtectCopyWired) |
| + } |
| +} |
| + |
| // The gate bites: a wired row whose text is not in its file, an approved row |
| // left wired, and a docs row wired are each refused; an id in neither list |
| // and an id in both are each refused by the accounting. |
| @@ -187,7 +183,7 @@ func TestEdgeProtectGatesRefuse(t *testing.T) { |
| t.Errorf("no problem saying %q in %q", want, got) |
| } |
| } |
| - acc := checkEdgeProtectAccounted([]string{"EP-1", "EP-2", "EP-3"}, []string{"EP-1"}, []string{"EP-1"}) |
| + acc := checkEdgeProtectAccounted([]string{"EP-1", "EP-2"}, []string{"EP-1"}, []string{"EP-1"}) |
| if len(acc) != 2 || !strings.Contains(acc[0], "EP-1") || !strings.Contains(acc[1], "EP-2") { |
| t.Errorf("accounting problems = %q, want EP-1 twice and EP-2 missing", acc) |
| } |
diff --git a/docs/site/cli.md b/docs/site/cli.md| index 9a43c5d6c..3c5b0ffdd 100644 |
| --- a/docs/site/cli.md |
| +++ b/docs/site/cli.md |
| @@ -1309,6 +1309,10 @@ carlos logs --app hello --since 1h -f |
| an RE2 pattern, `--stream app` drops the platform commentary, and `--host` |
| narrows to one instance. |
| +### carlos explain |
| + |
| +`carlos explain <code> --app <a>` reads a reference code from a page the platform's edge protection answered. It says which rule fired and when, and shows the request while a record of it is kept, for 7 days. |
| + |
| ### carlos errors |
| One row per distinct error, newest first, with how many times it happened |
diff --git a/docs/superpowers/plans/2026-10-25-edge-protection-2-copy.md b/docs/superpowers/plans/2026-10-25-edge-protection-2-copy.md| index 71304a74a..cd9faa9f8 100644 |
| --- a/docs/superpowers/plans/2026-10-25-edge-protection-2-copy.md |
| +++ b/docs/superpowers/plans/2026-10-25-edge-protection-2-copy.md |
| @@ -37,26 +37,27 @@ Placeholders: |
| | id | file | text | status | |
| |---|---|---|---| |
| -| EP-1 | internal/edge/guard.go | Not found.\n\nIf you expected a page here, send this reference to the site's owner: <code> | pending | |
| +| EP-1 | internal/edge/guard.go | Not found.\n\nIf you expected a page here, send this reference to the site's owner: <code> | approved | |
| ## `carlos explain` |
| | id | file | text | status | |
| |---|---|---|---| |
| -| EP-2 | explain_cmd.go | usage: carlos explain <code> --app <a> [flags]\n\nWhat a reference code from a page the edge answered says: which protection rule fired, when, and the request it answered, while a record of it is kept. --json prints the console's answer as it is. | pending | |
| -| EP-4 | explain_cmd.go | checked yes. this deployment sealed the code | pending | |
| -| EP-5 | explain_cmd.go | checked no. the console has no key to check the seal with, so treat the rest as unchecked | pending | |
| -| EP-6 | explain_cmd.go | checked no. the code is not sealed, so anyone could have written it. treat the rest as unchecked | pending | |
| -| EP-7 | explain_cmd.go | rule not in this console's catalogue (hash <hash>) | pending | |
| -| EP-8 | explain_cmd.go | reference <code>\nwhen <time>\ntier <tier> | pending | |
| -| EP-9 | explain_cmd.go | request <method> <path> on <host>, answered <status> | pending | |
| -| EP-10 | explain_cmd.go | request not kept. it was sampled away, or is older than 7 days | pending | |
| -| EP-11 | explain_cmd.go | request the records could not be read just now. try again in a minute | pending | |
| -| EP-12 | explain_cmd.go | no reference code like that for this app. check the code, and that it came from one of this app's pages | pending | |
| -| EP-13 | explain_cmd.go | rule <rule> | pending | |
| +| EP-2 | explain_cmd.go | usage: carlos explain <code> --app <a> [flags]\n\nWhat a reference code from a page the edge answered says: which protection rule fired, when, and the request it answered, while a record of it is kept. --json prints the console's answer as it is. | approved | |
| +| EP-4 | explain_cmd.go | checked yes. this deployment sealed the code | approved | |
| +| EP-5 | explain_cmd.go | checked no. the console has no key to check the seal with, so treat the rest as unchecked | approved | |
| +| EP-6 | explain_cmd.go | checked no. the code is not sealed, so anyone could have written it. treat the rest as unchecked | approved | |
| +| EP-7 | explain_cmd.go | rule not in this console's catalogue (hash <hash>) | approved | |
| +| EP-8 | explain_cmd.go | reference <code>\nwhen <time>\ntier <tier> | approved | |
| +| EP-9 | explain_cmd.go | request <method> <path> on <host>, answered <status> | approved | |
| +| EP-10 | explain_cmd.go | request not kept. it was sampled away, or is older than 7 days | approved | |
| +| EP-11 | explain_cmd.go | request the records could not be read just now. try again in a minute | approved | |
| +| EP-12 | explain_cmd.go | no reference code like that for this app. check the code, and that it came from one of this app's pages | approved | |
| +| EP-13 | explain_cmd.go | rule <rule> | approved | |
| +| EP-14 | main.go (a fragment of the usage text) | explain what a reference code from a page the edge answered says | approved | |
| ## Docs |
| | id | file | text | status | |
| |---|---|---|---| |
| -| EP-3 | docs/site/cli.md | `carlos explain <code> --app <a>` reads a reference code from a page the platform's edge protection answered. It says which rule fired and when, and shows the request while a record of it is kept, for 7 days. | pending | |
| +| EP-3 | docs/site/cli.md | `carlos explain <code> --app <a>` reads a reference code from a page the platform's edge protection answered. It says which rule fired and when, and shows the request while a record of it is kept, for 7 days. | approved | |