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

   Backport of #72675 to `airflow-ctl/v0-1-test`.
   
   ## Why
   
   airflowctl generates its commands from the operations layer, and every 
generated
   command finishes by printing through `args.output`. That flag was only 
declared for
   commands whose method name happened to start with one of ten CRUD verbs, so 
the ones
   that did not — `assets materialize`, `backfill pause|unpause|cancel` and
   `connections test` — reached the printer with the attribute undefined and 
died with a
   raw traceback, after their request had already been sent and applied 
server-side.
   
   `-e/--env` deliberately keeps its existing whitelist. Nothing reads 
`args.env` for
   generated commands, so widening it would only let more commands silently 
accept an
   environment they then ignore and run against production credentials instead; 
that is
   tracked separately in https://github.com/apache/airflow/issues/70519.
   
   The bug is present on this branch. With the fix reverted, both tests this 
commit adds
   fail here:
   
   ```
   AttributeError: 'Namespace' object has no attribute 'output'
     at airflow-ctl/src/airflowctl/ctl/cli_config.py:818  ->  output=args.output
   ```
   
   ## The pick is not clean
   
   `cli_config.py` applied identically to main. The test file conflicted, and 
git's
   conflict region offered content belonging to a **different commit that is 
not on this
   branch** — the one that introduced `_call_generated_command` and the
   `test_primitive_param_*` tests. Those are left out, along with the
   `ClearTaskInstancesBody` and `DagRunOperations` imports they need, and the 
`pytest.fail`
   fallback in the help-texts test.
   
   One line was added that is not in the original commit: `from unittest import 
mock`. It
   is plain context on `main`, introduced by that same absent commit, and the 
test this
   change adds needs it.
   
   ## Checks
   
   - `pytest airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py` — 36 passed
   - `mypy` on the two files this PR touches — clean
   - `ruff` / `ruff format` — clean
   
   Two prek hooks were skipped locally, both for reasons unrelated to this 
change, and
   neither is expected to alter this diff:
   
   - `mypy-airflow-ctl` fails on this branch with 10 pre-existing errors in
     `tests/airflow_ctl/api/test_operations.py` and
     `tests/airflow_ctl/ctl/commands/test_dag_command.py`. Both files are 
byte-identical to
     this branch's tip and are untouched here; the errors are 
generated-datamodel drift
     (`Unexpected keyword argument "timetable_periodic" for "DAGResponse"`). 
Worth a
     separate look, but not this PR's to fix.
   - `generate-airflowctl-help-images` needs a CI image that does not exist for 
this
     branch. The original #72675 changed no help images, so this is expected to 
be a no-op.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5)
   
   Generated-by: Claude Code (Opus 5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


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