From 8fa00a0be7274486d2a09ac714d286103524950c Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Wed, 1 Apr 2026 10:21:29 -0700 Subject: [PATCH] tui: replace debug/test-only crate features with debug_assertions ## Why The remaining `vt100-tests` and `debug-logs` features in `codex-tui` were only selecting debug and test-only behavior. Those are exactly the cases where this repo already accepts `#[cfg(debug_assertions)]` as the Cargo-free substitute. ## What changed - delete `vt100-tests` and `debug-logs` from `codex-tui` - gate the VT100 integration tests with `debug_assertions` instead of a Cargo feature - gate the textarea debug log site with `debug_assertions` - shrink the manifest verifier allowlist again so only the remaining real feature exceptions stay permitted --- .github/scripts/verify_cargo_workspace_manifests.py | 2 -- codex-rs/tui/Cargo.toml | 4 ---- codex-rs/tui/src/bottom_pane/textarea.rs | 2 +- codex-rs/tui/tests/all.rs | 2 +- codex-rs/tui/tests/suite/vt100_history.rs | 2 +- codex-rs/tui/tests/suite/vt100_live_commit.rs | 2 +- 6 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/scripts/verify_cargo_workspace_manifests.py b/.github/scripts/verify_cargo_workspace_manifests.py index 0ad363f5b7..c576719e38 100644 --- a/.github/scripts/verify_cargo_workspace_manifests.py +++ b/.github/scripts/verify_cargo_workspace_manifests.py @@ -30,8 +30,6 @@ MANIFEST_FEATURE_EXCEPTIONS = { }, "codex-rs/tui/Cargo.toml": { "default": ("voice-input",), - "vt100-tests": (), - "debug-logs": (), "voice-input": ("dep:cpal",), }, } diff --git a/codex-rs/tui/Cargo.toml b/codex-rs/tui/Cargo.toml index 33485008cb..ee13092900 100644 --- a/codex-rs/tui/Cargo.toml +++ b/codex-rs/tui/Cargo.toml @@ -19,10 +19,6 @@ path = "src/lib.rs" [features] default = ["voice-input"] -# Enable vt100-based tests (emulator) when running with `--features vt100-tests`. -vt100-tests = [] -# Gate verbose debug logging inside the TUI implementation. -debug-logs = [] voice-input = ["dep:cpal"] [lints] diff --git a/codex-rs/tui/src/bottom_pane/textarea.rs b/codex-rs/tui/src/bottom_pane/textarea.rs index 18a7f8d312..58c7283801 100644 --- a/codex-rs/tui/src/bottom_pane/textarea.rs +++ b/codex-rs/tui/src/bottom_pane/textarea.rs @@ -530,7 +530,7 @@ impl TextArea { self.move_cursor_to_end_of_line(/*move_down_at_eol*/ true); } _o => { - #[cfg(feature = "debug-logs")] + #[cfg(debug_assertions)] tracing::debug!("Unhandled key event in TextArea: {:?}", _o); } } diff --git a/codex-rs/tui/tests/all.rs b/codex-rs/tui/tests/all.rs index 91de618f68..f1ef0f1106 100644 --- a/codex-rs/tui/tests/all.rs +++ b/codex-rs/tui/tests/all.rs @@ -1,6 +1,6 @@ // Single integration test binary that aggregates all test modules. // The submodules live in `tests/suite/`. -#[cfg(feature = "vt100-tests")] +#[cfg(debug_assertions)] mod test_backend; #[allow(unused_imports)] diff --git a/codex-rs/tui/tests/suite/vt100_history.rs b/codex-rs/tui/tests/suite/vt100_history.rs index 6df9dedf13..c740858969 100644 --- a/codex-rs/tui/tests/suite/vt100_history.rs +++ b/codex-rs/tui/tests/suite/vt100_history.rs @@ -1,4 +1,4 @@ -#![cfg(feature = "vt100-tests")] +#![cfg(debug_assertions)] #![expect(clippy::expect_used)] use crate::test_backend::VT100Backend; diff --git a/codex-rs/tui/tests/suite/vt100_live_commit.rs b/codex-rs/tui/tests/suite/vt100_live_commit.rs index 2be9658b23..d1ef96fd88 100644 --- a/codex-rs/tui/tests/suite/vt100_live_commit.rs +++ b/codex-rs/tui/tests/suite/vt100_live_commit.rs @@ -1,4 +1,4 @@ -#![cfg(feature = "vt100-tests")] +#![cfg(debug_assertions)] use crate::test_backend::VT100Backend; use ratatui::layout::Rect;