@@ -78,6 +78,47 @@ def test_construct_vector_stores_section_merge() -> None:
7878 assert len (output ) == 2
7979
8080
81+ def test_construct_vector_stores_section_skips_duplicate_from_existing () -> None :
82+ """Test skips BYOK entry when vector_store_id already exists in config."""
83+ ls_config = {
84+ "registered_resources" : {
85+ "vector_stores" : [
86+ {"vector_store_id" : "store1" , "provider_id" : "original_provider" },
87+ ]
88+ }
89+ }
90+ byok_rag = [
91+ {
92+ "vector_db_id" : "store1" ,
93+ "embedding_model" : "test-model" ,
94+ "embedding_dimension" : 512 ,
95+ },
96+ ]
97+ output = construct_vector_stores_section (ls_config , byok_rag )
98+ assert len (output ) == 1
99+ assert output [0 ]["provider_id" ] == "original_provider"
100+
101+
102+ def test_construct_vector_stores_section_skips_duplicate_within_byok () -> None :
103+ """Test skips duplicate vector_db_id entries within the BYOK RAG list."""
104+ ls_config : dict [str , Any ] = {}
105+ byok_rag = [
106+ {
107+ "vector_db_id" : "store1" ,
108+ "embedding_model" : "model-a" ,
109+ "embedding_dimension" : 512 ,
110+ },
111+ {
112+ "vector_db_id" : "store1" ,
113+ "embedding_model" : "model-b" ,
114+ "embedding_dimension" : 768 ,
115+ },
116+ ]
117+ output = construct_vector_stores_section (ls_config , byok_rag )
118+ assert len (output ) == 1
119+ assert output [0 ]["embedding_model" ] == "model-a"
120+
121+
81122# =============================================================================
82123# Test construct_vector_io_providers_section
83124# =============================================================================
0 commit comments