Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoclone with failed command needs more communication #1252

Open
harmony7 opened this issue Jul 16, 2024 · 6 comments
Open

Autoclone with failed command needs more communication #1252

harmony7 opened this issue Jul 16, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@harmony7
Copy link
Member

harmony7 commented Jul 16, 2024

Describing

The CLI has a useful flag --autoclone. However, I’m seeing confusing behavior when using it.

Assuming my service is currently on version 1 (active), if I use --autoclone and I type an invalid command, even something like this:

fastly backend create --autoclone --version=active

I get an error message:

ERROR: the Fastly API returned 400 Bad Request: Name can't be blank, 'address', 'ipv4', 'ipv6', or 'hostname' is required.

Unfortunately by this time it seems the cloning by --autoclone has already happened, so if I follow up with another command:

fastly backend create --autoclone --version=active --name=origin --address=www.example.com

I will end up on version 3.

I get it because I understand the cloning happens separate from the backend create, however the CLI doesn’t say this so I found it confusing. It results in a mismatch between the user's mental model of the state of the service and the actual state.

Proposed fix

More communication can help here. I’m thinking that a stdout message when the new version has been created would help clarify. That way, if an error occurs you can still see that the version has been created even though your desired operation never went through to completion.

@harmony7 harmony7 added the bug Something isn't working label Jul 16, 2024
@Integralist
Copy link
Collaborator

Agreed. This is a confusing experience.

Service versions are immutable so we can't undo the new service version.

We should see if we can validate the flag value before executing the handler logic.

@Integralist
Copy link
Collaborator

Might also be worth checking this broadly across the CLI (e.g. any where a new service version might be created).

@kpfleming
Copy link
Contributor

This is a slippery slope, of course.. if we attempt to validate the API input in the CLI before issuing the API request, then we're forever stuck with doing that for every API request. We'd also need to decide whether this belongs in the CLI itself or in go-fastly.

@Integralist
Copy link
Collaborator

Yeah we used to have go-fastly AND the CLI validate API inputs but then we removed that sort of logic to avoid being locked to a behaviour that we (go-fastly, CLI) don't control

@kpfleming
Copy link
Contributor

Proposal: what if the CLI 'remembered' that it had autocloned to create a new draft version, and if the subsequent API call failed, it emitted a specific detailed message telling the user what had happened (including the version number of the new draft version)?

@Integralist
Copy link
Collaborator

re: proposal -- that works for me I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants