Skip to content

Make required airflowctl body fields positional - #68014

Open
ibobgunardi wants to merge 3 commits into
apache:mainfrom
ibobgunardi:bobi/airflowctl-body-fields-positional
Open

ibobgunardi wants to merge 3 commits into
apache:mainfrom
ibobgunardi:bobi/airflowctl-body-fields-positional

Conversation

@ibobgunardi

@ibobgunardi ibobgunardi commented Jun 4, 2026 •

Copy link
Copy Markdown

Related to #60142.

Required scalar fields from generated request-body models are now emitted as positional arguments. That makes commands like airflow connections create test_conn postgres line up with the existing positional handling for required operation parameters, while nullable/defaulted fields stay as options.

Breaking CLI change: generated airflowctl commands that used required scalar request-body fields as options now take those values positionally instead, for example connections create test_con mysql instead of connections create --connection-id=test_con --conn-type=mysql.

Tested with:

  • PYTHONPATH='airflow-ctl\src;airflow-core\src' .venv\Scripts\python.exe -m pytest airflow-ctl\tests\airflow_ctl\ctl\test_cli_config.py -q --confcutdir=airflow-ctl\tests\airflow_ctl\ctl
  • .venv\Scripts\python.exe -m py_compile airflow-ctl\src\airflowctl\ctl\cli_config.py airflow-ctl\tests\airflow_ctl\ctl\test_cli_config.py
  • python -m py_compile airflow-ctl-tests\tests\airflowctl_tests\test_airflowctl_commands.py
  • git diff --check
Was generative AI tooling used to co-author this PR?

Yes. I used editor assistance while inspecting the command factory and running the local checks.


Important

🛠️ Maintainer triage note for @ibobgunardi · by @potiuk · 2026-07-02 17:38 UTC

Helpful heads-up from the maintainers — please address before this PR can be reviewed (see the Pull Request quality criteria):

  • These required static checks are failing and need a code fix (a rerun won't help): CI image checks / Static checks. Run them locally with pre-commit/prek and push the fixes.

The ball is in your court — you've been assigned to this PR. Fix the above, then mark it Ready for review.

Automated triage — may be imperfect; a maintainer takes the next look.

@potiuk

potiuk commented Jun 5, 2026

Copy link
Copy Markdown
Member

Thanks for the airflowctl improvements, @ibobgunardi — picking these up together since the three PRs (this, #68000, #67912) overlap and there are a couple of concrete fixes needed before they land.

#68000 vs this PR — conflict. These two edit the same two call sites in cli_config.py with opposite designs: #68000 makes required body fields required=True flags, while this one makes them positional. They're mutually exclusive and will textually conflict. The positional approach here is the right one — it matches the dev-list lazy consensus this file already follows for required primitive params. Could you fold #68000 into this PR (or close it) so we're not reviewing two contradictory designs for the same fields?

This PR — e2e test will break. Once required scalar body fields become positional, the existing invocations in airflow-ctl-tests/tests/airflowctl_tests/test_airflowctl_commands.py:66,72 still use the flag form and will fail with "unrecognized arguments":

  • connections create --connection-id=test_con --conn-type=mysql … → connections create test_con mysql …
  • connections update --connection-id=test_con --conn-type=postgres → connections update test_con postgres

Worth a line in the PR body noting this is a breaking CLI change, so the release manager captures it under "Significant Changes".

#67912 — crash when --limit is omitted. airflowctl tasks states-for-dag-run <dag> <run> without --limit passes limit=None into execute_list → if limit <= 0: → TypeError: '<=' not supported between 'NoneType' and 'int'. It's the first execute_list caller to expose limit to the CLI. Please default the flag (or coerce None→default before super().execute_list) and add a test that omits --limit.

None of these are big — mostly coordination plus two small fixes. Happy to take another look once they're reconciled.


Drafted-by: Claude Code (Opus 4.8); reviewed by @potiuk before posting

@ibobgunardi

Copy link
Copy Markdown
Author

Thanks for the concrete notes. I pushed the follow-ups:

Local checks:

  • python -m py_compile airflow-ctl\src\airflowctl\ctl\cli_config.py airflow-ctl\tests\airflow_ctl\ctl\test_cli_config.py airflow-ctl-tests\tests\airflowctl_tests\test_airflowctl_commands.py
  • PYTHONPATH='airflow-ctl\src;airflow-core\src' .\.venv\Scripts\python.exe -m pytest airflow-ctl\tests\airflow_ctl\ctl\test_cli_config.py airflow-ctl\tests\airflow_ctl\api\test_operations.py::TestTasksOperations -q --confcutdir=airflow-ctl\tests\airflow_ctl\ctl

@potiuk

potiuk commented Jun 25, 2026

Copy link
Copy Markdown
Member

@ibobgunardi — the Static checks job (plus some failing tests) is failing here — the static checks need a code fix on your side, and the test failures are worth a look too. You can reproduce and fix locally with:

pre-commit run --all-files     # or: breeze static-checks

Once those pass and CI is green, it'll be ready for a maintainer to pick up. Thanks!

See the PR quality criteria.

Automated first-pass triage note drafted by an AI-assisted tool — may get things wrong; once addressed, a real Apache Airflow maintainer takes the next look. (why automated)


Drafted-by: Claude Code (Opus 4.8); reviewed by @potiuk before posting

@potiuk

potiuk commented Jul 20, 2026

Copy link
Copy Markdown
Member

@ibobgunardi This PR has a few issues that need to be addressed before it can be reviewed — please see our Pull Request quality criteria.

Issues found:

  • ❌ Unit tests: Failing: Additional PROD image tests / Airflow CTL integration tests with PROD image. Run breeze run pytest <path> -xvs locally.
  • ❌ Pre-commit / static checks: Failing: CI image checks / Static checks. Run prek run --from-ref main --stage pre-commit locally to reproduce and fix.

Note: Your branch is 1053 commits behind main. Some check failures may be caused by changes in the base branch rather than by your PR. Please rebase your branch and push again to get up-to-date CI results.

What to do next:

  • Fix each issue listed above.
  • Make sure static checks pass locally (prek run --from-ref main --stage pre-commit).
  • Mark the PR as "Ready for review" when you're done.

There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates. If you have questions, feel free to ask on the Airflow Slack.


Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants