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

   Reverts #76131 and adds a static check so the same removal cannot land again 
by accident.
   
   related: #76568
   
   Every released Airflow 3 core re-exports `TimeDeltaSensorAsync` from the 
standard provider as `airflow.sensors.time_delta.TimeDeltaSensorAsync`. 
Removing the class in a provider release breaks that import on every core the 
provider still supports. Dropping the shim entry on `main` does not help, 
because released cores keep it. This was raised on the providers RC issue.
   
   Changes on top of the revert:
   
   * New prek hook `check-core-shim-targets-exist`. It reads every 
`add_deprecated_classes` map in `airflow-core` and fails when an 
`airflow.providers.*` target no longer exists in the provider sources. It 
parses the files and imports nothing, and ignores names bound only under 
`TYPE_CHECKING`. It covers all providers that core shims point at, not only 
standard. It runs on every change, so deleting a provider module alone cannot 
skip it.
   * The `TimeDeltaSensorAsync` warning now says the class will be removed once 
the provider requires Airflow 4, instead of "in a future version". The `TODO: 
Remove in the next major release` comment is gone, since a provider major is 
not the right trigger.
   * `AirflowProviderDeprecationWarning` is kept rather than 
`RemovedInAirflow4Warning`, because the standard provider still supports 
Airflow 2.11, which has no such class.
   
   The standard provider wave that prepared 2.0.0 needs to be redone. With 
#76131 reverted, the next release is a minor.
   
   Known limit: the hook checks the shim maps on `main`. A change that removes 
both the provider class and the core shim entry, as #76131 did, still passes 
it. Catching that needs the shim maps of released cores, which CI does not have 
without release tags.
   
   Checks run locally:
   
   * `uv run --project scripts pytest 
scripts/tests/ci/prek/test_check_core_shim_targets_exist.py`: 13 passed.
   * `uv run --project scripts pytest scripts/tests/`: 1977 passed, 1 skipped.
   * Removing the class while keeping the core shim entry makes the hook fail 
with the expected message.
   * `prek run --from-ref main --stage pre-commit`: all hooks pass except 
`check-template-fields-valid`, which could not build the CI image in my 
sandbox. The `breeze testing` commands from `breeze verify` were not run for 
the same reason. CI runs them.
   * `uv run --project providers/standard pytest 
providers/standard/tests/unit/standard/sensors/test_time_delta.py`: 19 passed.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5.5)
   
   Generated-by: Claude Code (Opus 5.5) 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