Skip to content

Commit 9378ca8

Browse files
fix: add project filter to apply_data_source and delete_data_source
Fixes feast-dev#6206 The apply_data_source method was matching data sources by name only, without filtering by project. In a shared registry scenario where multiple projects have data sources with the same name (e.g. the default "vals_to_add"), this caused cross-project overwriting. Also fix delete_data_source to use the same project-scoped filter, ensuring consistency across all registry mutation methods. Additionally fix Unicode mojibake in comments (em dashes were double-encoded as Latin-1 codepoints instead of UTF-8). Signed-off-by: Venkateswarlu Boggavarapu <[email protected]>
1 parent 9107a43 commit 9378ca8

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,10 @@ def apply_data_source(
394394
registry = self._prepare_registry_for_changes(project)
395395

396396
for idx, existing_data_source_proto in enumerate(registry.data_sources):
397-
if existing_data_source_proto.name == data_source.name:
397+
if (
398+
existing_data_source_proto.name == data_source.name
399+
and existing_data_source_proto.project == project
400+
):
398401
existing_data_source = DataSource.from_proto(existing_data_source_proto)
399402
# Check if the data source has actually changed
400403
if existing_data_source == data_source:
@@ -423,7 +426,10 @@ def delete_data_source(self, name: str, project: str, commit: bool = True):
423426
for idx, data_source_proto in enumerate(
424427
self.cached_registry_proto.data_sources
425428
):
426-
if data_source_proto.name == name:
429+
if (
430+
data_source_proto.name == name
431+
and data_source_proto.project == project
432+
):
427433
del self.cached_registry_proto.data_sources[idx]
428434
if commit:
429435
self.commit()
@@ -688,13 +694,13 @@ def apply_feature_view(
688694

689695
if not is_latest:
690696
# Explicit version: check if it exists (pin/revert) or not (forward declaration).
691-
# Note: The file registry is last-write-wins for true concurrent races —
697+
# Note: The file registry is last-write-wins for true concurrent races —
692698
# this is a pre-existing limitation for all file registry operations.
693699
# For multi-client environments, use the SQL registry.
694700
record = self._get_version_record(feature_view.name, project, pin_version)
695701

696702
if record is not None:
697-
# Version exists → pin/revert to that snapshot
703+
# Version exists → pin/revert to that snapshot
698704
# Check that the user hasn't also modified the definition.
699705
# Compare user's FV (with version="latest") against active FV.
700706
self._prepare_registry_for_changes(project)
@@ -735,7 +741,7 @@ def apply_feature_view(
735741
# Apply the restored FV using the standard path below
736742
feature_view = restored_fv
737743
else:
738-
# Version doesn't exist → forward declaration: create it
744+
# Version doesn't exist → forward declaration: create it
739745
feature_view.current_version_number = pin_version
740746
feature_view_proto = feature_view.to_proto()
741747
feature_view_proto.spec.project = project

0 commit comments

Comments
 (0)