-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Zendesk Search Tickets - remove automatic pagination, add page prop #18096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
WalkthroughRefactors the Zendesk search-tickets action to use direct search with explicit per_page and page parameters, adds a page prop, removes generator-based pagination, updates returned data and summary, and bumps versions for the action and the Zendesk component package. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Action as search-tickets Action
participant Zendesk as Zendesk API
User->>Action: Invoke with query, sortBy, sortOrder, limit, page
Action->>Zendesk: searchTickets(query, { per_page: limit, page })
Zendesk-->>Action: Results (tickets, pagination metadata)
Action-->>User: Return search results
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
components/zendesk/package.json (1)
3-3: Consider a minor version bump due to behavior changeThis package bump is patch-level. Given the action now returns a different shape (full search response vs. aggregated tickets array) and removes auto-pagination, this may be a breaking change for some users. Consider a minor bump (e.g., 0.9.0) for the package to reflect that behavior.
components/zendesk/actions/search-tickets/search-tickets.mjs (4)
8-8: Action version bump may understate behavior changeMoving from auto-pagination to single-page results and returning the raw search response changes both pagination semantics and return shape. Consider bumping the action version to a minor (e.g., 0.1.0) to make this more visible to users.
40-46: Validatepageinput and tighten prop definitionAdd a minimum constraint so invalid pages (e.g., 0, negatives) are rejected at input time. Also, since a default is provided,
optional: trueis redundant but harmless.Apply this diff:
page: { type: "integer", label: "Page", description: "The page number to retrieve. Default is 1.", default: 1, - optional: true, + optional: true, + min: 1, },
57-67: Good switch away from auto-pagination; build params defensivelyThis directly fixes the duplicate results issue. To avoid sending undefined query params (which some clients encode as
param=undefinedand may trigger 400s), buildparamsconditionally. Also, confirm Zendesk’s per_page max (commonly 100) and clamp if needed to prevent server-side errors.Apply this diff:
- const results = await this.app.searchTickets({ - step, - customSubdomain, - params: { - query, - sort_by: sortBy, - sort_order: sortOrder, - per_page: limit, - page: this.page, - }, - }); + const params = { + query, + per_page: limit, + page: this.page, + }; + if (sortBy) params.sort_by = sortBy; + if (sortOrder) params.sort_order = sortOrder; + // Optionally clamp per_page to Zendesk's max (often 100): + // if (params.per_page != null) params.per_page = Math.min(params.per_page, 100); + const results = await this.app.searchTickets({ + step, + customSubdomain, + params, + });Follow-ups:
- Please verify
this.app.searchTicketsacceptsper_pageandpageinparamsfor the search endpoint.- Confirm the intended semantics change:
limitnow maps to per-page size, not a cross-page maximum.
69-71: Enrich summary and confirm return shape/backward compatibilityConsider surfacing page context and count in the summary to aid users navigating pages. Also, returning the full search response is useful for
next_page/previous_page, but it changes the shape from the prior tickets array. If backward compatibility is desired, you could keep returning the full object while also exporting the current page’s length in the summary.Apply this diff to improve the summary:
- step.export("$summary", "Successfully retrieved tickets matching the search query"); + const pageCount = results?.results?.length ?? 0; + const hasNext = Boolean(results?.next_page); + const summary = `Retrieved ${pageCount} ticket${pageCount === 1 ? "" : "s"} (page ${this.page}${hasNext ? ", next page available" : ""})`; + step.export("$summary", summary);Question:
- Is the change in return value shape (array -> full search response) intentional and communicated (release notes/changelog)? If not, consider returning
results.resultswhile exposing pagination metadata via$summary.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
components/zendesk/actions/search-tickets/search-tickets.mjs(3 hunks)components/zendesk/package.json(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
components/zendesk/actions/search-tickets/search-tickets.mjs (3)
components/zendesk/actions/list-macros/list-macros.mjs (1)
results(71-86)components/zendesk/actions/list-ticket-comments/list-ticket-comments.mjs (1)
results(32-43)components/zendesk/actions/list-tickets/list-tickets.mjs (1)
results(44-56)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Lint Code Base
GTFalcao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Resolves #18067
Summary by CodeRabbit
New Features
Chores