fix(record): bound a cold video-validator compile by the stop's finalize budget

Merged
TH
1d ago
+424-48

Summary

Since #4065 moved recording into smoke:capture-close, the iOS smoke lane failed 3 times at record stop with xcrun timed out after 30000ms. It is swiftc doing a cold compile of the AVFoundation video validator, under a fixed 30 s bound.

record stop already has a 70 s finalization budget meant to cover this compile (#3697). The finalizer now hands it to the playability checks. Callers share one compile, each waits within its own budget, and the last to leave cancels it with SIGINT, so swift-driver also stops its frontend jobs (SIGKILL left them running). A spent budget, or a validator run that times out, reads as not playable. The overlay decides on the verdict the wait returns. 9 files.

No-deadline callers keep the fixed 30 s compile wait: Android pullPlayable (platform-runtime-screen-recording-android-host.ts) and the live-device assertions (test/integration/live-device-e2e/assertions.ts) call isPlayableVideo without a deadline.

Validation

  • pnpm check:affected --run --head a1af133177 (rebased on main): passed, exactCommit=true. Earlier unrelated flakes (stale-ref-warning, Revyl stray GET /, fixed on main by #4158) passed on rerun.
  • New tests fail on reverted source.
  • Live, iPhone 17e simulator, cold isolated Swift cache, CPU oversubscribed (see PR comment):
    • At cdf951620a, record stop passed with a 66.5 s compile (stop 73.2 s).
    • A forced 5 s abandon returned video_validator_compile_timeout. No swiftc/swift-frontend, .lock or temp dir was left, and the next stop compiled and passed.
  • Self-review: cold reread only.

šŸ¤– Generated with Claude Code