Skip to content

feat(cfl): add pagination cursor support to space list#45

Merged
rianjs merged 1 commit intomainfrom
feat/41-cfl-space-list-pagination-cursor
Jan 31, 2026
Merged

feat(cfl): add pagination cursor support to space list#45
rianjs merged 1 commit intomainfrom
feat/41-cfl-space-list-pagination-cursor

Conversation

@rianjs
Copy link
Copy Markdown
Contributor

@rianjs rianjs commented Jan 31, 2026

Summary

  • Add --cursor flag to cfl space list for cursor-based pagination
  • When more results are available, display the cursor value for the next page
  • Extract cursor from the _links.next URL returned by Confluence API

Usage

cfl space list                              # First page (25 results)
cfl space list --cursor "eyJpZCI6MTIzfQ==" # Next page using cursor
cfl space list --limit 100                  # Larger page size

Test plan

  • Unit tests for cursor flag passed to API
  • Unit tests for cursor extraction from next link
  • Unit tests for cursor display in stderr
  • All existing tests pass
  • Lint passes

Closes #41

Add --cursor flag to cfl space list for cursor-based pagination.
When more results are available, display the cursor value for the
next page so users can easily paginate through results.

Closes #41
@rianjs
Copy link
Copy Markdown
Contributor Author

rianjs commented Jan 31, 2026

Test Coverage Assessment for PR #45

I've reviewed the changes and test coverage for the pagination cursor feature.

Changes Summary

This PR adds pagination cursor support to cfl space list:

  1. New --cursor flag for specifying a pagination cursor
  2. extractCursor() helper function to parse cursor from next page links
  3. Updated output to show the next page command when more results exist

Test Coverage Analysis

Well Covered:

  • TestRunList_WithCursor - Verifies the cursor parameter is correctly passed to the API endpoint
  • TestRunList_DisplaysNextCursor - Verifies the next page cursor is extracted from the API response and displayed to stderr with the proper command format
  • TestExtractCursor - Comprehensive table-driven tests covering:
    • Valid cursor with other query params
    • Empty link (returns empty string)
    • Missing cursor param (returns empty string)
    • Full URL with cursor

Coverage Gaps Noted (acceptable):

  1. No API-layer test for cursor in spaces.go: The api/spaces_test.go file doesn't have a specific test for the Cursor option. However, this is a minor gap because:

    • The TestRunList_WithCursor test verifies end-to-end that the cursor reaches the API
    • The api/pages_test.go has TestClient_ListPages_WithCursor which tests the same pattern
    • The implementation in spaces.go is straightforward (if opts.Cursor != "" { params.Set("cursor", opts.Cursor) })
  2. Malformed URL edge case: extractCursor() handles url.Parse errors by returning empty string, but there's no explicit test for this. This is acceptable since:

    • The function is defensive (returns empty string on error)
    • Confluence's API should return well-formed URLs
    • The fallback behavior (showing the old "use --limit" message) is tested implicitly

Verdict

Test coverage is adequate. The critical paths are tested:

  • Cursor is correctly passed to the API
  • Cursor is correctly extracted from response links
  • User sees helpful next-page command in output

The implementation follows the same pattern as the existing pages pagination, and the tests are consistent with the testing patterns used elsewhere in the codebase.

@rianjs rianjs merged commit cf1139b into main Jan 31, 2026
7 checks passed
@rianjs rianjs deleted the feat/41-cfl-space-list-pagination-cursor branch January 31, 2026 10:43
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.

feat(cfl): port space list pagination cursor

1 participant