dkranchii opened a new pull request, #71729: URL: https://github.com/apache/airflow/pull/71729
## Summary `airflow dags list-jobs` accepts `--limit`, but the sibling `airflow dags list-runs` command does not — on busy DAGs the command dumps every run since the start of time (subject to date filters). This PR closes that asymmetry with a small, additive flag. ## Details - New `ARG_DR_LIMIT` typed as `positive_int(allow_zero=False)` — argparse rejects `0`, negative numbers, and non-numeric input up-front. - Applied in `dag_list_dag_runs` **after** the existing `run_after` DESC sort, so `--limit N` reliably returns the N most recent runs regardless of insertion order in `DagRun.find`. - Default behaviour when the flag is absent is unchanged (all rows returned). ## Test plan - [X] `ruff format` and `ruff check` clean. - [X] Parser smoke test: `--limit 3` parses to `int(3)`; `--limit 0`, `--limit -1`, `--limit abc` all rejected by argparse; `--limit` shows in `dags list-runs --help`. - `uv run --project airflow-core pytest airflow-core/tests/unit/cli/commands/test_dag_command.py::TestCliDags::test_cli_list_dag_runs airflow-core/tests/unit/cli/commands/test_dag_command.py::TestCliDags::test_cli_list_dag_runs_limit airflow-core/tests/unit/cli/commands/test_dag_command.py::TestCliDags::test_cli_list_dag_runs_limit_rejects_invalid -xvs` - [ ] `prek run --from-ref main --stage pre-commit` --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Cursor -- 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]
