Public: anyone can read this; the crew can change it.
Settings › Capacity's warm answer is read for its app time the way /search's is, and a test holds it #9744
Check · Review · Land · Live done — Landed and live in production.
Settings › Capacity's warm answer now has a test like the one /search has (#9715). Only `test/capacity-timing.test.ts` changes: `src/web/pages/capacity.ts` stays as it is because the new test passes on main.
shipped production is serving it deploy a5a2512
Settings › Capacity's warm answer now has a test like the one /search has (#9715). Only test/capacity-timing.test.ts changes: src/web/pages/capacity.ts stays as it is because the new test passes on main.
The new test loads the page as an admin twice. On the second (warm) answer it:
- reads the
appphase of Server-Timing with the sameappMshelper shape astest/search-page.test.ts, and fails if it is NaN. The time is reported, never compared to a limit (#4429). - holds the 50 ms bound as work:
requestStatementsplusexpectWorkagainst the existingWARM_STATEMENTSceiling of 64, unchanged. - checks that no git process starts. It watches both
Bun.spawnandBun.spawnSyncand counts calls whose program isgit, whether the command comes as a list or as{ cmd }.capacity.tsdoes not start git at all, so this guards against a future change that would.
Not done: no wall-clock limit, since a busy runner would make it flaky, as the issue warns.
Try it: bun test test/capacity*.test.ts. It ran 63 tests across 8 files with no failures. bun x tsc --noEmit is clean, and bun scripts/gate.ts printed no complaints.
🤖 Generated with Claude Code
Test-only change; it matches the issue. appMs has the same shape as search-page.test.ts. The second (warm) admin answer is checked for a sent app phase, statements are bounded by the unchanged WARM_STATEMENTS via requestStatements and expectWork, and no git is spawned. test/capacity-timing.test.ts passes locally (3 pass). The preview answers 303 to an unauthenticated request, as expected. Two next things: (1) the spawn spy only sees Bun.spawn and Bun.spawnSync, so also cover node:child_process if capacity.ts ever imports it; (2) the dedicated spawn-spy test duplicates the setup of the earlier tests in the file, so extract a shared admin-get helper.
Settings › Capacity's warm answer now has a test like the one /search has (#9715). Only
test/capacity-timing.test.tschanges:src/web/pages/capacity.tsstays as it is because the new test passes on main.The new test loads the page as an admin twice. On the second (warm) answer it:
appphase of Server-Timing with the sameappMshelper shape astest/search-page.test.ts, and fails if it is NaN. The time is reported, never compared to a limit (#4429).requestStatementsplusexpectWorkagainst the existingWARM_STATEMENTSceiling of 64, unchanged.Bun.spawnandBun.spawnSyncand counts calls whose program isgit, whether the command comes as a list or as{ cmd }.capacity.tsdoes not start git at all, so this guards against a future change that would.Not done: no wall-clock limit, since a busy runner would make it flaky, as the issue warns.
Try it:
bun test test/capacity*.test.ts. It ran 63 tests across 8 files with no failures.bun x tsc --noEmitis clean, andbun scripts/gate.tsprinted no complaints.🤖 Generated with Claude Code
Closes #9740