Validate Google operator templated parameters after rendering - #70534
Open
mitre88 wants to merge 1 commit into
Open
Validate Google operator templated parameters after rendering#70534mitre88 wants to merge 1 commit into
mitre88 wants to merge 1 commit into
Conversation
CloudSpeechToTextRecognizeSpeechOperator, CloudTextToSpeechSynthesizeOperator, and CloudFirestoreExportDatabaseOperator validate template fields inside _validate_inputs() called from __init__, so the checks ran against un-rendered Jinja expressions and an empty rendered value was never caught. The validation now runs at execute time, and the raises are narrowed from AirflowException to ValueError per the ongoing exception clean-up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three Google provider operators —
CloudSpeechToTextRecognizeSpeechOperator,CloudTextToSpeechSynthesizeOperator, andCloudFirestoreExportDatabaseOperator— validate their template fields (audio,config,input_data,voice,audio_config,target_bucket_name,target_filename,body) inside a_validate_inputs()helper called from__init__.Because the helper reads the fields through a method call, the
validate-operators-initcheck cannot see these reads (same blind spot as the AppFlow subclasses fixed in #70440), but the bug is the same one tracked in #70296: the emptiness checks run against un-rendered Jinja expressions, which are always non-empty, so a templated value rendering to an empty string is never caught. The_validate_inputs()call is moved to the start ofexecute()in all three operators.While relocating them, the
raise AirflowExceptionusages are narrowed toValueErrorper the ongoing exception clean-up (known_airflow_exceptions.txtentries for the three files drop to 0), following the pattern of #66279.Tests: converted the text-to-speech missing-argument test to the new exception type (it already exercised
execute), and added execute-time tests for the speech-to-text and Firestore operators that construct with a templated value and validate the rendered value — both fail against the previous implementation.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Fable 5) following the guidelines