Skip to content

fix(tui): route exit commands through cleanup#54

Merged
euxaristia merged 1 commit into
Cairn:mainfrom
PierrunoYT:fix/m03-tui-exit-cleanup
Jul 24, 2026
Merged

fix(tui): route exit commands through cleanup#54
euxaristia merged 1 commit into
Cairn:mainfrom
PierrunoYT:fix/m03-tui-exit-cleanup

Conversation

@PierrunoYT

@PierrunoYT PierrunoYT commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • return loop control from slash-command handling instead of calling std::process::exit(0)
  • route /exit, /quit, and /q through the existing clean TUI shutdown path so autosave, mouse cleanup, and terminal restoration run
  • add regression coverage that submits each exit command through the Enter-key command path and verifies normal event-loop termination is requested

Closes #27.

Validation

  • cargo test --locked exit_tests (1 passed)
  • RUSTFLAGS=-Dwarnings cargo test --locked (278 passed)
  • cargo fmt --all -- --check (reports pre-existing formatting drift across src/tui.rs; unrelated whole-file formatting was intentionally not included)
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of /exit, /quit, and /q commands so the terminal interface closes cleanly.
    • Preserved normal operation after empty input and unrecognized command options.
    • Prevented abrupt process termination when exiting through supported commands.
  • Tests

    • Added coverage verifying that exit commands stop the terminal interface as expected.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c4ad75fd-e3e4-48a9-9fc8-e5de668e3abc

📥 Commits

Reviewing files that changed from the base of the PR and between 7ebe4f4 and 2c5fb10.

📒 Files selected for processing (1)
  • src/tui.rs

📝 Walkthrough

Walkthrough

handle_command now returns a boolean loop-control result. Enter-key slash-command handling propagates that result, and /exit, /quit, and /q return false instead of terminating the process. Tests cover all three aliases.

Changes

TUI exit control

Layer / File(s) Summary
Command return contract
src/tui.rs
handle_command returns boolean results for empty, invalid, and non-exit commands.
Exit command wiring and validation
src/tui.rs
Enter-key command submission propagates the result; exit aliases return false and are covered by tests.

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

Suggested reviewers: euxaristia

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: routing TUI exit commands through cleanup.
Linked Issues check ✅ Passed The changes match #27 by returning loop-control signals instead of calling std::process::exit and adding exit-command coverage.
Out of Scope Changes check ✅ Passed The patch appears scoped to TUI exit handling and its regression tests, with no unrelated changes indicated.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@euxaristia euxaristia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Approved after audit.

@euxaristia
euxaristia merged commit 7b0fa5f into Cairn:main Jul 24, 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.

[Medium][M-03] Route exit commands through TUI cleanup

3 participants