Skip to content

testing: cover tool approval dialog surface#382

Open
RtlZeroMemory wants to merge 1 commit intomainfrom
feature/testing-tool-approval-dialog-surface
Open

testing: cover tool approval dialog surface#382
RtlZeroMemory wants to merge 1 commit intomainfrom
feature/testing-tool-approval-dialog-surface

Conversation

@RtlZeroMemory
Copy link
Copy Markdown
Owner

@RtlZeroMemory RtlZeroMemory commented Apr 14, 2026

Summary

  • add behavior-first coverage for the tool approval dialog's visible review surface when open
  • add layout coverage for closed zero-size behavior and open viewport clamping
  • keep keyboard routing and focus-order behavior out of scope because the public contract is still under-specified

Families and systems covered

  • tool approval dialog widget surface
  • overlay layout for tool approval dialog open and closed states

Tests added, rewritten, removed

  • added visible render-surface tests in packages/core/src/widgets/__tests__/overlays.test.ts
  • added closed/open layout tests in packages/core/src/widgets/__tests__/overlay.edge.test.ts
  • removed no existing tests

Implementation bugs fixed

  • none

Validation

  • ./node_modules/.bin/tsc -b packages/core/tsconfig.json --pretty false
  • node --test packages/core/dist/widgets/__tests__/overlays.test.js packages/core/dist/widgets/__tests__/overlay.edge.test.js packages/core/dist/widgets/__tests__/widgetRenderSmoke.test.js

Explicit gaps left out

  • keyboard routing and focus-order behavior remain blocked by missing public contract evidence
  • file-change preview presentation remains intentionally unclaimed because the docs do not specify its exact output

Summary by CodeRabbit

  • Tests
    • Enhanced test coverage for tool approval dialog overlay behavior, including dimension validation and boundary clamping scenarios.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

📝 Walkthrough

Walkthrough

Two test files expanded with coverage for the toolApprovalDialog overlay component: measurement and layout behavior validation when the dialog is open or closed, and UI rendering tests verifying correct button and element display under different prop configurations.

Changes

Cohort / File(s) Summary
Tool Approval Dialog Overlay Tests
packages/core/src/widgets/__tests__/overlay.edge.test.ts
Added tests validating measureOverlays returns zero dimensions when dialog is closed, and layoutOverlays clamps overlay rectangle coordinates and edges within viewport bounds.
Tool Approval Dialog Rendering Tests
packages/core/src/widgets/__tests__/overlays.test.ts
Added three UI rendering tests covering: dialog open with full approval interface, dialog open without session-allow button, and dialog closed with empty output.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 The approval dialog hops with glee,
With tests that measure, render, and decree—
Buttons checked, rectangles clamped tight,
Our overlay dances just right!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change—adding test coverage for the tool approval dialog surface—which aligns with the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/testing-tool-approval-dialog-surface

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/core/src/widgets/__tests__/overlays.test.ts (1)

125-194: Add a narrow-viewport variant for these render-surface assertions.

The new open/closed and optional-action checks are solid, but they only run at 60x16. Adding at least one smaller viewport case would better protect responsive truncation/wrapping behavior for the approval surface.

As per coding guidelines, "Test responsive behavior by validating UI at multiple viewport sizes."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/src/widgets/__tests__/overlays.test.ts` around lines 125 - 194,
Add narrow-viewport variants of the existing toolApprovalDialog tests by
re-running the same assertions using createTestRenderer with a smaller viewport
(e.g., cols: 40, rows: 10) to validate responsive truncation/wrapping; replicate
the three cases that reference ui.toolApprovalDialog (open with full request
including command, open without onAllowForSession, and closed) and assert the
same key strings (e.g., "Tool Approval", "Tool: Shell", "Risk: HIGH"/"Risk:
LOW", "Command:" and "rm -rf /tmp/demo" where applicable, "[Allow]", "[Deny]",
and absence/presence of "[Allow Session]") and that closed dialog returns an
empty trimmed string, using the same helper createTestRenderer and test names
for easy discovery.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/core/src/widgets/__tests__/overlays.test.ts`:
- Around line 125-194: Add narrow-viewport variants of the existing
toolApprovalDialog tests by re-running the same assertions using
createTestRenderer with a smaller viewport (e.g., cols: 40, rows: 10) to
validate responsive truncation/wrapping; replicate the three cases that
reference ui.toolApprovalDialog (open with full request including command, open
without onAllowForSession, and closed) and assert the same key strings (e.g.,
"Tool Approval", "Tool: Shell", "Risk: HIGH"/"Risk: LOW", "Command:" and "rm -rf
/tmp/demo" where applicable, "[Allow]", "[Deny]", and absence/presence of
"[Allow Session]") and that closed dialog returns an empty trimmed string, using
the same helper createTestRenderer and test names for easy discovery.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bd027321-54ce-4118-a826-a90f25e73acc

📥 Commits

Reviewing files that changed from the base of the PR and between 9df8069 and fe8ab16.

📒 Files selected for processing (2)
  • packages/core/src/widgets/__tests__/overlay.edge.test.ts
  • packages/core/src/widgets/__tests__/overlays.test.ts

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