fix(tui): suppress verbose logs while alt-screen is active#2262
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Hmbown
left a comment
There was a problem hiding this comment.
Approved after the follow-up test-only commit 4e2b6a6.
I checked the alt-screen suppression paths in logging.rs/ui.rs and pushed a small test cleanup so set_verbose_respects_alt_screen_suppression now asserts the Windows and non-Windows expectations directly instead of comparing against the same helper.
Local verification on the updated head:
- cargo fmt --all -- --check
- git diff --check
- cargo test -p codewhale-tui logging::tests:: -- --nocapture
- cargo check -p codewhale-tui --all-features --locked
Leaving merge to the normal gate; GitHub CI is still running after the latest push.
|
Pushed a small maintainer follow-up for the test-reliability review note: the serialized logging-state tests now recover a poisoned mutex guard with Local verification on the updated head:
|
Hmbown
left a comment
There was a problem hiding this comment.
The maintainer follow-up keeps the test mutex from poisoning across assertions, and the refreshed CI matrix is now clean across Ubuntu, macOS, Windows, npm smoke, GitGuardian, and Greptile. This is a focused v0.8.48 candidate for the Windows alt-screen verbose-log leak path. Thanks @Sskift for carrying the regression coverage here.
|
Independent review (Devin): Correctness — suppress/restore coverage is complete. All five alt-screen transitions call the right hook: Non-atomic TOCTOU in Suppression is Windows-only; Test serialisation is solid. v0.8.48 (#2256) compatibility: clean. The feature branch touches |
|
Thanks @Sskift — this still looks like the right fix for #1909, and the Windows CI signal is exactly what I wanted to see here. The blocker now is mechanical: GitHub can’t create a clean merge commit against current |
|
Thanks @Sskift — this was the right shape of fix for the Windows alt-screen logging leak, and the tests/review work here helped validate the behavior. I’m closing this as superseded because #1909 is now fixed by #2295 ( |
Summary
Closes #1909.
Testing
Greptile Summary
This PR fixes verbose log output leaking into the Windows TUI alt-screen by splitting the single
VERBOSEatomic into three:REQUESTED_VERBOSE(what the user asked for),IN_ALT_SCREEN(current TUI state), andVERBOSE(the live effective value derived from the other two). Previous review feedback onset_verbosebypass and parallel test races has been fully addressed.logging.rsgainssuppress_for_tui_alt_screen/restore_after_tui_alt_screenhelpers and a purealt_screen_verbose_statecombinator; stateful tests are serialized with a sharedMutexand a start-of-testreset_logging_state()call that correctly survives lock poisoning.tui/ui.rswires the new helpers into every alt-screen entry and exit site: the normalrun_tuiunwind path,TerminalCleanupGuard::drop(panic/early-return safety net),pause_terminal/resume_terminal(subprocess pauses), andemergency_restore_terminal.Confidence Score: 5/5
Safe to merge — the change is self-contained to logging state management with no impact on TUI rendering or data paths.
All exit paths (normal unwind, panic via Drop, subprocess pause/resume, emergency restore) correctly call restore_after_tui_alt_screen, the suppress/restore pair is idempotent, and the test suite serializes the stateful global-atomic tests while leaving the pure-function tests free to run concurrently. No regressions are apparent on non-Windows platforms since alt_screen_verbose_state is a no-op when is_windows is false.
No files require special attention.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Caller participant run_tui participant logging participant TerminalCleanupGuard Caller->>run_tui: run_tui(config, options) run_tui->>run_tui: execute!(EnterAlternateScreen) run_tui->>logging: suppress_for_tui_alt_screen() note over logging: IN_ALT_SCREEN=true<br/>VERBOSE=false (Windows)<br/>REQUESTED_VERBOSE unchanged run_tui->>run_tui: "create TerminalCleanupGuard (defused=false)" alt Subprocess pause/resume run_tui->>run_tui: pause_terminal() run_tui->>logging: restore_after_tui_alt_screen() note over logging: IN_ALT_SCREEN=false<br/>VERBOSE=REQUESTED_VERBOSE run_tui->>run_tui: resume_terminal() run_tui->>logging: suppress_for_tui_alt_screen() end alt Normal exit run_tui->>run_tui: "cleanup_guard.defused = true" run_tui->>run_tui: execute!(LeaveAlternateScreen) run_tui->>logging: restore_after_tui_alt_screen() note over logging: IN_ALT_SCREEN=false<br/>VERBOSE=REQUESTED_VERBOSE else Panic / early return TerminalCleanupGuard->>run_tui: "drop() [defused=false]" run_tui->>run_tui: execute!(LeaveAlternateScreen) TerminalCleanupGuard->>logging: restore_after_tui_alt_screen() else Emergency Caller->>run_tui: emergency_restore_terminal() run_tui->>logging: restore_after_tui_alt_screen() endReviews (5): Last reviewed commit: "test(logging): recover poisoned test mut..." | Re-trigger Greptile