Skip to content

Fix flaky GeneralTab and HooksTab tests - #852

Merged
Finesssee merged 1 commit into
mainfrom
fix/general-tab-sound-timer
Oct 13, 2026
Merged

Finesssee merged 1 commit into
mainfrom
fix/general-tab-sound-timer

Conversation

@Finesssee

@Finesssee Finesssee commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Two frontend tests on main fail CircleCI intermittently. Both hit the provider PRs this week (#839, #840, #841) even though those PRs don't touch these files.

  • GeneralTab sound preview timer. "Test sound" starts a 1.5 s timer that resets the playing state. Nothing cancelled it on unmount, so when the test environment tore down first, the timer called setState with no window and Vitest reported an unhandled ReferenceError: window is not defined (fails the run even though every test passed). The timer now lives in a ref; it is cleared on unmount and when a new preview replaces it. This also stops a real state update on an unmounted Settings window.
  • HooksTab 32 × 32 limit test. It renders 32 rules with 32 arguments each, then ran role queries across ~1,000 inputs. Under a loaded runner that passed the 5 s default timeout. It now uses text queries for the same buttons (about 940 ms → 380 ms locally) and has a 20 s timeout for the heavy render.

Tests

  • New cancels the sound preview timer on unmount test: fails without the GeneralTab.tsx change (timer still pending after unmount), passes with it.
  • pnpm exec vitest run src/surfaces/settings/tabs/GeneralTab.test.tsx src/surfaces/settings/tabs/HooksTab.test.tsx: 58 passed.
  • pnpm test: 122 files, 1107 tests passed, no unhandled errors.
  • pnpm exec tsc --noEmit -p .: clean.

No UI change in normal use (the preview button still re-enables after 1.5 s), so no CUA proof is attached.

Summary by CodeRabbit

  • Bug Fixes
    • Notification sound previews now clean up their playback timers when another preview starts, playback fails, or the settings screen closes. This prevents lingering timers and ensures an earlier preview cannot interfere with a newer one.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: nesszer/Win-CodexBar/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: b391fd08-78b3-485e-97e4-af6d6b84648a
📥 Commits

Reviewing files that changed from the base of the PR and between 93cc53d and c5ea0a8.

📒 Files selected for processing: 3
  • apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx
  • apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.tsx
  • apps/desktop-tauri/src/surfaces/settings/tabs/HooksTab.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

GeneralTab now manages the notification sound preview timer through replacement, playback failure, and component unmount. Its test checks timer cleanup on unmount. The HooksTab limit test updates its button queries, expected control count, and timeout.

Changes: Sound preview timer

Layer / File(s) Summary
Sound preview timeout lifecycle
apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.tsx, apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx
GeneralTab stores the active preview timeout, cancels the previous timeout when starting a preview, and clears the timeout on unmount. Playback failure clears the timeout only if it is still current. A test checks timer cleanup on unmount.

HooksTab limit test

Layer / File(s) Summary
Limit-test queries and timeout
apps/desktop-tauri/src/surfaces/settings/tabs/HooksTab.test.tsx
The test locates disabled add controls through their text and button elements, checks for 32 argument-add controls, and sets a 20-second timeout.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to c5ea0

The preview timer is managed across its lifecycle, and the HooksTab changes adjust test queries and timeout. No concrete merge-blocking risk is identified.

Pre-merge checks: Passed 7 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Ui Changes Include Windows Proof Warning GeneralTab.tsx changed under the settings UI. The new timer handling changes notification preview behavior by preventing an earlier preview timer from stopping a newer preview. The PR description st… Add screenshots or a proof note from a fresh Windows build to the PR description. The proof must cover the affected GeneralTab notification-sound preview behavior.
Passed Passed checks: 7 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title is a short imperative summary that directly identifies the flaky GeneralTab and HooksTab tests addressed by the pull request.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Provider Data Stays Siloed Passed PASS. The PR changes only GeneralTab sound-preview timer cleanup and two test implementations. Added code uses a local timeout ref, clears timers on replacement/unmount, and updates playback state. Th…
Secrets Handled Safely Passed The pull request changes only timer cleanup and test query behavior. The diff adds no token, cookie, API key, OAuth credential, authorization header, credential-file deletion, or keyring mutation. Exi…
No Unapproved Dependencies Passed The pull request changes only three TypeScript source/test files. It adds no Cargo.toml, package.json, npm/yarn lockfile, or pnpm packageManager change. The repository packageManager declaration remai…
Full details: Ui Changes Include Windows Proof

Explanation

GeneralTab.tsx changed under the settings UI. The new timer handling changes notification preview behavior by preventing an earlier preview timer from stopping a newer preview. The PR description states that no CUA proof is attached and provides no screenshot or proof note from a fresh Windows build.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Finesssee
Finesssee merged commit a00507d into main Oct 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant