Skip to content

feat(cli): nudge to upgrade when a newer roar is available on pypi#131

Merged
christophergeyer merged 1 commit into
mainfrom
feat/version-upgrade-hint
May 30, 2026
Merged

feat(cli): nudge to upgrade when a newer roar is available on pypi#131
christophergeyer merged 1 commit into
mainfrom
feat/version-upgrade-hint

Conversation

@christophergeyer
Copy link
Copy Markdown
Member

Why

Users on stale roar versions have no signal that a newer one exists.

How (zero foreground latency)

  • The pypi lookup runs only in the background telemetry uploader subprocess (roar.telemetry.uploader, already detached + DEVNULL'd), and caches {latest, checked_at} to disk under the cache home with a ~24h TTL. The foreground command path never makes a network call — it only reads the cache.
  • roar init emits an amber hint: (git-advice style, gated by hints.enabled) when the cached latest is newer than the running version, e.g.:
    hint: roar 0.4.0 is available (you have 0.3.3). Upgrade with `uv tool upgrade roar-cli` or `pip install -U roar-cli`.
    
  • Fail-open everywhere: a slow/unreachable pypi, a corrupt cache, or a missing cache simply means no nudge. The background check also self-throttles via the TTL so we don't hit pypi on every telemetry flush.

hint: (not warning:) is deliberate — an available upgrade is advisory, not an error; the hint system is exactly the opt-out-able advice channel for it.

Tests

tests/unit/test_version_check.py (8): hint when newer / none when current-or-newer / none without-or-corrupt cache (fail-open), refresh writes cache, refresh skips network when cache is fresh, refresh fail-opens on network error. ruff clean; existing init + telemetry suites green.

🤖 Generated with Claude Code

Checks pypi for the latest roar-cli version in the BACKGROUND telemetry
uploader subprocess (already detached + fire-and-forget) and caches the result
to disk under the cache home (~24h TTL). The foreground only ever reads the
cache, so the command path never makes a network call — zero added latency.
`roar init` emits a `hint:` (git-advice style, gated by hints.enabled) when the
cached latest is newer than the running version. Every path is fail-open: a
slow/unreachable pypi, or a corrupt/missing cache, simply means no nudge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@christophergeyer christophergeyer merged commit c2a4c7c into main May 30, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants