Repository navigation
Sweep cli/src/ui: inline wrappers, fix fake tests - #1961
Conversation
Assisted-by: Claude Code:claude-opus-5-5
confirm() now builds its Ask inline: the ask() and confirm_waits() wrappers are gone, and read_answer() is folded into confirm_with(). Ask loses non_interactive_answer, which every caller set to default_yes, and Ask, confirm_with and the note consts become private. select_one no longer re-checks the process quiet flag: its only caller passes the same flags ui::init saw, and --json returns earlier. ui/mod.rs replaces the four stdout_vt/stderr_vt fns with one vt() pair, drops the env_var wrapper, and fixes the severity comment that pointed at a moved get.rs fn. status.rs inlines term_is_dumb. Tests: drop the tautological wording test, the setup-style test of the removed field, the read_answer test that repeated the confirm_with cases, and the duplicate nobody-waits test. The TTY-dependent confirm_waits test becomes yes_or_json_answers_the_ default. status.rs drops a duplicate finish_with case. Assisted-by: Claude Code:claude-opus-5-5
Restores select_one's process-wide quiet check (a caller passing derived flags would otherwise print the note under --silent), keeps the env_var helper, and gives each platform its own vt() so the Windows body needs no return (clippy needless_return). Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ee261ca. Configure here.
Records the sweep PR in the register and the coverage manifest, and logs the run. Assisted-by: Claude Code:claude-opus-5-5
|
[burn-down agent] Labeled Ready for review at ee261ca.
Generated by Claude Code |
Final review briefWhat it does. This is a refactor sweep of Risk: low. Each removed item had its only users inside these three files (checked with a grep of Look here
Verified
Changes I made. None. Open questions. None. The three findings the author left unfixed are explained in the description, and I agree they are out of scope. Auto-merge is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
Wenxin Jiang (Wenxin-Jiang)
left a comment
There was a problem hiding this comment.
[agent] Reviewed ee261caddf0d669ba61d6e4b41b59caeae1d261c. Checked prompt defaults/EOF/error behavior, terminal VT checks and status-line gating. No major correctness issues found. Validation: source and regression-test review plus the available exact-head CI checks; no local test pass is claimed.
LLM Description written by Claude Code:claude-opus-5-5
Architecture refactor sweep of
crates/socket-patch-cli/src/ui/{mod,prompt,status,test_support}.rs, from the audit notes incoverage/files.tsv(ledger brancharch-audit/ledger, discussion #1830, living document Part 4 "structure").ui/text.rsis held by #1884. TheStatusLine::stderr(json, silent)→ one-bool change is also held, because its callers (scan/mod.rs,lock_cli.rs) are in open PRs.Changes
prompt.rsask()andconfirm_waits()intoconfirm(), and foldedread_answer()(single caller) intoconfirm_with()using early returns.Ask.non_interactive_answer: every caller set it todefault_yes.Ask,confirm_withand the threeNON_INTERACTIVE_*consts private, since nothing outside the file uses them.non_interactive_notes_share_one_wording(it asserted the consts equal their own literals);setup_style_default_no_but_proceed_when_non_interactive(it tested the removed field);read_answer_maps_empty_to_none_and_eof_to_decline(it repeated theconfirm_withcases: empty, whitespace, yes, no, non-UTF-8, EOF);a_prompt_nobody_waits_on_never_reads_the_answer(a duplicate ofnon_interactive_silent_writes_nothing);confirm_waits_agrees_with_confirm_over_the_flag_cubewithyes_or_json_answers_the_default. The old(yes=false, json=false)cell failed whenever stdin was a TTY;non_interactive_returns_the_non_interactive_answer_with_note→non_interactive_answers_the_default_with_note.eof_declines_even_when_default_is_yes;--yes/--jsonearly return failsyes_or_json_answers_the_default.mod.rsstdout_vt/stderr_vtfns andvt_probewith onevt() -> (stdout, stderr)per platform.ranking::severity_order.textgained exports.status.rsterm_is_dumb.shorter_after_longer_leaves_no_residue, which duplicated thefinish_withregression test; both tests are renamed after what they check.test_support.rsis clean. Its test stays inmod.rs:tests/common/pty_io.rsincludes the file by path, so a#[cfg(test)]module inside it would run in every integration binary./code-review high
I fixed 3 findings:
select_one'squiet()guard, which protects callers that pass derived flags;env_varhelper;vt(), so Windows clippy has noneedless_return.I left 3 findings unfixed:
(bool, bool)tuple can be misread. Its only callers are two adjacent lines inmod.rsand one instatus.rs, and the order is documented.TERM=dumbis read in two places. This existed before this PR (the audit notes list it); unifying it would change the live-line policy underNO_COLOR.confirmnon-TTY path has no end-to-end test. The old test only checked it when stdin was not a TTY, andtests/scanandtests/updatecover the non-interactive note end to end.Stats
git diff --stat: 3 files, +60 / −215. Production about +20 / −62; tests about +40 / −153.Behavior
None.
Risk
Low. Platform-specific code changed: the Windows
vt()inmod.rs. CI's windows compile check covers it; a maintainer may want a full-scope run.Results:
cargo clippy --workspace --all-features -D warnings: clean;cargo test -p socket-patch-cli --lib: 936 pass;--test update/--test scan: 247 + 68 pass;https://claude.ai/code/session_011f9aeQr6f8dLWGHbq6xTvm
Generated by Claude Code