Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Oct 24, 2025

Resolves #18847

Summary by CodeRabbit

  • Chores

    • Released maintenance update bumping Gmail component version to 1.3.4 with corresponding version increments across all actions and event sources.
  • Refactor

    • Optimized email composition workflow for improved performance during draft creation and message sending operations.

@vercel
Copy link

vercel bot commented Oct 24, 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 Oct 24, 2025 6:59pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Oct 24, 2025 6:59pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 24, 2025

Walkthrough

This PR updates the Gmail component with version bumps across multiple actions and sources, and refactors MailComposer usage in sendEmail and createDraft functions to call compile() during construction rather than separately after instantiation.

Changes

Cohort / File(s) Summary
Action version updates
components/gmail/actions/add-label-to-email/add-label-to-email.mjs, approve-workflow/approve-workflow.mjs, archive-email/archive-email.mjs, create-draft/create-draft.mjs, create-label/create-label.mjs, delete-email/delete-email.mjs, download-attachment/download-attachment.mjs, find-email/find-email.mjs, get-send-as-alias/get-send-as-alias.mjs, list-labels/list-labels.mjs, list-send-as-aliases/list-send-as-aliases.mjs, remove-label-from-email/remove-label-from-email.mjs, send-email/send-email.mjs, update-org-signature/update-org-signature.mjs, update-primary-signature/update-primary-signature.mjs
Individual version field increments across 15 action files; no functional logic changes.
Source version updates
components/gmail/sources/new-attachment-received/new-attachment-received.mjs, new-email-matching-search/new-email-matching-search.mjs, new-email-received/new-email-received.mjs, new-labeled-email/new-labeled-email.mjs, new-sent-email/new-sent-email.mjs
Version field increments across 5 source files; no behavioral changes.
MailComposer refactoring
components/gmail/gmail.app.mjs
Updated sendEmail and createDraft methods to call compile() immediately during MailComposer construction (chained method call) rather than separately after instantiation; build invoked on compiled mail object.
Package manifest
components/gmail/package.json
Version bump from 1.3.3 to 1.3.4.

Sequence Diagram

sequenceDiagram
    participant Code as Action/Source
    participant MailComposer
    participant Compiled as Compiled Mail

    rect rgb(200, 220, 255)
    Note over Code,Compiled: Old Flow
    Code->>MailComposer: new MailComposer(options)
    Code->>MailComposer: mail.compile()
    MailComposer->>Compiled: compiled mail
    Code->>Compiled: mail.build()
    Compiled-->>Code: raw message
    end

    rect rgb(220, 240, 200)
    Note over Code,Compiled: New Flow
    Code->>MailComposer: new MailComposer(options).compile()
    MailComposer->>Compiled: compiled mail
    Code->>Compiled: mail.build()
    Compiled-->>Code: raw message
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Most changes are repetitive version increments across multiple files (low effort). The functional modification in gmail.app.mjs is a straightforward method chaining refactor that preserves behavior while improving construction semantics; this is straightforward logic to verify.

Possibly related PRs

  • Gmail usability pt.2 #13868: Modifies Gmail component's sendEmail/createDraft logic to handle additional props (fromEmail, attachments) alongside the MailComposer compile/build sequencing changes in this PR.

Suggested reviewers

  • luancazarine
  • dannyroosevelt

Poem

