Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Sep 22, 2025

Resolves #18426

Summary by CodeRabbit

  • New Features
    • Added metadataOnly option to return only email metadata, omitting message content and snippet.
  • Changes
    • Reduced default max results from 100 to 20 for email searches.
  • Chores
    • Bumped action version to 0.1.6.
    • Bumped package version to 1.3.2.

@vercel
Copy link

vercel bot commented Sep 22, 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 22, 2025 6:15pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Sep 22, 2025 6:15pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 22, 2025

Walkthrough

Updates gmail-find-email action: adds boolean prop metadataOnly, changes maxResults default from 100 to 20 and updates descriptions, and bumps action version to 0.1.6. Runtime now conditionally strips message.payload and message.snippet when metadataOnly is true. Package version in components/gmail/package.json bumped to 1.3.2.

Changes

Cohort / File(s) Summary
Gmail find-email action updates
components/gmail/actions/find-email/find-email.mjs
Version 0.1.5 → 0.1.6; adds public prop metadataOnly (boolean) to return only metadata; changes maxResults default 100 → 20 and description; runtime flow gates text-payload processing and strips payload/snippet when metadataOnly is true.
Package metadata bump
components/gmail/package.json
Version bump 1.3.1 → 1.3.2; no other changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant A as gmail-find-email Action
  participant G as Gmail API

  C->>A: run(query, maxResults, metadataOnly)
  A->>G: messages.list(query, maxResults=20 default)
  G-->>A: message IDs
  A->>G: messages.get(each ID)
  G-->>A: message objects
  alt metadataOnly == true
    A->>A: Remove message.payload and message.snippet
    note right of A: Emit metadata-only results
  else metadataOnly == false
    A->>A: validateTextPayload(message)
    A->>A: Process text payload/snippet as before
  end
  A-->>C: Results array
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I sift through threads with twitching nose,
Trim payloads down where metadata grows.
A hop, a skip—max twenty I’ll seek,
Light as a whisker, efficient and sleek.
Snippets left burrowed, headers in sight—
Carrot-clean searches, tidy and bright. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The changeset includes a modification to the maxResults prop default (from 100 to 20) which is unrelated to issue #18426's request to add a metadata-only option; while version bumps are routine, changing a public default is a behavioral change that appears out of scope and requires justification. This unexplained default change makes the out-of-scope check fail. Either revert the maxResults default change or add a clear justification and tests in the PR description explaining why the default was reduced, and document this change in the changelog and linked issue if it is intentional.
Description Check ⚠️ Warning The repository's PR template requires a "## WHY" section but the provided description contains only "Resolves #18426" and lacks the required rationale, summary of changes, usage or testing notes, so it does not meet the template's expectations. Please update the PR description to include the "## WHY" section explaining the motivation from issue #18426, a concise summary of the implemented changes (new metadataOnly prop, behavior changes, and any public API/default/version updates), and brief reviewer/testing instructions or notes.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly and accurately describes the primary change—adding a metadataOnly flag to the gmail-find-email action—and directly reflects the PR's code changes and the linked issue's objective to return only metadata.
Linked Issues Check ✅ Passed Issue #18426 requested a boolean prop to return only metadata (everything except snippet and payload); the PR adds a metadataOnly prop and omits message.payload and message.snippet when enabled, which implements the issue's primary objective. The chosen prop name differs from the suggested return_metadata_only but the issue did not mandate a specific name, and the version bumps are expected and non-blocking.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-18426

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/gmail/actions/find-email/find-email.mjs (1)

65-107: Bug: Emitted array may exclude parsed payload changes when validateTextPayload returns a new object.

You push the message before potential reassignment (message = parsedMessage). If validateTextPayload returns a new object, messagesToEmit holds the original object, not the parsed one.

Apply this diff to push after processing and preserve derived fields when parsedMessage is returned:

