Protection tab follow-ups (discussion 479): singular headlines for counts of one on the tab and the operator page (PT-C50..C55), an operator empty state when nothing was checked (PT-C56) and the approved 'nothing looked like an attack' line (PT-C06) when nothing was caught, the tab's range nav aria-label 'Period' (PT-C57), a same-box Logs-cap regression test for the protection filter, and an hourly throttle on the console's unreadable-fleet log line. Copy PT-C50..C57 approved by Paul unchanged. Review: Astra whole-branch R1, no findings. Not released.
Squashed from protection-tab-followups into main.
8 files changed,
+284
−16
docs/superpowers/plans/2026-10-30-console-protection-tab-copy.md+14 −1internal/console/approved_protection_copy_test.go+3 −0internal/console/edgedays.go+35 −1internal/console/edgedays_test.go+35 −0internal/console/protectionview_test.go+184 −5internal/console/server.go+3 −0internal/console/templates/app_protection.html+5 −5internal/console/templates/fleet_protection.html+5 −4
CI cancelled — superseded by a newer push — run details
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..09737a4d8 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`): |
| @@ -38,7 +43,7 @@ The rules (the same as the analytics on-ramp deck, |
| | 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-C06 | templates/app_protection.html and templates/fleet_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 | |
| @@ -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 and templates/fleet_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/edgedays.go b/internal/console/edgedays.go| index 5087fad3f..3b2186023 100644 |
| --- a/internal/console/edgedays.go |
| +++ b/internal/console/edgedays.go |
| @@ -9,6 +9,8 @@ import ( |
| "os" |
| "sort" |
| "strings" |
| + "sync" |
| + "time" |
| "github.com/carlosframework/platform/internal/release" |
| "github.com/carlosframework/platform/internal/usage" |
| @@ -73,7 +75,7 @@ func (s *Server) readEdgeDays(ctx context.Context, st release.Store, dates []str |
| if acct != "" || ctx.Err() != nil { |
| return nil, nil, fmt.Errorf("fleet %s: %w", f.name, err) |
| } |
| - log.Printf("console: edge days: fleet %s left out: %v", f.name, err) |
| + s.logUnreadFleet(f.name, err) |
| unread = append(unread, f.name) |
| continue |
| } |
| @@ -84,6 +86,38 @@ func (s *Server) readEdgeDays(ctx context.Context, st release.Store, dates []str |
| return out, unread, nil |
| } |
| +// edgeDayLogEvery is how often one fleet's unreadable day is logged: the |
| +// operator's page reads every fleet on every view, so a fleet that stays |
| +// unreadable would otherwise log on each one. |
| +const edgeDayLogEvery = time.Hour |
| + |
| +// edgeDayLogState is the log's memory, kept on the Server: when each fleet's |
| +// unreadable day was last logged. |
| +type edgeDayLogState struct { |
| + edgeLogMu sync.Mutex |
| + edgeLoggedAt map[string]time.Time |
| +} |
| + |
| +// logUnreadFleet logs that fleet was left out of an operator read, at most |
| +// once per fleet per edgeDayLogEvery. The page names the fleet on every read |
| +// whether or not this logs. |
| +func (s *Server) logUnreadFleet(fleet string, err error) { |
| + now := s.now() |
| + s.edgeLogMu.Lock() |
| + if s.edgeLoggedAt == nil { |
| + s.edgeLoggedAt = map[string]time.Time{} |
| + } |
| + last, logged := s.edgeLoggedAt[fleet] |
| + due := !logged || now.Sub(last) >= edgeDayLogEvery |
| + if due { |
| + s.edgeLoggedAt[fleet] = now |
| + } |
| + s.edgeLogMu.Unlock() |
| + if due { |
| + log.Printf("console: edge days: fleet %s left out: %v", fleet, err) |
| + } |
| +} |
| + |
| // edgeDayFleet is a fleet readEdgeDays reads: its name and its owner. |
| type edgeDayFleet struct{ name, account string } |
diff --git a/internal/console/edgedays_test.go b/internal/console/edgedays_test.go| index bd027b3ba..ec995c04d 100644 |
| --- a/internal/console/edgedays_test.go |
| +++ b/internal/console/edgedays_test.go |
| @@ -1,9 +1,11 @@ |
| package console |
| import ( |
| + "bytes" |
| "context" |
| "encoding/json" |
| "io" |
| + "log" |
| "net/http" |
| "reflect" |
| "strings" |
| @@ -266,6 +268,39 @@ func TestReadEdgeDaysOperatorSkipsBadFleet(t *testing.T) { |
| } |
| } |
| +// The operator page reads every fleet on every view, so an unreadable |
| +// fleet's log line is throttled: once per fleet per hour. The answer does not |
| +// change with it. |
| +func TestReadEdgeDaysUnreadableFleetLogsOncePerHour(t *testing.T) { |
| + fx := edForeignFixture(t) |
| + clock := time.Date(2026, 11, 2, 10, 0, 0, 0, time.UTC) |
| + fx.srv.opNow = func() time.Time { return clock } |
| + var logs bytes.Buffer |
| + prev := log.Writer() |
| + log.SetOutput(&logs) |
| + t.Cleanup(func() { log.SetOutput(prev) }) |
| + read := func() { |
| + t.Helper() |
| + _, unread, err := fx.srv.readEdgeDays(context.Background(), fx.rel, []string{edDate}, "") |
| + if err != nil || !reflect.DeepEqual(unread, []string{"f2"}) { |
| + t.Fatalf("operator read = %v, %v, want f2 unread", unread, err) |
| + } |
| + } |
| + logged := func() int { return strings.Count(logs.String(), "edge days: fleet f2 left out") } |
| + |
| + read() |
| + clock = clock.Add(59 * time.Minute) |
| + read() |
| + if n := logged(); n != 1 { |
| + t.Errorf("two reads inside the hour logged %d times, want once", n) |
| + } |
| + clock = clock.Add(time.Minute) |
| + read() |
| + if n := logged(); n != 2 { |
| + t.Errorf("a read after the hour: %d log lines in all, want 2", n) |
| + } |
| +} |
| + |
| // The rate-limit GET reads only the fleets the instance's account owns: a |
| // foreign fleet's malformed day does not fail it. |
| func TestRateLimitCountsIgnoresForeignFleet(t *testing.T) { |
diff --git a/internal/console/protectionview_test.go b/internal/console/protectionview_test.go| index 231d656a0..fd3f47d43 100644 |
| --- a/internal/console/protectionview_test.go |
| +++ b/internal/console/protectionview_test.go |
| @@ -374,6 +374,32 @@ func TestLogsProtectionFilterBeforeCap(t *testing.T) { |
| } |
| } |
| +// The same, with the match and the ordinary records on ONE box. The cap is |
| +// per box, so a filter applied after it (but before the boxes merge) would |
| +// pass the two-box test above and still lose the match here: its chunk comes |
| +// first, and the cap's trim takes the box's oldest record. |
| +func TestLogsProtectionFilterBeforeCapOneBox(t *testing.T) { |
| + if testing.Short() { |
| + t.Skip("writes a full collect cap of records") |
| + } |
| + fx, c := ptFixture(t) |
| + start := time.Now().UTC().Add(-30 * time.Minute) |
| + ptLogRecords(t, fx, "box-a", []applog.Record{ptEdgeRecord(start, 1, "block", "hard.secrets.env", "/.env")}) |
| + bulk := make([]applog.Record, logsCollectCap+1) |
| + for i := range bulk { |
| + bulk[i] = ptEdgeRecord(start.Add(time.Second+time.Duration(i)*time.Millisecond), uint64(10+i), "", "", fmt.Sprintf("/p%d", i)) |
| + } |
| + ptLogRecords(t, fx, "box-a", bulk) |
| + |
| + if got := ptMsgs(ptLogsData(t, fx, c, "stream=edge&protection=1&since=1h").Lines); len(got) != 1 || !strings.Contains(got[0], "hard.secrets.env") { |
| + t.Errorf("data door = %q, want the one match", got) |
| + } |
| + before := applog.EncodeCursor(applog.Record{TS: start.Add(-time.Minute), Box: "box-a", Seq: 0}) |
| + if got := ptMsgs(ptLogsData(t, fx, c, "stream=edge&protection=1&since=1h&cursor="+url.QueryEscape(before)).Lines); len(got) != 1 || !strings.Contains(got[0], "hard.secrets.env") { |
| + t.Errorf("follow = %q, want the one match", got) |
| + } |
| +} |
| + |
| func TestProtectionLogsLinkStart(t *testing.T) { |
| now := time.Date(2026, 11, 5, 13, 0, 0, 0, time.UTC) |
| for days, want := range map[int]string{7: "2026-10-30T00:00:00Z", 30: "2026-10-29T13:00:00Z"} { |
| @@ -512,8 +538,8 @@ func TestFleetProtectionListsApps(t *testing.T) { |
| ptWant(t, page, ptCopy(t, "PT-C41", map[string]string{"days": "7", "caught": "10", "apps": "2"})) |
| } |
| -// Checked traffic with nothing caught still reads as a clean window, and |
| -// has no rows. Nothing checked anywhere says no headline at all. |
| +// Checked traffic with nothing caught reads as a clean window (PT-C06, never |
| +// a count of zero requests), and has no rows. Nothing checked anywhere says no headline at all. |
| func TestFleetProtectionNothingCaught(t *testing.T) { |
| fx := newConsoleFixture(t) |
| c := signInOperator(t, fx) |
| @@ -521,10 +547,10 @@ func TestFleetProtectionNothingCaught(t *testing.T) { |
| ptRefuse(t, page, ptHeadlineLead, "That's", "<td>") |
| ptWant(t, page, "<th scope=\"col\">Account</th>") |
| - fpGuard(t, fx.rel, "box-a", ptHost, "bab", "shop", 100, 0, 0) |
| + fpGuard(t, fx.rel, "box-a", ptHost, "bab", "shop", 50, 0, 0) |
| page = fpPage(t, fx, c, "") |
| - ptWant(t, page, ptCopy(t, "PT-C41", map[string]string{"days": "7", "caught": "0", "apps": "0"})) |
| - ptRefuse(t, page, "That's", "<td>") |
| + ptWant(t, page, ptCopy(t, "PT-C06", map[string]string{"days": "7"})) |
| + ptRefuse(t, page, "That's", "<td>", "0 requests", ptCopy(t, "PT-C56", nil)) |
| } |
| func TestFleetProtectionData(t *testing.T) { |
| @@ -656,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/server.go b/internal/console/server.go| index 63f41b4ef..004be63f5 100644 |
| --- a/internal/console/server.go |
| +++ b/internal/console/server.go |
| @@ -1399,6 +1399,9 @@ type Server struct { |
| // watch's memory (lifetimes_floor.go). |
| trashSweepState |
| lifetimesFloorState |
| + // edgeDayLogState throttles the operator edge-day read's per-fleet log |
| + // line (edgedays.go). |
| + edgeDayLogState |
| // relayNow is the relay paths' clock seam: nil means time.Now. Tests |
| // drive lease expiry with it; nothing in production sets it. |
| relayNow func() time.Time |
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..20946212f 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 not .Caught}}Nothing in the last {{.Days}} days looked like an attack.{{else 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> |