Repository navigation
fix(api): return 400 for a bad cursor on globally paginated endpoints - #10487
Darshanpawar7 wants to merge 1 commit into
Conversation
plane.utils.global_paginator raised ValueError for a cursor that isn't page_size:page:offset, ZeroDivisionError for a page size of 0 and an error on the queryset slice for a negative one, so v2 work items, work item versions and description versions returned 500. Reject these cursors with ParseError, as BasePaginator does.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Description
plane/utils/global_paginator.pynow rejects a badcursorwith 400 (ParseError, "Invalid cursor parameter.") instead of 500, asBasePaginator.paginatealready does:page_size:page:offset:PaginateCursor.from_stringraisedValueError, whichpaginatedidn't catch;ceil(total_results / page_size)raisedZeroDivisionError, and a negative size failed on the queryset slice;This covers v2 work items, work item versions, and work item and intake description versions. Valid cursors behave as before.
Type of Change
Test Scenarios
plane/tests/contract/app/test_global_paginator_cursor_app.py: six bad cursors (abc,10:0,x:0:0,0:0:0,-5:0:0,10:-1:0) return 400 on all four endpoints, and10:0:0still returns 200. The six bad-cursor tests fail onpreview(500) and pass with this change.ruff checkandruff format --checkpass on the changed files. The backend suite passes (1,845 tests); four asset tests that need object storage (test_generic_asset_patch_scope.py,test_static_asset_disposition_app.py) fail the same way onpreviewwithout this change.References
Fixes #10486
Summary by CodeRabbit