Skip to content

fix: return empty list when template list offset exceeds count#279

Open
pranavgundu wants to merge 1 commit into
runpod:mainfrom
pranavgundu:fix/template-list-pagination-offset
Open

fix: return empty list when template list offset exceeds count#279
pranavgundu wants to merge 1 commit into
runpod:mainfrom
pranavgundu:fix/template-list-pagination-offset

Conversation

@pranavgundu
Copy link
Copy Markdown

Summary

  • template list returned the full unsliced result when --offset was greater than or equal to the number of templates after filtering. Pagination check used opts.Offset < len(allTemplates), so out of range offsets fell through and re-returned everything.
  • Fix returns []Template{} immediately when Offset >= len(allTemplates).

Before fix

  • runpodctl template list --type official → 13 templates
  • runpodctl template list --type official --offset 13 → returned all 13 again (expected [])
  • runpodctl template list --type official --offset 99999 → returned all 13 (expected [])

After fix

  • --offset 13[]
  • --offset 99999[]
  • --offset 5 → 8 results (in-range still correct)

Test plan

  • go test ./...
  • go vet ./...
  • live e2e against api.runpod.io for offset edge cases above
  • go test -tags e2e ./e2e

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