carlos / platform Public

console: the scripted session polls the Logs tab's /logs/data as the page does; ceiling 992 to 1000

After each Logs view the session now makes one /logs/data request the
way app_logs.html's script makes it (the filter form's values,
limit=200, the page's cursor in place of since). The walk exempts that
deferred endpoint from its call count, so until now its S3 reads
escaped both gates. Each poll is 4 S3 requests and the session views
Logs twice, so the recorded baseline goes from 992 to 1000; nothing
else in the script changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev a6c2cb47bed1aeeb72c412082769f04777b75cb9 parent f5599d4
2 files changed, +78 −6
  • internal/console/perfwalk_test.go +77 −5
  • internal/console/testdata/perf-session-s3.txt +1 −1
diff --git a/internal/console/perfwalk_test.go b/internal/console/perfwalk_test.go
index cfc3bbde0..d9c9285d7 100644
--- a/internal/console/perfwalk_test.go
+++ b/internal/console/perfwalk_test.go
@@ -4,6 +4,7 @@ import (
"bufio"
"context"
"fmt"
+ "html"
"io"
"log"
"net/http"
@@ -11,6 +12,7 @@ import (
"net/url"
"os"
"path/filepath"
+ "regexp"
"slices"
"strconv"
"strings"
@@ -753,7 +755,8 @@ func perfSessionCeiling(t *testing.T) (int64, string, bool) {
}
// TestPerfSessionS3Requests is the whole-session count the warm walk
-// cannot give: first views, deferred loads and a write's own reads. On
+// cannot give: first views, deferred loads (the Logs tab's /logs/data
+// poll, which the walk exempts from its count) and a write's own reads. On
// newPerfFixture with latency off, signed in as Paul, it runs a fixed
// script and sums every S3 request the fake answers, with perfQuiesce
// after each step so background loads are included, and holds the total
@@ -788,17 +791,47 @@ func TestPerfSessionS3Requests(t *testing.T) {
t.Fatalf("%s answered %d, want %d:\n%s", what, status, want, body)
}
}
- view := func(p string) {
+ view := func(p string) (body string) {
t.Helper()
step("GET "+p, func() (int, string) {
- status, _, body := get(t, c, fx.ts.URL+p)
+ var status int
+ status, _, body = get(t, c, fx.ts.URL+p)
return status, body
})
+ return body
}
app := fx.path("/apps/kass")
+ // After each Logs view, one poll of its deferred part, /logs/data, made
+ // as the page's script makes it: the filter form's values, limit=200,
+ // and the page's cursor in place of since.
+ logsPoll := func(page string) {
+ t.Helper()
+ u := app + "/logs/data?" + perfLogsPollQuery(t, page).Encode()
+ step("GET "+u, func() (int, string) {
+ req, err := http.NewRequest(http.MethodGet, fx.ts.URL+u, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+ req.Header.Set("Accept", "application/json")
+ resp, err := c.Do(req)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer resp.Body.Close()
+ body, _ := io.ReadAll(resp.Body)
+ if resp.StatusCode == http.StatusOK && !strings.Contains(string(body), `"lines"`) {
+ t.Fatalf("GET %s answered no lines:\n%s", u, body)
+ }
+ return resp.StatusCode, string(body)
+ })
+ }
for _, tab := range []string{"", "/instances", "/deployments", "/releases", "/logs", "/errors", "/availability", "/analytics", "/activity"} {
- view(app + tab)
- view(app + tab)
+ for range 2 {
+ page := view(app + tab)
+ if tab == "/logs" {
+ logsPoll(page)
+ }
+ }
}
for _, s := range slices.Sorted(mapKeys(appSettingsSections)) {
view(app + "/settings/" + s)
@@ -829,3 +862,42 @@ func TestPerfSessionS3Requests(t *testing.T) {
t.Errorf("the scripted session made %d S3 requests, over the ceiling of %d in testdata/perf-session-s3.txt (%s)", total, ceiling, reason)
}
}
+
+var (
+ perfLogsCursor = regexp.MustCompile(`id="logs-filter"[^>]*data-cursor="([^"]*)"`)
+ perfLogsSelect = regexp.MustCompile(`(?s)<select name="([a-z]+)">(.*?)</select>`)
+ perfLogsOption = regexp.MustCompile(`<option value="([^"]*)"( selected)?>`)
+)
+
+// perfLogsPollQuery is the query the Logs page's script sends on its first
+// poll (app_logs.html): every filter select's value (the selected option,
+// or the first, as a browser submits it), limit=200, and, when the page
+// carries a cursor, that cursor with since and until dropped.
+func perfLogsPollQuery(t *testing.T, page string) url.Values {
+ t.Helper()
+ m := perfLogsCursor.FindStringSubmatch(page)
+ if m == nil {
+ t.Fatalf("the Logs page has no logs-filter form with a data-cursor:\n%s", page)
+ }
+ q := url.Values{}
+ for _, sel := range perfLogsSelect.FindAllStringSubmatch(page, -1) {
+ opts := perfLogsOption.FindAllStringSubmatch(sel[2], -1)
+ if len(opts) == 0 {
+ continue
+ }
+ v := opts[0][1]
+ for _, o := range opts {
+ if o[2] != "" {
+ v = o[1]
+ }
+ }
+ q.Set(sel[1], html.UnescapeString(v))
+ }
+ q.Set("limit", "200")
+ if cursor := html.UnescapeString(m[1]); cursor != "" {
+ q.Set("cursor", cursor)
+ q.Del("since")
+ q.Del("until")
+ }
+ return q
+}
diff --git a/internal/console/testdata/perf-session-s3.txt b/internal/console/testdata/perf-session-s3.txt
index 746b3e0fc..2f4ff340c 100644
--- a/internal/console/testdata/perf-session-s3.txt
+++ b/internal/console/testdata/perf-session-s3.txt
@@ -1 +1 @@
-992 baseline before plan 2, 2026-10-26
+1000 baseline before plan 2, 2026-10-26