fix(record): start the touch overlay budget when record stop starts finalizing
Summary
Found while driving an EAS cloud simulator session. A 62 s recording's touch overlay ran out of its 70 s budget, the first record stop exited 1, and a second record stop returned the same file with the overlay warning.
On the local CLI path, an overlay timeout already exits 0 and shows Overlay warning:. The second stop returning the file is the replay from ADR 0024 and #2534. The likely cause of exit 1 is that the stop ran past the 90 s request window. The overlay budget started only when the overlay itself started, so the playability checks before it were not counted. On a cold host those checks first compile a validator (5.8 s measured here, 21.6 s at background QoS, with a 30 s budget of its own), and 70 s on top of that can overrun the window.
The finalizer now starts the budget before those checks, so their time comes out of the overlay's share. The overlay also stops repeating the waits the finalizer just ran. 6 files.
Validation
Tested commit: 3cc60037e6 (rebased on main after #3613). pnpm check:affected --run passes (1303 related tests). All new tests fail on base: the overlay test gets 70000 where 45000 is expected; with the second commit reverted, the post-export check runs past an expired budget and renames the composited file, and the wait polls its full schedule. Live run below is from 2d09bbbbf9; the second commit only changes what happens after the budget runs out.
Live run on an iPhone 17 simulator with a cold AGENT_DEVICE_SWIFT_CACHE_DIR, a short recording with touches, then record stop twice. The helper's --timeout-ms was read from ps during the first stop.
base 2a2f3f2906 | head 2d09bbbbf9 | |
|---|---|---|
helper --timeout-ms | 63257 | 59282 |
| stop 1 / stop 2 exit | 0 / 0 | 0 / 0 |
On base, a 5-minute recording overran the overlay budget and record stop still exited 0 with the warning (72 s).
Risk: I could not push a local stop past 90 s, so the EAS exit 1 was not reproduced. The first stop's stderr there should show Daemon request timed out.