Shawnsuun opened a new pull request, #77904:
URL: https://github.com/apache/airflow/pull/77904

   `airflowctl` commands that act on a Dag run (`dags state`, `tasks state`, 
`tasks failed-deps`, `tasks states-for-dag-run`) take either a `run_id` 
positional or `--logical-date`, and must get exactly one. The check compared 
both against `None`, so an explicit empty `run_id` counted as given:
   
   ```
   airflowctl dags state my_dag ""
   ```
   
   passed the check, then fell through to the logical-date path (which tests 
`if args.run_id:`) with a `None` date and crashed with `AttributeError: 
'NoneType' object has no attribute 'replace'` instead of printing the usual 
error.
   
   Change: the selector check now treats an empty value as missing, matching 
how the rest of the module already reads these arguments. An empty `run_id` 
without `--logical-date` now exits 1 with "Provide either run_id or 
--logical-date, but not both". `--logical-date ""` is handled the same way: on 
its own it gives that same message (it used to report `Invalid --logical-date: 
''`), and next to a real value of the other selector it is ignored rather than 
counted as a second selector. All callers in `dag_command.py` and 
`task_command.py` go through this one check.
   
   Tests: the "requires one selector" test now also covers an empty `run_id`, 
an empty `--logical-date`, and both empty; the "accepts one selector" tests 
also cover the other selector being empty. These new cases fail without the fix.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, 
please
   change below checkbox to `[X]` followed by the name of the tool, uncomment 
the "Generated-by".
   -->
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: GitHub Copilot (Claude Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   


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