Skip to content

Conversation

@jcortes
Copy link
Collaborator

@jcortes jcortes commented Sep 11, 2025

WHY

Resolves #18338

Summary by CodeRabbit

  • New Features
    • New Row Added events now include an optional rowAsObject when headers are enabled, while retaining the original newRow array for compatibility.
  • Documentation
    • Clarified Has Headers and Header Row descriptions with clearer guidance and examples.
  • Tests
    • Updated test event to mirror the new payload structure, showing both newRow (array) and rowAsObject.
  • Chores
    • Bumped component versions to reflect changes.

…change in the Google Sheets New Row Added source
@jcortes jcortes self-assigned this Sep 11, 2025
@vercel
Copy link

vercel bot commented Sep 11, 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 Sep 11, 2025 3:01pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Sep 11, 2025 3:01pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 11, 2025

Walkthrough

Updates Google Sheets “New Row Added” common source to always emit array newRow and optionally rowAsObject when headers are enabled. Adjusts test event to mirror new payload. Bumps versions in package.json, instant source, and polling source. No other structural changes.

Changes

Cohort / File(s) Summary of Changes
Core payload emission update
components/google_sheets/sources/common/new-row-added.mjs
Emission logic refactored to always include original array newRow; conditionally add rowAsObject when hasHeaders is true. Variable rename (transformedRowrowAsObject). Prop descriptions clarified for hasHeaders and headerRow.
Test event alignment
components/google_sheets/sources/new-row-added/test-event.mjs
Test payload changed: newRow now an array; added rowAsObject with header-keyed object. Other fields unchanged.
Version bumps
components/google_sheets/package.json, components/google_sheets/sources/new-row-added/new-row-added.mjs, components/google_sheets/sources/new-row-added-polling/new-row-added-polling.mjs
Incremented versions only; no functional changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User as User/Sheet Edit
  participant Sheets as Google Sheets
  participant Source as New Row Added Source
  participant Emitter as Event Emitter

  User->>Sheets: Add new row
  Sheets-->>Source: Change notification/poll result
  activate Source
  Source->>Source: Read row, range, worksheet, rowNumber
  alt hasHeaders = true
    Source->>Source: Map row to object using headerRow
    Note right of Source: Prepare eventData with newRow (array)<br/>+ rowAsObject (object)
  else hasHeaders = false
    Note right of Source: Prepare eventData with newRow (array) only
  end
  Source->>Emitter: emit(eventData)
  deactivate Source
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks (4 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR uses the required "## WHY" heading from the repository template but the body contains only "Resolves #18338" and lacks the explanatory content the template expects; it does not describe the motivation, the implemented change, impact on consumers (Connect partners), or verification steps. This renders the description incomplete against the repository's template requirements. Expand the "## WHY" section to briefly explain the bug and its impact, summarize the implemented fix (preserve newRow as an array and add an optional rowAsObject when headers are enabled), reference #18338, note any consumer impact or migration guidance for Connect partners, and add brief verification/testing steps or links to tests.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly describes the primary change in this PR: a backward-compatible fix for the Google Sheets "New Row Added" source to address a breaking change, and it directly relates to the modified files and intent described in the PR. It is specific to the affected feature and communicates the important outcome (restored backward compatibility).
Linked Issues Check ✅ Passed The code-level objectives in [#18338] are satisfied: the PR preserves the original array-shaped newRow in all cases and conditionally adds rowAsObject when headers are enabled, test-event data and version bumps align with that behavior, and these changes prevent the silent schema break described in the issue. Policy and partner-notification questions raised in the issue are not addressed by code changes here, which is appropriate since those are non-code actions outside this PR's scope.
Out of Scope Changes Check ✅ Passed All modifications are confined to the google_sheets component (the new-row-added source payload construction, associated test-event update, and minor version bumps); I do not see unrelated files or functionality touched, so there are no out-of-scope changes present.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

I tap my paws on column lines—tick, tick, tick!
Arrays remain, while headers add their trick.
A twin-tailed payload hops into view,
newRow stays classic, rowAsObject’s new.
Carrots aligned, schemas in sync—hooray!
Sheets now emit the smart-and-safe way. 🥕✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-google-sheets-backward-compatible-new-row-added

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

🧹 Nitpick comments (1)
components/google_sheets/sources/common/new-row-added.mjs (1)

247-249: Guard against null just in case

typeof null === "object". While _transformRowToObject won’t return null today, add a truthy check for defensive safety.

-          if (this.hasHeaders && typeof rowAsObject === "object" && !Array.isArray(rowAsObject)) {
+          if (this.hasHeaders && rowAsObject && typeof rowAsObject === "object" && !Array.isArray(rowAsObject)) {
             eventData.rowAsObject = rowAsObject;
           }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4e584e and 7da17ec.

📒 Files selected for processing (5)
  • components/google_sheets/package.json (1 hunks)
  • components/google_sheets/sources/common/new-row-added.mjs (2 hunks)
  • components/google_sheets/sources/new-row-added-polling/new-row-added-polling.mjs (1 hunks)
  • components/google_sheets/sources/new-row-added/new-row-added.mjs (1 hunks)
  • components/google_sheets/sources/new-row-added/test-event.mjs (1 hunks)
⏰ 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: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (8)
components/google_sheets/package.json (1)

3-3: Version bump looks good

Patch bump to 0.8.9 aligns with backward-compatible behavior change.

components/google_sheets/sources/new-row-added/new-row-added.mjs (1)

11-11: Source version bump OK

Increment to 0.1.16 matches the event payload adjustment in common.

components/google_sheets/sources/new-row-added-polling/new-row-added-polling.mjs (1)

11-11: Polling source version bump OK

0.0.8 correctly tracks the shared behavior change.

components/google_sheets/sources/new-row-added/test-event.mjs (2)

2-7: Sample event now preserves array newRow — good

Array form for newRow matches the BC contract.


7-11: Adding rowAsObject is the right compatibility bridge

This enables header-keyed access without breaking consumers of newRow array.

components/google_sheets/sources/common/new-row-added.mjs (3)

33-33: Minor copy tweak approved

Header row description and emphasis read clearly.


236-249: Back-compat event shape change looks correct

Always emitting newRow (array) and conditionally adding rowAsObject addresses the breaking change without disrupting existing mappings.


236-249: Action: Verify there are no consumers expecting object-shaped newRow; migrate to rowAsObject if found

Automated repo search returned no matches — manual verification required. Check components/google_sheets/sources/common/new-row-added.mjs (lines 236–249) — it now emits both the original array newRow and rowAsObject when headers are present.

Run locally to locate any consumers and tests that dereference fields on newRow and update them to use event.rowAsObject (or preserve compatibility):

  • rg -n --hidden -uu '\bnewRow\s*.' || true
  • rg -n --hidden -uu '\browAsObject\b' || true
  • rg -n --hidden -uu 'export default\s*{[\s\S]?"newRow"\s:\s*{' components/google_sheets || true

If any hits exist, replace usages of newRow.<field> with event.rowAsObject.<field> (or keep both shapes where necessary) and update docs/tests.

Copy link
Collaborator

@luancazarine luancazarine left a comment

Choose a reason for hiding this comment

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

Hi @jcortes, LGTM! Ready for QA!

@vunguyenhung vunguyenhung merged commit 537097f into master Sep 12, 2025
10 checks passed
@vunguyenhung vunguyenhung deleted the fix-google-sheets-backward-compatible-new-row-added branch September 12, 2025 01:40
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.

[BUG] Breaking change regarding Google Sheets in PD Connect setting

4 participants