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

A red Server-Timing sweep names the route that failed and why, so a one-off failure in the full suite can be diagnosed from its log #9502

Merged opened this

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

Merged

When the Server-Timing sweep goes red now, its log says which page failed and why. It no longer stops on the first failure with no route attached.

shipped production is serving it deploy a5a2512

opened this

When the Server-Timing sweep goes red now, its log says which page failed and why. It no longer stops on the first failure with no route attached.

What moved where: the loop that fetches each page moved out of test/server-timing-sweep.test.ts into a plain function, collectTimings, in the new file test/helpers/timing-sweep.ts. It runs any fetch over a list of paths, four at a time, and sorts each page into one of these lists:

  • named: pages that name session and render
  • bare: pages that don't
  • redirected: pages that answer 3xx
  • failures: pages that throw (abort, reset) or answer 5xx, each as { path, status } or { path, error }
  • missingApp: pages whose Server-Timing leaves out app, each as { path, serverTiming }

In the sweep:

  • Nothing is asserted inside the loop any more. expect(failures).toEqual([]) and expect(missingApp).toEqual([]) each run once at the end, so a red run lists every bad route at once.
  • Each request now gives up after 20 s, down from 60 s, under the test's 120 s cap. A slow page then shows up by name in failures instead of timing out the whole test. A comment in the test says why.
  • The redirect and debt assertions are unchanged.
  • A 5xx page now counts as a failure even if its Server-Timing header looks right, so the sweep is slightly stricter than before.

New unit tests:

  • One feeds collectTimings a fake fetch with six pages: one throws, one answers 500, one has no app, plus a named page, a bare page and a redirect. It checks that each path lands in the right list.
  • Another uses a page that never answers and a 20 ms limit, and checks that it comes back as a timeout entry naming /slow.

What I chose not to do: no change to src/, because no real page failed. I did not try to reproduce the old failure from #9407. The keep_plan tool the issue mentions isn't available in this run, so the issue has no plan on it.

How to try it: bun test test/server-timing-sweep.test.ts passed three runs in a row: 4 pass, 0 fail, about 2.7 s each. bun scripts/gate.ts and bun x tsc --noEmit are both clean.

🤖 Generated with Claude Code

Closes #9500

commented

When the Server-Timing sweep goes red now, its log says which page failed and why. It no longer stops on the first failure with no route attached.

What moved where: the loop that fetches each page moved out of test/server-timing-sweep.test.ts into a plain function, collectTimings, in the new file test/helpers/timing-sweep.ts. It runs any fetch over a list of paths, four at a time, and sorts each page into one of these lists:

  • named: pages that name session and render
  • bare: pages that don't
  • redirected: pages that answer 3xx
  • failures: pages that throw (abort, reset) or answer 5xx, each as { path, status } or { path, error }
  • missingApp: pages whose Server-Timing leaves out app, each as { path, serverTiming }

In the sweep:

  • Nothing is asserted inside the loop any more. expect(failures).toEqual([]) and expect(missingApp).toEqual([]) each run once at the end, so a red run lists every bad route at once.
  • Each request now gives up after 20 s, down from 60 s, under the test's 120 s cap. A slow page then shows up by name in failures instead of timing out the whole test. A comment in the test says why.
  • The redirect and debt assertions are unchanged.
  • A 5xx page now counts as a failure even if its Server-Timing header looks right, so the sweep is slightly stricter than before.

New unit tests:

  • One feeds collectTimings a fake fetch with six pages: one throws, one answers 500, one has no app, plus a named page, a bare page and a redirect. It checks that each path lands in the right list.
  • Another uses a page that never answers and a 20 ms limit, and checks that it comes back as a timeout entry naming /slow.

What I chose not to do: no change to src/, because no real page failed. I did not try to reproduce the old failure from #9407. The keep_plan tool the issue mentions isn't available in this run, so the issue has no plan on it.

How to try it: bun test test/server-timing-sweep.test.ts passed three runs in a row: 4 pass, 0 fail, about 2.7 s each. bun scripts/gate.ts and bun x tsc --noEmit are both clean.

🤖 Generated with Claude Code

Approved

Test-only change, no user-facing surface (no src/, no page or terminal door, no README edit), so the experience checks do not apply. collectTimings records throws and 5xx as {path,status|error}, collects pages missing app, and the sweep asserts both once at the end. The 20 s per-request abort sits under the 120 s cap, with a comment saying why. Two unit tests over a fake fetch cover all three failure kinds and the timeout, and both fail without the change. The pull reports three green runs.

Two things I would do next: (1) add the response status or the first bytes of the body to a 5xx failure entry so the log says why, not only the code; (2) have the sweep fail if failures plus the other lists do not add up to the number of paths, so a page can never drop out silently.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs