Repository navigation
fix(list): read a capped total as a floor and trust has_next_page past it - #221
Merged
Merged
Conversation
…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.
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.
Problem
The incident, alert and alert-event list endpoints stop counting at 1000. Past that they keep returning rows but report
total: 1000, so:showing 100 of 1000 total results, which reads as the exact size of the set;--page 11 --limit 100) printed no hint at all, because the page offset had already passed the reported total.Change
listPage.TotalCappedmarks endpoints whose count is capped;PrintCappedListsets it together withhas_next_pageforincident list,alert list,alert-event listandalert events.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).has_next_pagealone, not by the page offset.Testing
internal/cli/list_completeness_test.gofor capped page 1, past the cap withhas_next_pagetrue/false,has_next_page=falseoverriding the offset, a capped endpoint below the cap, and an uncapped total of 1000.go test ./...andmake lintpass.incident list --limit 100pages 1, 11 and 100 printshowing N of at least 1000 total results;change liststill printsof 219.