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

shahar1 pushed a commit to branch airflow-ctl/v0-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/airflow-ctl/v0-1-test by this 
push:
     new 8d9639ac0bd [airflow-ctl/v0-1-test] Fix airflowctl dagrun list 
ignoring --start-date and --end-date (#76348) (#76382)
8d9639ac0bd is described below

commit 8d9639ac0bda04eddda51da677cc1a67c9bb0c79
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Nov 3 16:20:58 2026 +0000

    [airflow-ctl/v0-1-test] Fix airflowctl dagrun list ignoring --start-date 
and --end-date (#76348) (#76382)
    
    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.
    (cherry picked from commit 29368e8ac5ac114346d4c5763893bb2b212ce606)
    
    Co-authored-by: Andrew Chang <[email protected]>
---
 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 ed6b8affd04..0057c45f00c 100644
--- a/airflow-ctl/src/airflowctl/api/operations.py
+++ b/airflow-ctl/src/airflowctl/api/operations.py
@@ -621,8 +621,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
             dag_id: The Dag ID to filter by. If None, retrieves Dag runs for 
all Dags (using "~").
             logical_date_gte: Filter Dag runs with a logical date greater than 
or equal to this value.
@@ -637,8 +637,8 @@ class DagRunOperations(BaseOperations):
         params = _build_query_params(
             limit=limit,
             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,
             order_by=order_by,
diff --git a/airflow-ctl/tests/airflow_ctl/api/test_operations.py 
b/airflow-ctl/tests/airflow_ctl/api/test_operations.py
index 027429e531d..a03f410300d 100644
--- a/airflow-ctl/tests/airflow_ctl/api/test_operations.py
+++ b/airflow-ctl/tests/airflow_ctl/api/test_operations.py
@@ -1543,13 +1543,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