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

opened this

Merged 45d 16h ago, live in production

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 nodemodules.

Notes

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

7 earlier comments
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

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.

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.

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.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs