Skip to content

Conversation

@dannyroosevelt
Copy link
Collaborator

@dannyroosevelt dannyroosevelt commented Apr 29, 2025

WHY

Summary by CodeRabbit

  • New Features

    • Users can now select verified sites from a dropdown when working with Google Search Console actions.
    • Added the ability to filter and retrieve data for specific subdomains and customize filtering options.
    • URL submission for indexing now supports both update and delete notifications.
  • Improvements

    • Enhanced error messages for better guidance when access is denied or requests are invalid.
    • Documentation expanded with clearer instructions for handling domain properties, subdomains, and advanced filtering.
    • Improved summary messages and input validation for URL submissions.
  • Documentation

    • Updated README with detailed guidance on domain vs. URL properties, subdomain filtering, and data breakdown by page.

@vercel
Copy link

vercel bot commented Apr 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Apr 29, 2025 4:20am
pipedream-docs ⬜️ Ignored (Inspect) Apr 29, 2025 4:20am
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Apr 29, 2025 4:20am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 29, 2025

Walkthrough

This update enhances the Google Search Console integration by expanding documentation, refining user input options, and improving error handling. The README now explains domain and subdomain handling, filtering, and advanced usage. The retrieve-site-performance-data action introduces new props for granular filtering and dynamic construction of dimension filters, along with improved error messages. The submit-url-for-indexing action adds a notification type selector and clearer error reporting. The app module now supports dynamic, paginated selection of verified sites via a new prop definition and supporting methods. The package version is incremented to 0.8.0.

Changes

File(s) Change Summary
components/google_search_console/README.md Expanded documentation with sections on domain vs. subdomain properties, subdomain filtering, individual page data, and advanced filtering. Moved and reformatted use cases. Removed "Available Actions" section and related links.
components/google_search_console/actions/retrieve-site-performance-data/... Updated action to version 0.0.3. Changed siteUrl to use a propDefinition with dynamic selection. Added fixed options to dimensions. Replaced dimensionFilterGroups with new props for subdomain filtering and advanced filters. Refactored filter group construction logic. Enhanced error handling for 403 and general errors. Improved summary export pluralization.
components/google_search_console/actions/submit-url-for-indexing/submit-url-for-indexing.mjs Updated action to version 0.0.3. Added notificationType prop for URL_UPDATED/URL_DELETED selection. Enhanced siteUrl description. Trimmed URL before validation/submission. Used selected notification type in API call. Improved error handling for 403 and 400 errors. Reformatted warnings in summary export.
components/google_search_console/google_search_console.app.mjs Added siteUrl propDefinition with an async options method for dynamic, paginated site selection. Introduced getSites and listSiteOptions methods to fetch and format verified site options from the Search Console API. No breaking changes to existing logic.
components/google_search_console/package.json Bumped package version from 0.7.1 to 0.8.0. No other content changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant RetrieveAction as Retrieve Site Performance Data Action
    participant App as Google Search Console App
    participant GSCAPI as Google Search Console API

    User->>RetrieveAction: Select siteUrl (from dynamic options), set filters
    RetrieveAction->>App: Fetch siteUrl options (paginated)
    App->>GSCAPI: GET /webmasters/v3/sites
    GSCAPI-->>App: List of verified sites
    App-->>RetrieveAction: siteUrl options
    RetrieveAction->>RetrieveAction: Build dimensionFilterGroups based on props
    RetrieveAction->>App: getSitePerformanceData(siteUrl, filters)
    App->>GSCAPI: Query performance data
    GSCAPI-->>App: Data response
    App-->>RetrieveAction: Data
    RetrieveAction-->>User: Return results or error message
Loading
sequenceDiagram
    participant User
    participant SubmitAction as Submit URL for Indexing Action
    participant App as Google Search Console App
    participant GSCAPI as Google Indexing API

    User->>SubmitAction: Provide siteUrl and select notificationType
    SubmitAction->>SubmitAction: Trim and validate siteUrl
    alt Valid URL
        SubmitAction->>App: Submit URL with notificationType
        App->>GSCAPI: POST indexing request
        GSCAPI-->>App: Response
        App-->>SubmitAction: Result
        SubmitAction-->>User: Success message (with warnings if any)
    else Invalid or Error
        SubmitAction-->>User: Detailed error message
    end
