← Back to issue list

store: handle store errors in whoami command (CRAFT-701)

View original Github issue

Metadata

Project
charmcraft
Number
#609
Type
pull request
State
merged
Author
cmatsuoka
Labels
—
Created
Updated
Closed

Current evaluation

Merged in canonical/charmcraft#609 via 3d7474b1 (merge 69df5a9a), adding allow_login so whoami reports logged-out and expired-credential errors without automatic login.

Resolution: closed resolved

Reason: PR #609 was merged as commit 3d7474b1 with merge commit 69df5a9a. It added the allow_login option and explicit whoami errors for logged-out users and invalid credentials.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Define a `allow_login` parameter to the store client decorator so that the `whoami` command can use it to handle errors without automatically logging the user in. Example error messages: - If no external credentials are used, and the user is not logged in: ``` $ charmcraft whoami You are not logged in to Charmhub. ``` - If credentials are used, and the response code is 401: ``` $ CHARMCRAFT_AUTH="$(cat ~/creds-expired)" charmcraft whoami Provided credentials are no longer valid for Charmhub. Regenerate them and try again. ``` Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged in canonical/charmcraft#609 via 3d7474b1 (merge 69df5a9a), adding allow_login so whoami reports logged-out and expired-credential errors without automatic login.
stealth/space-bunny-alpha — closed resolved Merged canonical/charmcraft#609 (merge commit 69df5a9a), adding allow_login so whoami reports logged-out and expired-credential errors without attempting automatic login.
qwen/qwen3.6-35b-a3b — — Merged after two reviewer approvals and passing CI. Added an allow_login parameter to the store client decorator, allowing the whoami command to properly handle authentication and expired credential errors without triggering automatic login.
qwen3.6-35b-a3b-mtp-q6 — — Merged an update adding an allow_login parameter to the store client decorator. This enables the whoami command to gracefully handle authentication errors without auto-login, displaying clear messages for unauthenticated or expired credentials.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1904 fix(store): make "whoami" work with charm-scoped credentials charmcraft merged Merged PR charmcraft#1904 (commit 5b85a11e) fixed whoami for charm-scoped credentials and closed #1869.
78%
#725 craft-store error when using `charmcraft login` command charmcraft closed Confusing craft-store "Credentials found" error on `charmcraft login` (double login). Closed by facundobatista as tracked in the more specific #833, whose improved error landed via PR #916.
75%
#612 Show more information about current credentials in the whoami command (CRAFT-651). charmcraft merged Merged in charmcraft#612 via e69d3755, expanding whoami to show credential details and updating craft-store for minor API changes.
74%
#916 (charmhub) Provide a better error to the user on a login attempt when already having credentials (CRAFT-1269) charmcraft merged Merged PR #916 in commit 3b54c459, improving the double-login error to explain that stored credentials may be invalid and recommend logging out; fixes #833.
72%
#594 The `whoami` command may end in StoreServerError [401] UNAUTHORIZED charmcraft closed Expired-credential handling for whoami was fixed by PR #609, merged as 69df5a9a, so 401 responses now report logged-out status without auto-login.
71%
#190 charmcraft whoami tries to login charmcraft closed Fixed in merged PR #609 (merge commit 69df5a9a): whoami now reports logged-out or expired credentials without opening an authorization page.
71%
#5536 fix(store): catch credential decoding errors snapcraft merged Merged in canonical/snapcraft#5536 (commit 3784560f3), converting malformed store credential decoding failures into a user-friendly error and updating craft-store.
70%
#599 Better UX when retrying store ops if alternate auth is used (CRAFT-653). charmcraft merged Merged in canonical/charmcraft#599 (c6ec9c0d), improving store retries with alternate auth by prompting users to regenerate invalid credentials instead of re-login.
70%