pierrejeambrun commented on code in PR #72640:
URL: https://github.com/apache/airflow/pull/72640#discussion_r3951321896


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/partitioned_dag_runs.py:
##########
@@ -283,7 +283,14 @@ def get_partitioned_dag_runs(
 
     if not (rows := session.execute(query).all()):
         if dag_id.value is not None and total_entries == 0:
-            dag_exists = 
session.scalar(select(DagModel.dag_id).where(DagModel.dag_id == dag_id.value))
+            # Scope the existence probe to Dags the caller may read: without 
this, an
+            # unreadable-but-existing Dag returns 200-empty while a 
nonexistent Dag
+            # returns 404, letting the caller distinguish the two and learn 
which Dags
+            # exist outside their permitted set.
+            dag_exists_query = select(DagModel.dag_id).where(DagModel.dag_id 
== dag_id.value)
+            if readable_dag_ids is not None:
+                dag_exists_query = 
dag_exists_query.where(DagModel.dag_id.in_(readable_dag_ids))

Review Comment:
   I don't think we should handle that case. Let me simplify that.



-- 
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]

Reply via email to