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>
This commit is contained in:
Iisyourdad
2026-06-12 09:02:51 -05:00
parent 0ab29e4ff0
commit 3d0b753205
5 changed files with 217 additions and 55 deletions
+12
View File
@@ -37,6 +37,18 @@ Keep-a-Changelog conventions; versions follow semver.
buffering by the time the window tucks away, so the first click is
served a pre-click frame like the rest.
### Added
- **Click debounce (`capture.clickDebounceMs`, default 200ms).** Clicks of
the same mouse button closer together than the window collapse into one
step, so accidental fast or double clicks don't each become a step, while
any two deliberate clicks spaced further apart both register. It is a
leading-edge debounce measured from the last *accepted* click, so a run of
fast clicks can't push the next real click out. Set it to 0 to capture
every click. Backed by behavioral unit tests that drive click sequences
through real timestamps (not keyword checks) plus an end-to-end self-test
scenario.
### Fixed
- **Fast click bursts no longer lose screenshots.** Finishing or pausing a