Lightweight coding agent that runs in your terminal
Rust
[codex] Tighten external migration prompt tests (#18768)
alexsong-oai6bbd710496e2
diff --git a/codex-rs/tui/src/external_agent_config_migration.rs b/codex-rs/tui/src/external_agent_config_migration.rsindex 2b667b802a..ecc2f75b4b 100644--- a/codex-rs/tui/src/external_agent_config_migration.rs+++ b/codex-rs/tui/src/external_agent_config_migration.rs@@ -775,7 +775,49 @@ mod tests {use ratatui::layout::Rect;use std::path::PathBuf;+ fn sample_plugin_details() -> codex_app_server_protocol::MigrationDetails {+ codex_app_server_protocol::MigrationDetails {+ plugins: vec![+ PluginsMigration {+ marketplace_name: "acme-tools".to_string(),+ plugin_names: vec![+ "deployer".to_string(),+ "formatter".to_string(),+ "lint".to_string(),+ ],+ },+ PluginsMigration {+ marketplace_name: "team-marketplace".to_string(),+ plugin_names: vec!["asana".to_string()],+ },+ PluginsMigration {+ marketplace_name: "debug".to_string(),+ plugin_names: vec!["sample".to_string()],+ },+ PluginsMigration {+ marketplace_name: "data-tools".to_string(),+ plugin_names: vec!["warehouse".to_string()],+ },+ ],+ }+ }++ #[cfg(windows)]+ fn sample_project_root() -> PathBuf {+ PathBuf::from(r"C:\workspace\project")+ }++ #[cfg(not(windows))]+ fn sample_project_root() -> PathBuf {+ PathBuf::from("/workspace/project")+ }++ fn sample_project_path(path: &str) -> String {+ sample_project_root().join(path).display().to_string()+ }+fn sample_items() -> Vec<ExternalAgentConfigMigrationItem> {+ let project_root = sample_project_root();vec![ExternalAgentConfigMigrationItem {item_type: ExternalAgentConfigMigrationItemType::Config,@@ -787,40 +829,21 @@ mod tests {},ExternalAgentConfigMigrationItem {item_type: ExternalAgentConfigMigrationItemType::Plugins,- description:- "Migrate enabled plugins from /workspace/project/.claude/settings.json"- .to_string(),- cwd: Some(PathBuf::from("/workspace/project")),- details: Some(codex_app_server_protocol::MigrationDetails {- plugins: vec![- PluginsMigration {- marketplace_name: "acme-tools".to_string(),- plugin_names: vec![- "deployer".to_string(),- "formatter".to_string(),- "lint".to_string(),- ],- },- PluginsMigration {- marketplace_name: "team-marketplace".to_string(),- plugin_names: vec!["asana".to_string()],- },- PluginsMigration {- marketplace_name: "debug".to_string(),- plugin_names: vec!["sample".to_string()],- },- PluginsMigration {- marketplace_name: "data-tools".to_string(),- plugin_names: vec!["warehouse".to_string()],- },- ],- }),+ description: format!(+ "Migrate enabled plugins from {}",+ sample_project_path(".claude/settings.json")+ ),+ cwd: Some(project_root.clone()),+ details: Some(sample_plugin_details()),},ExternalAgentConfigMigrationItem {item_type: ExternalAgentConfigMigrationItemType::AgentsMd,- description: "Migrate /workspace/project/CLAUDE.md to /workspace/project/AGENTS.md"- .to_string(),- cwd: Some(PathBuf::from("/workspace/project")),+ description: format!(+ "Migrate {} to {}",+ sample_project_path("CLAUDE.md"),+ sample_project_path("AGENTS.md")+ ),+ cwd: Some(project_root),details: None,},]@@ -853,6 +876,9 @@ mod tests {);let rendered = render_screen(&screen, /*width*/ 80, /*height*/ 21);+ #[cfg(windows)]+ assert_snapshot!("external_agent_config_migration_prompt_windows", rendered);+ #[cfg(not(windows))]assert_snapshot!("external_agent_config_migration_prompt", rendered);}diff --git a/codex-rs/tui/src/snapshots/codex_tui__external_agent_config_migration__tests__external_agent_config_migration_prompt_windows.snap b/codex-rs/tui/src/snapshots/codex_tui__external_agent_config_migration__tests__external_agent_config_migration_prompt_windows.snapnew file mode 100644index 0000000000..3c438fe458--- /dev/null+++ b/codex-rs/tui/src/snapshots/codex_tui__external_agent_config_migration__tests__external_agent_config_migration_prompt_windows.snap@@ -0,0 +1,23 @@+---+source: tui/src/external_agent_config_migration.rs+expression: rendered+---+ > External agent config detected+ We found settings from another agent that you can add to this project.+ Select what to import+ Home+ [x] Migrate /Users/alex/.claude/settings.json into /Users/alex/.codex/con…++ Project: C:\workspace\project+ [x] Migrate enabled plugins from .claude\settings.json (4 marketplaces, 6…+ • acme-tools: deployer, formatter, +1 more+ • team-marketplace: asana+ • debug: sample+ • +1 more marketplaces+ [x] Migrate CLAUDE.md to AGENTS.md++ Selected 3 of 3 item(s).+ 1. Proceed with selected+ 2. Skip for now+ 3. Don't ask again+ Use ↑/↓ to move, space to toggle, 1/2/3 to choose, a/n for all/none