Repository navigation
Escape error text in airflowctl safe_call_command messages - #76264
Conversation
Andrushika
left a comment
There was a problem hiding this comment.
Small thing in the description: on main the command still exits with status 1, because the MarkupError is an uncaught exception. The user-visible change is the traceback in place of the server error, so maybe drop the exit-status part.
shahar1
left a comment
There was a problem hiding this comment.
LGTM — the five safe_call_command handlers now escape the exception text before it reaches Rich, with a parametrized regression test that fails on main (reproduced: rich.errors.MarkupError: closing tag '[/bogus]' at position 32 doesn't match any open tag), CI green.
Smaller observations
- PR description: as
Andrushikanoted, onmainthe command still exits with status 1, because an uncaughtMarkupErrormakes Python exit 1. The user-visible regression is the traceback in place of the real error. Worth dropping the exit-status clause before merge, since the description becomes the squash commit message. - Follow-up, not for this PR: the same unescaped
{e}interpolation remains inairflow-ctl/src/airflowctl/ctl/commands/auth_command.py(lines 95 and 158),dag_command.py(lines 58 and 119) andconfig_command.py(line 841). Those print server or exception text through Rich markup too, so they can hit the sameMarkupError.
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 guide.
Drafted-by: Claude Code (Claude Fable 5.1); reviewed by shahar1 before posting
safe_call_command interpolated exception and server error text straight into Rich markup. A message containing a tag-like fragment such as "[/x]" made rich.print raise MarkupError, so the user saw a traceback instead of the real failure and the exit code was no longer 1. Escape the text in the AirflowCtl, protocol, timeout, server response and HTTP status handlers.
56214f2 to
46a7c0b
Compare
|
Pushed a fix to resolve conflicts |
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.
|
…mand messages (#76264) (#76385) safe_call_command interpolated exception and server error text straight into Rich markup. A message containing a tag-like fragment such as "[/x]" made rich.print raise MarkupError, so the user saw a traceback instead of the real failure and the exit code was no longer 1. Escape the text in the AirflowCtl, protocol, timeout, server response and HTTP status handlers. (cherry picked from commit ab39e95) Co-authored-by: Rishabh <Rishabh00b@gmail.com>
…mand messages (apache#76264) (apache#76385) safe_call_command interpolated exception and server error text straight into Rich markup. A message containing a tag-like fragment such as "[/x]" made rich.print raise MarkupError, so the user saw a traceback instead of the real failure and the exit code was no longer 1. Escape the text in the AirflowCtl, protocol, timeout, server response and HTTP status handlers. (cherry picked from commit ab39e95) Co-authored-by: Rishabh <Rishabh00b@gmail.com>
airflowctl's central error handler prints exception and server error text through Rich markup without escaping it. If the text contains a tag-like fragment such as
[/x],rich.printraisesMarkupError. The user then sees a traceback instead of the real failure, and the command no longer exits with status 1.The text is now escaped in the AirflowCtl, protocol, timeout, server response and HTTP status handlers. This is the same class of bug fixed for table output in #76175.
Tests: parametrized over the five handler types; all five fail without the change.
Was generative AI tooling used to co-author this PR?