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

Remove user environment validation logic #785

Merged
merged 24 commits into from
Feb 6, 2023

Conversation

Integralist
Copy link
Collaborator

Context:
The compute build command currently contains internal logic for validating a user's local environment. It does this in an attempt to reduce the number of possible errors when trying to compile a Compute project.

Problem:
The validation logic is tightly coupled to specific expectations of the CLI and its starter kits and consequently results in errors that are difficult to understand and debug, as well as restricts users from using their own tools and scripts.

Solution:
We should remove as much of the user environment validation logic as possible as this will help to reduce friction for users who want to switch the tooling used, as well as reduce the general confusion caused for users when there are environment validation errors, and lastly, it reduces the maintenance overhead for contributors to the CLI code base as the logic flow becomes much simpler.

Notes:
In the 5.x CLI releases we persisted a 'default' build script to disk (specifically the fastly.toml manifest). We no longer do that as part of the changes in this PR. The intention for the new 6.0.0 CLI release is to use the default build script and inform the user but not to persist that to disk under the [scripts.build] section. This makes the developer experience less confusing for users (e.g. you no longer open up your fastly.toml manifest and find a bunch of things have been unexpectedly added/modified).

Screenshots:
Below are some screenshots to highlight the new output using the compute-starter-kit-rust-default.

First, we initialise a new project, we take a look at the fastly.toml manifest and see there is no [scripts.build] defined, and we run compute build (the CLI will use a 'default' build script known to work generally for Rust):

Screenshot 2023-02-01 at 12 49 10

If we re-run the command with --verbose we'll see additional information that lets us know what the CLI is doing:

Screenshot 2023-02-01 at 12 51 32

If we had instead manually updated the fastly.toml manifest to include a [scripts.build] that failed to produce the expected output (we state in our documentation that we require the build script to produce a ./bin/main.wasm binary), then we would see this error returned, which includes some generic steps to help guide the user:

Screenshot 2023-02-01 at 12 56 11

The first bullet point suggestion says to re-run the command with the --verbose flag, and if we do that we'll see the following output (admittedly in my contrived example it doesn't really offer any more help but if your [scripts.build] was an actual script trying to produce a ./bin/main.wasm binary, then the output from that command would be displayed and hopefully there would be enough context in its error output to guide the user):

Screenshot 2023-02-01 at 12 59 56

@Integralist Integralist force-pushed the integralist/strip-env-validation branch from 17410d7 to b3a6fef Compare February 1, 2023 14:59
Copy link
Member

@kailan kailan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic! Really pleased to see so much code removed. Great work

@Integralist Integralist merged commit 68e7a18 into main Feb 6, 2023
@Integralist Integralist deleted the integralist/strip-env-validation branch February 6, 2023 14:05
@Integralist Integralist mentioned this pull request Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants