Skip to content

fix: let split --dry-run run unattended instead of aborting on closed stdin - #173

Open
vitali87 wants to merge 1 commit into
mainfrom
fix/dry-run-non-interactive
Open

fix: let split --dry-run run unattended instead of aborting on closed stdin#173
vitali87 wants to merge 1 commit into
mainfrom
fix/dry-run-non-interactive

Conversation

@vitali87

Copy link
Copy Markdown
Owner

Summary

split --dry-run < /dev/null — the documented automation mode (preview + save plan) — exited 1 without saving anything. The interactive editor runs unconditionally before the plan is saved, and typer/click converts the EOF from a closed stdin into an Abort inside the prompt, so no except EOFError around it can help. The repo's own scripts/score_pr.py had to work around this with input="done\n".

_interactive_edit now returns the plan as-is with a yellow notice when sys.stdin.isatty() is false, before any prompt. Interactive behaviour (including Ctrl+C → abort) is unchanged. Review verified with real subprocess runs: dry-run with closed stdin exits 0 and writes the plan; the score_pr.py workaround still works; a non-dry-run split with closed stdin is still stopped by the Proceed with creating branches and PRs? confirm gate before anything is created.

Test plan

  • TestDryRunWithClosedStdin drives the real editor under CliRunner's non-TTY stdin (no _interactive_edit patch) — fails on main, passes here
  • Review ran the CLI end to end in a scratch repo for dry-run, piped-"done", and non-dry-run closed-stdin cases
  • 457 tests pass, ruff clean
  • Local review: 5/5

… stdin

The interactive editor ran unconditionally before the plan was saved, and
typer.prompt turns the EOF from a closed stdin (scripts, CI,
'split --dry-run < /dev/null') into an Abort, so the documented automation
mode exited 1 without saving anything - the repo's own scripts/score_pr.py
had to work around it with input='done'. The editor is now skipped with a
notice when stdin is not a TTY; click converts EOF to Abort inside the
prompt itself, so the guard has to happen before prompting.
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 6 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6ad63bf4-a125-4700-80bb-ac1532662634

📥 Commits

Reviewing files that changed from the base of the PR and between db793ec and e2efecd.

📒 Files selected for processing (2)
  • pr_split/cli.py
  • tests/test_cli_coverage.py

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.

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