Skip to content

[enhancement]: bare local server start should auto-install latest when nothing is installed #264

@sdairs

Description

@sdairs

Summary

Running clickhousectl local server start with no installed version, no default set, and no --version flag should bootstrap automatically: install latest and start the server. Today it fails instead.

Current behaviour

start_server (crates/clickhousectl/src/local/mod.rs:294-300) only auto-installs when --version is passed:

let version = if let Some(spec_str) = &version_spec {
    // server start --version <spec> → resolves + installs if missing
    let spec = version_manager::parse_version_spec(spec_str)?;
    let platform = version_manager::platform::Platform::detect()?;
    version_manager::install::ensure_installed_local_first(&spec, &platform).await?
} else {
    // bare `server start` → just reads the default, no install
    version_manager::get_default_version()?
};

With nothing installed, get_default_version() returns Error::NoDefaultVersion, which prints:

No default version set. Run: clickhousectl local use <version>

and exits with code 1. No download happens. The only zero-to-running path right now is local server start --version latest, or the documented three-step local install stable && local use stable && local server start.

Proposed behaviour

When no --version is given and no default version is set (get_default_version()NoDefaultVersion), fall back to installing latest and starting with it, rather than erroring. Effectively, the bare-start else branch should treat a missing default as "install latest" instead of a hard error.

Suggested shape:

  • If a default exists → use it (unchanged).
  • If no default is set → resolve VersionSpec::Latest, ensure_installed_local_first, set it as the default (matching install's first-install-sets-default behaviour), then start. Emit a note to stderr that latest was installed so the auto-download isn't silent.
  • A VersionNotFound default (file points at a removed binary) should remain an error — only the no default at all case bootstraps.

Notes

  • Do not set the default version to the version that was installed. This is deliberate; it means the user will keep getting the latest version if they dont pin.
  • Doc update to README.md to reflect that a bare server start now bootstraps.
  • Update all docs that show using a tag like "stable" to use latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions