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

A repository's reports list's Server-Timing names its phases: session, each read, render #3450

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`GET /:owner/:name/reports` now answers with a Server-Timing header that names `session`, `repo`, `reports` and `render`, alongside the `app` entry every response already carries. The new test and `test/reports.test.ts` pass (26 tests). I couldn't run the type check: `bun x tsc --noEmit` failed here with a read-only temp directory error.

shipped production is serving it deploy 15c0f93

opened this

GET /:owner/:name/reports now answers with a Server-Timing header that names session, repo, reports and render, alongside the app entry every response already carries. The new test and test/reports.test.ts pass (26 tests). I couldn't run the type check: bun x tsc --noEmit failed here with a read-only temp directory error.

  • How it's done: reportsPage in src/web/pages/reports.ts uses notePhase and timePhase the way milestones.ts does. repo times loadRepo, and reports times waitingReports. render covers building the page.
  • Unchanged: the body, status codes and caching are as before, and the reads run in the same order with the same early returns. Nothing new is computed for the header.
  • Test: test/reports-timing.test.ts signs in as the repository's owner, requests the page, and checks that each of the five names appears with a duration. It checks names only, never a wall-clock time, and it fails without the change.
  • Left out: the other pages in reports.ts (the public report form and the accept and dismiss actions) don't get timing, since the issue names only the list.

Closes #3421

commented

GET /:owner/:name/reports now answers with a Server-Timing header that names session, repo, reports and render, alongside the app entry every response already carries. The new test and test/reports.test.ts pass (26 tests). I couldn't run the type check: bun x tsc --noEmit failed here with a read-only temp directory error.

  • How it's done: reportsPage in src/web/pages/reports.ts uses notePhase and timePhase the way milestones.ts does. repo times loadRepo, and reports times waitingReports. render covers building the page.
  • Unchanged: the body, status codes and caching are as before, and the reads run in the same order with the same early returns. Nothing new is computed for the header.
  • Test: test/reports-timing.test.ts signs in as the repository's owner, requests the page, and checks that each of the five names appears with a duration. It checks names only, never a wall-clock time, and it fails without the change.
  • Left out: the other pages in reports.ts (the public report form and the accept and dismiss actions) don't get timing, since the issue names only the list.
Approved

Matches the milestones.ts pattern exactly (notePhase session, timePhase repo/reports, render around page()). Early returns, order of reads and body are unchanged; no markup touched, so DESIGN.md is unaffected. The test asserts names and format only and fails without the change. I could not reach the preview from my sandbox (host blocked), so I judged from source. Next: 1) add the same phases to the accept/dismiss POSTs if the owner wants them; 2) the test hand-casts the user with as never — use the created user object instead.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs