Skip to content

Conversation

bontaq
Copy link

@bontaq bontaq commented Oct 16, 2025

WHY

The main impetus for this is to provide an action LLMs can call before calling other Spotify actions, since they need to get proper IDs to pass in. I imagine it's handy for other things too :p

Summary by CodeRabbit

  • New Features

    • Added a Spotify Search action to search tracks, artists, albums, and playlists with configurable query, types, market, limit, offset, and external content options; returns results and a concise summary.
  • Chores

    • Bumped Spotify component version to 0.8.0.

Copy link

vercel bot commented Oct 16, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Oct 17, 2025 8:17pm

💡 Enable Vercel Agent with $100 free credit for automated AI reviews

@adolfo-pd adolfo-pd added the User submitted Submitted by a user label Oct 16, 2025
@pipedream-component-development
Copy link
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

@pipedream-component-development
Copy link
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

Walkthrough

Adds a new Spotify Search action that validates inputs, performs a GET to Spotify's /search with provided params, aggregates items across requested types, and returns the API response. Also bumps the Spotify component package version to 0.8.0.

Changes

Cohort / File(s) Change Summary
New Spotify Search Action
components/spotify/actions/search/search.mjs
Adds a default-exported action object with metadata and props (spotify app, query, type, market, limit, offset, includeExternal); validates non-empty query and at least one type; issues axios GET to Spotify /search with params; aggregates items across requested types using result mappings; builds summary/typeLabel and returns API response.
Version Update
components/spotify/package.json
Bumps package version from 0.7.3 to 0.8.0.

Sequence Diagram

sequenceDiagram
    participant User
    participant Action as Spotify Search Action
    participant Spotify as Spotify API

    User->>Action: invoke(query, types, market, limit, offset, includeExternal)
    Action->>Action: validate query and types
    Action->>Spotify: GET /search?q=...&type=...&market=...&limit=...&offset=...&include_external=...
    Spotify-->>Action: per-type search payloads
    Action->>Action: extract & aggregate items, build summary
    Action-->>User: return aggregated response and summary
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through queries bright and clear,

I gathered albums, tracks, and artists near.
Types united, results all in a row,
A version nudged up — off we go! 🎶

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Add search action for spotify" directly and clearly describes the primary change in this pull request—the addition of a new Spotify Search action. The title is concise, specific enough for teammates to understand the main purpose, and avoids generic or vague phrasing. While the changeset also includes a version bump, that is a secondary consequence of the feature addition, and the title appropriately focuses on the main change.
Description Check ✅ Passed The PR description follows the required template structure by including the "## WHY" section and provides substantive, meaningful content explaining the motivation for the change. The author clearly states that the action enables LLMs to obtain proper Spotify IDs before calling other Spotify actions, and notes potential additional use cases. The template defines only a single required section, which has been completed with relevant context.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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: 2

🧹 Nitpick comments (1)
components/spotify/actions/search/search.mjs (1)

68-76: Consider removing redundant description text.

The description on line 73 states "Default: 20, Maximum: 50" but this information is already captured by the default: 20 and max: 50 properties. While the redundancy doesn't cause issues and may help users, it creates a maintenance burden if these values need to change.

Apply this diff to remove the redundant information:

-      description: "The maximum number of results to return per type. Default: 20, Maximum: 50.",
+      description: "The maximum number of results to return per type.",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe7f45d and 8c8d735.

📒 Files selected for processing (2)
  • components/spotify/actions/search/search.mjs (1 hunks)
  • components/spotify/package.json (1 hunks)
🔇 Additional comments (7)
components/spotify/package.json (2)

3-3: LGTM! Appropriate version bump for new feature.

The minor version increment from 0.7.3 to 0.8.0 correctly follows semantic versioning for the addition of the new search action.


18-18: LGTM! Secure lodash version.

The lodash dependency at version 4.17.21 includes the security fix for CVE-2021-23337 (command injection in _.template) and is a stable release. Based on learnings.

components/spotify/actions/search/search.mjs (5)

1-7: LGTM! Efficient import strategy.

Using lodash/get.js for a single function is a good practice for tree-shaking and keeping bundle size minimal. Based on learnings.


9-19: LGTM! Appropriate metadata and annotations.

The metadata correctly describes this as a read-only search operation with appropriate hints for the platform.


122-125: LGTM! Safe property access with aggregation.

Using lodash.get with a fallback empty array ensures safe access to nested response properties and correctly handles missing data. The reduce properly aggregates items across all requested types.


127-134: LGTM! Clear and informative summary construction.

The typeLabel logic correctly handles both single and multiple type searches, with appropriate pluralization. The summary message clearly communicates results to users.


135-135: LGTM! Returning full API response provides flexibility.