Loading

Possibly related PRs

  • PipedreamHQ/pipedream#16458: Refactors the retrieve-site-performance-data action, simplifying prop declarations and API call handling, directly modifying the same action and logic as this PR.

Suggested labels

User submitted

Suggested reviewers

  • michelle0927
  • jcortes

Poem

A bunny hopped through Console land,
Tweaking props with gentle hand.
Domains and subs, now clear as day,
Filters built the rabbit way.
URLs indexed, warnings neat—
With every change, the docs repeat.
Version bumped, the code’s anew—
🐇 Cheers to search, from me to you!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/google_search_console/actions/retrieve-site-performance-data/retrieve-site-performance-data.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/google_search_console/google_search_console.app.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/google_search_console/actions/submit-url-for-indexing/submit-url-for-indexing.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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.

@dannyroosevelt dannyroosevelt changed the title Google search console filters Fix filter handling for Google Search Console action Apr 29, 2025
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

🧹 Nitpick comments (2)
components/google_search_console/actions/retrieve-site-performance-data/retrieve-site-performance-data.mjs (2)

172-172: Consider error handling for parseIfJsonString

The parseIfJsonString method is used to parse advanced filters, but there's no error handling if parsing fails. Consider adding a try/catch block to provide a more meaningful error message:

-dimensionFilterGroups = googleSearchConsole.parseIfJsonString(advancedDimensionFilters);
+try {
+  dimensionFilterGroups = googleSearchConsole.parseIfJsonString(advancedDimensionFilters);
+} catch (error) {
+  throw new Error(`Invalid format for advancedDimensionFilters: ${error.message}`);
+}

198-201: Nice touch with the summary message pluralization!

The conditional pluralization of "row" based on the count makes for a more polished user experience.

For even more conciseness, consider using the plural() utility if available in your codebase:

-$.export("$summary", `Fetched ${rowCount} ${rowCount === 1 ? "row" : "rows"} of data.`);
+$.export("$summary", `Fetched ${rowCount} ${plural(rowCount, "row", "rows")} of data.`);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d78852 and a1727f3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • components/google_search_console/README.md (1 hunks)
  • components/google_search_console/actions/retrieve-site-performance-data/retrieve-site-performance-data.mjs (5 hunks)
  • components/google_search_console/actions/submit-url-for-indexing/submit-url-for-indexing.mjs (2 hunks)
  • components/google_search_console/google_search_console.app.mjs (2 hunks)
  • components/google_search_console/package.json (1 hunks)
🧰 Additional context used
🪛 LanguageTool
components/google_search_console/README.md

[style] ~3-~3: Consider an alternative adjective to strengthen your wording.
Context: ...ormance, integrate with other tools for deeper analysis, or keep tabs on your SEO stra...

(DEEP_PROFOUND)


[style] ~37-~37: Consider an alternative adjective to strengthen your wording.
Context: ...for maintaining an evolving dataset for deeper analysis, historical reference, or shar...

(DEEP_PROFOUND)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (21)
components/google_search_console/google_search_console.app.mjs (3)

7-17: The propDefinitions implementation looks good!

This addition introduces a reusable siteUrl prop definition that allows users to select verified sites from their Google Search Console. The implementation includes pagination support through the prevContext parameter, which is a best practice for handling potentially large lists of options.


34-40: Well-implemented API method for retrieving sites

The getSites method is cleanly implemented, leveraging the existing _makeRequest method for authentication and properly structured to accept additional parameters.


41-62: Great implementation of the site options list with pagination

The listSiteOptions method properly handles pagination through page tokens and transforms the API response into a format suitable for dropdown selection in the UI. The default empty array for siteEntry provides protection against undefined values.

components/google_search_console/package.json (1)

3-3: Version bump is appropriate for the new features

