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 #11535

Parked opened this
Closed without merging

/system now has a "Page budgets" section: one line per PAGEBUDGETS page, with its measured median beside its budget in ms and SQL statements. A page over budget is one plain line (data-over="1"), not a banner.

Notes

stopped parked by the crew deploy 37af3d9

opened this

/system now has a "Page budgets" section: one line per PAGE_BUDGETS page, with its measured median beside its budget in ms and SQL statements. A page over budget is one plain line (data-over="1"), not a banner.

  • Where the numbers come from: src/perf/budget_read.ts takes the median of the last 15 minutes from the perf record in src/perf/record.ts. It keeps the result for 5 seconds, so a busy /system doesn't re-sort the samples. A page not opened in that window says "not opened in the last 15 minutes".
  • Same rows elsewhere: systemWithReaders adds a budgets array, each row with its line of words. So GET /api/v1/telemetry/system and the MCP system tool's default answer carry the same rows. I added no new tool or kind. The tool's doc string and docs/MCP.md say so.
  • Files: the section is src/web/pages/system-budget.ts, mounted once in system.ts. src/perf/page_budget.ts is removed from scripts/unreached-allow.json, and the notes are in docs/features/page-budget.md.
  • Tests: test/system-budget.test.ts fails if the section stops drawing every table row, if the rows stop following the table, or if the line wording diverges.
  • Checks: gate, tsc, design-lint, test/mcp-size.test.ts and test/system-telemetry.test.ts pass. scripts/fast.ts said the diff is too broad to name, so I ran only the tests near the change.
  • Left out: the measured SQL statement count. The perf record holds timings only, so statements show as the budget alone. The earlier parked branch wasn't reachable, so I started over.
  • Heads-up: test/mcp-system-routes.test.ts fails when run in one process with mcp-size and system-telemetry. It does so without my change too, because the in-process perf record is shared, and it passes alone.
  • Try it: open /system as the owner and look for "Page budgets"; GET /api/v1/telemetry/system returns budgets.

Closes #11457

3 earlier comments
commented

/system now has a "Page budgets" section: one line per PAGE_BUDGETS page, with its measured median beside its budget in ms and SQL statements. A page over budget is one plain line (data-over="1"), not a banner.

  • Where the numbers come from: src/perf/budget_read.ts takes the median of the last 15 minutes from the perf record in src/perf/record.ts. It keeps the result for 5 seconds, so a busy /system doesn't re-sort the samples. A page not opened in that window says "not opened in the last 15 minutes".
  • Same rows elsewhere: systemWithReaders adds a budgets array, each row with its line of words. So GET /api/v1/telemetry/system and the MCP system tool's default answer carry the same rows. I added no new tool or kind. The tool's doc string and docs/MCP.md say so.
  • Files: the section is src/web/pages/system-budget.ts, mounted once in system.ts. src/perf/page_budget.ts is removed from scripts/unreached-allow.json, and the notes are in docs/features/page-budget.md.
  • Tests: test/system-budget.test.ts fails if the section stops drawing every table row, if the rows stop following the table, or if the line wording diverges.
  • Checks: gate, tsc, design-lint, test/mcp-size.test.ts and test/system-telemetry.test.ts pass. scripts/fast.ts said the diff is too broad to name, so I ran only the tests near the change.
  • Left out: the measured SQL statement count. The perf record holds timings only, so statements show as the budget alone. The earlier parked branch wasn't reachable, so I started over.
  • Heads-up: test/mcp-system-routes.test.ts fails when run in one process with mcp-size and system-telemetry. It does so without my change too, because the in-process perf record is shared, and it passes alone.
  • Try it: open /system as the owner and look for "Page budgets"; GET /api/v1/telemetry/system returns budgets.
commented

I made no new push. The preview deploy didn't fail on anything in the code.

  • What the log says: the app started, /readyz came up, and the log ends with done and serving. The only complaint is "no tests declared, none run", which is a note about the preview, not an error.
  • Why that note appears: forge.json declares tests under check (fast, run, verify). Nothing there makes the preview deploy run tests, and this pull didn't change forge.json.
  • Preview check: / and /healthz on https://lab--11535--forge-trevato-apps.open-platform.sh both answer 200, / in about 0.9 s. I couldn't open /system there because it needs a signed-in owner.
  • Tests before the first push: gate, tsc, design-lint, test/system-budget.test.ts, test/mcp-size.test.ts and test/system-telemetry.test.ts pass. The test/mcp-system-routes.test.ts failure only shows up when it runs in one process with others. It fails the same way without my change, and it passes alone.

If the forge's check result shows red on the pull, send me that log. It is a different failure from this deploy note.

commented

The "both doors" gate failed on this pull. I fixed it with a "No door:" commit line, not a new terminal screen, and the gate now passes locally. I did not rerun tsc or the tests, since the new commit is empty and changes no files.

What changed: /system now shows each first-opened page's measured median beside its PAGE_BUDGETS budget. The same rows are in the telemetry API and the MCP system tool. The new src/web/pages/system-budget.ts is a section of the existing /system page, not a new page. A "No door:" commit line is the route AGENTS.md allows for that.

What I left out: I did not add a terminal screen or change src/tui/screens/system.ts. The /system terminal screen already imports from src/system/telemetry.ts. I did not check that it renders the new budget rows. If you want them in the terminal as well, that is a separate change.

How to try it: open /system as the owner and read the Page budgets section. The preview is at https://lab--11535--forge-trevato-apps.open-platform.sh.

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs