Skip to content

test(floating-terminal): mock the bulk-close confirmation the panel suite cannot render - #30568

Merged
nwparker merged 1 commit into
mainfrom
nwparker/fix-floating-panel-confirmation-mock
Oct 19, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/fix-floating-panel-confirmation-mock

Conversation

@nwparker

@nwparker nwparker commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11
Prod 0 0 0 0

ELI5

After #30551 ("Confirm before bulk-closing tabs") merged, all 73 cases in FloatingTerminalPanel.behavior.test.tsx fail on main with TypeError: null is not an object (evaluating 'dispatcher.useContext'). That breaks the test / tests node 24 3/5 shard for every PR. This test-only fix makes the suite pass again.

What Changed

  • Before: the suite calls FloatingTerminalPanel as a plain function, with React's hooks swapped for test versions. Confirm before bulk-closing tabs #30551 made bulk closes go through useBulkTabCloseConfirmation and then useConfirmationDialog, which calls the real useContext. Outside a React render there's nothing to back that call, so every case crashed.
  • After: the suite mocks @/components/use-bulk-tab-close-confirmation with a version that confirms at once, so the bulk-close assertions still run right after the click. The real hook keeps its own coverage from Confirm before bulk-closing tabs #30551.

Why

  • Mocking confirmation-dialog-context with an async confirm leaves 5 bulk-close cases failing, because they assert synchronously.
  • A synchronous thenable is rejected by unicorn/no-thenable.
  • Mocking the hook one level up matches how the suite already stubs its other collaborators.

Linked Issue

N/A (maintainer). Unblocks PR CI for everyone.

Visual Proof

N/A: test-only.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • src/renderer/src/components/floating-terminal/: 11 files, 150 tests pass. Before the fix, the behavior file had 73 failures.

  • bun check -p config/tsconfig.tc.web.json passes, as do oxlint and the changed-code quality gate.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Test-only.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…uite cannot render

#30551 routed bulk tab closes through useConfirmationDialog, whose real
useContext has no dispatcher when this suite calls the panel as a plain
function. All 73 behavior cases failed on main. Confirm immediately in the
mock so the bulk-close assertions still run right after the click.
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d03d1d26-8674-4c67-ae1f-eab8f73b8ec3
📥 Commits

Reviewing files that changed from the base of the PR and between 70d00aa and 488d5aa.

📒 Files selected for processing: 1
  • src/renderer/src/components/floating-terminal/FloatingTerminalPanel.behavior.test.tsx

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

📝 Walkthrough

The test adds a mock for useBulkTabCloseConfirmation. The mock selects tab IDs without showing a confirmation dialog. It calls closeTabs only when the selection is nonempty.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 488d5

The change isolates synchronous bulk-close behavior in the panel tests; no actionable merge risk is established.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: mocking bulk-close confirmation in the floating-terminal tests.
Description check Passed The description is complete and focused. It explains the failure, the test-only fix, the implementation choice, testing results, visual proof exception, and compatibility considerations.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

✨ Finishing Touches
📝 Generate docstrings
  • 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.

@nwparker
nwparker merged commit d45894c into main Oct 19, 2026
30 checks passed
@nwparker
nwparker deleted the nwparker/fix-floating-panel-confirmation-mock branch October 19, 2026 05:13
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