ayanhussain81 opened a new pull request, #74372:
URL: https://github.com/apache/airflow/pull/74372
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
`sync_bundles_to_db` handles a configured bundle whose view URL template or
template
parameters raise by logging the error and `continue`-ing. The bundle is
never removed from
the set of stored rows that the end of the sync deactivates, so a bundle
that is still in the
config gets treated as "no longer found in config":
- its `DagBundleModel` row is set to `active = False`,
- its `ParseImportError` rows are deleted, hiding the failure from users,
- its team association is cleared (`bundle.teams = []`) until a later
successful sync.
The log line "is no longer found in config and has been disabled" is also
wrong in this case.
This change leaves a configured bundle's stored row untouched when template
generation fails
(`stored.pop(name, None)` before the `continue`). It also passes the
helper's own `bundle_name`
parameter to `get_bundle` instead of the enclosing loop variable `name`. The
two are equal at the
only call site today, so this is a latent fix rather than a behavior change.
Regression test:
`test_sync_bundles_to_db_keeps_configured_bundle_active_when_template_fails`
makes `_extract_template_params` raise for a bundle that was previously
active and asserts it
stays active and keeps its import error. It fails on `main` and passes with
this change.
Verified locally: the new test passes; `test_dag_bundle_manager.py` shows 55
passing tests. Three
tests in that file error at setup with `ModuleNotFoundError: No module named
'airflow_shared'` in
a local sandbox (unrelated to this change; it comes from the log-capture
fixture). `ruff check`
and `ruff format --check` are clean on both changed files.
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
<!--
Generated-by: Claude Code following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
-->
Claude Code was used to locate the bug, reproduce it with a test, implement
the change, and run
the tests and linters. The diff and test results were reviewed before
submission.
---
* Read the [Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines).
* No related issue. Found through source review of
`dag_processing/bundles/manager.py`.
* Newsfragment (`{pr_number}.bugfix.rst`) will be added as a follow-up
commit once the PR number is known.
🤖 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]