Repository navigation
Conversation
Dag discovery treated any file that sniffed as a zip archive as a zipped Dag, whatever its name. Formats such as .jar, .whl, .egg and .docx are zip containers too, so each of them sitting in a Dags folder was queued for parsing on every Dag processor loop, only to yield no Dags, and showed up in parsing stats and in `airflow dags report`. Zipped Dags can only be loaded from .zip files anyway, since the importer registry picks an importer by file extension, and main already discovers files by extension alone. Limiting the archive check to .zip makes discovery agree with both.
Aditya-XR
requested review from
ephraimbuddy and
jedcunningham
as code owners
October 12, 2026 07:18
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
2 tasks done
Contributor
|
Closing as we won't make additional 3.3 releases |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On 3.3, Dag discovery decides whether a non-
.pyfile is a zipped Dag withzipfile.is_zipfile()alone, without looking at the file name..jar,.whl,.egg,.docx,.xlsxand plenty of other formats are zip containers, so any of them sitting in a Dags folder gets picked up as a Dag file. The Dag processor then queues it for parsing on every loop, the parse finds no importer for that extension and returns nothing, and the file shows up in parsing stats andairflow dags reportwith 0 Dags. #71125 has a report of this from a real deployment.This goes straight to
v3-3-testbecause there is nothing to cherry-pick: onmainandv3-4-testthe importer-based discovery already matches on file extension only.Change: a non-
.pyfile is only treated as a zipped Dag when its name ends in.zip(any case) and it is a valid zip archive. Applied to both discovery paths:find_dag_file_pathsinairflow/utils/file.py, used by the Dag processor vialist_py_file_pathsPythonDagImporter.list_dag_files, used byDagBag.collect_dagsThis makes the directory walk agree with the rest of 3.3, where the importer registry already picks an importer by file extension.
Behaviour notes
.zipand.ZIParchives are discovered exactly as before, and an invalid.zipis still skipped..zip(abundle.zip.bakbackup, a file with no extension, ...) is no longer discovered. Dags inside such files couldn't be loaded before either, because no importer is registered for those extensions, so nothing that works today stops working.import_fileand_get_observed_filelocsstill useis_zipfile, but they only ever see files that discovery returned, so I left them alone to keep the patch small.Testing
.zip,.ZIP,.jar,.whl,.egg,.docx,.zip.bakand no extension. The six non-.zipcases fail on currentv3-3-testand pass with the change.airflow-core/tests/unit/utils/test_file.pyandairflow-core/tests/unit/dag_processing/: 466 passed (450 existing + 16 new). The same 450 pass on the base branch.prekon the changed files passes, including mypy for airflow-core..zipand.ZIPbundles, a plain.pyDag, a directory namedfolder.zip/, a corrupt.zip, and a.jar,.whl,.docxand.zip.bakthat each contain a Dag. Before, discovery returned 8 entries including all four non-.ziparchives; after, only the.py, the two archives and the file insidefolder.zip/. The set of loaded Dags is the same before and after.related: #71125
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5.5) following the guidelines