Skip to content

test(core): add regression tests for incorrect pagination cursor extraction#17

Merged
niklashigi merged 14 commits intomainfrom
test/core/pagination-cursor-regression
Dec 18, 2025
Merged

test(core): add regression tests for incorrect pagination cursor extraction#17
niklashigi merged 14 commits intomainfrom
test/core/pagination-cursor-regression

Conversation

@niklashigi
Copy link
Member

@niklashigi niklashigi commented Dec 18, 2025

This prepares the fix for #12 - the resolution itself is made using a change to our SDK-specific OpenAPI (not tracked in this repo)


Note

Add comprehensive pagination tests and make mock request body parsing more robust in test utilities.

  • Tests:
    • Add pagination behavior tests in tests/test_pagination.py covering:
      • Iteration across multiple pages and request count validation
      • Passing cursor to subsequent requests
      • Stopping when next is null
      • Preserving original query params across pages
      • Manual pagination via next()
  • Test Utilities:
    • In tests/conftest.py, enhance MockContext request capture to parse non-GET request bodies by trying JSON first and falling back to raw string on decode/parse errors.

Written by Cursor Bugbot for commit a9830a9. This will update automatically on new commits. Configure here.

Base automatically changed from test/core/clean-up-structure to main December 18, 2025 09:56
@niklashigi niklashigi merged commit 28b9837 into main Dec 18, 2025
1 of 2 checks passed
@niklashigi niklashigi deleted the test/core/pagination-cursor-regression branch December 18, 2025 09:58
request_body = json.loads(request.content.decode())
except (json.JSONDecodeError, UnicodeDecodeError):
# Fall back to raw string if not valid JSON
request_body = request.content.decode()
Copy link

Choose a reason for hiding this comment

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

Bug: Exception handler will re-raise same UnicodeDecodeError

The exception handler catches UnicodeDecodeError from the decode() call on line 95, but then the fallback on line 98 calls request.content.decode() again. If the original error was a UnicodeDecodeError, this second decode call will raise the same exception, which won't be caught. The fallback needs to handle the case where the content cannot be decoded as UTF-8, such as by specifying an error handler (e.g., decode(errors='replace')) or storing raw bytes.

Fix in Cursor Fix in Web

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