cli: show helpful message for 'snapcraft list-keys' with no keys
Metadata
Current evaluation
Merged PR #1784 (commit 5c76509ff): snapcraft list-keys now directs users to register-key --help when no keys exist instead of printing an empty table.
Resolution: closed resolved
Reason: PR #1784 was merged as commit 5c76509ff. The change adds the helpful no-keys message and a unit test covering the empty account_keys case.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Tell user to see 'register-key --help' if there is no key registered. Before this fix, an empty table was printed. (which is ugly and redundant)
LP: [#1720210](https://bugs.launchpad.net/snapcraft/+bug/1720210)
- [X] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [X] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [X] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)?
- [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [X] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh unit`?
-----
Hi! I could check that the changed message is printed with my account w/o registering key, and after I registered one, the ordinary table showed up. However, I'm not sure how to write a test for it. Or is it simple enough that there's no test needed? I'm doing this as a GCI task to fix a bitesize bug of snapcraft, and not that familiar with these stuff ;( If there's something I didn't do correctly with the flow, do not hesitate to teach me. Many thanks!
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1784 (commit 5c76509ff): snapcraft list-keys now directs users to register-key --help when no keys exist instead of printing an empty table. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1784 as commit 5c76509ff: snapcraft list-keys now points users to register-key --help when no keys are registered, instead of printing an empty table. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix replacing the empty table output of snapcraft list-keys with a helpful message directing users to register-key --help. Added a unit test mocking an empty key list. Approved and merged after reviewer guidance on test implementation. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a fix replacing the empty table for snapcraft list-keys with a helpful message pointing to register-key --help. After maintainer guidance, the contributor added a unit test for the empty key scenario, and the pull request was merged. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
snapcraft (launchpad)#1720210
(confidence 99%)
Linked Launchpad bug #1720210 tracked list-keys printing an empty table when no keys were registered.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1622037 snapcraft list-keys prints no message when there are no keys | snapcraft (launchpad) | closed | Fixed in #1784 (commit 5c76509ff); snapcraft list-keys now prints a helpful message when no keys are present instead of an empty table. | |
| #1736864 snapcraft list-keys with no snap keys returns an empty table | snapcraft (launchpad) | closed | Fixed via merged canonical/snapcraft#1784 (commit 5c76509ff): list-keys now shows registration guidance instead of an empty table when no keys exist. | |
| #1720210 snapcraft list-keys with no keys returns an empty table | snapcraft (launchpad) | closed | Empty-key output was fixed by PR #4245 (commit 1c44a58fc): keys now reports that no keys are registered and points users to register-key help. | |
| #1858994 snapcraft list-keys doesn't show the non-registered key when no key is registered | snapcraft (launchpad) | open | list-keys hid local unregistered keys when no key was registered (snapcraft 3.8). Fixed by 1c44a58fc; today's 'keys' command lists local keys and marks unregistered ones, and list-keys was removed in Snapcraft 9. | |
| #786 Add `snapcraft list-keys` | snapcraft | merged | Merged #786 as 233adda3a, adding snapcraft list-keys to display keys registered to the user's Store account alongside local key data. | |
| #1720207 snapcraft list-keys returns no keys, but the user has keys | snapcraft (launchpad) | open | Observed behavior is resolved: keys now displays registered remote-only key fingerprints separately from local keys; legacy list-keys was renamed and removed in Snapcraft 9. | |
| #1621895 Implement `snapcraft list-keys` | snapcraft (launchpad) | closed | snapcraft list-keys was implemented by merged PR snapcore/snapcraft#786 in commit 233adda3a, showing store-account keys alongside local key data. |