🐰 Versions bump like carrots in the spring,
From 0.0.2 to 0.0.3, all things sing!
MailComposer now compiles on the fly,
BCC drafts sail through the digital sky. 📬

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings, 2 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The pull request contains numerous version bump changes across multiple unrelated Gmail actions and sources that extend beyond the scope of fixing the BCC issue in #18847. Specifically, the PR updates versions in 15+ files including approve-workflow, archive-email, create-label, delete-email, find-email, list-labels, and others, along with a version bump in the main package.json. These version increments appear to be maintenance updates unrelated to fixing the specific Create Draft BCC bug described in the linked issue and PR title, suggesting they may be out-of-scope or belong in a separate release PR.
Description Check ⚠️ Warning The pull request description does not follow the required template structure. The template specifies a required "## WHY" section for the author to complete, but the provided description contains only "Resolves #18847" with no explanation section, rationale for the changes, or context about the bug being fixed. The description is incomplete and provides minimal information beyond a bare issue reference.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title "Gmail 'Create Draft' bug fix" is related to the changeset and identifies the affected component (Gmail Create Draft), but it uses generic language that lacks specificity. The title indicates there is a bug fix but does not clarify which bug is being addressed (the BCC property issue) or how it is being fixed. A teammate scanning the git history would need to click the PR to understand the specific nature of the bug being resolved.
Linked Issues Check ❓ Inconclusive The linked issue #18847 describes a bug where the BCC property is not being added to drafts created by the Gmail "Create Draft" action. The PR includes a change to the MailComposer usage in gmail.app.mjs that modifies how the compile() and build() methods are sequenced. However, the raw summary states that "The keepBcc behavior remains unchanged" and describes only a method call sequence modification, which creates ambiguity about whether this technical change actually resolves the reported BCC issue. Without clarity that the sequence change fixes the problem, compliance with the stated requirement cannot be conclusively determined.
✨ 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 issue-18847

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.

@michelle0927 michelle0927 marked this pull request as ready for review October 24, 2025 19:01
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 (1)
components/gmail/gmail.app.mjs (1)

525-532: Consider aligning draft encoding with email sending for consistency.

There's an encoding inconsistency between sendEmail and createDraft:

  • sendEmail (lines 484-487) converts the message to UTF-8, fixes header formatting (:\r\n and :\n:), then uses the encodeMessage helper for URL-safe base64
  • createDraft (line 532) uses message.toString("base64") directly without header fixing or URL-safe encoding

While the current approach appears to work for drafts, aligning both methods would improve maintainability and reduce the risk of subtle encoding issues.

Apply this diff to align the encoding:

 const mail = new MailComposer(options).compile();
 mail.keepBcc = true;
 const message = await mail.build();
+// Fix headers that are separated with newlines
+const messageFixed = message.toString("utf8")
+  .replace(/:\r\n/g, ":")
+  .replace(/:\n/g, ":");
+const rawMessage = this.encodeMessage(messageFixed);
 try {
   const response = await this._client().users.drafts.create({
     userId: constants.USER_ID,
     requestBody: {
       message: {
         threadId: threadId,
-        raw: message.toString("base64"),
+        raw: rawMessage,
       },
     },
   });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2c5f4f2 and 3408e4e.

📒 Files selected for processing (22)
  • components/gmail/actions/add-label-to-email/add-label-to-email.mjs (1 hunks)
  • components/gmail/actions/approve-workflow/approve-workflow.mjs (1 hunks)
  • components/gmail/actions/archive-email/archive-email.mjs (1 hunks)
  • components/gmail/actions/create-draft/create-draft.mjs (1 hunks)
  • components/gmail/actions/create-label/create-label.mjs (1 hunks)
  • components/gmail/actions/delete-email/delete-email.mjs (1 hunks)
  • components/gmail/actions/download-attachment/download-attachment.mjs (1 hunks)
  • components/gmail/actions/find-email/find-email.mjs (1 hunks)
  • components/gmail/actions/get-send-as-alias/get-send-as-alias.mjs (1 hunks)
  • components/gmail/actions/list-labels/list-labels.mjs (1 hunks)
  • components/gmail/actions/list-send-as-aliases/list-send-as-aliases.mjs (1 hunks)
  • components/gmail/actions/remove-label-from-email/remove-label-from-email.mjs (1 hunks)
  • components/gmail/actions/send-email/send-email.mjs (1 hunks)
  • components/gmail/actions/update-org-signature/update-org-signature.mjs (1 hunks)
  • components/gmail/actions/update-primary-signature/update-primary-signature.mjs (1 hunks)
  • components/gmail/gmail.app.mjs (1 hunks)
  • components/gmail/package.json (1 hunks)
  • components/gmail/sources/new-attachment-received/new-attachment-received.mjs (1 hunks)
  • components/gmail/sources/new-email-matching-search/new-email-matching-search.mjs (1 hunks)
  • components/gmail/sources/new-email-received/new-email-received.mjs (1 hunks)
  • components/gmail/sources/new-labeled-email/new-labeled-email.mjs (1 hunks)
  • components/gmail/sources/new-sent-email/new-sent-email.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). (3)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (22)
components/gmail/package.json (1)

