@@ -904,6 +904,112 @@ def test_apply_data_source_with_timestamps(test_registry):
904904 "test_registry" ,
905905 all_fixtures ,
906906)
907+ def test_apply_data_source_cross_project_isolation (test_registry ):
908+ """Test that apply_data_source uses project-scoped filtering.
909+
910+ Regression test for https://github.com/feast-dev/feast/issues/6206:
911+ applying a data source to one project must not overwrite the data source
912+ with the same name in a different project.
913+
914+ See: feast-dev/feast#6298
915+ """
916+ project_a = "project_a"
917+ project_b = "project_b"
918+
919+ source_a = FileSource (
920+ name = "shared_source_name" ,
921+ file_format = ParquetFormat (),
922+ path = "file://feast/project_a.parquet" ,
923+ timestamp_field = "ts_col" ,
924+ )
925+ source_b = FileSource (
926+ name = "shared_source_name" ,
927+ file_format = ParquetFormat (),
928+ path = "file://feast/project_b.parquet" ,
929+ timestamp_field = "ts_col" ,
930+ )
931+
932+ test_registry .apply_data_source (source_a , project_a , commit = True )
933+ test_registry .apply_data_source (source_b , project_b , commit = True )
934+
935+ # Each project should have exactly its own source
936+ sources_a = test_registry .list_data_sources (project_a )
937+ sources_b = test_registry .list_data_sources (project_b )
938+ assert len (sources_a ) == 1
939+ assert len (sources_b ) == 1
940+
941+ # Paths must be project-specific â not overwritten cross-project
942+ assert sources_a [0 ].path == "file://feast/project_a.parquet"
943+ assert sources_b [0 ].path == "file://feast/project_b.parquet"
944+
945+ # Re-apply source_b with updated path: must not bleed into project_a
946+ source_b_updated = FileSource (
947+ name = "shared_source_name" ,
948+ file_format = ParquetFormat (),
949+ path = "file://feast/project_b_v2.parquet" ,
950+ timestamp_field = "ts_col" ,
951+ )
952+ test_registry .apply_data_source (source_b_updated , project_b , commit = True )
953+
954+ sources_a_after = test_registry .list_data_sources (project_a )
955+ assert len (sources_a_after ) == 1
956+ assert sources_a_after [0 ].path == "file://feast/project_a.parquet" , (
957+ "apply_data_source for project_b must not overwrite project_a's source"
958+ )
959+
960+ test_registry .teardown ()
961+
962+
963+ @pytest .mark .integration
964+ @pytest .mark .parametrize (
965+ "test_registry" ,
966+ all_fixtures ,
967+ )
968+ def test_delete_data_source_project_scoped (test_registry ):
969+ """Test that delete_data_source only removes the source from the given project.
970+
971+ Regression test for https://github.com/feast-dev/feast/issues/6206:
972+ deleting a data source from one project must not delete the data source
973+ with the same name from another project.
974+ """
975+ project_a = "project_a"
976+ project_b = "project_b"
977+
978+ source_a = FileSource (
979+ name = "shared_source_name" ,
980+ file_format = ParquetFormat (),
981+ path = "file://feast/project_a.parquet" ,
982+ timestamp_field = "ts_col" ,
983+ )
984+ source_b = FileSource (
985+ name = "shared_source_name" ,
986+ file_format = ParquetFormat (),
987+ path = "file://feast/project_b.parquet" ,
988+ timestamp_field = "ts_col" ,
989+ )
990+
991+ test_registry .apply_data_source (source_a , project_a , commit = True )
992+ test_registry .apply_data_source (source_b , project_b , commit = True )
993+
994+ # Delete the source from project_a only
995+ test_registry .delete_data_source ("shared_source_name" , project_a , commit = True )
996+
997+ # project_a should have no sources; project_b should be unaffected
998+ sources_a = test_registry .list_data_sources (project_a )
999+ sources_b = test_registry .list_data_sources (project_b )
1000+ assert len (sources_a ) == 0 , "Source should be deleted from project_a"
1001+ assert len (sources_b ) == 1 , "Source in project_b must not be deleted"
1002+ assert sources_b [0 ].path == "file://feast/project_b.parquet"
1003+
1004+ test_registry .teardown ()
1005+
1006+
1007+ @pytest .mark .integration
1008+ @pytest .mark .parametrize (
1009+ "test_registry" ,
1010+ all_fixtures ,
1011+ )
1012+
9071013def test_modify_feature_views_success (test_registry ):
9081014 # Create Feature Views
9091015 batch_source = FileSource (
0 commit comments