Improve the errors of subo-dev
This might very well be a fix meant for Atmo, but I file it here for subo because I think it's primarily a (beginner) UX/DX issue.
With a newly scaffolded project, I forgot to run subo build before subo dev, this was the output:
$ subo dev
{"log_message":"(W) configured to use HTTP with no TLS","timestamp":"2022-05-18T18:26:50.656847092Z","level":2,"app":{"atmo_version":"0.4.7"}}
Error: failed to coordinator.Start: failed to App.Start: failed to findBundle: failed to Read bundle: failed to open bundle: open ./runnables.wasm.zip: no such file or directory
Usage:
atmo [bundle-path] [flags]
Flags:
--appName string if passed, it'll be used as ATMO_APP_NAME, otherwise 'Atmo' will be used (default "Atmo")
--domain string if passed, it'll be used as ATMO_DOMAIN and HTTPS will be used, otherwise HTTP will be used
-h, --help help for atmo
--httpPort int if passed, it'll be used as ATMO_HTTP_PORT, otherwise '8080' will be used (default 8080)
--tlsPort int if passed, it'll be used as ATMO_TLS_PORT, otherwise '443' will be used (default 443)
-v, --version version for atmo
--wait if passed, Atmo will wait until a bundle becomes available on disk, checking once per second
ℹ️ failed to getLatestVersion: failed to fetch latest subo release: context deadline exceeded
Buried in there is the message that runnables.wasm.zip (that is, the Runnable bundle) was not found. Then we seem to fall back an "invalid Atmo command, show commandline help" message which is the second issue. The third issue is the extra log messages logged by Atmo before reaching to the point where it checks for the Runnable bundle.
We should reorganize this to:
- Ideally move the critical checks, such as existence of the runnable bundle at the very beginning of Atmo startup (or even into
subo) - The above may return "false negatives" when Atmo is (intended) to run with the
--waitflag butsuboknows whats going on in cases likesubo devso maybe this check is indeed better suited forsubo - We should proactively and descriptively describe the issue:
:warning: Could not start Atmo: we couldn't find the Runnable bundle (
./runnables.wasm.zip) - We could even go full Clippy ("Did you forget to run
subo build?), and/or link to troubleshooting tips in the docs.
Similar one, in sat, with a missing runnable:
{"log_message":"(E) failed to exec.Do: failed to reconcilePoolSize: failed to addThread more than numRetries: runnable returned OnChange error: failed to addInstance: failed to builder.New: failed to internals: failed to get ref ModuleBytes: failed to ReadFile for Wasm module: open /Users/lauralangdon/Suborbital/subo/hello-world/hello-world.wasm: no such file or directory","timestamp":"2022-05-20T16:22:57.284998634Z","level":1,"app":{"sat_version":"v0.1.3"}}