Repository navigation
Fix variables import with structured falsy values - #67060
Conversation
|
@Leondon9 A few things need addressing before review — see our Pull Request quality criteria.
No rush. 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. Drafted-by: Claude Code (Opus 4.7); reviewed by @potiuk before posting |
potiuk
left a comment
There was a problem hiding this comment.
Reviewed end-to-end — correct and well-targeted. The bug is the truthiness check v.get("value"), which dropped structured entries whose value is falsy ("", 0, false, null) and stored the whole {value, description} dict instead; "value" in v membership fixes it, and serialize_json=not isinstance(value, str) stays consistent (empty-string → no serialize, others → serialize), exactly as the parametrized test asserts. The airflowctl side sensibly rejects non-object JSON up front instead of failing mid-iteration, and soft_wrap=True keeps long file paths intact in the error. Both behaviors are tested.
One note on the newsfragment thread: keeping 67060.bugfix.rst is correct here. airflow-core does consume newsfragments via towncrier at release, and this is a user-facing CLI bugfix — exactly the case that warrants one. (The "generated at release / not needed per PR" convention applies to providers and airflow-ctl, whose release managers regenerate changelogs from git log — not airflow-core.) So it can stay as-is.
LGTM.
This review was drafted by an AI-assisted tool and confirmed by an Apache Airflow maintainer. The maintainer approving this PR has read the findings and signed off. If something feels off, please reply on the PR and a maintainer will follow up.
More on how Apache Airflow handles maintainer review: contributing-docs/05_pull_requests.rst.
Drafted-by: Claude Code (Opus 4.8); reviewed by @potiuk before posting
57b8fd2 to
20c4350
Compare
Backport successfully created: airflow-ctl/v0-1-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
…y values (apache#67060) * Fix variables import with structured falsy values * Add newsfragment for variables import fix * Fix airflowctl variable import error path wrapping * Remove unnecessary variables import newsfragment (cherry picked from commit 837bfde) Co-authored-by: leon.jeon <[email protected]>
…y values (#67060) (#68247) * Fix variables import with structured falsy values * Add newsfragment for variables import fix * Fix airflowctl variable import error path wrapping * Remove unnecessary variables import newsfragment (cherry picked from commit 837bfde) Co-authored-by: leon.jeon <[email protected]>
…y values (#67060) (#68247) * Fix variables import with structured falsy values * Add newsfragment for variables import fix * Fix airflowctl variable import error path wrapping * Remove unnecessary variables import newsfragment (cherry picked from commit 837bfde) Co-authored-by: leon.jeon <[email protected]>
Fix variable import handling for structured falsy values.
This keeps core CLI and
airflowctlimport semantics aligned when a variable entry is shaped like{"value": ..., "description": ...}and the value is falsy, such as an empty string,0,false, ornull.It also makes
airflowctl variables importreject non-object JSON input with the existing invalid-file error instead of failing later while iterating.Tests:
breeze run pytest airflow-ctl/tests/airflow_ctl/ctl/commands/test_variable_command.py -xvsbreeze run pytest airflow-core/tests/unit/cli/commands/test_variable_command.py::TestCliVariables::test_variables_import_with_structured_falsy_values -xvsprek run ruff --files airflow-core/src/airflow/cli/commands/variable_command.py airflow-core/tests/unit/cli/commands/test_variable_command.py airflow-ctl/src/airflowctl/ctl/commands/variable_command.py airflow-ctl/tests/airflow_ctl/ctl/commands/test_variable_command.pyWas generative AI tooling used to co-author this PR?
Generated-by: Codex (GPT-5) following the guidelines