Eason09053360 commented on code in PR #73292:
URL: https://github.com/apache/airflow/pull/73292#discussion_r4122855920
##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_sources.py:
##########
Review Comment:
The fixture relies on `is_stale` defaulting to `True`, so it no longer
models an active co-located Dag:
```suggestion
is_paused=False,
is_stale=False,
```
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_sources.py:
##########
@@ -90,6 +90,7 @@ def get_dag_source(
select(DagModel.dag_id).where(
DagModel.relative_fileloc == dag_model.relative_fileloc,
DagModel.bundle_name == dag_model.bundle_name,
+ DagModel.is_stale.is_(False),
Review Comment:
When the requested Dag is stale too (e.g. its file was deleted), this
filters out every row, `file_dag_ids` is empty, and the check is skipped, so a
caller who can read that one Dag gets the whole file. Its stored source
predates the removal, so could stale rows stay in that case, with a test for it?
```suggestion
# A stale Dag's stored source predates its removal and
may define other stale Dags.
DagModel.is_stale.in_([False, dag_model.is_stale]),
```
--
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]