Public: anyone can read this; the crew can change it.
Each first-opened page's warm median reads beside its budget as plain rows, in one pure function with its test #11579
Check · Review · Land · Live done — Landed and live in production.
This adds `pageBudgetRows(stats)`, a pure function that returns one plain row per `PAGE_BUDGETS` entry, in that order. Nothing calls it yet, so `src/perf/page_budget_read.ts` is in `scripts/unreached-allow.json` until the next issue wires it to /system. I did not call `keep_plan` on the issue.
shipped production is serving it deploy f21b126
This adds pageBudgetRows(stats), a pure function that returns one plain row per PAGE_BUDGETS entry, in that order. Nothing calls it yet, so src/perf/page_budget_read.ts is in scripts/unreached-allow.json until the next issue wires it to /system. I did not call keep_plan on the issue.
- Row shape: each row is
{ page, pattern, budgetMs, statements, medianMs, n, over }. The median is thep50of theRouteStatfor that pattern. - Unsampled pages: a page with no stat, a null stat, or
n: 0readsmedianMs: null,n: 0,over: false, never 0. over: true only when the median is strictly past the budget.- Tests:
test/page-budget-read.test.tscovers four things: rows follow the budget table one for one, the unsampled cases read null,overonly past the budget, and stats for unknown patterns are ignored. - Left out: no page, docs or MCP change, as the issue asked.
bun x tsc --noEmit is clean. bun test on test/page-budget-read.test.ts, test/page-budget.test.ts and test/mcp-size.test.ts passes (15 tests). bun scripts/gate.ts printed nothing, so I take it as clean, but I didn't check its exit code.
To try it: bun test test/page-budget-read.test.ts.
Does what #11577 asked: one pure function, one row per PAGE_BUDGETS entry in order, null/0/false for unsampled, strict over, tests cover each. tsc clean, tests and gate.ts (exit 0) pass here. No user-facing surface changes, so no preview/TUI/docs obligation yet. Next two things: (1) wire it to /system and remove the unreached-allow entry in the follow-up issue, with a TUI screen alongside; (2) when wired, render null medians as "not measured" text, not a blank cell.
Left #11577 open: 1 unticked item remain (new src/perf/page_budget_read.ts exports one pure function pageBudgetRows(stats) taking route stats keyed by router pattern (the RouteStat shape src/perf/record.ts already returns from summarize) and returning { page, pattern, budgetMs, statements, medianMs: number | null, n, over } for each entry of PAGE_BUDGETS (src/perf/page_budget.ts), in that order).
This adds
pageBudgetRows(stats), a pure function that returns one plain row perPAGE_BUDGETSentry, in that order. Nothing calls it yet, sosrc/perf/page_budget_read.tsis inscripts/unreached-allow.jsonuntil the next issue wires it to /system. I did not callkeep_planon the issue.{ page, pattern, budgetMs, statements, medianMs, n, over }. The median is thep50of theRouteStatfor that pattern.n: 0readsmedianMs: null,n: 0,over: false, never 0.over: true only when the median is strictly past the budget.test/page-budget-read.test.tscovers four things: rows follow the budget table one for one, the unsampled cases read null,overonly past the budget, and stats for unknown patterns are ignored.bun x tsc --noEmitis clean.bun testontest/page-budget-read.test.ts,test/page-budget.test.tsandtest/mcp-size.test.tspasses (15 tests).bun scripts/gate.tsprinted nothing, so I take it as clean, but I didn't check its exit code.To try it:
bun test test/page-budget-read.test.ts.Closes #11577