Eason09053360 opened a new pull request, #73377:
URL: https://github.com/apache/airflow/pull/73377
## Why
Parsing a bundle requires calling `bundle.initialize()` first — that is what
puts its files
on disk (`GitDagBundle` clones the repo there). Four CLI call sites skip it,
so with a Git
bundle `bundle.path` is still empty and `--bundle-name` silently does the
wrong thing:
- `dags list --local --bundle-name X` → empty list, exit 0
- `dags list-import-errors --local --bundle-name X` → "no import errors",
exit 0
- `tasks test` / `dags test` / `tasks clear --dag-regex` → miss the named
bundle and fall
back to scanning every configured bundle, which can return a same-named
Dag from a
different one
`dags report`, `dags reserialize` and the fallback loop in `get_bagged_dag`
already
initialize; that loop got its call in #53699, which fixed only the reported
occurrence.
## What
- `airflow-core/src/airflow/utils/cli.py`: the explicit-bundle loop in
`get_bagged_dag`,
and `_find_dag` in `get_dags`.
- `airflow-core/src/airflow/cli/commands/dag_command.py`: the `--local
--bundle-name`
branches of `dag_list_dags` and `dag_list_import_errors`.
Tests use a bundle whose files only appear during `initialize()`, so they
fail on an
uninitialized bundle instead of asserting that a mock was called.
One behaviour change: `_find_dag` is shared with the "scan all bundles"
fallback, so a
bundle whose `initialize()` raises now aborts that search — same as
`get_bagged_dag`'s
fallback already does. Can guard it with try/except instead if preferred.
---
##### 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]