Warn when CLI is older than API minimum version#26
Conversation
Check x-notte-min-cli-version response header and print a one-time stderr warning when the running CLI is outdated. Prevents silent data loss from schema mismatches.
Reuse the existing update.PrintUpdateNotification flow so the user gets an interactive Y/n upgrade prompt (or a non-blocking notice in non-TTY/agent contexts) when the API returns a minimum CLI version higher than the running one.
|
@greptile |
|
#26 is still needed — the two PRs solve different problems:
The critical distinction is the data-loss scenario in the PR description: when the API makes a schema-breaking change (e.g. the S3 migration), #24 won't help — it only nudges users toward newer versions on a 24-hour cadence and doesn't convey urgency. #26 fires on the specific request that's affected and explicitly signals "your version is too old to work correctly." The Tip: You can customize Greptile's behavior for this repo with |
|
#26 is still needed — the two PRs solve different problems: #24 (merged): Proactive update check via GitHub releases API, cached for 24 hours. Tells users "a newer version exists." May be delayed by the cache TTL. #26 (this PR): Reactive compatibility enforcement via The key gap #24 leaves: a user within the 24h cache window on an incompatible version will get no warning from #24, but will silently get broken results. #26 fires the moment any API response carries the header — no cache involved. The diff in #26 also integrates cleanly with #24's infrastructure — it reuses Short answer: merge both. #24 = "upgrade available," #26 = "upgrade required now." |
ok but this assumes that we correctly override x-notte-cli-min-version when we do the releases but this will never happen in practice |
Summary
x-notte-min-cli-versionresponse header from the API on every requestnotte sessions networkreturning 0 batches on v0.0.10 after the S3 migration)Companion API change: the backend sets
x-notte-min-cli-version: 0.0.12on all responses (separate PR in the monorepo).Test plan
TestCheckMinVersion_WarnsWhenOutdated— warning printed when CLI < minTestCheckMinVersion_SilentWhenCurrent— no output when CLI >= minTestCheckMinVersion_SilentWhenNoHeader— no output when header absentTestCheckMinVersion_SkipsDevVersion— no output for dev buildsgo test ./internal/...)Greptile Summary
Adds a
x-notte-min-cli-versionresponse-header check to every API request and surfaces a one-time upgrade prompt when the running CLI falls below the API-advertised minimum. The approach —sync.Once+ package-level globals written in the HTTP transport and read afterrootCmd.Execute()returns — is correct for single-goroutine CLI invocations and is well-covered by tests.Confidence Score: 5/5
Safe to merge; both findings are P2 edge cases that do not affect the primary upgrade-warning path
No P0/P1 defects. The detectOnce consumed-early concern is a theoretical edge case (requires different API endpoints to return different minimums mid-session) and the changelog-URL issue is a minor UX trade-off explicitly acknowledged in the PR description. All four new tests pass and cover the main behavioural branches.
internal/api/client.go — sync.Once consumption order; internal/cmd/root.go — changelog URL target version
Important Files Changed
Prompt To Fix All With AI
Reviews (4): Last reviewed commit: "prompt upgrade instead of just warning o..." | Re-trigger Greptile