@@
-    const messagesToEmit = [];
-    for await (let message of this.gmail.getAllMessages(messageIds)) {
-      messagesToEmit.push(message);
+    const messagesToEmit = [];
+    for await (let message of this.gmail.getAllMessages(messageIds)) {
@@
-      if (this.metadataOnly) {
-        delete message.payload;
-        delete message.snippet;
-      } else {
-        const parsedMessage = utils.validateTextPayload(message, this.withTextPayload);
-        if (parsedMessage) {
-          message = parsedMessage;
-        } else {
-          if (message.payload?.body?.data && !Array.isArray(message.payload.parts)) {
-            message.payload.body.text = utils.decodeBase64Url(message.payload.body.data);
-          }
-          if (Array.isArray(message.payload?.parts)) {
-            utils.attachTextToParts(message.payload.parts);
-          }
-        }
-      }
+      if (this.metadataOnly) {
+        delete message.payload;
+        delete message.snippet;
+        messagesToEmit.push(message);
+      } else {
+        const parsedMessage = utils.validateTextPayload(message, this.withTextPayload);
+        if (parsedMessage) {
+          const { message_id, date, sender, recipient, subject } = message;
+          message = {
+            ...parsedMessage,
+            message_id,
+            date,
+            sender,
+            recipient,
+            subject,
+          };
+        } else {
+          if (message.payload?.body?.data && !Array.isArray(message.payload.parts)) {
+            message.payload.body.text = utils.decodeBase64Url(message.payload.body.data);
+          }
+          if (Array.isArray(message.payload?.parts)) {
+            utils.attachTextToParts(message.payload.parts);
+          }
+        }
+        messagesToEmit.push(message);
+      }
🧹 Nitpick comments (4)
components/gmail/actions/find-email/find-email.mjs (4)

24-30: Tighten copy; clarify interplay with withTextPayload and define “metadata.”

Current text is missing “to” and doesn’t state that withTextPayload is ignored when metadataOnly=true. Define metadata explicitly per issue #18426.

 metadataOnly: {
   type: "boolean",
   label: "Metadata Only",
-  description: "Only return metadata for the messages. This reduces the size of the payload and makes it easier for LLMs work with.",
+  description: "Return only message metadata (all fields except `snippet` and `payload`). This reduces the payload size and makes it easier for LLMs to work with. When enabled, the “Return payload as plaintext” option is ignored.",
   optional: true,
   default: false,
 },

Also consider updating withTextPayload’s description to note it’s ignored when Metadata Only is enabled.


19-23: Copy nit: missing “to.”

“… makes it easier for LLMs work with” → “… makes it easier for LLMs to work with.”

-      description: "Convert the payload response into a single text field. **This reduces the size of the payload and makes it easier for LLMs work with.**",
+      description: "Convert the payload response into a single text field. This reduces the size of the payload and makes it easier for LLMs to work with.",

100-114: Minor: fast‑path return in metadataOnly branch.

You can push and continue to next iteration after deleting content, avoiding unnecessary checks.

-      if (this.metadataOnly) {
+      if (this.metadataOnly) {
         delete message.payload;
         delete message.snippet;
+        messagesToEmit.push(message);
+        continue;
       } else {

1-124: Use the processed message when adding to messagesToEmit (components/gmail/actions/find-email/find-email.mjs)
messagesToEmit.push(message) is called before utils.validateTextPayload; move the push after parsing or push parsedMessage || message so emission doesn't rely on in-place mutation. Other call sites (components/gmail/sources/new-attachment-received/new-attachment-received.mjs and components/gmail/sources/common/base.mjs) already use the returned parsedMessage.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e80efa and 0fd45c6.

📒 Files selected for processing (2)
  • components/gmail/actions/find-email/find-email.mjs (4 hunks)
  • components/gmail/package.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
components/gmail/actions/find-email/find-email.mjs (3)
components/gmail/sources/new-email-received/new-email-received.mjs (1)
  • message (587-589)
components/gmail/sources/common/base.mjs (2)
  • message (24-28)
  • parsedMessage (21-21)
components/gmail/sources/new-attachment-received/new-attachment-received.mjs (1)
  • parsedMessage (105-105)
⏰ 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: Verify TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
🔇 Additional comments (3)
components/gmail/package.json (1)

3-3: Version bump looks correct; confirm release notes and publish flow.

1.3.2 aligns with the new action behavior. Ensure CHANGELOG/release notes reflect the default change for maxResults and the new metadataOnly prop before publishing.

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

8-8: Version bump to 0.1.6 is appropriate.

Good granularity for the added prop and default change.


51-53: Default change from 100 → 20: confirm impact and comms.

This is a behavior change that may reduce results for existing users who didn’t set maxResults. Ensure docs/release notes call this out, and consider a deprecation note if existing workflows auto‑upgrade.

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 @michelle0927, LGTM! Ready for QA!

@vunguyenhung vunguyenhung merged commit f00257b into master Sep 24, 2025
10 checks passed
@vunguyenhung vunguyenhung deleted the issue-18426 branch September 24, 2025 05:34
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.

[FEATURE] Add return_metadata_only prop (or something similar) to gmail-find-email action

4 participants