The increment from 0.7.1 to 0.8.0 follows semantic versioning principles, as these changes add new functionality without breaking existing API contracts.

components/google_search_console/README.md (3)

3-3: Improved introduction with clear value proposition

This enhanced introduction clearly explains the capabilities of the Google Search Console API and its benefits for Pipedream users, setting appropriate expectations.

🧰 Tools
🪛 LanguageTool

[style] ~3-~3: Consider an alternative adjective to strengthen your wording.
Context: ...ormance, integrate with other tools for deeper analysis, or keep tabs on your SEO stra...

(DEEP_PROFOUND)


5-32: Excellent documentation on domain properties and filtering

This new section provides valuable instructions for working with domain properties and subdomains in Google Search Console, addressing a potentially confusing topic. The documentation clearly explains:

  1. The difference between URL and domain properties
  2. How to filter for specific subdomains
  3. How to get data for individual pages
  4. Advanced filtering options

This will significantly improve the user experience when working with these features.


35-39: Well-formatted example use cases

The example use cases have been preserved but are now better formatted, making them easier to read and understand.

🧰 Tools
🪛 LanguageTool

[style] ~37-~37: Consider an alternative adjective to strengthen your wording.
Context: ...for maintaining an evolving dataset for deeper analysis, historical reference, or shar...

(DEEP_PROFOUND)

components/google_search_console/actions/submit-url-for-indexing/submit-url-for-indexing.mjs (9)

8-8: Version update reflects the feature enhancement

The version bump from 0.0.2 to 0.0.3 properly indicates the addition of new features.


15-16: Improved description for the siteUrl property

The enhanced description clarifies that the URL must be a canonical URL verified in Google Search Console, which helps prevent user errors.


17-32: Great addition of notification type selection

Adding the notificationType prop gives users control over whether they're notifying Google about an updated or deleted URL. The well-labeled options with clear descriptions and sensible default value make this easy to use.


35-38: Clean property extraction and URL trimming

The destructuring of properties and trimming of the URL input are well-implemented. Trimming the URL is a good defensive programming practice to handle potential user input errors.


42-43: Proper use of trimmed URL for validation

The code correctly uses the trimmed URL when checking if the URL is valid, ensuring consistent validation.


52-53: Using trimmed URL and selected notification type

The code now properly submits the trimmed URL and uses the user-selected notification type instead of a hardcoded value, making the action more flexible.


59-68: Enhanced error handling with specific error messages

The improved error handling provides detailed, context-specific error messages for common HTTP status codes:

  • 403 (Access denied) - Suggests checking if the URL belongs to a property the user has access to
  • 400 (Invalid request) - Advises the user to ensure the URL is canonical and verified

This will greatly help users troubleshoot issues without needing to understand HTTP status codes.


71-74: Better formatting of warning messages

The code now formats warnings as bullet points when they exist, improving readability in the output summary.


77-77: Clean summary message with conditionally appended warnings

The summary export message now includes the trimmed URL and appends any warnings in a clean, readable format.

components/google_search_console/actions/retrieve-site-performance-data/retrieve-site-performance-data.mjs (5)

8-8: Good refactoring of the siteUrl property and version increment!

Converting the siteUrl from a simple string input to a propDefinition that references the app's method improves usability by providing a dynamic list of verified sites. The updated description also clearly explains how to handle subdomains, which is a common source of confusion for users.

Also applies to: 13-17


34-41: Nice addition of explicit dimension options!

Adding a fixed set of selectable options for dimensions prevents errors from invalid values and makes the UI more user-friendly by showing available choices.


81-120: Well-designed filtering options with clear documentation!

The new filtering properties (subdomainFilter, filterDimension, filterOperator, and advancedDimensionFilters) provide a good balance between simplicity for common use cases and flexibility for advanced scenarios. The descriptions effectively explain each property's purpose.


189-193: Excellent enhancement to error handling!

Adding a specific error message for 403 errors with guidance on how to properly access subdomains is very helpful for users. This type of contextual error handling significantly improves the user experience.


181-183:

❓ Verification inconclusive