Returning the complete API response (rather than just aggregated items) gives users access to pagination metadata and other useful information from the Spotify API.

@bontaq bontaq force-pushed the add-search-for-spotify branch from 8c8d735 to ea5fab0 Compare October 17, 2025 14:33
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: 1

♻️ Duplicate comments (2)
components/spotify/actions/search/search.mjs (2)

106-108: Empty query validation added — LGTM.

Good use of ConfigurationError and trimming to prevent empty searches. This addresses earlier feedback.


110-110: Removed array normalization — consistent with other Spotify actions.

Using type directly matches patterns elsewhere in this package.

🧹 Nitpick comments (2)
components/spotify/actions/search/search.mjs (2)

112-123: Add a request timeout for resiliency.

Prevent hanging runs on network stalls by setting a conservative timeout.

-    const res = await axios($, this.spotify._getAxiosParams({
+    const res = await axios($, this.spotify._getAxiosParams({
       method: "GET",
       path: "/search",
       params: {
         q: query,
         type: types.join(","),
         market,
         limit,
         offset,
         include_external: includeExternal,
       },
-    }));
+      timeout: 15000,
+    }));

125-129: Use flatMap to simplify aggregation.

Minor readability win; behavior unchanged.

-    const allItems = types.reduce((accumulator, itemType) => (
-      accumulator.concat(get(res, `${ITEM_TYPES_RESULT_NAME[itemType]}.items`, []))
-    ), []);
+    const allItems = types.flatMap(
+      (itemType) => get(res, `${ITEM_TYPES_RESULT_NAME[itemType]}.items`, []),
+    );
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8c8d735 and ea5fab0.

📒 Files selected for processing (2)
  • components/spotify/actions/search/search.mjs (1 hunks)
  • components/spotify/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • components/spotify/package.json

@bontaq bontaq force-pushed the add-search-for-spotify branch from ea5fab0 to 490562b Compare October 17, 2025 14:56
@bontaq bontaq force-pushed the add-search-for-spotify branch from 490562b to 199e016 Compare October 17, 2025 20:17
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 (2)
components/spotify/actions/search/search.mjs (2)

25-29: Consider adding prop-level validation for better UX.

While the runtime validation at lines 106-108 works, adding required: true to the query prop would provide earlier feedback (at configuration time rather than execution time) and improve the user experience by preventing empty workflows from being saved.

Apply this diff to add prop-level validation:

 query: {
   type: "string",
   label: "Search Query",
   description: "Search query keywords and optional field filters. [See the Spotify docs for query syntax](https://developer.spotify.com/documentation/web-api/reference/search)",
+  required: true,
 },

Note: You can keep the runtime trim validation at line 106 for whitespace-only inputs even with required: true.


129-143: LGTM! Response aggregation and summary logic work correctly.

The use of flatMap with lodash/get elegantly aggregates items across all requested types, and the summary message provides useful feedback. The typeLabel logic correctly handles singular/plural forms.

The typeLabel logic could be slightly simplified for readability:

-    const typeLabel = types.length > 1
-      ? "items"
-      : types[0] + (allItems.length !== 1
-        ? "s"
-        : "");
+    const typeLabel = types.length === 1
+      ? `${types[0]}${allItems.length === 1 ? "" : "s"}`
+      : "items";

This flips the condition to check for the simpler case first and uses a template literal, but both versions are functionally equivalent.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 490562b and 199e016.

📒 Files selected for processing (2)
  • components/spotify/actions/search/search.mjs (1 hunks)
  • components/spotify/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • components/spotify/package.json
🔇 Additional comments (5)
components/spotify/actions/search/search.mjs (5)

1-10: LGTM! All imports are used and appropriate.

The imports are clean and all utilized within the action. Using lodash/get for safe nested property access in the response aggregation is a solid choice.


12-22: LGTM! Metadata follows Pipedream conventions.

The component key follows the required format, the version is appropriate for a new component, and the annotations accurately reflect the search action's characteristics (non-destructive, external API call, read-only).


30-63: LGTM! Well-structured type selection with sensible defaults.

The prop correctly uses a string[] type with all six Spotify search types represented. The default value of [ITEM_TYPES.TRACK] ensures users always have at least one type selected, which works well with the validation at lines 111-113.


64-94: LGTM! Props follow best practices.

Good use of propDefinition to reuse common props from the app file. The limit max of 50 and default of 20 align with Spotify API constraints. The includeExternal prop correctly supports the "audio" option per the Spotify API specification.


96-127: LGTM! Solid validation and API request structure.

The validation logic correctly guards against empty queries (including whitespace-only) and empty type arrays, preventing both poor UX and API errors. The API call is well-structured with appropriate parameters, and the 15-second timeout is sensible for an external search API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

User submitted Submitted by a user

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants