Skip to content

fix: detect duplicate feature view/data source names early in parse_repo to fix flaky test (#6417)#6454

Open
obielin wants to merge 2 commits into
feast-dev:masterfrom
obielin:fix/early-duplicate-validation-6417
Open

fix: detect duplicate feature view/data source names early in parse_repo to fix flaky test (#6417)#6454
obielin wants to merge 2 commits into
feast-dev:masterfrom
obielin:fix/early-duplicate-validation-6417

Conversation

@obielin
Copy link
Copy Markdown

@obielin obielin commented May 29, 2026

What this PR does / why we need it

Fixes the flaky test test_cli_apply_duplicated_featureview_names (and similar tests) that intermittently fails in CI with empty output due to subprocess timeout.

Root cause: Duplicate feature view name detection happened too late in the pipeline — inside store.plan() / store.apply() via _validate_feature_views(), after FeatureStore and heavy dependencies (Dask, registry, provider) had already been initialized. When the validation error was raised, slow atexit handlers (Dask thread pool) could block process exit indefinitely, causing the 60s timeout to trigger and the output to be lost.

Changes

sdk/python/feast/repo_operations.py

  • Added ConflictingFeatureViewNames and DataSourceRepeatNamesException imports from feast.errors
    • Added early duplicate detection in parse_repo() before any FeatureStore initialization:
    • Validates that all feature view names (across FeatureView, StreamFeatureView, OnDemandFeatureView) are case-insensitively unique → raises ConflictingFeatureViewNames immediately if collision found
    • Validates that all data source names are case-insensitively unique → raises DataSourceRepeatNamesException immediately if collision found

sdk/python/feast/cli/cli.py

  • Added import sys
    • Added FeastError to the import from feast.errors
    • Added except FeastError handler (after existing FeastProviderLoginError) in both plan_command and apply_total_command — prints a clean error message and exits with code 1 instead of letting validation errors propagate as unhandled tracebacks

How has this been tested

  • The existing integration tests in sdk/python/tests/integration/cli/test_cli_apply_duplicates.py cover the fix:
    • test_cli_apply_duplicated_featureview_names
    • test_cli_apply_duplicate_data_source_names
    • test_cli_apply_duplicated_featureview_names_multiple_py_files
      These tests assert rc != 0 and the expected error message in the output, which is now guaranteed since the error is raised before any heavy initialization.

Closes

Closes #6417

obielin added 2 commits May 29, 2026 21:25
…epo (feast-dev#6417)

Moves duplicate feature view name and data source name detection into parse_repo() before FeatureStore initialization. This prevents flaky test failures caused by slow atexit handlers (Dask, PySpark) blocking process exit when the error is raised late.
Add sys import and FeastError catch blocks to plan_command and apply_total_command in cli.py. This ensures clean error output and immediate exit (code 1) when validation errors like ConflictingFeatureViewNames are raised, preventing unhandled traceback and slow process exit.
@obielin obielin requested a review from a team as a code owner May 29, 2026 20:40
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bbcf25aaf6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +230 to +233
lower_name = fv.name.lower()
if lower_name in fv_names_seen:
existing_fv = fv_names_seen[lower_name]
raise ConflictingFeatureViewNames(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor skip-feature-view-validation during early parsing

When feast plan/apply --skip-feature-view-validation is used, _get_repo_contents() still calls parse_repo() before the flag reaches FeatureStore.plan()/apply(), so this unconditional duplicate feature-view check now fails even though those methods explicitly skip _validate_all_feature_views under that option. Repos relying on the documented escape hatch for overly strict feature-view validation will no longer be able to run the command; pass the skip flag into parsing or keep this validation on the existing gated path.

Useful? React with 👍 / 👎.

@franciscojavierarceo
Copy link
Copy Markdown
Member

@coded review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: test_cli_apply_duplicated_featureview_names fails with empty output on subprocess timeout

2 participants