Cannot do list-validation-sets and set verbosity level

Hey there,

I am trying to find out the underlying HTTPs requests snapcraft is doing when doing list-validation-sets, for which I am trying to set the verbosity level when running a command.

snapcraft list-validation-sets --help suggests that I can either use --verbose or --verbosity + level. However, when I try this the argument parser/dispatcher seems to fail.

If I try --verbose, I get “No such option”:

charlee@lpks0013-ubuntu:/snap/snapcraft$ snapcraft list-validation-sets --verbose
Starting snapcraft, version 8.3.1                                                                                                                                                                          
Logging execution to '/home/charlee/.local/state/snapcraft/log/snapcraft-20240902-111841.879390.log'                                                                                                       
Usage: snapcraft list-validation-sets [OPTIONS]
Try 'snapcraft list-validation-sets -h' for help.

Error: No such option: --verbose

If I try --verbosity it seems to acknowledge the option exists, but I am not using it right:

charlee@lpks0013-ubuntu:/snap/snapcraft$ snapcraft list-validation-sets --verbosity
Usage: snapcraft [options] command [args]...
Try 'snapcraft -h' for help.

Error: The 'verbosity' option expects one argument.

But then when I try to set the verbosity level it fails again (maybe I am not setting it right? but then the error message is wrong):

charlee@lpks0013-ubuntu:/snap/snapcraft$ snapcraft list-validation-sets --verbosity debug
2024-09-02 11:18:51.499 Starting snapcraft, version 8.3.1                                                                                                                                                  
2024-09-02 11:18:51.499 Logging execution to '/home/charlee/.local/state/snapcraft/log/snapcraft-20240902-111851.498721.log'                                                                               
2024-09-02 11:18:51.499 Configuring application...                                                                                                                                                         
2024-09-02 11:18:51.499 Preparing application...                                                                                                                                                           
2024-09-02 11:18:51.500 Build plan: platform=None, build_for=None                                                                                                                                          
2024-09-02 11:18:51.500 Running snapcraft list-validation-sets on host                                                                                                                                     
Usage: snapcraft list-validation-sets [OPTIONS]
Try 'snapcraft list-validation-sets -h' for help.

Error: No such option: --verbosity
charlee@lpks0013-ubuntu:/snap/snapcraft$ snapcraft list-validation-sets --verbosity=debug
2024-09-02 11:18:55.927 Starting snapcraft, version 8.3.1                                                                                                                                                  
2024-09-02 11:18:55.927 Logging execution to '/home/charlee/.local/state/snapcraft/log/snapcraft-20240902-111855.926468.log'                                                                               
2024-09-02 11:18:55.927 Configuring application...                                                                                                                                                         
2024-09-02 11:18:55.927 Preparing application...                                                                                                                                                           
2024-09-02 11:18:55.927 Build plan: platform=None, build_for=None                                                                                                                                          
2024-09-02 11:18:55.928 Running snapcraft list-validation-sets on host                                                                                                                                     
Usage: snapcraft list-validation-sets [OPTIONS]
Try 'snapcraft list-validation-sets -h' for help.

Error: No such option: --verbosity

FYI it is not the first time that I get the wrong error message out of the snapcraft application, maybe it is worthwhile to look whether the logic is robust enough to catch wrong usage properly.

Kind regards, Charlee

Hi @Charlee,

--verbosity and --verbose not working for commands in the legacy codebase is a known issue and unfortunately a long-standing issue that we haven’t had the resources to address.

The work is described here. We’ve had some similar bug reports for this ([1] [2] [3]).

If it helps in your original endeavor, here is the documentation on the API for validation sets: Validation Sets — Snap Store Documentation

Hey there,

Ok, no worries! Just wanted to help by reporting, but you already know.

I originally thought that when I did an API request the revision wasn’t listed, so I was looking for some option to return the revision. But then I found out the revision is only listed when it is not 0 :stuck_out_tongue: Is this on purpose?

I just stumbled upon that same discovery last month!

I asked the store team about it. They said it wasn’t done on purpose, but there isn’t a good reason to fix it and change the API since it’s easy to handle on the client side with a snippet like revision = response("revision", 0).

I do wish they would mention that in their API.

Unless the key changes (or someone makes a mistake in their code) and nobody notices because everyone has a built-in default, and then every validation-set suddenly has revision 0 in everyone’s logic :smiley:

I would say that is an argument to fix it :smiley: also doesn’t sound very hard?

But will adapt my code to deal with the lack of they key and default it to 0