SEPURI-SAI-KRISHNA opened a new pull request, #72171:
URL: https://github.com/apache/airflow/pull/72171

   Addresses the bulk of the deferred hook-configuration gap tracked in #72144.
   
   `AwsBaseWaiterTrigger` now builds the hook itself, from the parameters it 
already serializes, driven by an `aws_hook_class` attribute, the same 
arrangement `AwsBaseHookMixin` gives the operators. Subclasses name the hook 
they need instead of constructing it, so `region_name`, `verify` and 
`botocore_config` reach the triggerer by default rather than only where a
   subclass remembered to thread them through.
   
   That removes 40 bespoke `hook()` implementations, and takes the provider 
from **49 of 113** defer sites forwarding the full hook configuration to **110 
of 113**.
   
   ### What is deliberately left out
   
   **Three services are reserved for the Contributors Workshop**, at the 
request of the workshop organiser on #72144: `sensors/batch.py`, 
`sensors/opensearch_serverless.py` and 
`operators/sagemaker_unified_studio_notebook.py`. They are listed in 
`PENDING_MIGRATION` in the invariant test, which asserts each entry is still 
*needed*, a stale line fails the suite, so the allowlist cannot outlive the 
work it tracks.
   
   **`SageMakerNotebookOperator`** defers to `SageMakerNotebookJobTrigger`, 
which is a plain `BaseTrigger` whose hook is addressed by execution name and 
takes no connection parameters at all. **`EksPodOperator`** defers to 
`EksPodTrigger`, a `KubernetesPodTrigger` that reaches the pod through a 
kubeconfig rather than a boto3 client. Neither is an instance of this bug; both 
are named explicitly in the test rather than passed over silently.
   
   ### Invariant test
   
   `test_deferred_hook_configuration.py` walks every `self.defer(trigger=...)` 
call in the provider and fails if one does not pass the hook configuration, 
plus asserts every `AwsBaseWaiterTrigger` subclass can actually build a hook. 
It resolves a `trigger=` expression to every construction it can evaluate to, 
so a trigger chosen in a conditional expression is checked on both branches, 
that is how the two `EmrContainer` sites were caught. A defer site whose 
trigger is a bare reference is asserted against an explicit allowlist rather 
than skipped. An operator added later that forgets the parameters fails in CI 
rather than in production.
   
   ### Notes for review
   
   - **Stacked on #72098.** No file overlaps, but the invariant test asserts 
every non-allowlisted site forwards the configuration, and 13 of them are fixed 
by that PR. This should merge after it.
   - `aws_hook_class` binds the hook at class definition, so the 
`@patch("...triggers.<module>.<Hook>")` idiom no longer intercepts it for 
migrated triggers. No existing test needed changing as a result.
   - `EmrContainerTrigger`'s hook takes an extra `virtual_cluster_id`, so it 
overrides `_hook_parameters` rather than using the default, the escape hatch 
the base class keeps for exactly this.
   - `EksDeleteClusterTrigger` bypasses the base `__init__` and rolls its own 
`serialize()`, so it sets and serializes the two new parameters explicitly.
   - Verified against a full run of the operator, sensor and trigger suites: 
2463 passed, 3 skipped, with an identical list of 5 failures and 30 collection 
errors before and after the change (all missing optional dependencies in the 
local environment, `airflow_shared`, `common.messaging`, openlineage).
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5)
   
   Generated-by: Claude Code (Opus 5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


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