Skip to content

Commit 7af2d71

Browse files
fix: Add project filter to apply_data_source and delete_data_source (fixes feast-dev#6206)
Filters existing data sources by both name and project in the file registry implementation, fixing cross-project contamination (issue feast-dev#6206). Changes: - apply_data_source: added project-scoped deduplication check - delete_data_source: added project filter to avoid cross-project deletion Signed-off-by: Venkateswarlu Boggavarapu <[email protected]>
1 parent f08b4e8 commit 7af2d71

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎sdk/python/feast/infra/registry/registry.py‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,12 @@ def list_data_sources(
386386
def apply_data_source(
387387
self, data_source: DataSource, project: str, commit: bool = True
388388
):
389+
"""Apply a data source to the registry with project-scoped deduplication.
390+
391+
Filters existing data sources by both name and project (fixes feast-dev/feast#6206),
392+
preserving the original created_timestamp if the source already exists in the
393+
target project.
394+
"""
389395
now = _utc_now()
390396
if not data_source.created_timestamp:
391397
data_source.created_timestamp = now
@@ -394,7 +400,10 @@ def apply_data_source(
394400
registry = self._prepare_registry_for_changes(project)
395401

396402
for idx, existing_data_source_proto in enumerate(registry.data_sources):
397-
if existing_data_source_proto.name == data_source.name:
403+
if (
404+
existing_data_source_proto.name == data_source.name
405+
and existing_data_source_proto.project == project
406+
):
398407
existing_data_source = DataSource.from_proto(existing_data_source_proto)
399408
# Check if the data source has actually changed
400409
if existing_data_source == data_source:
@@ -423,7 +432,7 @@ def delete_data_source(self, name: str, project: str, commit: bool = True):
423432
for idx, data_source_proto in enumerate(
424433
self.cached_registry_proto.data_sources
425434
):
426-
if data_source_proto.name == name:
435+
if data_source_proto.name == name and data_source_proto.project == project:
427436
del self.cached_registry_proto.data_sources[idx]
428437
if commit:
429438
self.commit()

0 commit comments

Comments
 (0)