Simplify TUI startup test coverage#22573
Conversation
| let startup_tooltip_override = | ||
| prepare_startup_tooltip_override(&mut config, &available_models, is_first_run) | ||
| .await; |
There was a problem hiding this comment.
Codex flagged this, and it seems legitimate albeit minor- NUX messages may be marked as displayed when startup fails before they are displayed to the user.
[P2] Defer tooltip impression until startup succeeds — /Users/kbond/code/codex/codex-rs/tui/src/app.rs:760-760. When starting a fresh session with an eligible model-availability NUX and thread initialization fails (for example, the malformed rules path covered by the new exec-policy test), this now persists the NUX shown-count before start_thread returns, so one of the limited tooltip impressions is consumed even though the chat widget never renders it. Keep the preparation/persistence after successful thread startup, or otherwise defer the count update until the tooltip can actually be shown.
There was a problem hiding this comment.
Oops, I just noticed this comment after merging. I'll fold a fix into a follow-up PR.
Why
The TUI startup test surface had drifted into expensive, brittle coverage:
tui/tests/suite/no_panic_on_startup.rswas already ignored as flaky while still spawning a PTY to exercise malformed exec-policy rules.tui/tests/suite/model_availability_nux.rsused a seeded session, cursor-query spoofing, and repeated interrupts to verify a narrow resume-path invariant.app/tests.rshad started accumulating unrelated startup and summary coverage in one flat module even after the surrounding app code was split into feature modules.This keeps those behaviors covered while making the tests cheaper to understand and less likely to rot. It also preserves the malformed-rules regression from #8803 without requiring a terminal orchestration test.
What changed
rulesstartup PTY case with a direct exec-policy loader regression:rules_path_file_returns_read_dir_errorshould_prepare_startup_tooltip_override,then added focused coverage for the resume/fork gate and the persisted NUX counter.
tui/src/app/tests.rsinto dedicated modules so the test layout better mirrors the current app architecture.Verification
cargo test -p codex-core rules_path_file_returns_read_dir_errorcargo test -p codex-tui startup_cargo test -p codex-tui session_summary_cargo test -p codex-tui goal_slash_command_rejects_oversized_objective