Skip to content

[Python] Honor exception_level on NotFound in VertexAIFeatureStore enrichment handlers - #41705

Open
arijeetmukherjee3108-droid wants to merge 1 commit into
apache:masterfrom
arijeetmukherjee3108-droid:fix-vertex-ai-feature-store-not-found
Open

arijeetmukherjee3108-droid wants to merge 1 commit into
apache:masterfrom
arijeetmukherjee3108-droid:fix-vertex-ai-feature-store-not-found

Conversation

@arijeetmukherjee3108-droid

Copy link
Copy Markdown
Contributor

Addresses #41345

Summary

  • Fix UnboundLocalError in VertexAIFeatureStoreEnrichmentHandler.__call__ when fetch_feature_values raises NotFound and exception_level=ExceptionLevel.QUIET by returning (request, beam.Row()) without logging.
  • Honor exception_level (RAISE, WARN, QUIET) on NotFound in VertexAIFeatureStoreLegacyEnrichmentHandler.__call__ instead of unconditionally raising ValueError.
  • Add unit tests in sdks/python/apache_beam/transforms/enrichment_handlers/vertex_ai_feature_store_test.py covering QUIET, WARN, and RAISE on NotFound for both handlers.

Note on __init__ existence checks (item 3 in #41345): Kept the eager admin checks in __init__ unchanged to preserve existing fail-fast behavior verified by test_permission_denied_online_store, test_raise_error_feature_store_not_found_online_store, and test_vertex_ai_legacy_feature_store_invalid_featurestore. Happy to address that separately if maintainers prefer deferring it to __enter__.

Testing

  • Ran pytest sdks/python/apache_beam/transforms/enrichment_handlers/vertex_ai_feature_store_test.py -v (10 passed) and enrichment_test.py (11/11 total passed).
  • Verified clean skip when google.cloud.aiplatform is unavailable (non-GCP environment).
  • Verified pylint --rcfile=sdks/python/.pylintrc (10.00/10), yapf --diff, and git diff --cached --check report no issues.

@github-actions github-actions Bot added python core size/m M: 50-249 lines changed labels Nov 26, 2026

@github-actions github-actions Bot left a comment

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.

📋 Review Summary

This PR cleanly resolves two bugs in the Vertex AI Feature Store enrichment handlers: it prevents an UnboundLocalError when fetch_feature_values raises NotFound under ExceptionLevel.QUIET in VertexAIFeatureStoreEnrichmentHandler, and updates VertexAIFeatureStoreLegacyEnrichmentHandler to properly respect exception_level (RAISE, WARN, and QUIET) on NotFound exceptions. Comprehensive unit tests are included for all ExceptionLevel variants across both handlers.

🔍 General Feedback

  • The control flow in except NotFound: is clean, concise, and consistent across both the online store and legacy handlers.
  • Retaining the existing __init__ existence validation preserves backward compatibility with existing unit tests (TestVertexAIFeatureStoreHandlerInit).
  • Test coverage in vertex_ai_feature_store_test.py thoroughly exercises QUIET, WARN, and RAISE modes for both handlers.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @tvalentyn for label python.
Backup reviewer: damccorm (if the main reviewer is unresponsive, you can escalate to them by tagging their username)

This pull request likely touches a core component ("core" label). Please review with scrutiny.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant