Skip to content

[airflow-ctl/v0-1-test] Stop swallowing unexpected keyring errors when saving airflowctl credentials (#70991) - #76047

Merged
shahar1 merged 1 commit into
apache:airflow-ctl/v0-1-testfrom
shahar1:backport-2bb32e3-airflow-ctl/v0-1-test
Oct 30, 2026
Merged

shahar1 merged 1 commit into
apache:airflow-ctl/v0-1-testfrom
shahar1:backport-2bb32e3-airflow-ctl/v0-1-test

Conversation

@shahar1

@shahar1 shahar1 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Backport of #70991 to airflow-ctl/v0-1-test (cherry picked from 2bb32e3).

Applies cleanly.

uv run --project airflow-ctl pytest airflow-ctl/tests passes, except test_server_connection_refused, which also fails on the unchanged branch in my local environment.


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

🤖 Generated with Claude Code

…n saving airflowctl credentials (apache#70991)

* Stop swallowing unexpected keyring errors when saving airflowctl credentials

The TypeError handler in Credentials.save() only produced a meaningful
error when api_token was None and client_kind was ClientKind.CLI at the
same time. No caller can satisfy both: the two save() call sites in
auth_command.py pass ClientKind.AUTH or leave client_kind at its default
of None, and each already guarantees a non-None token. The branch was
therefore unreachable, leaving the handler as an unconditional swallow
that let a failed credential save return as if it had succeeded.

* Update airflow-ctl/src/airflowctl/api/client.py

* Repair the duplicated keyring call left by the applied suggestion

Applying the review suggestion from the web UI kept the original
set_password call alongside the replacement, leaving the module
unparseable. The accompanying test constructed Credentials without a
token and only passed because the mocked backend accepted None.

---------

(cherry picked from commit 2bb32e3)

Co-authored-by: Henry Chen <[email protected]>
Co-authored-by: Y-C <[email protected]>
@shahar1
shahar1 enabled auto-merge (squash) October 30, 2026 15:49
@shahar1
shahar1 merged commit c55f756 into apache:airflow-ctl/v0-1-test Oct 30, 2026
13 checks passed
shahar1 added a commit that referenced this pull request Nov 19, 2026
…n saving airflowctl credentials (#70991) (#76047)

* Stop swallowing unexpected keyring errors when saving airflowctl credentials

The TypeError handler in Credentials.save() only produced a meaningful
error when api_token was None and client_kind was ClientKind.CLI at the
same time. No caller can satisfy both: the two save() call sites in
auth_command.py pass ClientKind.AUTH or leave client_kind at its default
of None, and each already guarantees a non-None token. The branch was
therefore unreachable, leaving the handler as an unconditional swallow
that let a failed credential save return as if it had succeeded.

* Update airflow-ctl/src/airflowctl/api/client.py

* Repair the duplicated keyring call left by the applied suggestion

Applying the review suggestion from the web UI kept the original
set_password call alongside the replacement, leaving the module
unparseable. The accompanying test constructed Credentials without a
token and only passed because the mocked backend accepted None.

---------

(cherry picked from commit 2bb32e3)

Co-authored-by: rjgoyln <[email protected]>
Co-authored-by: Henry Chen <[email protected]>
Co-authored-by: Y-C <[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.

2 participants