Make update notice prominent on every non-JSON command (#269)#272
Open
sdairs wants to merge 2 commits into
Open
Make update notice prominent on every non-JSON command (#269)#272sdairs wants to merge 2 commits into
sdairs wants to merge 2 commits into
Conversation
Surface the available-update state far more aggressively: - Show the cached update notice at the very end of every command that produces human-readable output (stderr), not just --help/--version. --json and detected coding agents continue to suppress it so machine consumers stay clean. - New single-line message: "There is a new version of clickhousectl. Update with `clickhousectl update`." - --version now always hits the network to refresh the cache + reset the staleness timer, then prints the notice from the fresh cache. - `update --check` now also writes the cache + resets the timer on every run. - Successful `update` clears the cache so the notice disappears at once. - Keep the 24h background-refresh gate for normal commands; on network failure preserve any previously-cached "update available" version instead of clobbering it with the current version. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
bugbot review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8812b60. Configure here.
The 'Already up to date' path in perform_update returned without writing the cache, so a stale 'update available' notice (e.g. from a yanked release or wrong cache entry within the 24h window) kept nagging even after the user explicitly ran `update`. Refresh the cache to network truth before returning, mirroring the success path and check_for_update. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #269
Problem
Users weren't updating clickhousectl because the update notice was barely surfaced — it only printed on
--help/--version, never during normal command execution.What changed
--jsoncommand. The cached update notice now prints to stderr at the very end of every command that produces human-readable output.--jsonand detected coding agents continue to suppress it, so machine/agent consumers are unaffected.--versionalways checks the network, refreshes the cache, and resets the staleness timer, then prints the notice from the fresh cache.update --checknow also writes the cache and resets the timer on every run.updateclears the cache so the notice disappears immediately.Tests
cache_is_staleboundary cases (update.rs).command_json_flagmapping +--json/updatesuppression (main.rs).Manual verification (live network, current latest
0.3.1)--version, seeded stale cache0.3.1, timer reset--versionon a tempv0.0.1buildupdate --check, seeded wrong cacheUpdate available: v0.0.1 → v0.3.1; cache rewritten, timer reset--json/ under agent detection🤖 Generated with Claude Code