Skip to content

Conversation

@jcortes
Copy link
Collaborator

@jcortes jcortes commented Nov 27, 2025

WHY

Resolves #19119

Summary by CodeRabbit

Release Notes

  • New Features
    • Added polling to detect new comments added to Google Sheets spreadsheets.
    • Added polling to detect new row and cell updates in Google Sheets spreadsheets.

✏️ Tip: You can customize this high-level summary in your review settings.

@jcortes jcortes self-assigned this Nov 27, 2025
@vercel
Copy link

vercel bot commented Nov 27, 2025

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

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Nov 27, 2025 4:32pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Nov 27, 2025 4:32pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

Walkthrough

This PR introduces polling-based sources for Google Sheets as alternatives to webhook-based triggers. It adds a shared comment-processing module, two new polling sources (new comments and new updates), corresponding test fixtures, and bumps the package version to 0.13.0.

Changes

Cohort / File(s) Summary
Version Management
components/google_sheets/package.json
Version bumped from 0.12.0 to 0.13.0
Shared Comment Logic
components/google_sheets/sources/common/new-comment.mjs
New module exporting methods to fetch and process Google Sheets comments, including timestamp management, metadata generation, sheet identity retrieval, and spreadsheet processing with event emission
New Comment Polling Source
components/google_sheets/sources/new-comment-polling/new-comment-polling.mjs
components/google_sheets/sources/new-comment-polling/test-event.mjs
New polling source that triggers on added comments; includes configuration (key, name, description, version, dedupe, type), props (googleSheets, db, timer, watchedDrive, sheetID), and run delegation to processSpreadsheet. Test fixture provides a comment event payload structure.
New Updates Polling Source
components/google_sheets/sources/new-updates-polling/new-updates-polling.mjs
components/google_sheets/sources/new-updates-polling/test-event.mjs
New polling source that triggers on spreadsheet cell or row updates; includes configuration, props, deploy hook (takeSheetSnapshot), and run method that retrieves spreadsheet and processes it. Test fixture provides worksheet metadata, cell values, and change tracking payload.

Sequence Diagram(s)

sequenceDiagram
    participant Timer as Polling Timer
    participant Source as Polling Source
    participant DB as Local DB
    participant API as Google Sheets API
    participant Emit as Event Emitter

    loop Every interval
        Timer->>Source: trigger run()
        Source->>DB: _getLastTs()
        DB-->>Source: lastTs
        Source->>API: listComments(sheetID, lastTs)
        API-->>Source: comments array
        alt New comments exist
            Source->>DB: _setLastTs(newest.createdTime)
            loop For each comment (reversed)
                Source->>Source: generateMeta(comment)
                Source->>Emit: emit(comment, meta)
            end
        else No new comments
            Source->>Source: early exit
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify timestamp lifecycle in new-comment.mjs: _getLastTs/_setLastTs logic and how lastTs is persisted and updated across polling cycles
  • Compare polling implementations: Confirm new-comment-polling.mjs and new-updates-polling.mjs follow consistent patterns and are wired correctly to their common/base methods
  • Test event structures: Validate that test fixtures accurately represent expected Google Sheets API response payloads
  • Deduplication strategy: Confirm "unique" dedupe setting works appropriately with emitted events from both sources

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR implements polling sources for New Comment and New Updates features as required by issue #19119, though New or Updated Resource component was not addressed. Complete the implementation by adding a polling source for the New or Updated Resource component as specified in issue #19119.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: introducing polling sources as alternatives to webhook-based triggers for Google Sheets, which aligns with the changeset.
Description check ✅ Passed The description is minimal but sufficient, providing a clear reference to the resolved issue #19119 which establishes the rationale for the changes.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing polling sources for Google Sheets; no extraneous modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch google-sheets-polling-soures-alternative

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1fdb386 and be57ab6.

📒 Files selected for processing (6)
  • components/google_sheets/package.json (1 hunks)
  • components/google_sheets/sources/common/new-comment.mjs (1 hunks)
  • components/google_sheets/sources/new-comment-polling/new-comment-polling.mjs (1 hunks)
  • components/google_sheets/sources/new-comment-polling/test-event.mjs (1 hunks)
  • components/google_sheets/sources/new-updates-polling/new-updates-polling.mjs (1 hunks)
  • components/google_sheets/sources/new-updates-polling/test-event.mjs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
