Skip to content

fix(ux): rate-limit update banner and silence /api/0/ auto-fix (#785)#787

Merged
BYK merged 1 commit intomainfrom
cli-ux-output-noise
Apr 21, 2026
Merged

fix(ux): rate-limit update banner and silence /api/0/ auto-fix (#785)#787
BYK merged 1 commit intomainfrom
cli-ux-output-noise

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 20, 2026

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:

  • 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) — matches gh CLI.
  • 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 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 transparent auto-correction. Demoted to log.debug so 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.
  • Full unit suite: 5263 passing.

Part of #785 (addresses items #10 and #11).

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.
@github-actions
Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (issue) Add resolve, unresolve (reopen), and merge commands by BYK in #778

Bug Fixes 🐛

  • (error-reporting) Fall back to message prefix for ValidationError without field by BYK in #776
  • (hex-id) Auto-recover malformed hex IDs in view commands (CLI-16G) by BYK in #777
  • (init) Force process exit after wizard completes by betegon in #782

Internal Changes 🔧

  • (init) Trim deprecated --features help entries by MathurAditya724 in #781
  • Regenerate docs by github-actions[bot] in 58a84035

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-787/

Built to branch gh-pages at 2026-04-20 17:15 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

Codecov Results 📊

138 passed | Total: 138 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1710 uncovered lines.
✅ Project coverage is 95.52%. Comparing base (base) to head (head).

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

@BYK BYK merged commit 81034da into main Apr 21, 2026
25 checks passed
@BYK BYK deleted the cli-ux-output-noise branch April 21, 2026 08:54
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.

1 participant