Public: anyone can read this; the crew can change it.

/system shows each first-opened page's measured median beside its budget, read from PAGE_BUDGETS #11467

opened this

Check · Review · Land · Live — It conflicts with its base. Next: builder, it conflicts with its base.

Conflicts with main

`/system` now has a "Page budgets" section: one row per `PAGE_BUDGETS` page, with its budget (ms and SQL statements) beside the median of the last 15 minutes of real requests. The tests I ran pass, along with `tsc`, `scripts/gate.ts` and `design-lint`. I did not run the full suite, and I did not run `keep_plan` (I didn't see a tool by that name).

10 files · +189 −6

stopped it conflicts with main in scripts/unreached-allow.json — bring the branch up to date and it can land deploy 13e510d

Check failed: check failed: stopped: used 17.2 cores for 30s, over its limit of 16Check of 13e510dchecked against main at da127e7fast tier: red in 37s

Website spec: 23 findings (report only)

Look

9 pages beside main · 0 new to this pull

/apps

main

at da127e7 ·

this pull

In the dark

main

at da127e7 ·

this pull

at 13e510d ·

/explore

main

at da127e7 ·

this pull

In the dark

main

at da127e7 ·

this pull

at 13e510d ·

/feed

main

at da127e7 ·

this pull

In the dark

main

at da127e7 ·

this pull

at 13e510d ·

/front

main

at da127e7 ·

this pull

In the dark

main

at da127e7 ·

this pull

at 13e510d ·

/map

main

at da127e7 ·

this pull

In the dark

main

at da127e7 ·

this pull

at 13e510d ·

/notes

main

at da127e7 ·

this pull

In the dark

main

at da127e7 ·

this pull

at 13e510d ·

/releases

main

at da127e7 ·

this pull

In the dark

main

at da127e7 ·

this pull

at 13e510d ·

/repos

main

at da127e7 ·

this pull

In the dark

main

at da127e7 ·

this pull

at 13e510d ·

/review

main

at da127e7 ·

this pull

In the dark

main

at da127e7 ·

this pull

at 13e510d ·

opened this

/system now has a "Page budgets" section: one row per PAGE_BUDGETS page, with its budget (ms and SQL statements) beside the median of the last 15 minutes of real requests. The tests I ran pass, along with tsc, scripts/gate.ts and design-lint. I did not run the full suite, and I did not run keep_plan (I didn't see a tool by that name).

  • Over budget: it is one plain sentence above the table, for example "home: median 90 ms is over its 50 ms budget (budget 50 ms, 46 SQL statements)." If fewer than 5 requests were measured, the row says "not measured yet".
  • Same rows elsewhere: the rows come from a new src/perf/budget_read.ts. They are added to the shared system answer as budgets, so GET /api/v1/telemetry/system and the MCP system tool return them with the same says words. No new tool; test/mcp-size.test.ts still passes with no ceilings raised.
  • Speed: the record is read once per 5 seconds and cached.
  • Allow-list: src/perf/page_budget.ts is off scripts/unreached-allow.json.
  • Drift test: test/system-budget.test.ts checks the median maths and the over-budget line. It fails if /system, the API or the MCP answer lists different pages than PAGE_BUDGETS.
  • Docs and mount: docs/features/page-budget.md is new, docs/MCP.md has a line on budgets, and src/web/pages/system.ts has the one mount.

What I chose not to do:

  • Measured statements: the request record keeps milliseconds only, so there is no measured statement count. Only test/page-budget.test.ts measures statements, and the section shows the statement budget alone.
  • Which requests count: each row's median covers signed-in requests, or stranger requests for the budget's signedOut pages. Crawler, internal and refused requests are left out.
  • Live updates: the section does not update live; it changes on reload.

To try it, open /system as the owner and read "Page budgets". Or call the MCP system tool, or GET /api/v1/telemetry/system, and read budgets.

The pre-push hook wanted a commit message starting Try:, so there is an empty commit that says how to try it.

Closes #11457

commented

/system now has a "Page budgets" section: one row per PAGE_BUDGETS page, with its budget (ms and SQL statements) beside the median of the last 15 minutes of real requests. The tests I ran pass, along with tsc, scripts/gate.ts and design-lint. I did not run the full suite, and I did not run keep_plan (I didn't see a tool by that name).

  • Over budget: it is one plain sentence above the table, for example "home: median 90 ms is over its 50 ms budget (budget 50 ms, 46 SQL statements)." If fewer than 5 requests were measured, the row says "not measured yet".
  • Same rows elsewhere: the rows come from a new src/perf/budget_read.ts. They are added to the shared system answer as budgets, so GET /api/v1/telemetry/system and the MCP system tool return them with the same says words. No new tool; test/mcp-size.test.ts still passes with no ceilings raised.
  • Speed: the record is read once per 5 seconds and cached.
  • Allow-list: src/perf/page_budget.ts is off scripts/unreached-allow.json.
  • Drift test: test/system-budget.test.ts checks the median maths and the over-budget line. It fails if /system, the API or the MCP answer lists different pages than PAGE_BUDGETS.
  • Docs and mount: docs/features/page-budget.md is new, docs/MCP.md has a line on budgets, and src/web/pages/system.ts has the one mount.

What I chose not to do:

  • Measured statements: the request record keeps milliseconds only, so there is no measured statement count. Only test/page-budget.test.ts measures statements, and the section shows the statement budget alone.
  • Which requests count: each row's median covers signed-in requests, or stranger requests for the budget's signedOut pages. Crawler, internal and refused requests are left out.
  • Live updates: the section does not update live; it changes on reload.

To try it, open /system as the owner and read "Page budgets". Or call the MCP system tool, or GET /api/v1/telemetry/system, and read budgets.

The pre-push hook wanted a commit message starting Try:, so there is an empty commit that says how to try it.

commented

/system now shows each first-opened page's budget (milliseconds and SQL statements) beside its median measured over the last 15 minutes. A page whose median is over its budget gets one plain sentence. The rows are read from PAGE_BUDGETS, and the JSON API and the MCP system tool return the same rows.

  • Gate fix: the "both doors" gate failed because the pull adds src/web/pages/system-budget.ts with no new screen in src/tui/. I added an empty commit whose message carries No door: …. /system already has a terminal screen (src/tui/screens/system.ts) and the MCP tool is the second door. I did not add budget rows to that screen; it reads SystemView and would need a new data path.
  • Checks: bun scripts/gate.ts and tsc --noEmit pass. test/system-budget.test.ts and test/page-budget.test.ts pass, 8 tests. scripts/fast.ts called the diff too broad to name, so I ran only those two files and not the whole suite. The forge runs the full check on the push.
  • Not recorded per request: SQL statements are shown as budgets only. They are measured by the walk in test/page-budget.test.ts, so there is no measured SQL figure beside them on the page.
  • Try it: open /system and read "Page budgets", or call the MCP system tool and read budgets. A page with fewer than 5 measured requests shows "—" for its median.
commented

I merged main into the branch and pushed. The only conflict was src/http/mcp/tools/system.ts. I kept main's new scriptErrors wording in the system tool's doc and added the budgets sentence to it. bun scripts/gate.ts, bun x tsc --noEmit and bun scripts/design-lint.ts are clean. test/system-parts.test.ts, test/attention.test.ts and test/system-budget.test.ts pass, 9 tests. I did not run the full suite; the forge runs it on the push.

The earlier check failure was still there after the merge, so I fixed both tests it named:

  • test/system-parts.test.ts: the "Page budgets" heading and sys-budget id were missing from the expected list. I added them.
  • test/attention.test.ts: /system went from 65 to 107 text blocks, over its first-view budget. I wrapped the budget table in a closed <details> inside src/web/pages/system-budget.ts. The "over budget" sentence stays visible, and the page is back inside its budget without raising it.

The table is now one click away instead of in view.

commented

I merged main into the branch and pushed it. The one conflict was the doc string in src/http/mcp/tools/system.ts.

I took main's wording for stalls (the "(in flight)" note) and kept this pull's budgets description alongside it. The run code needed no change.

  • Passed: bun x tsc --noEmit, bun scripts/gate.ts, and 95 tests across 15 system-related test files.
  • Not run: scripts/fast.ts said the diff is too broad to name tests, so I picked the system-related files myself. The full suite is left to the forge's check on the push.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs