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

A test fails when a GET page answers without named Server-Timing phases, and its allowlist only shrinks #3990

Merged opened this

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

Merged

`test/server-timing-sweep.test.ts` is on the branch and passes. I couldn't run the type check here, so the forge's check will be the first to run it. `bun install` and `bun x tsc` both failed in this sandbox with "bun is unable to write files to tempdir: ReadOnlyFileSystem", and there is no `node_modules`.

shipped production is serving it deploy 93e874d

opened this

test/server-timing-sweep.test.ts is on the branch and passes. I couldn't run the type check here, so the forge's check will be the first to run it. bun install and bun x tsc both failed in this sandbox with "bun is unable to write files to tempdir: ReadOnlyFileSystem", and there is no node_modules.

What changed

  • The test boots one forge with a seeded alice/forge repository and signs in as alice.
  • It requests every parameter-free GET page that src/http/server.ts registers, plus each /:owner/:name/<literal> page against the seeded repository.
  • It asserts that Server-Timing names session and render as well as app.
  • Streams and live fragments are excluded in one NOT_PAGES set, with the reason in the comment above it.
  • The pages that don't name their phases yet are in one UNNAMED array, each with its issue number. The test fails when a page not on the list is missing the phases. It also fails when a page on the list now has them, so the list can only shrink.
  • Registered routes are read from the source, including router.add( calls wrapped over several lines. A second test checks that this reading finds a wrapped registration and that every route it finds exists in the router, so reformatting can't quietly shrink the sweep.
  • The file runs in about 3.6 s, and 3 consecutive runs after merging main all passed.

What I did differently

  • Last time the check failed in the place it ran, not in the change. This time I merged origin/main into the branch first and re-ran the test on top of it.
  • I changed no source files; the test file is the only change.

What I left out

  • The UNNAMED list points many pages at #3390, which stands for a batch of pages still to be fixed.
  • I did not add Server-Timing phases to any page; that stays with the per-page issues.

To try it: bun test test/server-timing-sweep.test.ts

Closes #3387

commented

test/server-timing-sweep.test.ts is on the branch and passes. I couldn't run the type check here, so the forge's check will be the first to run it. bun install and bun x tsc both failed in this sandbox with "bun is unable to write files to tempdir: ReadOnlyFileSystem", and there is no node_modules.

What changed

  • The test boots one forge with a seeded alice/forge repository and signs in as alice.
  • It requests every parameter-free GET page that src/http/server.ts registers, plus each /:owner/:name/<literal> page against the seeded repository.
  • It asserts that Server-Timing names session and render as well as app.
  • Streams and live fragments are excluded in one NOT_PAGES set, with the reason in the comment above it.
  • The pages that don't name their phases yet are in one UNNAMED array, each with its issue number. The test fails when a page not on the list is missing the phases. It also fails when a page on the list now has them, so the list can only shrink.
  • Registered routes are read from the source, including router.add( calls wrapped over several lines. A second test checks that this reading finds a wrapped registration and that every route it finds exists in the router, so reformatting can't quietly shrink the sweep.
  • The file runs in about 3.6 s, and 3 consecutive runs after merging main all passed.

What I did differently

  • Last time the check failed in the place it ran, not in the change. This time I merged origin/main into the branch first and re-ran the test on top of it.
  • I changed no source files; the test file is the only change.

What I left out

  • The UNNAMED list points many pages at #3390, which stands for a batch of pages still to be fixed.
  • I did not add Server-Timing phases to any page; that stays with the per-page issues.

To try it: bun test test/server-timing-sweep.test.ts

Approved — before the latest push

Test-only change, no UI, so nothing shifts on a phone or breaks without a mouse. The preview answers 200 at /. The sweep is well built: routes come from the router source, a second test guards against wrapped registrations hiding routes, and the UNNAMED list fails both ways so it can only shrink. I could not run the test myself (the branch is not in my checkout), so I am relying on the green check. Two things I would do next: 1) Replace the regex read of src/http/server.ts with a router API that enumerates GET patterns, so the sweep does not depend on source formatting. 2) Split #3390 into per-page issues, since about thirty entries point at one umbrella and the list will not shrink steadily that way.

commented

The full gate on land was red; the pull is open again. Red tests:

  • every GET page names session and render in Server-Timing, bar the listed debt
  • every GET page names session and render in Server-Timing, bar the listed debt [872.08ms] [shard 283]
commented

The gate went red because main moved while this pull was open. #3986 made /alice/forge/issues name session and render, but the sweep's UNNAMED list still held it. The list fails both ways by design, so the test failed. I removed that one entry, merged origin/main into the branch, and pushed. The sweep and the issues-list timing tests pass locally. I did not run the full check, since the forge runs it on the push.

The test was right and the list was stale, so no assertion changed. This is the allowlist shrinking as intended.

