1fanwang opened a new pull request, #70331: URL: https://github.com/apache/airflow/pull/70331
`ruleset` is a template field, so it is rendered after `__init__` runs. The constructor did `self.ruleset = ruleset.strip()`, which strips the un-rendered value. A templated `ruleset` that renders with surrounding whitespace is therefore never stripped, and `validate_inputs()` rejects it because the rendered value no longer ends with `]`: ``` AttributeError: RuleSet must starts with Rules = [ and ends with ] ``` Store `ruleset` verbatim in the constructor and strip the rendered value at the start of `execute()`, before validation. related: #70296 <details><summary>Testing Done</summary> Operator-level repro (real Dag, real render, real `execute` with a mocked Glue conn). Before the fix, a templated ruleset rendering to `' Rules = [...] '` reaches `validate_inputs()` unstripped and raises: ``` AttributeError: RuleSet must starts with Rules = [ and ends with ] ``` After the fix, `execute()` strips first and the API receives the clean `'Rules = [...]'`. The new `test_execute_strips_rendered_ruleset` drives that render→execute path; it fails on the pre-fix source and passes after. `TestGlueDataQualityOperator`: 11 passed. </details> --- ##### Was generative AI tooling used to co-author this PR? - [ ] Yes (please specify the tool below) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
