This is an automated email from the ASF dual-hosted git repository.

shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 29368e8ac5a Fix airflowctl dagrun list ignoring --start-date and 
--end-date (#76348)
29368e8ac5a is described below

commit 29368e8ac5ac114346d4c5763893bb2b212ce606
Author: Andrew Chang <[email protected]>
AuthorDate: Wed Nov 4 00:06:37 2026 +0800

    Fix airflowctl dagrun list ignoring --start-date and --end-date (#76348)
    
    airflowctl sent the two filters as start_date and end_date query
    parameters. The Dag runs endpoint only reads range parameters such as
    start_date_gte and end_date_lte, and FastAPI drops parameters it does
    not declare. The command returned all Dag runs with no error.
---
 airflow-ctl/src/airflowctl/api/operations.py         | 8 ++++----
 airflow-ctl/tests/airflow_ctl/api/test_operations.py | 6 +++++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/airflow-ctl/src/airflowctl/api/operations.py 
b/airflow-ctl/src/airflowctl/api/operations.py
index 802f663abb4..b994da791ce 100644
--- a/airflow-ctl/src/airflowctl/api/operations.py
+++ b/airflow-ctl/src/airflowctl/api/operations.py
@@ -700,8 +700,8 @@ class DagRunOperations(BaseOperations):
 
         Args:
             state: Filter Dag runs by state (optional; no filter applied when 
omitted)
-            start_date: Filter Dag runs by start date (optional)
-            end_date: Filter Dag runs by end date (optional)
+            start_date: Return only Dag runs that started at or after this 
time (optional)
+            end_date: Return only Dag runs that ended at or before this time 
(optional)
             limit: Limit the number of results returned
             offset: Offset to start returning results from
             dag_id: The Dag ID to filter by. If None, retrieves Dag runs for 
all Dags (using "~").
@@ -723,8 +723,8 @@ class DagRunOperations(BaseOperations):
             limit=limit,
             offset=offset,
             state=str(state) if state is not None else None,
-            start_date=start_date,
-            end_date=end_date,
+            start_date_gte=start_date,
+            end_date_lte=end_date,
             logical_date_gte=logical_date_gte,
             logical_date_lte=logical_date_lte,
             partition_date_gte=partition_date_gte,
diff --git a/airflow-ctl/tests/airflow_ctl/api/test_operations.py 
b/airflow-ctl/tests/airflow_ctl/api/test_operations.py
index 3642ed7473b..a2dd344887d 100644
--- a/airflow-ctl/tests/airflow_ctl/api/test_operations.py
+++ b/airflow-ctl/tests/airflow_ctl/api/test_operations.py
@@ -1669,13 +1669,17 @@ class TestDagRunOperations:
     def test_list(self):
         def handle_request(request: httpx.Request) -> httpx.Response:
             assert request.url.path == f"/api/v2/dags/{self.dag_id}/dagRuns"
+            assert {key: value for key, value in request.url.params.items() if 
"date" in key} == {
+                "start_date_gte": "2025-01-01T00:00:00",
+                "end_date_lte": "2025-01-02T00:00:00",
+            }
             return httpx.Response(200, 
json=json.loads(self.dag_run_collection_response.model_dump_json()))
 
         client = make_api_client(transport=httpx.MockTransport(handle_request))
         response = client.dag_runs.list(
             dag_id=self.dag_id,
             start_date=datetime.datetime(2025, 1, 1, 0, 0, 0),
-            end_date=datetime.datetime(2025, 1, 1, 0, 0, 0),
+            end_date=datetime.datetime(2025, 1, 2, 0, 0, 0),
             state=DagRunState.RUNNING,
             limit=1,
         )

Reply via email to