Remove TUI legacy core test_support dependencies (#27484)

## Why

The TUI now sits on the app-server layer, but
`app-server-client::legacy_core` still exposed core test helpers solely
for TUI tests. We've been whittling away the remaining dependencies.
This is the next step on that journey.

There is no functional change — just a refactor, and this affects only
test code, so it should be low risk.

## What changed

- remove the `legacy_core::test_support` re-export and call
model-manager test helpers directly
- keep the bundled model-preset cache local to TUI test support
- import constraint types directly from `codex-config`
This commit is contained in:
Eric Traut authored and GitHub committed 2026-06-10 17:55:49 -07:00
1 parent 1a9efd473b
commit 36fc79c6f4
13 files changed
+73 -51

No files matched your search

+5 -2
View File
@@ -6,12 +6,14 @@
use super::*;
use crate::chatwidget::tests::make_chatwidget_manual_with_sender;
use codex_models_manager::test_support::construct_model_info_offline_for_tests;
use codex_models_manager::test_support::get_model_offline_for_tests;
pub(super) async fn make_test_app() -> App {
let (chat_widget, app_event_tx, _rx, _op_rx) = make_chatwidget_manual_with_sender().await;
let config = chat_widget.config_ref().clone();
let file_search = FileSearchManager::new(config.cwd.to_path_buf(), app_event_tx.clone());
let model = crate::legacy_core::test_support::get_model_offline(config.model.as_deref());
let model = get_model_offline_for_tests(config.model.as_deref());
let session_telemetry = test_session_telemetry(&config, model.as_str());
App {
@@ -68,7 +70,8 @@ pub(super) async fn make_test_app() -> App {
}
fn test_session_telemetry(config: &Config, model: &str) -> SessionTelemetry {
let model_info = crate::legacy_core::test_support::construct_model_info_offline(model, config);
let model_info =
construct_model_info_offline_for_tests(model, &config.to_models_manager_config());
SessionTelemetry::new(
ThreadId::new(),
model,
+7 -4
View File
@@ -75,6 +75,8 @@ use codex_app_server_protocol::TurnStatus;
use codex_app_server_protocol::UserInput;
use codex_app_server_protocol::UserInput as AppServerUserInput;
use codex_app_server_protocol::WarningNotification;
use codex_models_manager::test_support::construct_model_info_offline_for_tests;
use codex_models_manager::test_support::get_model_offline_for_tests;
use codex_otel::SessionTelemetry;
use codex_protocol::ThreadId;
use codex_protocol::config_types::CollaborationMode;
@@ -307,7 +309,7 @@ async fn enqueue_primary_thread_session_replays_turns_before_initial_prompt_subm
let thread_id = ThreadId::new();
let initial_prompt = "follow-up after replay".to_string();
let config = app.config.clone();
let model = crate::legacy_core::test_support::get_model_offline(config.model.as_deref());
let model = get_model_offline_for_tests(config.model.as_deref());
app.chat_widget = ChatWidget::new_with_app_event(ChatWidgetInit {
config,
frame_requester: crate::tui::FrameRequester::test_dummy(),
@@ -4024,7 +4026,7 @@ async fn make_test_app() -> App {
let (chat_widget, app_event_tx, _rx, _op_rx) = make_chatwidget_manual_with_sender().await;
let config = chat_widget.config_ref().clone();
let file_search = FileSearchManager::new(config.cwd.to_path_buf(), app_event_tx.clone());
let model = crate::legacy_core::test_support::get_model_offline(config.model.as_deref());
let model = get_model_offline_for_tests(config.model.as_deref());
let session_telemetry = test_session_telemetry(&config, model.as_str());
App {
@@ -4088,7 +4090,7 @@ async fn make_test_app_with_channels() -> (
let (chat_widget, app_event_tx, rx, op_rx) = make_chatwidget_manual_with_sender().await;
let config = chat_widget.config_ref().clone();
let file_search = FileSearchManager::new(config.cwd.to_path_buf(), app_event_tx.clone());
let model = crate::legacy_core::test_support::get_model_offline(config.model.as_deref());
let model = get_model_offline_for_tests(config.model.as_deref());
let session_telemetry = test_session_telemetry(&config, model.as_str());
(
@@ -4607,7 +4609,8 @@ fn lines_to_single_string(lines: &[Line<'_>]) -> String {
}
fn test_session_telemetry(config: &Config, model: &str) -> SessionTelemetry {
let model_info = crate::legacy_core::test_support::construct_model_info_offline(model, config);
let model_info =
construct_model_info_offline_for_tests(model, &config.to_models_manager_config());
SessionTelemetry::new(
ThreadId::new(),
model,
+1 -1
View File
@@ -6,7 +6,7 @@ use pretty_assertions::assert_eq;
use tokio::sync::mpsc::unbounded_channel;
fn all_model_presets() -> Vec<ModelPreset> {
crate::legacy_core::test_support::all_model_presets().clone()
crate::test_support::TEST_MODEL_PRESETS.clone()
}
fn model_availability_nux_config(shown_count: &[(&str, u32)]) -> ModelAvailabilityNuxConfig {