Fix: -Limit ignored under AutoPaginate (#30) - #48
Merged
dmann000 merged 4 commits intoJul 24, 2026
Merged
Conversation
… inside it (dmann000#30 test fix)
…follow-up) Final-review finding: the truthy check on $QueryParams['limit'] admitted a negative limit, which would make the post-loop GetRange() throw instead of behaving as "no limit". Unreachable via any current public cmdlet (all validate limit > 0 before setting the query param), but tightening the private function's own guard removes the latent crash and the separate limit=0 gap in one edit.
This was referenced Jul 23, 2026
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
Invoke-PfbApiRequest -AutoPaginatehad no running-total guard against the caller's-Limit: Purity//FB REST treatslimitas page size only and keeps returning acontinuation_tokenpast that point, so everyGet-Pfb* -Limit Ncall was silently re-paging the full collection.$requestedLimit, read once from$QueryParams['limit']) that stops issuing further paginated requests once the total reaches the limit, and trims the final result to exactly that count.GetRange()crash risk (unreachable via any current public cmdlet, but cheap to close).Private/Invoke-PfbApiRequest.ps1.Fixes #30.
Test plan
Tests/Invoke-PfbApiRequest.Tests.ps1covering: (a) pagination stops early and trims to-Limitwhen the server keeps returningcontinuation_tokens past that point, (b) full-collection auto-pagination is unchanged when no-Limitis given.limit=100against a 340-item collection confirmed the server returns exactly 100 items and acontinuation_tokeneven though more items remain -- the exact root cause.Get-PfbSession -Limit 5/-Limit 250each returned exactly that many items with only one page request;Get-PfbSessionwith no-Limitstill returned the full 340.