Skip to content

Fix enum names and non-ISO dates in airflowctl dags output - #76354

Merged
shahar1 merged 1 commit into
apache:mainfrom
Eason09053360:fix-airflowctl-dag-state-json-output
Nov 6, 2026
Merged

shahar1 merged 1 commit into
apache:mainfrom
Eason09053360:fix-airflowctl-dag-state-json-output

Conversation

@Eason09053360

Copy link
Copy Markdown
Contributor

Why

airflowctl dags pause, unpause, drain and next-execution handed enum and datetime objects to print_as, which str()s every value. So -o json printed "DagSchedulingState.ACTIVE" and "2024-12-31 23:59:59+00:00" instead of the API's "active" and "2024-12-31T23:59:59Z", and disagreed with dags get for the same Dag.

What

airflow-ctl/src/airflowctl/ctl/commands/dag_command.py now dumps the response with model_dump(mode="json"), as the generated dags get already does; table output changes the same way. The tests assert the printed JSON matches what the server sent, and test_next_execution checks the printed output instead of the returned datetime objects.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5.5)

Generated-by: Claude Code (Opus 5.5) following the guidelines

`dags pause`, `unpause`, `drain` and `next-execution` printed
"DagSchedulingState.ACTIVE" and "2024-12-31 23:59:59+00:00" with
`-o json`, so scripts comparing against the API values never matched,
and the output disagreed with `dags get` for the same Dag.
@shahar1
shahar1 merged commit 3204b6e into apache:main Nov 6, 2026
121 of 136 checks passed
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Backport successfully created: airflow-ctl/v0-1-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ airflow-ctl/v0-1-test PR Link

shahar1 added a commit that referenced this pull request Nov 6, 2026
…l dags output (#76354) (#76574)

* [airflow-ctl/v0-1-test] Fix enum names and non-ISO dates in airflowctl dags output (#76354)

`dags pause`, `unpause`, `drain` and `next-execution` printed
"DagSchedulingState.ACTIVE" and "2024-12-31 23:59:59+00:00" with
`-o json`, so scripts comparing against the API values never matched,
and the output disagreed with `dags get` for the same Dag.
(cherry picked from commit 3204b6e)

Co-authored-by: Y-C <[email protected]>

* Test the enum output fix against the field this branch has

The cherry-picked test asserts on `scheduling_state`, which `DAGResponse`
does not have on this branch, so it raised KeyError. `allowed_run_types`
is the enum field that `pause` and `unpause` print here, and it printed
"DagRunType.MANUAL" before this fix.

Claude-Session: https://claude.ai/code/session_01BVx6g7kMcPenQEPwEZbPQJ

---------

Co-authored-by: Y-C <[email protected]>
Co-authored-by: Shahar Epstein <[email protected]>
shahar1 added a commit to shahar1/airflow that referenced this pull request Nov 7, 2026
…l dags output (apache#76354) (apache#76574)

* [airflow-ctl/v0-1-test] Fix enum names and non-ISO dates in airflowctl dags output (apache#76354)

`dags pause`, `unpause`, `drain` and `next-execution` printed
"DagSchedulingState.ACTIVE" and "2024-12-31 23:59:59+00:00" with
`-o json`, so scripts comparing against the API values never matched,
and the output disagreed with `dags get` for the same Dag.
(cherry picked from commit 3204b6e)

Co-authored-by: Y-C <[email protected]>

* Test the enum output fix against the field this branch has

The cherry-picked test asserts on `scheduling_state`, which `DAGResponse`
does not have on this branch, so it raised KeyError. `allowed_run_types`
is the enum field that `pause` and `unpause` print here, and it printed
"DagRunType.MANUAL" before this fix.

Claude-Session: https://claude.ai/code/session_01BVx6g7kMcPenQEPwEZbPQJ

---------

Co-authored-by: Y-C <[email protected]>
Co-authored-by: Shahar Epstein <[email protected]>
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