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

   ### Problem
   
   `SecretCache` is declared in `__lazy_imports`, so `from airflow.sdk import 
SecretCache` works at runtime — but it is missing from both `__all__` and the 
`TYPE_CHECKING` re-export block. Consequences:
   
   - type checkers and IDEs flag every such import — including seven uses 
inside airflow-core itself (`dag_processing/manager.py`, 
`models/connection.py`, `models/variable.py` ×3, and two test files)
   - the name is invisible to `from airflow.sdk import *` and the generated API 
docs
   
   This is the same class as #75744 (the `lineage` export).
   
   ### Fix
   
   Declare `SecretCache` in `__all__` and re-export it in the `TYPE_CHECKING` 
block (`airflow.sdk.execution_time.cache` import, isorted).
   
   ### Guard
   
   Adds `task-sdk/tests/test_sdk_public_api.py`: a static consistency test that 
parses the package root and fails when any `__lazy_imports` name is missing 
from `__all__` or the `TYPE_CHECKING` block. Module-level annotated names like 
`conf` are the sanctioned exception, so the `lineage`/`SecretCache` class of 
drift cannot silently return.
   
   ### Tests
   
   Both guard tests fail on `main` (assertion message names `SecretCache`) and 
pass with this change:
   
   ```
   tests/test_sdk_public_api.py::test_lazy_imports_are_declared_in_all PASSED
   
tests/test_sdk_public_api.py::test_lazy_imports_are_reexported_for_type_checkers
 PASSED
   ```
   
   Runtime sanity: `airflow.sdk.SecretCache` resolves to 
`airflow.sdk.execution_time.cache.SecretCache` and `'SecretCache' in 
airflow.sdk.__all__` is `True`. `ruff` (pinned 0.17.3) check + format clean on 
both touched files.
   
   ---
   
   _Transparent disclosure: developed and verified with AI assistance under 
human direction, per the repo's agent guidelines._
   


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