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


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:
##########
@@ -571,9 +588,38 @@ def get_dag_runs(
     use_cursor = cursor is not None
     query = select(DagRun).options(*eager_load_dag_run_for_list())
 
+    partition_date_local_day: RangeFilter | None = None
     if dag_id != "~":
-        get_latest_version_of_dag(dag_bag, dag_id, session)  # Check if the 
Dag exists.
+        dag = get_latest_version_of_dag(dag_bag, dag_id, session)  # Check if 
the Dag exists.
         query = query.filter(DagRun.dag_id == dag_id).options()
+        partition_date_local_day = RangeFilter(
+            Range(
+                lower_bound_gte=(
+                    dag.timetable.localize_partition_datetime(
+                        datetime.datetime.combine(partition_date_start, 
datetime.time.min)
+                    )
+                    if partition_date_start is not None
+                    else None
+                ),
+                lower_bound_gt=None,
+                upper_bound_lte=None,
+                upper_bound_lt=(
+                    dag.timetable.localize_partition_datetime(
+                        datetime.datetime.combine(
+                            partition_date_end + datetime.timedelta(days=1), 
datetime.time.min
+                        )

Review Comment:
   Two partition-date-window code paths with different interval conventions. 
The route localizes inline and uses a half-open < localize(end+1day), while the 
pre-existing DagRun.apply_partition_date_window (dagrun.py:2242) localizes with 
an inclusive <= localize(end). They serve different inputs (date vs datetime) 
so they aren't trivially merge-able, but having two partition-date localization 
conventions is a drift risk — worth a cross-reference comment or consolidation 
so a future reader doesn't assume they match.
   



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