fix: auto-paginate channel list --all across conversations.list pages#14
Merged
Conversation
977d847 to
c68617b
Compare
Slack's conversations.list frequently returns far fewer channels per page than the requested limit, even in modest workspaces, while still handing back a next_cursor. `channel list --all` only ever made a single call, so it silently under-reported the workspace's channels despite the flag's name promising otherwise. ListChannels now follows the cursor internally until exhausted (or a 50-page safety cap, surfaced via a new `truncated` field) when --all is set and no explicit --cursor is given. Passing --cursor still fetches a single page for manual/resume use.
c68617b to
01dc7ab
Compare
3 tasks
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
channel list --allonly ever made a single call toconversations.list, but Slack frequently shards results well below the requested--limiteven in modest workspaces — while still returning anext_cursor. This meant--allsilently under-reported the workspace's channels despite its name. In production this caused a channel lookup for an internal customer alerting channel to fail (only 15 of the workspace's channels came back on page one), skipping a scheduled Slack post entirely.ListChannelsnow auto-follows the cursor internally and merges every page whenAll=trueand no explicit--cursoris passed--cursorstill fetches a single page (manual/resume use)maxAutoPaginatePagessafety cap (50 pages); if hit, the result carriestruncated: trueplus a resumablenext_cursorTest plan
go build ./...go vet ./...go test ./...— addedinternal/slack/channels_test.gocovering: merging across sharded pages, explicit-cursor single-page behavior, and the truncation capNeed help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.