allow large pagesize limits on rest api#2661
allow large pagesize limits on rest api#2661sw34 wants to merge 2 commits intozenstackhq:release/v2from
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR changes REST pagination so ChangesREST Pagination Size Limit
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/server/src/api/rest/index.ts`:
- Around line 1675-1677: The clamp currently uses the raw this.options.pageSize
which can be invalid; change it to use the normalized pageSizeOption (and only
apply the clamp if pageSizeOption !== undefined) so that limit =
Math.min(pageSizeOption, limit) is used instead of referencing
this.options.pageSize, ensuring negative or invalid raw values don't produce a
negative limit; update the block around where limit and pageSizeOption are
handled in the same function to perform the explicit !== undefined check before
clamping.
In `@packages/server/tests/api/rest-largepagesize.test.ts`:
- Line 41: The test title string "returns only 15 items when limit set to 5" is
inconsistent with the request using page[limit]=15; update the Jest/Mocha
it(...) description to reflect the actual behavior (e.g., change to "returns
only 15 items when limit set to 15") so the test name matches the request in the
test body that uses page[limit]=15 in the rest-largepagesize.test spec.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 50a35ab3-7a39-426a-889f-b68a8e71ef1a
📒 Files selected for processing (2)
packages/server/src/api/rest/index.tspackages/server/tests/api/rest-largepagesize.test.ts
resolves #2660