jedcunningham commented on code in PR #58242:
URL: https://github.com/apache/airflow/pull/58242#discussion_r2535004943
##########
airflow-core/src/airflow/dag_processing/collection.py:
##########
@@ -423,16 +429,17 @@ def update_dag_parsing_results_in_db(
import_errors.update(serialize_errors)
# Record import errors into the ORM - we don't retry on this one as it's
not as critical that it works
try:
- # TODO: This won't clear errors for files that exist that no longer
contain DAGs. Do we need to pass
- # in the list of file parsed?
+ if files_parsed is not None:
+ all_files_parsed = files_parsed
+ else:
+ # Fallback: infer from dags and import_errors
Review Comment:
Why do we need a fallback?
##########
airflow-core/tests/unit/dag_processing/test_collection.py:
##########
@@ -774,6 +774,56 @@ def test_remove_error_updates_loaded_dag_model(self,
testing_dag_bundle, session
)
assert dag_model.has_import_errors is False
+ @pytest.mark.usefixtures("clean_db")
+ def test_clear_import_error_for_file_without_dags(self,
testing_dag_bundle, session):
+ """
+ Test that import errors are cleared for files that were parsed but no
longer contain DAGs.
+
+ This tests the fix for the issue where import errors persisted for
files that were
+ successfully parsed but no longer contained any DAGs.
Review Comment:
```suggestion
```
--
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]