Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Aug 18, 2025

Resolves #18067

Summary by CodeRabbit

  • New Features

    • Zendesk “Search Tickets” action now supports a “Page” option to retrieve a specific page of results (default: 1), improving pagination control.
    • Search results are returned as a single page directly, aligning output with the selected page and per-page limit.
    • Updated success message for consistency.
  • Chores

    • Bumped Zendesk component version to 0.8.1 and action version to 0.0.5.

@vercel
Copy link

vercel bot commented Aug 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
docs-v2 Ignored Ignored Aug 18, 2025 6:03pm
pipedream-docs Ignored Ignored Aug 18, 2025 6:03pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Aug 18, 2025 6:03pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 18, 2025

Walkthrough

Refactors 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

Cohort / File(s) Summary
Zendesk search-tickets action refactor
components/zendesk/actions/search-tickets/search-tickets.mjs
Bump action version to 0.0.5; add optional integer prop page (default 1); switch from app.paginate to app.searchTickets with per_page and page; remove manual tickets aggregation and pagination resourceKey/max; return direct results; update summary text.
Zendesk component package metadata
components/zendesk/package.json
Bump package version 0.8.0 → 0.8.1; no other 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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Add pagination support using next_page and previous_page URLs to retrieve subsequent pages and avoid repeated results (#18067) Uses page/per_page parameters; does not consume or expose next_page/previous_page links or cursors; navigation via URL-based pagination not implemented.

Poem

I thump my paws on changelog ground,
Page by page, the tickets found.
No endless loops, just tidy rows—
Hop to the next, that’s how it goes.
With version bumps and carrot cheer,
I search, I sort—results appear! 🥕✨

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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-18067

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 change

This 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 change

Moving 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: Validate page input and tighten prop definition

Add a minimum constraint so invalid pages (e.g., 0, negatives) are rejected at input time. Also, since a default is provided, optional: true is 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 defensively

This directly fixes the duplicate results issue. To avoid sending undefined query params (which some clients encode as param=undefined and may trigger 400s), build params conditionally. 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.searchTickets accepts per_page and page in params for the search endpoint.
  • Confirm the intended semantics change: limit now maps to per-page size, not a cross-page maximum.

69-71: Enrich summary and confirm return shape/backward compatibility

Consider 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.results while 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 84fa60f and cf6671c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is 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

Copy link
Collaborator

@GTFalcao GTFalcao left a comment

Choose a reason for hiding this comment

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

LGTM!

@vunguyenhung vunguyenhung merged commit e66baec into master Aug 19, 2025
11 checks passed
@vunguyenhung vunguyenhung deleted the issue-18067 branch August 19, 2025 08:56
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.

[ACTION] Refactor: Zendesk-Search-Ticekts with pagination offset

4 participants