Skip to content

fix(cli): print cancellation footer once - #1581

Merged
aidenybai merged 1 commit into
mainfrom
codex/dedupe-tui-cancel-footer
Aug 5, 2026
Merged

fix(cli): print cancellation footer once#1581
aidenybai merged 1 commit into
mainfrom
codex/dedupe-tui-cancel-footer

Conversation

@aidenybai

@aidenybai aidenybai commented Aug 5, 2026

Copy link
Copy Markdown
Member

Why

Before: pressing Ctrl-C after opening and closing the issue review cleared Ink and printed the cancellation footer, then the resolved report lifecycle printed the normal scan footer again.

After: Ctrl-C marks the existing TUI quit state before clearing Ink, so cancellation owns the only footer while normal completion remains unchanged.

Product brief:

  • Job: let an interactive CLI user cancel after reviewing issues and get one clear exit message with a restored terminal.
  • Reuse: use the existing pendingActions.didQuit footer suppression instead of adding another output mode or state owner.
  • Metric: keep the existing tui.cancelled counter; no new telemetry surface is needed.
  • Compatibility: patch changeset only; no flags, config, report schema, score, package API, or GitHub Action behavior changes.
  • Kill signal: revert if cancellation telemetry starts reporting errors or the lifecycle regression can no longer prove one footer owner.

What changed

  • notify ScanApp's existing quit owner before the Ctrl-C path clears the active Ink renderer
  • preserve the dedicated cancellation footer and suppress the completed-scan footer
  • cover the full report → issue review → back → Ctrl-C sequence

Test plan

  • nr test
  • nr lint
  • nr typecheck
  • nr format:check
  • nr smoke:json-report
  • npx -y react-doctor@latest --verbose --scope changed
  • real PTY on a Next.js project: --scope full --verbose --yes, enter issue review, escape back, then Ctrl-C; exits 130 with one cancellation footer

Note

Low Risk
Small CLI-only change to Ctrl-C handling with a focused regression test; no auth, data, or API impact.

Overview
Fixes a TUI bug where Ctrl-C after visiting issue review and returning to the report could print two footers: the cancellation message and then the normal completed-scan footer.

useExitOnCtrlC now accepts an optional onCancel callback and ScanApp passes onQuit into it so Ctrl-C sets the same pendingActions.didQuit flag as q / Esc before Ink tears down. That reuses existing footer suppression instead of new state.

A new scan-app test covers report → issue review → back → Ctrl-C and asserts onQuit and exitGracefully run once.

Reviewed by Cursor Bugbot for commit 408aa3c. Bugbot is set up for automated code reviews on this repo. Configure here.

@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@1581
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@1581
npm i https://pkg.pr.new/react-doctor@1581

commit: 408aa3c

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 408aa3c.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Interactive terminal E2E

React Doctor interactive terminal recording

Recorded from the built CLI at 408aa3c in a real terminal. The fixture holds Git busy for three seconds, so Scanning... must appear immediately after project selection, then exercises the compact interactive report.

Download the GIF and MP4 artifact

@aidenybai
aidenybai merged commit 274bd39 into main Aug 5, 2026
27 of 29 checks passed
@aidenybai
aidenybai deleted the codex/dedupe-tui-cancel-footer branch August 5, 2026 05:39
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