Commit Graph

17 Commits

Author SHA1 Message Date
Iisyourdad f2c5831315 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>
2026-06-12 09:17:59 -05:00
Iisyourdad 3d0b753205 Add a 200ms click debounce with extensive behavioral tests
Template tests / tests (push) Waiting to run
Template tests / tests (pull_request) Waiting to run
Per request: clicks of the same button closer together than
capture.clickDebounceMs (default 200ms) now collapse into a single step, so
accidental fast/double clicks don't each become a step. It is a leading-edge
debounce measured from the last *accepted* click, so a run of fast clicks
can't push the next deliberate click out — two clicks spaced beyond the
window (e.g. the reported 400-500ms apart) always register.

Replaces the prior 8ms duplicate-delivery suppression (subsumed by the
window). Configurable; 0 captures every click.

Tests (the point of this change is that it can't silently regress):
- 13 behavioral unit tests in capture.test.js that drive real onOsClick
  calls with controlled timestamps and assert which clicks survive — the
  reported 400/450/500ms cases, sub-window collapse, the 200ms boundary,
  per-button independence, configurability, debounce=0, last-accepted (not
  last-dropped) reference, session reset, and a full onOsClick -> queue ->
  store integration check. No keyword/comment assertions.
- A fourth end-to-end self-test scenario (burst of 40ms clicks collapses to
  1; three 300ms-apart clicks each register => 4 total). The marker/drain
  scenarios set debounce to 0 so they keep stressing the frame pipeline.

147 unit tests + all repo checks pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 09:02:51 -05:00
Iisyourdad 0ab29e4ff0 Warm the frame recorder before hiding the window at recording start
Template tests / tests (push) Successful in 1m52s
Template tests / tests (pull_request) Successful in 1m46s
The first screenshot of a session was late while every later one was fine.
Cause: on 'Start recording' the window hid first and the capture backend
started warming up after — creating worker, getUserMedia, first frame takes
~1s. A click in that gap found no buffered frame and took the post-click
fresh shot.

armRecording() now warms the recorder while the window is still visible and
only hides once frames are buffering (with a brief post-hide settle so the
first frame shows the user's screen, not the dismissed app window). Verified
end to end with a new self-test scenario that clicks 250ms after start: the
first click is now served a pre-click frame instead of a post-click shot.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 08:48:54 -05:00
Iisyourdad 34cc358902 Never take a post-click screenshot when a pre-click frame exists
Template tests / tests (push) Successful in 1m48s
Template tests / tests (pull_request) Successful in 1m55s
The remaining 'captured slightly after the click' reports came from the
fresh-shot fallback, which grabs the screen when the click is processed
(after it). The previous lead change made that fallback *more* likely: a
frame now had to be >=120ms before the click to qualify, so on machines
where the capture stream can't always keep a frame that old buffered, more
clicks fell through to the post-click shot.

Make the click-lead a two-tier preference instead of a hard gate in
selectFrameForClick:
1. newest frame captured at least leadMs before the click (ideal margin), else
2. newest frame captured before the click at all.
Only when no pre-click frame exists does the caller fresh-shot. leadMs is
threaded through the stream backend to the worker so both selection paths
agree. Verified end to end: frames land ~120-170ms before each click,
markers stay at 0.00%, and the 8-click burst still saves all 8.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 08:40:33 -05:00
Iisyourdad 5b89b5c927 Capture the screen slightly before each click; record milestone in CHANGELOG
Template tests / tests (push) Successful in 1m58s
Template tests / tests (pull_request) Successful in 1m47s
Real-world recording now saves every click with exact markers; the only
remaining nit was screenshots feeling a touch late. Add a configurable
click-lead (capture.clickLeadMs, default 120ms) that targets the screen
just before the hook timestamp, and tighten the stream sampling cadence to
50ms so a frame near that target always exists. Verified end to end: frames
now land ~120-160ms before the click (was 25-57ms), markers stay at 0.00%
offset, and the 8-click burst still saves all 8.

Also document the milestone in docs/CHANGELOG.md and remove an accidental
paste of Gitea commit-page text from it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 08:12:13 -05:00
Iisyourdad 6682cdae0f Fixed clicking location part 4
Template tests / tests (push) Successful in 1m52s
2026-06-11 16:57:59 -05:00
Iisyourdad 0ecc1b473f Fixed an issue where clicking wouldn't line up with screenshot part 2
Template tests / tests (push) Successful in 1m56s
2026-06-11 12:23:02 -05:00
Iisyourdad 6d529256bb Fixed an issue where clicking wouldn't line up with screenshot
Template tests / tests (push) Successful in 1m49s
2026-06-11 12:08:37 -05:00
Iisyourdad c352741809 Fixed a bug where a resumed recording wouldn't update the image Part 2
Template tests / tests (push) Successful in 1m51s
2026-06-11 11:57:55 -05:00
Iisyourdad 72b3f10a8a Fixed a bug where a resumed recording wouldn't update the image
Template tests / tests (push) Successful in 1m54s
2026-06-11 11:48:09 -05:00
Iisyourdad 3df52e37fc added restore button
Template tests / tests (push) Successful in 1m48s
2026-06-11 11:35:57 -05:00
Iisyourdad 33c421b746 Added select button toggle for trash library grid
Template tests / tests (push) Successful in 2m0s
2026-06-11 11:31:58 -05:00
Iisyourdad 726f993a7a added select button while editing guides
Template tests / tests (push) Successful in 1m48s
2026-06-11 11:17:24 -05:00
Iisyourdad 706d9dce60 Make it so that the recording bar pops up everytime on the guide editor
Template tests / tests (push) Successful in 1m59s
2026-06-11 11:05:25 -05:00
Iisyourdad 572b66650b Fix settings button on library view
Template tests / tests (push) Failing after 46s
2026-06-11 10:47:32 -05:00
Iisyourdad 85a34d6ab5 select button on cards in library view
Template tests / tests (push) Successful in 1m52s
2026-06-11 10:19:56 -05:00
Iisyourdad dca3e042f2 Cleanup
Template tests / tests (push) Successful in 1m48s
2026-06-11 09:44:52 -05:00