test(hud): guard full-screen passthrough bounds while recording - #873
test(hud): guard full-screen passthrough bounds while recording#873adityarao3 wants to merge 1 commit into
Conversation
getHudOverlayBounds() used to pass `isHudOverlayMousePassthroughSupported() && !hudOverlayRecordingActive` to getHudOverlayWindowBounds(), so starting a recording dropped the HUD from the full-screen click-through overlay to the compact 860x160 fallback window. That window is opaque to clicks, so it swallowed every click landing in the bottom-centre of the screen instead of passing it to the app being recorded, and the HUD's own Stop button became unreachable once the renderer requested passthrough. dd7af60 removed the `&& !hudOverlayRecordingActive` term while working on the recording webcam, but nothing covers that decision, so the regression can return unnoticed. The bug is still present in every published release (v1.3.3, v1.3.4-beta.1, v1.3.5-beta.2). This adds a test that drives the real createHudOverlayWindow() and setHudOverlayRecordingActive() code paths with electron mocked, and asserts the bounds applied while recording still cover the full work area. Verified it fails with the old expression restored and passes on current main. The test is skipped on Linux, where passthrough is unsupported and the compact fallback is the intended behaviour. Test-only; no production code changes.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe pull request adds an Electron test for HUD overlay bounds. The test mocks Electron display and window APIs, activates recording, and verifies that the overlay retains the full work-area bounds on non-Linux platforms. ChangesHUD overlay bounds validation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change adds regression coverage to ensure the HUD retains full-screen passthrough bounds when recording starts, without changing production behavior. It is ready to merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
getHudOverlayBounds()used to passisHudOverlayMousePassthroughSupported() && !hudOverlayRecordingActivetogetHudOverlayWindowBounds(). The&& !hudOverlayRecordingActiveterm meant that starting a recording made the overlay behave as if passthrough were unsupported, so it dropped from the full-screen click-through overlay to the compact 860x160 fallback window.That window is opaque to clicks. While recording it swallowed every click landing in the bottom-centre of the screen instead of passing it through to the app being recorded, and the HUD's own Stop button became unreachable once the renderer requested passthrough on hover.
On a 1536x816 work area the overlay became an opaque bar at
(338, 656), which matches the region users report as unclickable.This is the Windows/macOS counterpart of the click-blocking behaviour described in #861 (which covers the Linux side, where passthrough is genuinely unsupported).
Status on main
Already fixed: dd7af60 ("Keep the recording webcam movable and visible") removed the
&& !hudOverlayRecordingActiveterm. That change was made while working on the recording webcam rather than as a deliberate fix for this, and no test covers the decision, so the regression can silently return.It is still present in every published release — v1.3.3, v1.3.4-beta.1 and v1.3.5-beta.2 — so users on a download rather than
mainstill hit it.What this PR adds
A regression test only. No production code changes —
electron/windows.tsis untouched.The test drives the real
createHudOverlayWindow()andsetHudOverlayRecordingActive()code paths withelectronmocked, then asserts the bounds applied while recording still cover the full work area. It binds to the actual call site rather than re-implementing the predicate, so it fails if the old expression comes back.windows.tsresolves the screen module throughcreateRequire("electron"), which bypassesvi.mock("electron"), sonode:moduleis mocked alongside it.Verification
&& !hudOverlayRecordingActiverestored:expected { x: 530, y: 920, width: 860 } to deeply equal { x: 0, y: 0, width: 1920 }maintsc --noEmitclean,biome checkcleanSummary by CodeRabbit
Bug Fixes
Tests