shahar1 opened a new pull request, #73286:
URL: https://github.com/apache/airflow/pull/73286

   closes: https://github.com/apache/airflow/issues/35259
   
   ## Human Summary
   I've figured out that it would be easier and better to add all `conn_id` at 
once to all operators, as the original issue suggests, rather than managing a 
"burn-out" operation like we did in #70296. It is very quick fix, and I don't 
want to spend days reviewing AI PRs that do it. To ensure that it is being 
enforced, also added a pre-commit to do that.
   
   ## AI Summary
   <details>
   <summary>Click here</summary>
   Connection ids are meant to be templatable (`conn_id="{{ params.conn_id 
}}"`), but coverage across providers was uneven: 331 of 1144 provider classes 
with `template_fields` listed their `*conn_id` argument, the rest did not, and 
many subclasses that redefine `template_fields` silently dropped the parent's 
connection id.
   
   **Commit 1** adds every `*conn_id` argument to `template_fields` where 
templating can take effect (523 entries across 237 files, 59 providers). 
Arguments read in `__init__` or stored under a different attribute name (e.g. 
`SparkSubmitOperator` keeps `_conn_id`) are left alone since rendering would 
not reach them. Six Vertex AI operators gain an explicit `gcp_conn_id` 
parameter forwarded to the base class so `validate-operators-init` sees a plain 
assignment. Five tests asserting exact tuples are updated.
   
   **Commit 2** adds the `check-conn-id-templated` prek hook (providers config) 
so this does not erode. It parses the provider tree once, resolves 
`template_fields` across the inheritance chain the way Python does (literal 
tuples, `*Parent.template_fields`, `tuple({...} | 
set(Parent.template_fields))`, `aws_template_fields(...)`), and reports any 
`*conn_id` `__init__` argument, own or inherited, that the resolved fields 
miss. Arguments templating cannot act on are skipped. Runs in ~6 s on the full 
tree, only parses files containing `conn_id`. Covered by 16 unit tests under 
`scripts/tests/ci/prek/`.
   
   Verified with `breeze run mypy` on the touched files, the runtime superset 
check of every edited class, and the `template_fields` tests of all 59 
providers.
   
   related: #35259
   </details>
   
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Fable 5.1)
   
   Generated-by: Claude Code (Fable 5.1) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to