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

test/game-desk.test.ts runs under the 20 s file budget and leaves SLOW #18279

opened this

Merged 6h 19m ago, live in production

game-desk.test.ts is now under 10 s alone, but only because I split it into four files. Total CPU barely moved, about 26 s before and about 26 s after, so the single file was not made cheaper. Why I split it.

Notes

opened this

game-desk.test.ts is now under 10 s alone, but only because I split it into four files. Total CPU barely moved, about 26 s before and about 26 s after, so the single file was not made cheaper.

Why I split it. A full agent.sh sync costs about 0.3 to 0.45 s of CPU: about 34 jq calls, curl and the fake docker. The file makes roughly 45 full syncs and about as many quick polls, and each poll is what each case asserts, so no fixed wait or shared boot could remove that cost. The budget is per file, so the split is what brings each file under it. Say if you would rather I drop assertions to shrink the single file instead.

CPU alone, before and after. One file was 26.4 s CPU (user 11.5 s, system 14.9 s) and 49 s wall. Now each file is under 10 s alone, wall 4 to 16 s:

FileCPU alone
game-desk.test.ts (requests out)about 5.9 s
game-desk-answers.test.ts (answers in, snapshot)about 7.4 s
game-desk-poll.test.ts (quick poll timing)about 8.5 s
game-desk-proxy.test.ts (watcher shell, origin file)about 4.1 s

I measured the 20 s full-suite figure only as the alone run: the sandbox can't run the whole suite, and the forge's check will time it under load. I did not run the check, so whether it clears the file budget is not known yet.

What changed

  • Split into four files. The shared fake docker and forge moved to test/helpers/game-desk.ts.
  • Merged cases:
    • The three snapshot cases are now one run: a good snapshot, a bad version, bad base64, then one over the limit. It asserts the version sequence the quick polls report, that the good snapshot survives and that no snapshot.tmp is left.
    • The "answer comes with the quick poll" case is folded into the "quick poll says back what it put in" case. It now also asserts the inbox file equals the told answer.
  • Waits cut:
    • Cases that waited on a quick poll before writing their request now write after the first one.
    • The "does not spin" cases wait 1.5 s and 2.2 s with tighter limits, where they waited 3 s and 3.5 s. A spinning agent would still fail them, since it polls about 10 times a second.
    • The long-sync case uses EVERY=4 instead of 20.
    • The "older forge" case waits for 4 quick polls instead of 6.
  • Origin case: it uses 5 agent runs instead of 7. The deletion checks pre-write a stale file, so each deletion is actually observed.
  • Gate: the test/game-desk.test.ts entry is removed from SLOW in scripts/gate.ts.

Checks. Each of the four files passes --rerun-each 10 (poll ×10 included). bun x tsc --noEmit is clean and bun scripts/gate.ts --explain reports 39 of 39 rules satisfied. --fix rewrapped comments, which are committed.

No page, action, route or tool changed, so there is nothing for the terminal or docs/features/ to follow. I added no dependency and reused the existing pollUntil helper.

Closes #18240

commented

game-desk.test.ts is now under 10 s alone, but only because I split it into four files. Total CPU barely moved, about 26 s before and about 26 s after, so the single file was not made cheaper.

Why I split it. A full agent.sh sync costs about 0.3 to 0.45 s of CPU: about 34 jq calls, curl and the fake docker. The file makes roughly 45 full syncs and about as many quick polls, and each poll is what each case asserts, so no fixed wait or shared boot could remove that cost. The budget is per file, so the split is what brings each file under it. Say if you would rather I drop assertions to shrink the single file instead.

CPU alone, before and after. One file was 26.4 s CPU (user 11.5 s, system 14.9 s) and 49 s wall. Now each file is under 10 s alone, wall 4 to 16 s:

FileCPU alone
game-desk.test.ts (requests out)about 5.9 s
game-desk-answers.test.ts (answers in, snapshot)about 7.4 s
game-desk-poll.test.ts (quick poll timing)about 8.5 s
game-desk-proxy.test.ts (watcher shell, origin file)about 4.1 s

I measured the 20 s full-suite figure only as the alone run: the sandbox can't run the whole suite, and the forge's check will time it under load. I did not run the check, so whether it clears the file budget is not known yet.

What changed

  • Split into four files. The shared fake docker and forge moved to test/helpers/game-desk.ts.
  • Merged cases:
    • The three snapshot cases are now one run: a good snapshot, a bad version, bad base64, then one over the limit. It asserts the version sequence the quick polls report, that the good snapshot survives and that no snapshot.tmp is left.
    • The "answer comes with the quick poll" case is folded into the "quick poll says back what it put in" case. It now also asserts the inbox file equals the told answer.
  • Waits cut:
    • Cases that waited on a quick poll before writing their request now write after the first one.
    • The "does not spin" cases wait 1.5 s and 2.2 s with tighter limits, where they waited 3 s and 3.5 s. A spinning agent would still fail them, since it polls about 10 times a second.
    • The long-sync case uses EVERY=4 instead of 20.
    • The "older forge" case waits for 4 quick polls instead of 6.
  • Origin case: it uses 5 agent runs instead of 7. The deletion checks pre-write a stale file, so each deletion is actually observed.
  • Gate: the test/game-desk.test.ts entry is removed from SLOW in scripts/gate.ts.

Checks. Each of the four files passes --rerun-each 10 (poll ×10 included). bun x tsc --noEmit is clean and bun scripts/gate.ts --explain reports 39 of 39 rules satisfied. --fix rewrapped comments, which are committed.

No page, action, route or tool changed, so there is nothing for the terminal or docs/features/ to follow. I added no dependency and reused the existing pollUntil helper.

commented

Left #18240 open: 1 unticked item remain (bun test ./test/game-desk.test.ts takes under 10 s of CPU alone and under 20 s under full-suite load (say the before and after numbers in the pull).).

Sign in to join this conversation.

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

Keyboard shortcuts

Docs