operator-pages: scale timings held to the 150 ms screen budget, the dashboard's reads together
Per-read wall clocks of 20 ms (100 ms for OperatorCounts) measured the CI worker, which runs these queries about twice as slowly as a desk machine. Query shape stays held by TestOperatorQueryPlans.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+25
−18
internal/console/opstore_test.go+25 −18
CI passed — run details
diff --git a/internal/console/opstore_test.go b/internal/console/opstore_test.go| index 7c4675e71..c0eaa44ad 100644 |
| --- a/internal/console/opstore_test.go |
| +++ b/internal/console/opstore_test.go |
| @@ -757,18 +757,21 @@ func opSeedScale(t *testing.T, s *Store, now time.Time) (account int64) { |
| return 1000 + 7 |
| } |
| -// opCountsScaleBudget is OperatorCounts' own budget at scale. Its active |
| -// counts deduplicate every address signed in during the window: 60,000 |
| -// sessions for the 30-day count, which this SQLite does as a MERGE of two |
| -// sorted halves in about 40 ms on its own (reading the same 60,000 index |
| -// entries without the dedup takes 2 ms). Allowed by controller ruling |
| -// 2026-10-26: an operator-only page, still inside the 150 ms screen budget. |
| -// The other reads keep 20 ms. |
| -const opCountsScaleBudget = 100 * time.Millisecond |
| +// dashboardScaleReads are the reads /fleet makes on every view. At scale |
| +// their sum must fit the 150 ms screen budget (perfBudget) under CI, and so |
| +// must any one read on its own. Controller ruling 2026-10-27: per-read wall |
| +// clocks of 20 ms (100 ms for OperatorCounts) measured the CI worker, which |
| +// runs these queries about twice as slowly as a desk machine (OperatorCounts |
| +// 103 ms there, 48 ms here). Query shape is held by TestOperatorQueryPlans; |
| +// these tests hold the budget a person feels. |
| +var dashboardScaleReads = map[string]bool{ |
| + "OperatorCounts": true, "NewPeoplePerDay": true, "NewestPeople": true, "feed all": true, |
| +} |
| // TestOperatorCountsAtScale times every operator read on a production-sized |
| -// store. Each is printed; under CI each must answer within 20 ms, except |
| -// OperatorCounts (opCountsScaleBudget), timed as the best of scaleTimingRuns. |
| +// store. Each is printed; under CI each must answer within perfBudget, and |
| +// the dashboard's reads together within it too, each timed as the best of |
| +// scaleTimingRuns. |
| func TestOperatorCountsAtScale(t *testing.T) { |
| s := openOpStore(t) |
| acct := opSeedScale(t, s, opNow) |
| @@ -822,6 +825,7 @@ func TestOperatorCountsAtScale(t *testing.T) { |
| return len(f), err |
| }}, |
| } |
| + var dashboard time.Duration |
| for _, r := range reads { |
| // The first call warms the page cache, as a running console's is. |
| if _, err := r.run(); err != nil { |
| @@ -839,14 +843,17 @@ func TestOperatorCountsAtScale(t *testing.T) { |
| t.Errorf("%s returned nothing", r.name) |
| } |
| t.Logf("%-24s %8.2f ms (%d)", r.name, float64(took.Microseconds())/1000, got) |
| - budget := 20 * time.Millisecond |
| - if r.name == "OperatorCounts" { |
| - budget = opCountsScaleBudget |
| + if dashboardScaleReads[r.name] { |
| + dashboard += took |
| } |
| - if perfEnforce() && took > budget { |
| - t.Errorf("%s took %v, over %v", r.name, took, budget) |
| + if perfEnforce() && took > perfBudget { |
| + t.Errorf("%s took %v, over %v", r.name, took, perfBudget) |
| } |
| } |
| + t.Logf("%-24s %8.2f ms", "dashboard reads together", float64(dashboard.Microseconds())/1000) |
| + if perfEnforce() && dashboard > perfBudget { |
| + t.Errorf("the dashboard's reads took %v together, over %v", dashboard, perfBudget) |
| + } |
| } |
| // scaleTimingRuns is how many timed runs a scale query gets; its time is |
| @@ -893,7 +900,7 @@ func TestFirstAccountIsTheEarliestLiveMembership(t *testing.T) { |
| // accounts who created 8,000 apps, and one account holding all those apps |
| // and 2,000 members. Each relationship is counted on its own, so neither |
| // list multiplies one by the other; under CI each page answers within |
| -// 20 ms, timed as the best of scaleTimingRuns. |
| +// perfBudget, timed as the best of scaleTimingRuns. |
| func TestPeopleAndAccountsWithConcentratedOwnership(t *testing.T) { |
| s := openOpStore(t) |
| db, ok := s.db.(*sql.DB) |
| @@ -934,8 +941,8 @@ func TestPeopleAndAccountsWithConcentratedOwnership(t *testing.T) { |
| opMust(t, run()) // warm |
| took := bestOfScaleRuns(func() { opMust(t, run()) }) |
| t.Logf("%-12s %8.2f ms", name, float64(took.Microseconds())/1000) |
| - if perfEnforce() && took > 20*time.Millisecond { |
| - t.Errorf("%s took %v, over 20 ms", name, took) |
| + if perfEnforce() && took > perfBudget { |
| + t.Errorf("%s took %v, over %v", name, took, perfBudget) |
| } |
| } |
| var people []PersonRow |