components/google_sheets/sources/new-updates-polling/new-updates-polling.mjs (1)
components/google_sheets/actions/create-spreadsheet/create-spreadsheet.mjs (1)
  • googleSheets (60-66)
components/google_sheets/sources/new-comment-polling/new-comment-polling.mjs (1)
components/google_sheets/actions/create-spreadsheet/create-spreadsheet.mjs (1)
  • googleSheets (60-66)
⏰ 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
🔇 Additional comments (13)
components/google_sheets/package.json (1)

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

The minor version increment is correct for adding new polling sources as alternatives to existing webhook triggers.

components/google_sheets/sources/new-comment-polling/test-event.mjs (1)

1-21: LGTM! Test fixture structure is appropriate.

The fixture correctly represents a Google Drive comment event with all necessary fields for testing comment processing logic.

components/google_sheets/sources/new-updates-polling/test-event.mjs (1)

1-71: LGTM! Comprehensive test fixture for update events.

The fixture includes all necessary components: worksheet metadata, current values, and a detailed changes array representing cell updates.

components/google_sheets/sources/new-updates-polling/new-updates-polling.mjs (4)

50-52: Verify processSpreadsheet accepts a spreadsheet parameter.

Line 52 calls this.processSpreadsheet(spreadsheet) with the fetched spreadsheet as an argument. However, the processSpreadsheet() method in new-comment.mjs takes no parameters. Confirm that the processSpreadsheet() method in the common/new-updates.mjs module (which is imported but not in this PR) accepts a spreadsheet parameter.


46-47: I was unable to access the repository to verify the location of the takeSheetSnapshot() method. The repository clone operation failed, preventing me from searching the codebase for method definitions in the base or common modules.

Verify that takeSheetSnapshot() is available from inherited methods.

The deploy() hook calls this.takeSheetSnapshot(), which must be provided by either base.methods or common.methods. Confirm this method exists in one of the inherited modules by:

  • Checking the base method definitions for google_sheets sources
  • Verifying the common method definitions for new-updates.mjs or similar shared modules
  • Ensuring proper inheritance chain from the parent class

2-2: The import path is valid and the file exists in the codebase.

The file components/google_sheets/sources/common/new-updates.mjs is present in the repository, so the import at line 2 will resolve correctly. There is no module resolution error.


34-36: The method access pattern is correct—no issue found.

The code at line 35 using googleSheets.methods.getDriveId(c.watchedDrive) follows the documented Pipedream pattern for accessing app helper methods within propDefinition functions. This is the standard approach when a dependent prop needs to derive configuration (like driveId) from an earlier prop selection. The original concern about the access pattern being unusual is unfounded; Pipedream documentation confirms this is the recommended usage.

Likely an incorrect or invalid review comment.

components/google_sheets/sources/common/new-comment.mjs (4)

3-8: LGTM! State management methods are correct.

The timestamp getter/setter methods appropriately use the database service for persistence.


9-15: LGTM! Metadata generation is appropriate.

The method correctly constructs event metadata with id, summary, and timestamp.


16-18: LGTM! Simple and correct conversion.

Converting sheetID to string is appropriate for API calls.


19-34: Perfect! I've completed the verification. Let me now provide the rewritten review comment based on my findings.


The listComments method exists and correctly returns an async iterable.

The method is inherited from googleDrive.app.mjs (line 717) via the spread operator in google_sheets.app.mjs. It's implemented as an async generator (async *listComments) that yields comments one at a time, making it suitable for the for await loop. Memory usage is efficient—the method fetches comments in paginated batches of 100 and yields each comment individually, ensuring that only one page of results is held in memory at a time.

The logic correctly fetches comments since the last timestamp, updates state, and emits events in chronological order.

components/google_sheets/sources/new-comment-polling/new-comment-polling.mjs (2)

34-36: Verify the method access pattern for getDriveId.

Line 35 uses googleSheets.methods.getDriveId(c.watchedDrive). This is the same pattern as in new-updates-polling.mjs. Verify this is the correct way to access app methods in Pipedream prop definitions.

Since this is a duplicate concern, see the verification script in the new-updates-polling.mjs review for the same line range.


45-47: LGTM! Correct delegation to processSpreadsheet.

The run method correctly calls processSpreadsheet() without arguments, which matches the signature in the common/new-comment.mjs module.


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.

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] Google Sheets - Provide polling options as an alternative to current webhook based ones

2 participants