@@ -775,51 +775,52 @@ mod tests {
775775 use ratatui:: layout:: Rect ;
776776 use std:: path:: PathBuf ;
777777
778+ fn sample_plugin_details ( ) -> codex_app_server_protocol:: MigrationDetails {
779+ codex_app_server_protocol:: MigrationDetails {
780+ plugins : vec ! [
781+ PluginsMigration {
782+ marketplace_name: "acme-tools" . to_string( ) ,
783+ plugin_names: vec![
784+ "deployer" . to_string( ) ,
785+ "formatter" . to_string( ) ,
786+ "lint" . to_string( ) ,
787+ ] ,
788+ } ,
789+ PluginsMigration {
790+ marketplace_name: "team-marketplace" . to_string( ) ,
791+ plugin_names: vec![ "asana" . to_string( ) ] ,
792+ } ,
793+ PluginsMigration {
794+ marketplace_name: "debug" . to_string( ) ,
795+ plugin_names: vec![ "sample" . to_string( ) ] ,
796+ } ,
797+ PluginsMigration {
798+ marketplace_name: "data-tools" . to_string( ) ,
799+ plugin_names: vec![ "warehouse" . to_string( ) ] ,
800+ } ,
801+ ] ,
802+ }
803+ }
804+
778805 fn sample_items ( ) -> Vec < ExternalAgentConfigMigrationItem > {
806+ // Keep snapshot fixtures descriptive but synthetic so layout coverage
807+ // stays stable when detection/path-formatting behavior changes.
779808 vec ! [
780809 ExternalAgentConfigMigrationItem {
781810 item_type: ExternalAgentConfigMigrationItemType :: Config ,
782- description:
783- "Migrate /Users/alex/.claude/settings.json into /Users/alex/.codex/config.toml"
784- . to_string( ) ,
811+ description: "Migrate home settings into home config" . to_string( ) ,
785812 cwd: None ,
786813 details: None ,
787814 } ,
788815 ExternalAgentConfigMigrationItem {
789816 item_type: ExternalAgentConfigMigrationItemType :: Plugins ,
790- description:
791- "Migrate enabled plugins from /workspace/project/.claude/settings.json"
792- . to_string( ) ,
817+ description: "Migrate enabled plugins from project settings" . to_string( ) ,
793818 cwd: Some ( PathBuf :: from( "/workspace/project" ) ) ,
794- details: Some ( codex_app_server_protocol:: MigrationDetails {
795- plugins: vec![
796- PluginsMigration {
797- marketplace_name: "acme-tools" . to_string( ) ,
798- plugin_names: vec![
799- "deployer" . to_string( ) ,
800- "formatter" . to_string( ) ,
801- "lint" . to_string( ) ,
802- ] ,
803- } ,
804- PluginsMigration {
805- marketplace_name: "team-marketplace" . to_string( ) ,
806- plugin_names: vec![ "asana" . to_string( ) ] ,
807- } ,
808- PluginsMigration {
809- marketplace_name: "debug" . to_string( ) ,
810- plugin_names: vec![ "sample" . to_string( ) ] ,
811- } ,
812- PluginsMigration {
813- marketplace_name: "data-tools" . to_string( ) ,
814- plugin_names: vec![ "warehouse" . to_string( ) ] ,
815- } ,
816- ] ,
817- } ) ,
819+ details: Some ( sample_plugin_details( ) ) ,
818820 } ,
819821 ExternalAgentConfigMigrationItem {
820822 item_type: ExternalAgentConfigMigrationItemType :: AgentsMd ,
821- description: "Migrate /workspace/project/CLAUDE.md to /workspace/project/AGENTS.md"
822- . to_string( ) ,
823+ description: "Migrate CLAUDE.md to AGENTS.md" . to_string( ) ,
823824 cwd: Some ( PathBuf :: from( "/workspace/project" ) ) ,
824825 details: None ,
825826 } ,
@@ -856,6 +857,71 @@ mod tests {
856857 assert_snapshot ! ( "external_agent_config_migration_prompt" , rendered) ;
857858 }
858859
860+ #[ test]
861+ fn display_description_rewrites_project_config_paths_relative_to_cwd ( ) {
862+ let cwd = PathBuf :: from ( "/workspace/project" ) ;
863+
864+ let item = ExternalAgentConfigMigrationItem {
865+ item_type : ExternalAgentConfigMigrationItemType :: Config ,
866+ description :
867+ "Migrate /workspace/project/source.json into /workspace/project/target.toml"
868+ . to_string ( ) ,
869+ cwd : Some ( cwd) ,
870+ details : None ,
871+ } ;
872+
873+ assert_eq ! (
874+ ExternalAgentConfigMigrationScreen :: display_description( & item) ,
875+ "Migrate source.json into target.toml"
876+ ) ;
877+ }
878+
879+ #[ test]
880+ fn display_description_rewrites_project_plugin_paths_and_adds_summary ( ) {
881+ let item = ExternalAgentConfigMigrationItem {
882+ item_type : ExternalAgentConfigMigrationItemType :: Plugins ,
883+ description : "Migrate enabled plugins from /workspace/project/plugins.json" . to_string ( ) ,
884+ cwd : Some ( PathBuf :: from ( "/workspace/project" ) ) ,
885+ details : Some ( sample_plugin_details ( ) ) ,
886+ } ;
887+
888+ assert_eq ! (
889+ ExternalAgentConfigMigrationScreen :: display_description( & item) ,
890+ "Migrate enabled plugins from plugins.json (4 marketplaces, 6 plugins)"
891+ ) ;
892+ }
893+
894+ #[ test]
895+ fn display_description_rewrites_project_markdown_paths_relative_to_cwd ( ) {
896+ let item = ExternalAgentConfigMigrationItem {
897+ item_type : ExternalAgentConfigMigrationItemType :: AgentsMd ,
898+ description : "Migrate /workspace/project/source.md to /workspace/project/target.md"
899+ . to_string ( ) ,
900+ cwd : Some ( PathBuf :: from ( "/workspace/project" ) ) ,
901+ details : None ,
902+ } ;
903+
904+ assert_eq ! (
905+ ExternalAgentConfigMigrationScreen :: display_description( & item) ,
906+ "Migrate source.md to target.md"
907+ ) ;
908+ }
909+
910+ #[ test]
911+ fn display_description_preserves_home_scope_descriptions ( ) {
912+ let item = ExternalAgentConfigMigrationItem {
913+ item_type : ExternalAgentConfigMigrationItemType :: Config ,
914+ description : "Migrate home settings into home config" . to_string ( ) ,
915+ cwd : None ,
916+ details : None ,
917+ } ;
918+
919+ assert_eq ! (
920+ ExternalAgentConfigMigrationScreen :: display_description( & item) ,
921+ "Migrate home settings into home config"
922+ ) ;
923+ }
924+
859925 #[ test]
860926 fn proceed_returns_selected_items ( ) {
861927 let items = sample_items ( ) ;
0 commit comments