3-3: LGTM: Package version bump is appropriate.

The version bump from 1.3.3 to 1.3.4 follows semantic versioning for a patch release containing the BCC bug fix.

components/gmail/sources/new-email-matching-search/new-email-matching-search.mjs (1)

9-9: LGTM: Version bump is consistent with package release.

components/gmail/actions/remove-label-from-email/remove-label-from-email.mjs (1)

7-7: LGTM: Version bump is consistent with package release.

components/gmail/actions/download-attachment/download-attachment.mjs (1)

10-10: LGTM: Version bump is consistent with package release.

components/gmail/actions/get-send-as-alias/get-send-as-alias.mjs (1)

8-8: LGTM: Version bump is consistent with package release.

components/gmail/actions/send-email/send-email.mjs (1)

9-9: LGTM: Version bump is consistent with package release.

components/gmail/sources/new-sent-email/new-sent-email.mjs (1)

9-9: LGTM: Version bump is consistent with package release.

components/gmail/actions/delete-email/delete-email.mjs (1)

8-8: LGTM: Version bump is consistent with package release.

components/gmail/actions/update-primary-signature/update-primary-signature.mjs (1)

7-7: Version bump only — OK.

No behavioral changes; safe to ship.

components/gmail/actions/add-label-to-email/add-label-to-email.mjs (1)

7-7: Version bump only — OK.

No logic changes in this action.

components/gmail/actions/create-label/create-label.mjs (1)

9-9: Version bump only — OK.

No functional changes detected.

components/gmail/actions/list-labels/list-labels.mjs (1)

7-7: Version bump only — OK.

No runtime impact here.

components/gmail/actions/find-email/find-email.mjs (1)

8-8: Version bump approved — BCC fix verified.

Verification confirms BCC is properly integrated into Create Draft: prop definition in create-draft.mjs (line 30), passed through gmail.app.mjs (line 311), MailComposer keepBcc flag set correctly (line 524), and message with headers sent to Gmail API via raw field (line 532). Metadata version change in find-email.mjs unrelated to this feature.

components/gmail/actions/list-send-as-aliases/list-send-as-aliases.mjs (1)

7-7: LGTM! Standard version bump.

The patch version increment aligns with the PR's bug fix scope.

components/gmail/actions/archive-email/archive-email.mjs (1)

8-8: LGTM! Standard version bump.

The patch version increment is appropriate for this bug fix release.

components/gmail/actions/update-org-signature/update-org-signature.mjs (1)

11-11: LGTM! Standard version bump.

The patch version increment is consistent with the PR's release scope.

components/gmail/sources/new-attachment-received/new-attachment-received.mjs (1)

11-11: LGTM! Standard version bump.

The patch version increment aligns with the coordinated release across Gmail components.

components/gmail/sources/new-labeled-email/new-labeled-email.mjs (1)

11-11: LGTM! Standard version bump.

The patch version increment is appropriate for this coordinated release.

components/gmail/actions/approve-workflow/approve-workflow.mjs (1)

7-7: LGTM! Standard version bump.

The patch version increment is consistent with the PR's bug fix release.

components/gmail/sources/new-email-received/new-email-received.mjs (1)

18-18: LGTM! Standard version bump.

The patch version increment aligns with the coordinated release across all Gmail components.

components/gmail/actions/create-draft/create-draft.mjs (1)

9-9: BCC fix is properly implemented and verified.

The script output confirms the implementation is correct:

  • createDraft method instantiates MailComposer with all options including BCC
  • mail.keepBcc = true is set to preserve BCC recipients in the compiled message
  • getOptionsToSendEmail properly passes bcc: props.bcc through options
  • The pattern is consistent and applied systematically

The version bump from 0.1.8 to 0.1.9 is appropriate for this bug fix. BCC recipients will now be correctly included in created drafts.

components/gmail/gmail.app.mjs (1)

523-525: LGTM! This fix should resolve the BCC bug.

The change ensures compile() is called on the MailComposer before setting keepBcc = true and calling build(). Without the compile step, the BCC recipients and other mail options aren't properly processed, which explains why BCC wasn't working in draft creation. This now matches the working pattern used in sendEmail (lines 479-482).

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] Gmail "Create Draft" BCC not working

1 participant