Skip to content

Commit 7243af3

Browse files
fix: add project filter to apply_data_source in shared registry
Fixes #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. Fixed by adding the project field check to mirror the pattern already used in apply_entity, apply_feature_service, and apply_feature_view.
1 parent 9107a43 commit 7243af3

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

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

Lines changed: 7 additions & 4 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:
@@ -688,13 +691,13 @@ def apply_feature_view(
688691

689692
if not is_latest:
690693
# 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
694+
# Note: The file registry is last-write-wins for true concurrent races —
692695
# this is a pre-existing limitation for all file registry operations.
693696
# For multi-client environments, use the SQL registry.
694697
record = self._get_version_record(feature_view.name, project, pin_version)
695698

696699
if record is not None:
697-
# Version exists pin/revert to that snapshot
700+
# Version exists → pin/revert to that snapshot
698701
# Check that the user hasn't also modified the definition.
699702
# Compare user's FV (with version="latest") against active FV.
700703
self._prepare_registry_for_changes(project)
@@ -735,7 +738,7 @@ def apply_feature_view(
735738
# Apply the restored FV using the standard path below
736739
feature_view = restored_fv
737740
else:
738-
# Version doesn't exist forward declaration: create it
741+
# Version doesn't exist → forward declaration: create it
739742
feature_view.current_version_number = pin_version
740743
feature_view_proto = feature_view.to_proto()
741744
feature_view_proto.spec.project = project

0 commit comments

Comments
 (0)