Verify API behavior with undefined dimensionFilterGroups

The code passes dimensionFilterGroups directly to the API, but when neither subdomainFilter nor advancedDimensionFilters is provided, this value will be undefined.

If the API requires this field to be an object (even if empty) rather than undefined, consider initializing it with an empty structure.


🏁 Script executed:

#!/bin/bash
# Check the Google Search Console API documentation or examples to verify behavior with undefined filterGroups
cd components/google_search_console && grep -r "dimensionFilterGroups" --include="*.mjs" . | grep -v "retrieve-site-performance-data.mjs"

Length of output: 134


Verify API behavior with undefined dimensionFilterGroups

We didn’t find any other references in the codebase. When neither subdomainFilter nor advancedDimensionFilters is supplied, dimensionFilterGroups will be undefined. Please confirm via the Google Search Console API docs or your integration tests whether omitting this field is acceptable. If the API requires an array (even if empty), consider defaulting it:

  • Location:
    components/google_search_console/actions/retrieve-site-performance-data/retrieve-site-performance-data.mjs
    Lines 181–183

Suggested change:

-          ...body,
-          dimensionFilterGroups,
+          ...body,
+          dimensionFilterGroups: dimensionFilterGroups ?? [],

Comment on lines +152 to +173
// Build dimension filters based on user input
let dimensionFilterGroups;

if (subdomainFilter) {
// If user provided a subdomain filter, create the filter structure
dimensionFilterGroups = {
filterGroups: [
{
filters: [
{
dimension: filterDimension || "page",
operator: filterOperator || "contains",
expression: subdomainFilter,
},
],
},
],
};
} else if (advancedDimensionFilters) {
// If user provided advanced filters, use those
dimensionFilterGroups = googleSearchConsole.parseIfJsonString(advancedDimensionFilters);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Good implementation of dynamic filter construction!

The approach to dynamically build dimension filters based on user input is clean and maintainable. However, there's one potential edge case to address:

Consider handling the case where both subdomainFilter and advancedDimensionFilters are provided:

 if (subdomainFilter) {
   // If user provided a subdomain filter, create the filter structure
   dimensionFilterGroups = {
     filterGroups: [
       {
         filters: [
           {
             dimension: filterDimension || "page",
             operator: filterOperator || "contains",
             expression: subdomainFilter,
           },
         ],
       },
     ],
   };
 } else if (advancedDimensionFilters) {
   // If user provided advanced filters, use those
   dimensionFilterGroups = googleSearchConsole.parseIfJsonString(advancedDimensionFilters);
+} else {
+  dimensionFilterGroups = undefined;
 }

This would make the intention explicit when neither filter is provided.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Build dimension filters based on user input
let dimensionFilterGroups;
if (subdomainFilter) {
// If user provided a subdomain filter, create the filter structure
dimensionFilterGroups = {
filterGroups: [
{
filters: [
{
dimension: filterDimension || "page",
operator: filterOperator || "contains",
expression: subdomainFilter,
},
],
},
],
};
} else if (advancedDimensionFilters) {
// If user provided advanced filters, use those
dimensionFilterGroups = googleSearchConsole.parseIfJsonString(advancedDimensionFilters);
}
// Build dimension filters based on user input
let dimensionFilterGroups;
if (subdomainFilter) {
// If user provided a subdomain filter, create the filter structure
dimensionFilterGroups = {
filterGroups: [
{
filters: [
{
dimension: filterDimension || "page",
operator: filterOperator || "contains",
expression: subdomainFilter,
},
],
},
],
};
} else if (advancedDimensionFilters) {
// If user provided advanced filters, use those
dimensionFilterGroups = googleSearchConsole.parseIfJsonString(advancedDimensionFilters);
} else {
// Explicitly handle the case where neither filter is provided
dimensionFilterGroups = undefined;
}

@dannyroosevelt dannyroosevelt merged commit dcec868 into master Apr 29, 2025
11 checks passed
@dannyroosevelt dannyroosevelt deleted the google-search-console-filters branch April 29, 2025 04:54
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.

2 participants