Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions codex-rs/app-server-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ pub mod legacy_core {
pub use codex_core::personality_migration::*;
}

pub mod test_support {
pub use codex_core::test_support::*;
}

pub mod windows_sandbox {
Comment thread
etraut-openai marked this conversation as resolved.
pub use codex_core::windows_sandbox::*;
}
Expand Down
7 changes: 5 additions & 2 deletions codex-rs/tui/src/app/test_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 7 additions & 4 deletions codex-rs/tui/src/app/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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());

(
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion codex-rs/tui/src/app/tests/model_catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions codex-rs/tui/src/chatwidget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ use crate::bottom_pane::TerminalTitleSetupView;
use crate::diff_model::FileChange;
use crate::git_action_directives::parse_assistant_markdown;
use crate::legacy_core::config::Config;
use crate::legacy_core::config::Constrained;
use crate::legacy_core::config::ConstraintResult;
use crate::legacy_core::config::PermissionProfileSnapshot;
#[cfg(any(target_os = "windows", test))]
use crate::legacy_core::windows_sandbox::WindowsSandboxLevelExt;
Expand Down Expand Up @@ -126,6 +124,8 @@ use codex_app_server_protocol::TurnPlanStepStatus;
use codex_app_server_protocol::TurnStatus;
use codex_app_server_protocol::UserInput;
use codex_config::ConfigLayerStackOrdering;
use codex_config::Constrained;
use codex_config::ConstraintResult;
use codex_config::types::ApprovalsReviewer;
use codex_config::types::Notifications;
use codex_config::types::WindowsSandboxModeToml;
Expand Down
6 changes: 4 additions & 2 deletions codex-rs/tui/src/chatwidget/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ pub(super) use crate::diff_model::FileChange;
pub(super) use crate::history_cell::UserHistoryCell;
pub(super) use crate::legacy_core::config::Config;
pub(super) use crate::legacy_core::config::ConfigBuilder;
pub(super) use crate::legacy_core::config::Constrained;
pub(super) use crate::legacy_core::config::ConstraintError;
pub(super) use crate::model_catalog::ModelCatalog;
pub(super) use crate::test_backend::VT100Backend;
pub(super) use crate::test_support::PathBufExt;
Expand Down Expand Up @@ -120,6 +118,8 @@ pub(super) use codex_app_server_protocol::UserInput;
pub(super) use codex_app_server_protocol::UserInput as AppServerUserInput;
pub(super) use codex_app_server_protocol::WarningNotification;
pub(super) use codex_config::ConfigLayerStack;
pub(super) use codex_config::Constrained;
pub(super) use codex_config::ConstraintError;
pub(super) use codex_config::RequirementSource;
pub(super) use codex_config::types::ApprovalsReviewer;
pub(super) use codex_config::types::Notifications;
Expand All @@ -129,6 +129,8 @@ pub(super) use codex_core_skills::model::SkillMetadata;
pub(super) use codex_features::FEATURES;
pub(super) use codex_features::Feature;
pub(super) use codex_git_utils::CommitLogEntry;
pub(super) use codex_models_manager::test_support::construct_model_info_offline_for_tests;
pub(super) use codex_models_manager::test_support::get_model_offline_for_tests;
pub(super) use codex_otel::RuntimeMetricsSummary;
pub(super) use codex_otel::SessionTelemetry;
pub(super) use codex_protocol::ThreadId;
Expand Down
11 changes: 6 additions & 5 deletions codex-rs/tui/src/chatwidget/tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ pub(super) fn snapshot(percent: f64) -> RateLimitSnapshot {
}

pub(super) 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,
Expand All @@ -136,7 +137,7 @@ pub(super) fn test_session_telemetry(config: &Config, model: &str) -> SessionTel

pub(super) fn test_model_catalog(_config: &Config) -> Arc<ModelCatalog> {
Arc::new(ModelCatalog::new(
crate::legacy_core::test_support::all_model_presets().clone(),
crate::test_support::TEST_MODEL_PRESETS.clone(),
))
}

Expand All @@ -152,9 +153,9 @@ pub(super) async fn make_chatwidget_manual(
let app_event_tx = AppEventSender::new(tx_raw);
let (op_tx, op_rx) = unbounded_channel::<Op>();
let mut cfg = test_config().await;
let resolved_model = model_override.map(str::to_owned).unwrap_or_else(|| {
crate::legacy_core::test_support::get_model_offline(cfg.model.as_deref())
});
let resolved_model = model_override
.map(str::to_owned)
.unwrap_or_else(|| get_model_offline_for_tests(cfg.model.as_deref()));
if let Some(model) = model_override {
cfg.model = Some(model.to_string());
}
Expand Down
4 changes: 2 additions & 2 deletions codex-rs/tui/src/chatwidget/tests/plan_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ async fn collaboration_modes_defaults_to_code_on_startup() {
assert_eq!(chat.active_collaboration_mode_kind(), ModeKind::Default);
assert_eq!(
chat.current_model(),
crate::legacy_core::test_support::get_model_offline(chat.config.model.as_deref())
get_model_offline_for_tests(chat.config.model.as_deref())
);
}

Expand Down Expand Up @@ -1482,7 +1482,7 @@ async fn make_startup_chat_with_cli_overrides(
.build()
.await
.expect("config");
let resolved_model = crate::legacy_core::test_support::get_model_offline(cfg.model.as_deref());
let resolved_model = get_model_offline_for_tests(cfg.model.as_deref());
let session_telemetry = test_session_telemetry(&cfg, resolved_model.as_str());
let init = ChatWidgetInit {
config: cfg.clone(),
Expand Down
2 changes: 1 addition & 1 deletion codex-rs/tui/src/chatwidget/tests/popups_and_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async fn experimental_mode_plan_is_ignored_on_startup() {
.build()
.await
.expect("config");
let resolved_model = crate::legacy_core::test_support::get_model_offline(cfg.model.as_deref());
let resolved_model = get_model_offline_for_tests(cfg.model.as_deref());
let session_telemetry = test_session_telemetry(&cfg, resolved_model.as_str());
let init = ChatWidgetInit {
config: cfg.clone(),
Expand Down
2 changes: 1 addition & 1 deletion codex-rs/tui/src/chatwidget/tests/status_and_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ async fn configured_pet_load_is_deferred_until_after_construction() {
let mut cfg = test_config().await;
cfg.tui_pet = Some(crate::pets::DEFAULT_PET_ID.to_string());
crate::pets::write_test_pack(&cfg.codex_home);
let resolved_model = crate::legacy_core::test_support::get_model_offline(cfg.model.as_deref());
let resolved_model = get_model_offline_for_tests(cfg.model.as_deref());
let session_telemetry = test_session_telemetry(&cfg, resolved_model.as_str());
let init = ChatWidgetInit {
config: cfg.clone(),
Expand Down
4 changes: 2 additions & 2 deletions codex-rs/tui/src/debug_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,16 +544,16 @@ mod tests {
use super::render_debug_config_lines;
use super::sandbox_mode_is_allowed_by_permissions;
use super::session_all_proxy_url;
use crate::legacy_core::config::Constrained;
use crate::legacy_core::config::ConstraintError;
use crate::legacy_core::config::Permissions;
use codex_app_server_protocol::AskForApproval;
use codex_app_server_protocol::ConfigLayerSource;
use codex_config::ConfigLayerEntry;
use codex_config::ConfigLayerStack;
use codex_config::ConfigRequirements;
use codex_config::ConfigRequirementsToml;
use codex_config::Constrained;
use codex_config::ConstrainedWithSource;
use codex_config::ConstraintError;
use codex_config::FeatureRequirementsToml;
use codex_config::FilesystemConstraints;
use codex_config::HookEventsToml;
Expand Down
Loading
Loading