Skip to content

fix(list): read a capped total as a floor and trust has_next_page past it - #221

Merged
ysyneu merged 1 commit into
mainfrom
fix/list-total-cap
Oct 11, 2026
Merged

ysyneu merged 1 commit into
mainfrom
fix/list-total-cap

Conversation

@ysyneu

@ysyneu ysyneu commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The incident, alert and alert-event list endpoints stop counting at 1000. Past that they keep returning rows but report total: 1000, so:

  • page 1 printed showing 100 of 1000 total results, which reads as the exact size of the set;
  • pages past the cap (e.g. --page 11 --limit 100) printed no hint at all, because the page offset had already passed the reported total.

Change

  • listPage.TotalCapped marks endpoints whose count is capped; PrintCappedList sets it together with has_next_page for incident list, alert list, alert-event list and alert events.
  • A capped total that reached 1000 reads at least 1000 (footer: total at least 1000; note: showing 100 of at least 1000 total results (page 1): raise --limit or use --page 2).
  • For such a total, whether rows remain is decided by has_next_page alone, not by the page offset.
  • Uncapped lists are unchanged, including a real total of exactly 1000.

Testing

  • Table cases in internal/cli/list_completeness_test.go for capped page 1, past the cap with has_next_page true/false, has_next_page=false overriding the offset, a capped endpoint below the cap, and an uncapped total of 1000.
  • go test ./... and make lint pass.
  • Against the live API: incident list --limit 100 pages 1, 11 and 100 print showing N of at least 1000 total results; change list still prints of 219.

…t it

The incident, alert and alert-event list endpoints stop counting at 1000:
past that they keep returning rows but report total=1000, so notes like
"showing 100 of 1000 total results" understated the set, and pages past
the cap printed no hint at all.

Those commands now mark their totals as capped. A total that reached the
cap reads "at least 1000", and whether rows remain is taken from the
response's has_next_page instead of the page offset. Uncapped lists are
unchanged, including a real total of exactly 1000.
@ysyneu
ysyneu merged commit ec0922a into main Oct 11, 2026
12 checks passed
@ysyneu
ysyneu deleted the fix/list-total-cap branch October 11, 2026 12:47
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