test(core): add regression tests for incorrect pagination cursor extraction#17
Merged
niklashigi merged 14 commits intomainfrom Dec 18, 2025
Merged
Conversation
# Conflicts: # tests/conftest.py # tests/test_basic_behavior.py # tests/test_error_handling.py # tests/test_job_board.py
# Conflicts: # tests/conftest.py
| 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() |
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/test_pagination.pycovering:cursorto subsequent requestsnextisnullnext()tests/conftest.py, enhanceMockContextrequest 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.