Problem
Users aren't updating clickhousectl. The update notice isn't surfaced enough.
Today the notice is shown in very few places:
- It only prints on
--help and --version (the clap error branch in crates/clickhousectl/src/main.rs), via update::print_cached_update_notice().
- It does not print during normal command execution at all — see the comment at
main.rs: "The notice itself is only shown on --help (above), not during normal execution."
- A 24-hour cache gate (
CHECK_INTERVAL_SECS = 24 * 60 * 60 + refresh_update_cache() in crates/clickhousectl/src/update.rs) means we only refresh the cached "latest version" once per day.
What we want
-
Kill the once-every-24-hour check gate. Remove the CHECK_INTERVAL_SECS throttle so we surface the available-update state on every invocation.
-
Show the notice on every command that does not pass --json. Every single non---json output should display the update notice when a newer version is available — not just --help/--version.
-
--help must always show it (when an update is available).
-
clickhousectl --version must always show it (when an update is available).
-
Always put the notice at the very end of the output.
-
New message text (single line, replacing the current two-line message):
There is a new version of clickhousectl. Update with clickhouse update.
Notes / open questions
- The requested message says
clickhouse update, but the update command is actually clickhousectl update (clickhouse is the server binary). We should confirm the intended command name before merging — most likely clickhousectl update.
--json output must remain clean (no notice), so machine/agent consumers are unaffected.
- Need to make sure the notice goes to stderr (as it does today) so it never corrupts piped stdout, and that it always lands after the command's own output.
- Consider keeping the background cache refresh (so we don't make a blocking network call on every command) but drop the staleness throttle, or refresh more aggressively. Implementation detail to settle in the PR.
Acceptance criteria
Problem
Users aren't updating clickhousectl. The update notice isn't surfaced enough.
Today the notice is shown in very few places:
--helpand--version(the clap error branch incrates/clickhousectl/src/main.rs), viaupdate::print_cached_update_notice().main.rs: "The notice itself is only shown on --help (above), not during normal execution."CHECK_INTERVAL_SECS = 24 * 60 * 60+refresh_update_cache()incrates/clickhousectl/src/update.rs) means we only refresh the cached "latest version" once per day.What we want
Kill the once-every-24-hour check gate. Remove the
CHECK_INTERVAL_SECSthrottle so we surface the available-update state on every invocation.Show the notice on every command that does not pass
--json. Every single non---jsonoutput should display the update notice when a newer version is available — not just--help/--version.--helpmust always show it (when an update is available).clickhousectl --versionmust always show it (when an update is available).Always put the notice at the very end of the output.
New message text (single line, replacing the current two-line message):
Notes / open questions
clickhouse update, but the update command is actuallyclickhousectl update(clickhouseis the server binary). We should confirm the intended command name before merging — most likelyclickhousectl update.--jsonoutput must remain clean (no notice), so machine/agent consumers are unaffected.Acceptance criteria
--jsoncommand when an update is available.--helpand--version.--jsonoutput unaffected.