youngduck98 commented on code in PR #75608:
URL: https://github.com/apache/airflow/pull/75608#discussion_r4469800285


##########
airflow-core/src/airflow/ui/src/pages/Run/Header.tsx:
##########
@@ -63,8 +64,16 @@ export const Header = ({ dagRun }: { readonly dagRun: 
DAGRunResponse }) => {
   const dagId = dagRun.dag_id;
   const dagRunId = dagRun.dag_run_id;
 
-  const { data: alertData } = useDeadlinesServiceGetDagDeadlineAlerts({ dagId 
});
-  const hasDeadlineAlerts = (alertData?.total_entries ?? 0) > 0;
+  const { data: deadlineData } = useDeadlinesServiceGetDeadlines({
+    dagId,
+    dagRunId,
+    includeAlerts: true,

Review Comment:
   `includeAlerts: true` returns the deadline records together with the alert 
definitions from the Dag version that created this run. Header and 
DeadlineStatus use the same query parameters and share one cached request.
   
   The run view uses the alert definitions from the Dag version that created 
the run, so later filter changes do not affect how that run’s deadline 
applicability is determined.
   For example, a manual run created while an alert applies only to scheduled 
runs has no deadline record and no Deadline field. If the filter later includes 
manual runs, using the latest definitions would incorrectly make that old run 
show Met, even though the alert did not apply when the run was created. Using 
the creation version keeps the field hidden.



##########
airflow-core/src/airflow/ui/src/pages/Run/Header.tsx:
##########
@@ -63,8 +64,16 @@ export const Header = ({ dagRun }: { readonly dagRun: 
DAGRunResponse }) => {
   const dagId = dagRun.dag_id;
   const dagRunId = dagRun.dag_run_id;
 
-  const { data: alertData } = useDeadlinesServiceGetDagDeadlineAlerts({ dagId 
});
-  const hasDeadlineAlerts = (alertData?.total_entries ?? 0) > 0;
+  const { data: alertData } = useDeadlinesServiceGetDagDeadlineAlerts({ dagId, 
dagRunId, limit: 100 });
+  const { data: deadlineData } = useDeadlinesServiceGetDeadlines({
+    dagId,
+    dagRunId,
+    limit: 10,
+    orderBy: ["deadline_time"],
+  });

Review Comment:
   The existing API returns deadline records and alert definitions separately, 
so i think reducing this to a single request required an API change. 
   In 
[83a900f8fc](https://github.com/apache/airflow/commit/83a900f8fca156f306bb6490b579f6336453faa2),
 I extended the existing run deadlines endpoint with an optional include_alerts 
parameter to return both together, using the alert definitions from the Dag 
version that created the run.
   I also updated DeadlineStatus to use the same API and query parameters as 
Header so both components can share one request. Please let me know if you 
would prefer a different approach.



##########
airflow-core/src/airflow/ui/src/pages/Run/Header.tsx:
##########
@@ -63,8 +64,16 @@ export const Header = ({ dagRun }: { readonly dagRun: 
DAGRunResponse }) => {
   const dagId = dagRun.dag_id;
   const dagRunId = dagRun.dag_run_id;
 
-  const { data: alertData } = useDeadlinesServiceGetDagDeadlineAlerts({ dagId 
});
-  const hasDeadlineAlerts = (alertData?.total_entries ?? 0) > 0;
+  const { data: deadlineData } = useDeadlinesServiceGetDeadlines({
+    dagId,
+    dagRunId,
+    includeAlerts: true,
+    limit: 10,
+    orderBy: ["deadline_time"],
+  });
+  const hasDeadlineAlerts =

Review Comment:
   The run header and its modal continue to show all stored deadline records 
for this run, regardless of its current run type. Filtering these records by 
run type could hide a stored missed deadline and show Met based only on another 
applicable alert.
   
   Only when no deadline records exist do we check the creation-version alert 
definitions against the run's current type: an applicable alert retains the 
existing Met display; otherwise, the Deadline field is hidden. Changing the 
filter does not delete existing deadline records.
   
   If the same run is later reprocessed as backfill, the UI simply displays the 
previously stored deadline records; it does not reevaluate the backfill 
execution.



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