Skip to content

Conversation

@fern-api
Copy link
Contributor

@fern-api fern-api bot commented Dec 10, 2025

Changes

This release fixes a critical pagination bug where hasNextPage() caused infinite loops when per_page was not explicitly specified.

Bug Fix:
The hasNextPage() function in paginated list methods was using request?.per_page ?? 1 instead of request?.per_page ?? 50, causing it to incorrectly return true when there were 1-49 items.

Before (buggy):

hasNextPage: (response) => (response?.roles ?? []).length >= (request?.per_page ?? 1)

After (fixed):

hasNextPage: (response) => (response?.roles ?? []).length >= (request?.per_page ?? 50)

Affected Methods (now fixed):

  • roles.list(), clients.list(), actions.list()
  • actions.triggers.bindings.list(), actions.versions.list()
  • deviceCredentials.list(), flows.list(), forms.list()
  • organizations.members.list(), organizations.members.roles.list()
  • organizations.enabledConnections.list(), organizations.invitations.list()
  • selfServiceProfiles.list(), userGrants.list(), users.list()
  • users.authenticationMethods.list(), users.logs.list()
  • users.organizations.list(), users.permissions.list(), users.roles.list()

Other changes:

  • Version bump: 5.1.0 → 5.2.0
  • New CustomPager class for flexible pagination patterns
  • Import ordering and code style improvements

References

Testing

  • This change adds unit test coverage
  • This change adds integration test coverage

Checklist

@fern-api fern-api bot requested a review from a team as a code owner December 10, 2025 12:29
@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

❌ Patch coverage is 90.49236% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.92%. Comparing base (850eb01) to head (88c9f54).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/management/core/pagination/CustomPager.ts 1.75% 56 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1279      +/-   ##
==========================================
- Coverage   89.21%   88.92%   -0.30%     
==========================================
  Files         369      371       +2     
  Lines       16846    16905      +59     
  Branches     8524     8376     -148     
==========================================
+ Hits        15029    15032       +3     
- Misses       1817     1873      +56     
Flag Coverage Δ
alltests 88.92% <90.49%> (-0.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/management/BaseClient.ts 100.00% <100.00%> (ø)
src/management/Client.ts 100.00% <100.00%> (ø)
src/management/api/errors/BadRequestError.ts 100.00% <100.00%> (ø)
src/management/api/errors/ConflictError.ts 100.00% <100.00%> (ø)
src/management/api/errors/ContentTooLargeError.ts 25.00% <100.00%> (ø)
src/management/api/errors/ForbiddenError.ts 100.00% <100.00%> (ø)
src/management/api/errors/InternalServerError.ts 100.00% <100.00%> (ø)
src/management/api/errors/NotFoundError.ts 100.00% <100.00%> (ø)
src/management/api/errors/PaymentRequiredError.ts 100.00% <100.00%> (ø)
...c/management/api/errors/ServiceUnavailableError.ts 100.00% <100.00%> (ø)
... and 148 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@developerkunal developerkunal changed the title 🌿 Fern Regeneration -- December 10, 2025 fix: Resolve hasNextPage() infinite loop when per_page is not specified Dec 10, 2025
Copy link
Contributor

@developerkunal developerkunal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@developerkunal developerkunal enabled auto-merge (squash) December 10, 2025 12:46
@developerkunal developerkunal merged commit 1de06e5 into master Dec 10, 2025
9 checks passed
@developerkunal developerkunal deleted the fern-bot/2025-12-10T12-29Z branch December 10, 2025 14:33
@developerkunal developerkunal mentioned this pull request Dec 10, 2025
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.

[v5] hasNextPage() uses incorrect default for per_page causing infinite loops

3 participants