Skip to content

feat(notification): show the capped notification counts - #172

Merged
omattsson merged 1 commit into
mainfrom
feat/notification-capped-counts
Oct 23, 2026
Merged

omattsson merged 1 commit into
mainfrom
feat/notification-capped-counts

Conversation

@omattsson

Copy link
Copy Markdown
Owner

Follow-up to omattsson/k8s-stack-manager#654 (backend PR omattsson/k8s-stack-manager#697).

Summary

The backend caps the notification counts: total is exact up to offset + 1000 (total_capped), and unread_count up to 1000 (unread_count_capped).

  • Types: PaginatedNotifications gets TotalCapped and UnreadCountCapped. UnreadCountResponse gets UnreadCountCapped. An older server sends neither flag, so they read as false.
  • Client: a new UnreadNotificationCount() returns the count and the flag. CountUnreadNotifications() keeps its signature.
  • notification list: the footer prints "(1000+ unread of 1000+ total)" when the server capped the counts.
  • notification count: stdout stays a bare integer, so [ "$(stackctl notification count)" -gt 0 ] keeps working. A capped count also writes a note to stderr. -o json and -o yaml carry unread_count_capped.

Works against old and new servers, so it can merge before or after the backend PR.

Not in this PR

The response contract test does not cover these types yet. testdata/swagger.json is far behind the backend main, so refreshing it now would pull in unrelated changes. Add the two cases (PaginatedNotifications, and UnreadCountResponse against models.UnreadNotificationCount) after the backend PR merges.

Tests

  • New tests for the list footer (exact, total capped, both capped), the JSON pass-through of the flags (also an older server), and count in table, JSON, YAML and quiet mode (stdout integer, stderr note).
  • A client test for UnreadNotificationCount, including an older server.
  • go vet ./... and go test ./... -race -count=1 pass.

🤖 Generated with Claude Code

k8s-stack-manager #654 caps the notification counts: `total` is exact up
to offset + 1000 (`total_capped`) and `unread_count` up to 1000
(`unread_count_capped`).

- types: PaginatedNotifications gets TotalCapped and UnreadCountCapped,
  UnreadCountResponse gets UnreadCountCapped. An older server sends
  neither flag (false).
- client: UnreadNotificationCount returns the count and the flag;
  CountUnreadNotifications keeps its signature.
- `notification list` prints "(1000+ unread of 1000+ total)" when capped.
- `notification count` keeps stdout a bare integer for scripts and writes
  a note to stderr when capped; -o json and -o yaml carry the flag.

The response contract test does not cover these types yet: add them after
the backend change merges and testdata/swagger.json is refreshed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@omattsson
omattsson merged commit 9c2f867 into main Oct 23, 2026
8 checks passed
@omattsson
omattsson deleted the feat/notification-capped-counts branch October 23, 2026 19:03
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