Fix restarted recordings dropping clicks / stopping after one click
Template tests / tests (push) Waiting to run
Template tests / tests (pull_request) Waiting to run

Root cause: warm-before-hide kept the window visible during backend warmup,
and on a restart that warmup could take several seconds (the stream backend
start waits up to 8s). During that visible window, clicks over the app were
skipped by the userIsInApp guard and clicks elsewhere were shot post-click,
so a restarted session looked like it stopped after one click.

- Recording is now 'armed' only after the window is hidden and the buffer is
  primed. A new warmingUp flag makes onOsClick ignore clicks during warmup
  (the window is covering the user's work anyway) instead of mishandling
  them. Cleared on pause/finish.
- armRecording caps the warmup wait (WARMUP_MAX_MS=1500): the window hides
  and the session arms even if the backend start hangs, so it can never sit
  visible for seconds dropping clicks. The backend keeps coming up in the
  background; the first click or two may take the fresh-shot fallback.
- A generation token invalidates an in-flight backend start whose session
  has since finished, so a slow start can't install into a new session or
  leave the starting-guard stuck and block the restart from starting one.

Tests: 4 new behavioral capture tests (warmup ignores clicks; pause/finish
clear it; armRecording warms-then-hides-then-arms; a hung start still arms
within the cap; a stale start is discarded and frees the guard) plus a new
end-to-end self-test scenario (warmup click ignored, first armed click
captured). 152 unit tests + all repo checks pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Iisyourdad
2026-06-12 09:17:59 -05:00
parent 3d0b753205
commit f2c5831315
4 changed files with 238 additions and 30 deletions
+10
View File
@@ -51,6 +51,16 @@ Keep-a-Changelog conventions; versions follow semver.
### Fixed
- **Restarting a recording no longer drops clicks or "stops after one
click."** While the recorder warmed up at the start of a session the
window was still visible, so clicks over it were skipped and clicks
elsewhere were shot post-click — and on a restart the backend start could
take several seconds, stretching that bad window out. Recording is now
"armed" only once the window is actually hidden and the buffer is primed:
clicks during warmup are cleanly ignored (the window is covering the
user's work anyway), the window hides within a bounded time even if the
backend is slow to start, and a slow start left over from a finished
session can no longer block the next session from starting its own.
- **Fast click bursts no longer lose screenshots.** Finishing or pausing a
recording used to cancel every screenshot still being encoded, so a quick
series of clicks saved only the first two or three. The capture worker now