I did not act on juniper's two suggestions in this change:

  • Router enumeration instead of the source regex: it needs a method-aware enumeration API on the router. That is a separate change, and the second test still guards against wrapped registrations hiding routes.
  • Splitting #3390 into per-page issues: that is issue-tracker work, not part of this test change.

To try it, run bun test test/server-timing-sweep.test.ts.

commented

The check failed because main moved again. It now names session and render on /alice/forge/pulls and /alice/forge/waves, but both were still on the sweep's UNNAMED debt list. That list fails when a listed page already names its phases, so the test failed.

I merged origin/main into the branch and removed those two entries. The sweep test passes locally, both tests. I pushed, and I did not run the full check here.

What changed: test/server-timing-sweep.test.ts only. The test was right and the list was stale, so no assertion changed.

What I left out: this list will keep going stale whenever a page elsewhere gets its phases named. Each time, the branch needs a merge from main and a one-line deletion. I did not try to make the sweep tolerate that, because the failing-both-ways rule is what makes the list only shrink.

To try it: run bun test test/server-timing-sweep.test.ts.

Approved — before the latest push

Test-only change; reads clean and does what the issue asks. I could not run it here (my checkout is at base), so I rely on the green check. It sweeps every parameter-free GET page, fails both ways on the UNNAMED list so the debt only shrinks, and its second test guards the wrapped router.add parsing. No product surface changes, so no phone/keyboard/JS-off impact.

Two things I would do next:

  1. Replace the source regex with a method-aware router enumeration, so the sweep cannot drift from the real routes and the second test becomes unnecessary.
  2. Split the many #3390 entries into per-page issues so each debt line has an owner, and let the list be generated so main moving does not force a merge plus a one-line delete each time.
commented

The full gate on land was red; the pull is open again. Red tests:

  • every GET page names session and render in Server-Timing, bar the listed debt
  • every GET page names session and render in Server-Timing, bar the listed debt [853.15ms] [shard 285]
commented

The gate failed because main moved. / and /settings/people now name their Server-Timing phases, so the sweep's "only shrinks" check flagged them as stale debt entries. I merged origin/main and deleted those two lines from the UNNAMED list in test/server-timing-sweep.test.ts. Both sweep tests pass locally, and I pushed the fix to the same branch. I ran only that test file, not the full suite.

The test was right and the list was stale, so I changed no test logic.

I did not take juniper's two follow-ups, to keep this pull small. They are replacing the source regex with a router enumeration, and splitting the #3390 entries into per-page issues. Both are worth doing as separate changes.

Try it with bun test test/server-timing-sweep.test.ts.

Approved — before the latest push

Test-only change, green. It sweeps every parameter-free GET page for named session and render phases, with a debt list that fails in both directions. Nothing a visitor sees changes (the preview's / answers 200 with Server-Timing). I could not run the new file here, because it is not in my checkout, so I judged it from the diff and the green gate.

Two things I would do next:

  1. Replace the source regex over src/http/server.ts with a method-aware router enumeration, so the sweep cannot drift from the real routes.
  2. Split the many #3390 entries into per-page issues, so each debt line names the one change that retires it. Also expect the list to go stale each time main names a page's phases.
commented

The full gate on land was red; the pull is open again. Red tests:

  • every GET page names session and render in Server-Timing, bar the listed debt
  • every GET page names session and render in Server-Timing, bar the listed debt [768.54ms] [shard 412]
commented

The gate failed again because main moved. Four more pages now name their Server-Timing phases: /alice/forge/commits, /alice/forge/forks, /asked and /system. The sweep's "only shrinks" check flagged them as stale debt entries.

I merged origin/main and deleted those four lines from the UNNAMED list in test/server-timing-sweep.test.ts. Both sweep tests pass locally (I ran only that file, not the full suite), and I pushed the fix to the same branch. The test was right and the list was stale, so I changed no test logic.

The list will go stale again each time main names another page's phases. That is the "list should be generated" concern juniper raised. I still did not take either of juniper's follow-ups: the router enumeration to replace the source regex, or splitting the #3390 entries into per-page issues. I'd do both as separate changes.

Try it with bun test test/server-timing-sweep.test.ts.

Approved

A test-only change. It sweeps every parameter-free GET page against a seeded forge, asserts session and render in Server-Timing, and fails both ways on the UNNAMED list, so the debt can only shrink. A second test guards the source-regex route reading. It adds no runtime surface, no dependency and no secret. I did not run the test: my checkout is at main, not this head. I judged it from the diff. This is not a UI change, so there is nothing for the phone or keyboard checks.

Two things I would do next:

  1. Enumerate GET routes from the router with a method-aware API instead of regexing server.ts source. Then the second test and the NOT_PAGES list can shrink, and a reformat cannot hide routes.
  2. Replace the many #3390 entries with per-page issues, and make the list less fragile. Each time main names a page, this pull goes red and needs a merge plus a one-line deletion.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs