fix(ux): rate-limit update banner and silence /api/0/ auto-fix (#785)#787
Merged
fix(ux): rate-limit update banner and silence /api/0/ auto-fix (#785)#787
Conversation
Two unrelated but similarly-shaped output-noise fixes from the UX feedback issue: **Update banner (item #10).** The "New version available" banner previously printed on every CLI invocation as long as the cached latest-version was ahead of CLI_VERSION. Scripts, CI logs, and screen-sharing sessions saw it repeatedly. It now: - Rate-limits to once per 24h across CLI invocations via a new `last_notified` metadata key in the version_check table. - Suppresses itself when stderr is not a TTY (pipes, CI, captures). - Only emits once per process even if called multiple times. The semver-compare + cached-version fetch logic is unchanged — only the display gate is new. `sentry cli upgrade` still always shows the current cached version. **`sentry api` /api/0/ prefix (item #11).** The CLI silently strips an accidental `/api/0/` prefix from the endpoint argument because the API client adds it automatically. Previously it emitted a `log.warn` about this — but there was nothing for the user to fix: the strip is a transparent auto-correction, not a warning. Demoted to `log.debug` so it's only visible with `--log-level debug`. Addresses #785 items #10 and #11.
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
|
Contributor
Codecov Results 📊✅ 138 passed | Total: 138 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 1710 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 95.52% 95.52% —%
==========================================
Files 262 262 —
Lines 38174 38205 +31
Branches 0 0 —
==========================================
+ Hits 36464 36495 +31
- Misses 1710 1710 —
- Partials 0 0 —Generated by Codecov Action |
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.
Summary
Two small output-noise fixes from the UX feedback issue:
Update banner (item #10). The "New version available" banner previously printed on every CLI invocation as long as the cached latest-version was ahead of
CLI_VERSION. Scripts, CI logs, and screen-sharing sessions all saw it repeatedly. It now:last_notifiedmetadata key in theversion_checktable.ghCLI.The semver-compare + cached-version fetch logic is unchanged; only the display gate is new.
sentry cli upgradestill always shows the current cached version.sentry api/api/0/ prefix (item #11). The CLI silently strips an accidental/api/0/prefix because the API client adds it automatically. Previously it emitted alog.warnabout this — but there was nothing for the user to fix: the strip is transparent auto-correction. Demoted tolog.debugso it's only visible with--log-level debug.Test plan
bun test test/lib/version-check.test.ts— added coverage for non-TTY suppression, once-per-process latch, and 24h rate-limit.bun run typecheck,bun run lint— clean.Part of #785 (addresses items #10 and #11).