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

test/crew-check-failed.test.ts runs under 10 s #3629

opened this

Merged 43d 4h ago, live in production

test/crew-check-failed.test.ts now runs in about 1.7 s instead of 11–12.7 s. It passed ten runs in a row (1.59–1.79 s each). The file's one test still takes more than 1 s, so that part of the issue isn't met.

Notes

opened this

test/crew-check-failed.test.ts now runs in about 1.7 s instead of 11–12.7 s. It passed ten runs in a row (1.59–1.79 s each). The file's one test still takes more than 1 s, so that part of the issue isn't met. I didn't run the type check: bun x tsc --noEmit failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem". The forge's check will run it.

Cause. Timing the test showed two gaps of about 5 s each. They were the crew's 5 s dispatch tick, once before the agent's first run and once before the follow-up run after the failed check. No production code waits wrongly. The crew already had a tickMs option, and nothing in this test used it.

Changes.

  • test/helpers/crew-standin.ts: startStandInCrew takes an optional { tickMs } and passes it to startCrew. Other callers are unaffected.
  • test/crew-check-failed.test.ts:
    • The crew starts with tickMs: 50.
    • The polling interval drops from 100 ms to 20 ms.
    • The per-wait timeout drops from 60 s to 20 s.
    • The test timeout drops from 120 s to 15 s.
  • scripts/test-times.json: this file's entry is now 1.8 s.

Left out.

  • Test over 1 s: What remains is real git pushes, a real check run and the shell stand-in. Getting under 1 s would mean faking those, and the test would stop proving the whole loop. Say so if you want that anyway.
  • Fake harness and fake clock: The crew is still driven by the existing shell stand-in, not a fake harness. There is no fake clock.
  • Sleeps: The test still polls with short sleeps (20 ms) rather than waiting on events.
  • Forge fixture: It was already built once per file.
  • Tests deleted: None. The single test keeps all of its assertions.

To try it: bun test test/crew-check-failed.test.ts.

Closes #3591

commented

test/crew-check-failed.test.ts now runs in about 1.7 s instead of 11–12.7 s. It passed ten runs in a row (1.59–1.79 s each). The file's one test still takes more than 1 s, so that part of the issue isn't met. I didn't run the type check: bun x tsc --noEmit failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem". The forge's check will run it.

Cause. Timing the test showed two gaps of about 5 s each. They were the crew's 5 s dispatch tick, once before the agent's first run and once before the follow-up run after the failed check. No production code waits wrongly. The crew already had a tickMs option, and nothing in this test used it.

Changes.

  • test/helpers/crew-standin.ts: startStandInCrew takes an optional { tickMs } and passes it to startCrew. Other callers are unaffected.
  • test/crew-check-failed.test.ts:
    • The crew starts with tickMs: 50.
    • The polling interval drops from 100 ms to 20 ms.
    • The per-wait timeout drops from 60 s to 20 s.
    • The test timeout drops from 120 s to 15 s.
  • scripts/test-times.json: this file's entry is now 1.8 s.

Left out.

  • Test over 1 s: What remains is real git pushes, a real check run and the shell stand-in. Getting under 1 s would mean faking those, and the test would stop proving the whole loop. Say so if you want that anyway.
  • Fake harness and fake clock: The crew is still driven by the existing shell stand-in, not a fake harness. There is no fake clock.
  • Sleeps: The test still polls with short sleeps (20 ms) rather than waiting on events.
  • Forge fixture: It was already built once per file.
  • Tests deleted: None. The single test keeps all of its assertions.

To try it: bun test test/crew-check-failed.test.ts.

commented

I merged main into the branch, resolved both conflicts, and pushed. The two crew tests I re-ran, test/crew-check-failed.test.ts and test/crew-already-done.test.ts, pass. I did not run the full suite, and I haven't seen the forge's check verdict on the push.

  • test/helpers/crew-standin.ts: main already had the tickMs option for startStandInCrew, so I took its version.
  • scripts/test-times.json: I kept main's 1.2 s for crew-already-done. For crew-check-failed I kept this branch's 1.8 s, down from main's 12.7 s.

test/crew-check-failed.test.ts now runs in about 1.5 s.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs