Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion sdk/python/feast/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.
import json
import logging
import sy
from datetime import datetime
from importlib.metadata import version as importlib_version
from pathlib import Path
Expand Down Expand Up @@ -49,7 +50,7 @@
from feast.cli.ui import ui
from feast.cli.validation_references import validation_references_cmd
from feast.constants import FEAST_FS_YAML_FILE_PATH_ENV_NAME
from feast.errors import FeastProviderLoginError
from feast.errors import FeastError, FeastProviderLoginError
from feast.repo_config import load_repo_config
from feast.repo_operations import (
apply_total,
Expand Down Expand Up @@ -258,6 +259,10 @@ def plan_command(
plan(repo_config, repo, skip_source_validation, skip_feature_view_validation)
except FeastProviderLoginError as e:
print(str(e))
Comment on lines 260 to 261

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 FeastProviderLoginError silently exits with code 0 while all other FeastErrors exit with code 1

In both plan_command and apply_total_command, the except FeastProviderLoginError handler catches the error and prints it but does not call sys.exit(1). Since FeastProviderLoginError is a subclass of FeastError (feast/errors.py:217), it is caught by the first handler and never reaches the new except FeastError block that calls sys.exit(1). This means a provider login failure during feast plan or feast apply will result in exit code 0 (success), which is incorrect for CI/CD pipelines and scripts that rely on exit codes to detect failures. The same pattern appears in apply_total_command at cli.py:321-322.

Suggested change
except FeastProviderLoginError as e:
print(str(e))
except FeastProviderLoginError as e:
print(str(e))
sys.exit(1)
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

sys.exit(1)
except FeastError as e:
print(str(e))
sys.exit(1)


@cli.command("apply", cls=NoOptionDefaultFormat)
Expand Down Expand Up @@ -316,6 +321,10 @@ def apply_total_command(
)
except FeastProviderLoginError as e:
print(str(e))
sys.exit(1)
except FeastError as e:
print(str(e))
sys.exit(1)


@cli.command("teardown", cls=NoOptionDefaultFormat)
Expand Down
28 changes: 28 additions & 0 deletions sdk/python/feast/repo_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from feast.data_source import DataSource, KafkaSource, KinesisSource
from feast.diff.registry_diff import extract_objects_for_keep_delete_update_add
from feast.entity import Entity
from feast.errors import ConflictingFeatureViewNames, DataSourceRepeatNamesException
from feast.feature_service import FeatureService
from feast.feature_store import FeatureStore
from feast.feature_view import DUMMY_ENTITY, FeatureView
Expand Down Expand Up @@ -219,6 +220,33 @@ def parse_repo(repo_root: Path) -> RepoContents:
elif isinstance(obj, Project) and not any((obj is p) for p in res.projects):
res.projects.append(obj)

# Early duplicate detection: validate feature view names are case-insensitively unique
# This runs before FeatureStore initialization to avoid slow cleanup on error
fv_names_seen = {}
all_feature_views = (
res.feature_views + res.stream_feature_views + res.on_demand_feature_views
)
for fv in all_feature_views:
lower_name = fv.name.lower()
if lower_name in fv_names_seen:
existing_fv = fv_names_seen[lower_name]
raise ConflictingFeatureViewNames(
fv.name,
existing_type=type(existing_fv).__name__,
new_type=type(fv).__name__,
)
fv_names_seen[lower_name] = fv

# Early duplicate detection: validate data source names are case-insensitively unique
ds_names_seen = {}
for ds in res.data_sources:
if ds.name is None:
continue
lower_name = ds.name.lower()
if lower_name in ds_names_seen:
raise DataSourceRepeatNamesException(ds.name)
ds_names_seen[lower_name] = ds

res.entities.append(DUMMY_ENTITY)
return res

Expand Down