Public: anyone can read this; the crew can change it.
Flaky test: 500 entries: GET /changelog answers in under 50 ms (median of 3 warm runs) #15381
Check · Review · Land · Live done — Landed and live in production.
test/changelog-timing.test.ts now counts work instead of CPU time, so machine load can no longer make it fail. It is a test-only change; no application code is touched. What it measures: both tests (500 entries, and 500 entries in two chapters) take one warm GET /changelog through pageWork from test/helpers/work.ts.
shipped production is serving it deploy 496afdb
test/changelog-timing.test.ts now counts work instead of CPU time, so machine load can no longer make it fail. It is a test-only change; no application code is touched.
- What it measures: both tests (500 entries, and 500 entries in two chapters) take one warm
GET /changelogthroughpageWorkfromtest/helpers/work.ts. They assert at most 40 SQL statements and at most 8 git spawns, checked withexpectWork. - Why those bounds: I measured 26 to 28 statements and 3 to 4 git spawns. Both counts stay flat as entries grow, so an N+1 over the 500 entries would exceed them on every run.
- Clock use: the elapsed time is printed for a person to read and is never asserted. This follows the "Speed is counted in work, never in a clock" principle and the
rawBudgetsrule inscripts/flake.ts. - Test names: the titles no longer say "under 50 ms". They now read "answers in constant work".
- What I left out: there is no wall-clock check at all any more. The 50 ms promise now rests on the work counts and the printed time.
- Checks run:
bun test test/changelog-timing.test.ts test/flake.test.tspasses (38 tests), andbun scripts/gate.ts --fixandbun x tsc --noEmitran. The gate rewrapped comments in one file, which is committed. - How to try it: run
bun test test/changelog-timing.test.ts.
Test-only change that replaces the flaky CPU-time check on GET /changelog with counted work. It uses the existing pageWork/expectWork helpers, so it follows the repo pattern and the no-clock principle. The bounds are 40 SQL statements and 8 git spawns, against 26-28 and 3-4 measured. They do not grow with entries, so an N+1 over the 500 entries would fail them. Elapsed time is printed and never asserted. No app code, dependency or README is touched. Two things I would do next: (1) add a guard that the statement count is the same at 50 and 500 entries, so the test pins constancy and not only a ceiling; (2) drop the printed ms line once the Server-Timing phases are logged elsewhere, to keep test output quiet.
test/changelog-timing.test.tsnow counts work instead of CPU time, so machine load can no longer make it fail. It is a test-only change; no application code is touched.GET /changelogthroughpageWorkfromtest/helpers/work.ts. They assert at most 40 SQL statements and at most 8 git spawns, checked withexpectWork.rawBudgetsrule inscripts/flake.ts.bun test test/changelog-timing.test.ts test/flake.test.tspasses (38 tests), andbun scripts/gate.ts --fixandbun x tsc --noEmitran. The gate rewrapped comments in one file, which is committed.bun test test/changelog-timing.test.ts.Closes #15380