Skip to content

fix: cancel ask flow on ctrl-c#4

Merged
devkade merged 2 commits intomainfrom
fix/issue-3-ctrl-c-cancel
Mar 29, 2026
Merged

fix: cancel ask flow on ctrl-c#4
devkade merged 2 commits intomainfrom
fix/issue-3-ctrl-c-cancel

Conversation

@devkade
Copy link
Copy Markdown
Owner

@devkade devkade commented Mar 29, 2026

Summary

  • make Ctrl-C cancel the ask flow in inline and tabbed UIs
  • preserve existing Escape behavior for editor-local exit vs flow cancel
  • add interaction coverage for Ctrl-C cancellation paths

Closes #3

Summary by CodeRabbit

  • New Features

    • Ctrl+C now immediately cancels interactions across interfaces, exiting note-editing and tab flows and returning a cancelled/empty-selection result.
  • Tests

    • Added interactive tests covering Ctrl+C cancellation from note editor, tabs, and submit navigation to ensure cancellation propagates correctly.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 29, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8faf444c-2ad9-4d5f-b3b1-9666f07943e3

📥 Commits

Reviewing files that changed from the base of the PR and between 8d66213 and 618f92c.

📒 Files selected for processing (1)
  • test/ask-ui-interaction.test.ts

📝 Walkthrough

Walkthrough

The change adds Ctrl+C handling to both inline and tabbed ask UIs: pressing Ctrl+C triggers an immediate cancel by calling done({ cancelled: true }), returning early from input handling and bypassing other key logic. Tests exercising cancellation from note editor and tabs were added.

Changes

Cohort / File(s) Summary
Ctrl+C Input Handlers
src/ask-inline-ui.ts, src/ask-tabs-ui.ts
Added high-priority early-exit key handlers: on Ctrl+C the UI calls done(..., cancelled: true) and returns immediately, skipping other input handling paths (note editing, navigation, submit, Escape handling).
Interactive Tests
test/ask-ui-interaction.test.ts
Added three interactive tests that simulate Ctrl+C from inline note editor and tabbed flows, asserting cancellation ({ cancelled: true } or empty selectedOptions) propagates correctly across UI states.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I thumped my foot and hit Ctrl-C,
A soft escape, a quick set free.
Notes closed gently, tabs waved adieu,
Hop away now — the prompt is through. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive Description addresses main changes but significantly deviates from the required template structure with missing sections like Validation checklist and Risk & Rollback. Complete the description using the template: add Validation checklist, Ask Session Logging Contract section if applicable, and Risk & Rollback assessment.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Title 'fix: cancel ask flow on ctrl-c' clearly and concisely summarizes the main change of implementing Ctrl-C cancellation.
Linked Issues check ✅ Passed Changes fully implement the requirement from issue #3 to make Ctrl-C behave like Escape by adding early-exit handlers in both UI flows with test coverage.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing Ctrl-C cancellation in ask flows and corresponding test coverage with no unrelated modifications.

✏️ 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 fix/issue-3-ctrl-c-cancel

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)
test/ask-ui-interaction.test.ts (1)

280-308: Test name at Line 280 is broader than the exercised path.

This case currently validates note-editor Ctrl-C only; consider renaming it (or adding the missing question-tab path) so the title matches behavior.

Proposed small cleanup
-it("cancels tab flow on Ctrl-C from question, note editor, and submit tab", async () => {
+it("cancels tab flow on Ctrl-C from note editor", async () => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/ask-ui-interaction.test.ts` around lines 280 - 308, The test named
"cancels tab flow on Ctrl-C from question, note editor, and submit tab" is
misleading because the implemented UI path only exercises the note-editor
Ctrl-C; update the test to either (a) rename the it(...) description to reflect
that it verifies Ctrl-C cancels from the note-editor only, or (b) extend the
simulated interactions in the custom factory/component (the calls to
component.handleInput including the "	", "memo", and "�" sequence) to also
exercise the question-tab and submit-tab flows so the title matches. Locate the
test case and modify the string passed to it(...) or add additional
component.handleInput steps and assertions around askQuestionsWithTabs to cover
the other tabs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@test/ask-ui-interaction.test.ts`:
- Around line 280-308: The test named "cancels tab flow on Ctrl-C from question,
note editor, and submit tab" is misleading because the implemented UI path only
exercises the note-editor Ctrl-C; update the test to either (a) rename the
it(...) description to reflect that it verifies Ctrl-C cancels from the
note-editor only, or (b) extend the simulated interactions in the custom
factory/component (the calls to component.handleInput including the "	", "memo",
and "�" sequence) to also exercise the question-tab and submit-tab flows so the
title matches. Locate the test case and modify the string passed to it(...) or
add additional component.handleInput steps and assertions around
askQuestionsWithTabs to cover the other tabs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4a7f4a1d-96e3-4c0e-b576-535c5c1dea71

📥 Commits

Reviewing files that changed from the base of the PR and between fde7001 and 8d66213.

📒 Files selected for processing (3)
  • src/ask-inline-ui.ts
  • src/ask-tabs-ui.ts
  • test/ask-ui-interaction.test.ts

@devkade devkade merged commit 333404b into main Mar 29, 2026
2 checks passed
@devkade devkade deleted the fix/issue-3-ctrl-c-cancel branch March 29, 2026 15:37
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.

[Feature request] Make Ctrl-C behave like Escape

1 participant