@@ -812,6 +812,107 @@ TEST(config_yaml_edit_goose_extensions_preserve_siblings) {
812812 PASS ();
813813}
814814
815+ TEST (config_yaml_edit_goose_accepts_empty_flow_mapping_in_sibling_issue1673 ) {
816+ const char * initial = "extensions:\n"
817+ " demo:\n"
818+ " enabled: true\n"
819+ " type: stdio\n"
820+ " cmd: /bin/true\n"
821+ " args:\n"
822+ " - --serve\n"
823+ " envs: {}\n"
824+ " env_keys: []\n"
825+ " timeout: 300\n"
826+ "GOOSE_THINKING_EFFORT: max\n" ;
827+ const char * block = " type: stdio\n"
828+ " cmd: \"/opt/codebase-memory-mcp\"\n"
829+ " args: []\n"
830+ " enabled: true\n" ;
831+ const char * expected = "extensions:\n"
832+ " demo:\n"
833+ " enabled: true\n"
834+ " type: stdio\n"
835+ " cmd: /bin/true\n"
836+ " args:\n"
837+ " - --serve\n"
838+ " envs: {}\n"
839+ " env_keys: []\n"
840+ " timeout: 300\n"
841+ " codebase-memory-mcp:\n"
842+ " type: stdio\n"
843+ " cmd: \"/opt/codebase-memory-mcp\"\n"
844+ " args: []\n"
845+ " enabled: true\n"
846+ "GOOSE_THINKING_EFFORT: max\n" ;
847+ yaml_fixture_t fixture ;
848+ ASSERT_EQ (yaml_fixture_init (& fixture , initial ), 0 );
849+
850+ ASSERT_EQ (cbm_yaml_upsert_owned_mapping_entry (fixture .path , "extensions" , "codebase-memory-mcp" ,
851+ block ),
852+ CBM_YAML_IDENTITY_EDIT_OK );
853+ char * installed = yaml_read_alloc (fixture .path );
854+ ASSERT_NOT_NULL (installed );
855+ ASSERT_STR_EQ (installed , expected );
856+
857+ free (installed );
858+ th_cleanup (fixture .dir );
859+ PASS ();
860+ }
861+
862+ TEST (config_yaml_edit_goose_still_rejects_nonempty_flow_mapping_issue1673 ) {
863+ const char * initial = "extensions:\n"
864+ " demo:\n"
865+ " enabled: true\n"
866+ " type: stdio\n"
867+ " cmd: /bin/true\n"
868+ " args: []\n"
869+ " envs: {FOO: bar}\n"
870+ " env_keys: []\n"
871+ " timeout: 300\n" ;
872+ const char * block = " type: stdio\n"
873+ " cmd: \"/opt/codebase-memory-mcp\"\n"
874+ " args: []\n"
875+ " enabled: true\n" ;
876+ yaml_fixture_t fixture ;
877+ ASSERT_EQ (yaml_fixture_init (& fixture , initial ), 0 );
878+
879+ ASSERT_EQ (cbm_yaml_upsert_owned_mapping_entry (fixture .path , "extensions" , "codebase-memory-mcp" ,
880+ block ),
881+ CBM_YAML_IDENTITY_EDIT_ERROR );
882+ char * unchanged = yaml_read_alloc (fixture .path );
883+ ASSERT_NOT_NULL (unchanged );
884+ ASSERT_STR_EQ (unchanged , initial );
885+
886+ free (unchanged );
887+ th_cleanup (fixture .dir );
888+ PASS ();
889+ }
890+
891+ TEST (config_yaml_edit_goose_still_rejects_merge_key_with_empty_mapping_issue1673 ) {
892+ const char * initial = "extensions:\n"
893+ " demo:\n"
894+ " type: stdio\n"
895+ " cmd: /bin/true\n"
896+ " <<: {}\n" ;
897+ const char * block = " type: stdio\n"
898+ " cmd: \"/opt/codebase-memory-mcp\"\n"
899+ " args: []\n"
900+ " enabled: true\n" ;
901+ yaml_fixture_t fixture ;
902+ ASSERT_EQ (yaml_fixture_init (& fixture , initial ), 0 );
903+
904+ ASSERT_EQ (cbm_yaml_upsert_owned_mapping_entry (fixture .path , "extensions" , "codebase-memory-mcp" ,
905+ block ),
906+ CBM_YAML_IDENTITY_EDIT_ERROR );
907+ char * unchanged = yaml_read_alloc (fixture .path );
908+ ASSERT_NOT_NULL (unchanged );
909+ ASSERT_STR_EQ (unchanged , initial );
910+
911+ free (unchanged );
912+ th_cleanup (fixture .dir );
913+ PASS ();
914+ }
915+
815916TEST (config_yaml_edit_owned_agent_mapping_installs_idempotently_and_removes_exact_state ) {
816917 struct owned_mapping_case {
817918 const char * section ;
@@ -1592,6 +1693,9 @@ SUITE(config_yaml_edit) {
15921693 RUN_TEST (config_yaml_edit_hermes_mapping_lifecycle );
15931694 RUN_TEST (config_yaml_edit_hermes_creates_missing_section );
15941695 RUN_TEST (config_yaml_edit_goose_extensions_preserve_siblings );
1696+ RUN_TEST (config_yaml_edit_goose_accepts_empty_flow_mapping_in_sibling_issue1673 );
1697+ RUN_TEST (config_yaml_edit_goose_still_rejects_nonempty_flow_mapping_issue1673 );
1698+ RUN_TEST (config_yaml_edit_goose_still_rejects_merge_key_with_empty_mapping_issue1673 );
15951699 RUN_TEST (config_yaml_edit_owned_agent_mapping_installs_idempotently_and_removes_exact_state );
15961700 RUN_TEST (config_yaml_edit_owned_agent_mapping_preserves_foreign_same_name_state );
15971701 RUN_TEST (config_yaml_edit_mapping_remove_first_middle_last );
0 commit comments