Skip to content

Commit 5b34cbb

Browse files
fix: Add project filter to apply_data_source and delete_data_source
Fixes two methods in the shared registry that were matching data sources by name only, without filtering by project. In multi-project registries where different projects share the same data source name (e.g. the default "vals_to_add"), this caused: - apply_data_source: cross-project overwriting of data sources - delete_data_source: deleting data sources from the wrong project Changes: - apply_data_source: adds and existing_data_source_proto.project == project check (mirrors the pattern used in apply_entity, apply_feature_service, apply_feature_view) - delete_data_source: uses the same project-scoped filter for consistency - Fix Unicode mojibake in registry.py comments (em dashes and right arrows were stored as double-encoded Latin-1 bytes) - apply ruff format - collapse single-line timestamp assignment Fixes #6206 Signed-off-by: Venkateswarlu Boggavarapu <mailtoboggavarapu@gmail.com>
1 parent 835cda8 commit 5b34cbb

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -394,16 +394,17 @@ 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:
401404
return
402405
else:
403406
# Preserve created_timestamp from existing data source
404-
data_source.created_timestamp = (
405-
existing_data_source.created_timestamp
406-
)
407+
data_source.created_timestamp = existing_data_source.created_timestamp
407408
del registry.data_sources[idx]
408409
break
409410

@@ -423,7 +424,10 @@ def delete_data_source(self, name: str, project: str, commit: bool = True):
423424
for idx, data_source_proto in enumerate(
424425
self.cached_registry_proto.data_sources
425426
):
426-
if data_source_proto.name == name:
427+
if (
428+
data_source_proto.name == name
429+
and data_source_proto.project == project
430+
):
427431
del self.cached_registry_proto.data_sources[idx]
428432
if commit:
429433
self.commit()
@@ -688,13 +692,13 @@ def apply_feature_view(
688692

689693
if not is_latest:
690694
# 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
695+
# Note: The file registry is last-write-wins for true concurrent races —
692696
# this is a pre-existing limitation for all file registry operations.
693697
# For multi-client environments, use the SQL registry.
694698
record = self._get_version_record(feature_view.name, project, pin_version)
695699

696700
if record is not None:
697-
# Version exists pin/revert to that snapshot
701+
# Version exists → pin/revert to that snapshot
698702
# Check that the user hasn't also modified the definition.
699703
# Compare user's FV (with version="latest") against active FV.
700704
self._prepare_registry_for_changes(project)
@@ -735,7 +739,7 @@ def apply_feature_view(
735739
# Apply the restored FV using the standard path below
736740
feature_view = restored_fv
737741
else:
738-
# Version doesn't exist forward declaration: create it
742+
# Version doesn't exist → forward declaration: create it
739743
feature_view.current_version_number = pin_version
740744
feature_view_proto = feature_view.to_proto()
741745
feature_view_proto.spec.project = project

0 commit comments

Comments
 (0)