Skip to content

Allow cursor-based pagination to query extra page until collection is empty#4195

Open
nogates wants to merge 1 commit into
masterfrom
nogates/mirror-retry-config
Open

Allow cursor-based pagination to query extra page until collection is empty#4195
nogates wants to merge 1 commit into
masterfrom
nogates/mirror-retry-config

Conversation

@nogates
Copy link
Copy Markdown
Contributor

@nogates nogates commented May 19, 2026

What does this PR do?

Mirrors datadog-api-client-java#3790 and datadog-api-client-go#3769 for the TypeScript client.

Cursor-based paginators now keep querying until the response collection is empty (results.length === 0), instead of stopping early when a page returns fewer items than the requested limit (results.length < pageSize). This prevents missed items when a page happens to return fewer results than the limit without being the last page. Page-offset and page-number paginations keep their existing behavior.

  • 24 cursor-based WithPagination methods updated across 13 v2 API files (Audit, CI Visibility Pipelines/Tests, Container Images, Containers, Events, Logs, Metrics, Processes, RUM, Security Monitoring, Spans, Test Optimization).
  • 21 offset/page-number-based methods remain unchanged.
  • Added trailing empty-response cassettes for ListSecurityFindings and SearchSecurityFindings pagination tests.

Additional Notes

The supporting cassettes (extra trailing {"data":[]} response) for most cursor-based endpoints were already added previously. Only the two Security Findings cassettes needed new empty-response entries.

Review checklist

Please check relevant items below:

  • This PR includes all newly recorded cassettes for any modified tests.

  • This PR does not rely on API client schema changes.

    • The CI should be fully passing.
  • Or, this PR relies on API schema changes and this is a Draft PR to include tests for that new functionality.

    • Note: CI shouldn't be run on this Draft PR, as its expected to fail without the corresponding schema changes.

🤖 Generated with Claude Code

… empty

Mirrors datadog-api-client-java#3790 and datadog-api-client-go#3769 for
the TypeScript client. Cursor-based paginators now keep querying until
the response collection is empty, instead of stopping early when a page
returns fewer items than the requested limit. Page-offset and page-number
paginations keep their existing behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nogates nogates requested review from a team as code owners May 19, 2026 11:18
@datadog-datadog-prod-us1-2
Copy link
Copy Markdown

datadog-datadog-prod-us1-2 Bot commented May 19, 2026

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 2 Pipeline jobs failed

Ensure labels | changelog   View in Datadog   GitHub Actions

🛟 This job is unlikely to succeed on retry. Please review your pipeline configuration. Missing required label 'changelog/*' for changelog validation.

Run Tests | test / test (16, ubuntu-latest)   View in Datadog   GitHub Actions

See error Test suite failed. Multiple tests encountered unmatched API responses leading to assertion errors.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7129a79 | Docs | Datadog PR Page | Give us feedback!

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