carlos / platform Public

console: the perf walk measures the plan keep page on a seeded lapsed account

The walk's fixture now carries the example plan catalogue and an account
paul owns on the lapse path (two apps, three instance records, free for
eight days after paying, the two newest turned off by the grace pass),
keepFixture's shape. The keep page is requested like any other screen
instead of skipped. Measured warm: 8 S3 calls (each app's instance
records listed and read, its sidecars listed, the domain claims listed),
median 209 ms under the walk's latency, so it is recorded over: with
that reason. No other screen's counts or the session total move.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 22df54a733a97758569dfc60a469496eadb9a987 parent f765166
2 files changed, +42 −2
  • internal/console/perfwalk_test.go +41 −1
  • internal/console/testdata/perf-budgets.txt +1 −1
diff --git a/internal/console/perfwalk_test.go b/internal/console/perfwalk_test.go
index cb945dd4c..3458d3fd2 100644
--- a/internal/console/perfwalk_test.go
+++ b/internal/console/perfwalk_test.go
@@ -84,7 +84,10 @@ const (
// a path, and the walk's in-flight counter, keyed by fixture.
type perfSeeds struct {
invite, emailLink string
- inflight *atomic.Int32
+ // lapsed is the sqid of the account seeded on the lapse path, for
+ // the keep page.
+ lapsed string
+ inflight *atomic.Int32
}
var perfSeeded sync.Map // *consoleFixture -> *perfSeeds
@@ -327,6 +330,12 @@ func perfSeed(t *testing.T, fx *consoleFixture, seeds *perfSeeds) {
}
}
+ // A plan catalogue, so the plan pages are live, and an account paul
+ // owns on the lapse path for the keep page: two apps and three
+ // instance records, free for eight days after paying, so the grace
+ // pass has turned the two newest off (keepFixture's shape).
+ perfSeedLapsed(t, fx, seeds)
+
// Every object was written seconds ago, and readers that trust an
// object's stamp only once it has settled (domains.ClaimCache's
// modSettle, two seconds) would re-read them for the first moments of
@@ -339,6 +348,36 @@ func perfSeed(t *testing.T, fx *consoleFixture, seeds *perfSeeds) {
perfSeedGoneBoxes(t, fx, 1100)
}
+// perfSeedLapsed turns the plan catalogue on and seeds the lapsed
+// account the keep page lists.
+func perfSeedLapsed(t *testing.T, fx *consoleFixture, seeds *perfSeeds) {
+ t.Helper()
+ fx.srv.cfg.PlanCatalog = examplePlanCatalog(t)
+ acct := planAccount(t, fx, 501)
+ if err := fx.st.AddMember(acct.ID, "paul@keymail.dev", RoleOwner, time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ // The grace pass mails the account's owners its notice: to a fake
+ // for the seeding only, so the walk's pages run on the console's own
+ // mail wiring.
+ prevMail, prevFederated := fx.srv.consoleMail, fx.srv.sendFederated
+ fx.srv.consoleMail, fx.srv.sendFederated = &fakeConsoleMail{ready: true}, nil
+ defer func() { fx.srv.consoleMail, fx.srv.sendFederated = prevMail, prevFederated }()
+ base := time.Now().Add(-8 * 24 * time.Hour)
+ lapseApp_(t, fx, acct, "shop", base.Add(-100*time.Hour))
+ lapseInstanceRec(t, fx, acct, "shop", "shop-1.example.com", base.Add(-99*time.Hour))
+ lapseApp_(t, fx, acct, "blog", base.Add(-98*time.Hour))
+ lapseInstanceRec(t, fx, acct, "blog", "blog-1.example.com", base.Add(-97*time.Hour))
+ lapseInstanceRec(t, fx, acct, "shop", "shop-2.example.com", base.Add(-96*time.Hour))
+ applyPlan(t, fx, acct, "personal", nil, nil, base.Add(-time.Hour))
+ applyPlan(t, fx, acct, "free", nil, nil, base)
+ fx.srv.planGracePass(context.Background(), time.Now())
+ if got, want := disabledOf(t, fx, acct), []string{"blog-1.example.com", "shop-2.example.com"}; !slices.Equal(got, want) {
+ t.Fatalf("perf fixture: the lapsed account's disabled = %v, want %v", got, want)
+ }
+ seeds.lapsed = acct.Sqid
+}
+
// perfAgeObjects sets every object's modification time in the fixture's
// DirStore back by age.
func perfAgeObjects(t *testing.T, fx *consoleFixture, age time.Duration) {
@@ -415,6 +454,7 @@ func perfTargets(fx *consoleFixture) map[string][]perfTarget {
"GET /a/{sqid}/trash": ok(fx.path("/trash")),
"GET /a/{sqid}/apps/{app}": ok(app),
"GET /a/{sqid}/apps/{app}/instances/{host}": ok(app + "/instances/kass.carlosapp.dev"),
+ "GET /a/{sqid}/plan/keep": ok("/a/" + seeds.lapsed + "/plan/keep"),
}
for _, tab := range []string{"account-review", "activity", "analytics", "availability", "deployments", "errors",
"instances", "logs", "logs/data", "pipeline", "releases", "settings"} {
diff --git a/internal/console/testdata/perf-budgets.txt b/internal/console/testdata/perf-budgets.txt
index d547bf97b..f1d092950 100644
--- a/internal/console/testdata/perf-budgets.txt
+++ b/internal/console/testdata/perf-budgets.txt
@@ -27,7 +27,6 @@ GET /auth/cli/whoami skip: a bearer-token JSON door, not a screen; timed in prod
/fleet/economics/bill skip: POST-only door; a GET answers 404 on its first line by design (economicspass.go)
/fleet/economics/scenarios skip: POST-only door; a GET answers 404 on its first line by design (economicspass.go)
/fleet/economics/tier skip: POST-only door; a GET answers 404 on its first line by design (economicspass.go)
-GET /a/{sqid}/plan/keep skip: dormant without CARLOS_PLAN_CATALOG, which the walk's fixture does not set; its gate answers 404 on its first line (planlapse_keep.go). Measure it once a fixture carries a plan catalogue
# Deferred parts: timed and printed, exempt from 150 ms and the call count.
GET /a/{sqid}/apps/{app}/logs/data deferred: deferred part (the Logs tab's data endpoint)
@@ -53,6 +52,7 @@ GET /a/{sqid}/apps/{app}/settings over: populateAppSettings builds every section
GET /a/{sqid}/apps/{app}/settings/{section} over: every section is built whichever one is shown, as on the general section (34 S3 calls warm; the pipeline section 8)
GET /a/{sqid}/fleet over: reads status/fleet.json and lists and reads each customer fleet's box reports (3 S3 calls warm)
GET /a/{sqid}/fleets/{fleet} over: lists and reads the fleet's box reports (2 S3 calls warm)
+GET /a/{sqid}/plan/keep over: the lapse inventory lists every app's instance records and reads each one, lists every app's sidecar records, and lists the domain claims (8 S3 calls warm for two apps and three instances, median 209 ms; it grows with the account)
GET /a/{sqid}/settings over: reads the account and app telemetry settings and the storage entitlement (3 S3 calls warm)
GET /a/{sqid}/trash over: reads each trashed app's deleted.json marker (1 S3 call warm per app)
GET /a/{sqid}/{$} over: the account home lists and reads every app's channels and its production flag (5 S3 calls warm)