This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-1-test by this push:
new 689da8fd80c [v3-1-test] Fix import errors updating DAGs in other
bundles (#63615) (#63629)
689da8fd80c is described below
commit 689da8fd80c02b1106cfdd5dbed9c2fa6d4b7832
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sun Mar 15 10:50:28 2026 +0100
[v3-1-test] Fix import errors updating DAGs in other bundles (#63615)
(#63629)
(cherry picked from commit b93d3798cf4b4561c84900ae4821837294e03d07)
Co-authored-by: GPK <[email protected]>
---
.../src/airflow/dag_processing/collection.py | 1 +
.../tests/unit/dag_processing/test_collection.py | 36 ++++++++++++++++++++++
2 files changed, 37 insertions(+)
diff --git a/airflow-core/src/airflow/dag_processing/collection.py
b/airflow-core/src/airflow/dag_processing/collection.py
index 324232c2986..326428e7b0d 100644
--- a/airflow-core/src/airflow/dag_processing/collection.py
+++ b/airflow-core/src/airflow/dag_processing/collection.py
@@ -351,6 +351,7 @@ def _update_import_errors(
update(DagModel)
.where(
DagModel.relative_fileloc == relative_fileloc,
+ DagModel.bundle_name == bundle_name_,
)
.values(
has_import_errors=True,
diff --git a/airflow-core/tests/unit/dag_processing/test_collection.py
b/airflow-core/tests/unit/dag_processing/test_collection.py
index d38e613d2bd..f3b4ce89541 100644
--- a/airflow-core/tests/unit/dag_processing/test_collection.py
+++ b/airflow-core/tests/unit/dag_processing/test_collection.py
@@ -50,6 +50,7 @@ from airflow.models.asset import (
DagScheduleAssetUriReference,
)
from airflow.models.dag import DagTag
+from airflow.models.dagbundle import DagBundleModel
from airflow.models.errors import ParseImportError
from airflow.models.serialized_dag import SerializedDagModel
from airflow.providers.standard.operators.empty import EmptyOperator
@@ -826,6 +827,41 @@ class TestUpdateDagParsingResults:
import_errors = set(session.execute(select(ParseImportError.filename,
ParseImportError.bundle_name)))
assert import_errors == {("other.py", bundle_name)}, "Import error for
parsed file should be cleared"
+ @pytest.mark.usefixtures("clean_db")
+ def
test_import_error_update_does_not_touch_other_bundle_with_same_relative_fileloc(self,
session):
+ relative_fileloc = "example_dag.py"
+ session.add_all([DagBundleModel(name="bundle_a"),
DagBundleModel(name="bundle_b")])
+ session.flush()
+ session.add_all(
+ [
+ DagModel(dag_id="dag_in_bundle_a",
relative_fileloc=relative_fileloc, bundle_name="bundle_a"),
+ DagModel(dag_id="dag_in_bundle_b",
relative_fileloc=relative_fileloc, bundle_name="bundle_b"),
+ ]
+ )
+ session.flush()
+
+ update_dag_parsing_results_in_db(
+ bundle_name="bundle_a",
+ bundle_version=None,
+ dags=[],
+ import_errors={("bundle_a", relative_fileloc): "Import failed in
bundle_a"},
+ parse_duration=None,
+ warnings=set(),
+ session=session,
+ files_parsed={("bundle_a", relative_fileloc)},
+ )
+ session.flush()
+
+ dag_in_bundle_a = session.get(DagModel, "dag_in_bundle_a")
+ dag_in_bundle_b = session.get(DagModel, "dag_in_bundle_b")
+
+ assert dag_in_bundle_a is not None
+ assert dag_in_bundle_b is not None
+ assert dag_in_bundle_a.bundle_name == "bundle_a"
+ assert dag_in_bundle_b.bundle_name == "bundle_b"
+ assert dag_in_bundle_a.has_import_errors is True
+ assert dag_in_bundle_b.has_import_errors is False
+
@pytest.mark.need_serialized_dag(False)
@pytest.mark.parametrize(
("attrs", "expected"),