π fix(redirects): paginate listRedirects to prevent silent truncation - #2
Merged
Merged
Conversation
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.
π Description
listRedirectsrequested/domain/domains/{domain}/webredirswith no pagination parameters. Gandi caps that endpoint at 50 results and returns them with no error, no warning, and no indication the list is partial β sogandi redirect listsilently under-reported whenever a domain held more than 50 redirects.Measured on a real domain: the API held 64 redirects, the CLI reported 50. The 14 missing entries were invisible to both the table output and
--json, so any script consuming the JSON got a confidently wrong answer. Notably, the missing entries included a redirect the user had just edited, which is how the bug surfaced.The fix pages through with
?page=N&per_page=100, accumulating results until a short page signals the end. It deliberately does not cap silently: if pages never run short after 100 iterations, it throws an error naming the domain, on the principle that a truncated list is indistinguishable from a complete one and so must never be returned quietly.Tests added in
src/lib/api.test.ts:page/per_pagequery params on both callsπ½οΈ Screencast
No visual changes.
β How to Validate
npm install && npm run buildgandi redirect list <domain>on a domain with more than 50 redirects β confirm the count matches what's actually configured (previously capped at 50).npm testβ see the new pagination coverage insrc/lib/api.test.ts(45 passing, up from 41).npm run lintβ clean.π οΈ Developer Checklist
npm testβ 45 passing, up from 41)Validated locally:
npm run lintclean,npm test(45 passing),npm run build(tsc) clean, and verified live against a real domain β the CLI now returns 64/64 redirects and the previously-missing record is visible. No further manual/exploratory testing beyond that was performed.