Skip to content

Add smoke test for broken import#66846

Open
parkhojeong wants to merge 2 commits into
apache:mainfrom
parkhojeong:add-import-smoke-check
Open

Add smoke test for broken import#66846
parkhojeong wants to merge 2 commits into
apache:mainfrom
parkhojeong:add-import-smoke-check

Conversation

@parkhojeong
Copy link
Copy Markdown
Contributor

@parkhojeong parkhojeong commented May 13, 2026

Problem

A broken import is sitting in the codebase, undetected by any check.

  • task_handler_with_custom_formatter.py has broken import _render_template_to_string from airflow.utils.helpers

Root cause

The module-level __getattr__ makes mypy treat every undefined name as possibly valid. so imports of removed symbols pass without warning

airflow.utils.helpers has a __getattr__ deprecation shim that masks removed-symbol imports from mypy.

Changes

Add a runtime smoke check for airflow.* module imports. Walks every module under airflow.* and verifies it can be imported. not a replacement for static analysis, but a backstop for what it can't see.

  • Excluded modules
    • Alembic env.py modules — require an Alembic runtime context.
    • apache-beam modules — heavy optional dep. covered by providers-tests instead.
  • Fix the broken import
    • TaskHandlerWithCustomFormatter
breeze shell -c "python /opt/airflow/scripts/in_container/run_check_airflow_import_smoke.py"
Screenshot
Before fixing
image
After fixing
image

Notes

Happy to wire it into pre-commit/CI, or split the regression fix into a separate PR — whichever you'd prefer.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)
    Cluade Code(Opus5.7)

@boring-cyborg boring-cyborg Bot added area:dev-tools area:logging backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch labels May 13, 2026
@parkhojeong parkhojeong marked this pull request as ready for review May 13, 2026 16:45
@parkhojeong
Copy link
Copy Markdown
Contributor Author

The CI failure around jwt.types.Options does not seem related to this PR.

@potiuk potiuk force-pushed the add-import-smoke-check branch from d6880a1 to fb5eae1 Compare May 13, 2026 18:56
@choo121600 choo121600 added the ready for maintainer review Set after triaging when all criteria pass. label May 15, 2026
@parkhojeong parkhojeong changed the title Add import smoke check Add smoke test for broken import May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools area:logging backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants