Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Sep 29, 2025

Resolves #18457

Summary by CodeRabbit

  • New Features

    • Multi-level folder selection with dynamic subfolder browsing for actions and triggers.
    • Updated Folder ID pickers with clearer labels/descriptions and auto-refreshing options.
    • Option to include subfolders when listing root folders.
    • Download action now exposes a filename field and improved file selection.
    • Upload action improves parent folder selection based on chosen subfolder.
    • “New File in Folder” and “New Folder” triggers use more accurate timestamps and simplified folder selection.
  • Chores

    • Version updates across Zoho WorkDrive components.

@vercel
Copy link

vercel bot commented Sep 29, 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 29, 2025 10:03pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Sep 29, 2025 10:03pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 29, 2025

Walkthrough

Introduces dynamic folder selection helpers and shared source base. Refactors actions and sources to use additional folder props, max folder resolution, and conditional subfolder loading. Updates pagination logic and timestamps, adds syncDir, and bumps versions across modules, including package.json.

Changes

Cohort / File(s) Change Summary
Common folder-props utilities
components/zoho_workdrive/common/additionalFolderProps.mjs
New module exporting additionalFolderProps and findMaxFolderId. Dynamically builds folderIdN props via iterative subfolder discovery; props are optional, labeled, and reloadProps-enabled. Includes numeric-suffix max finder.
Actions: Download / Upload
components/zoho_workdrive/actions/download-file/download-file.mjs, components/zoho_workdrive/actions/upload-file/upload-file.mjs
Download: version 0.0.6; adds syncDir; moves fileId into dynamic additionalProps with fileName; folderId label/description updated; options now async with pagination and getLimit(); exposes findMaxFolderId/getLimit. Upload: version 0.0.8; adds additionalProps(); parentId gets reloadProps; computes parent_id via findMaxFolderId; payload uses computed parent_id.
Sources base (shared)
components/zoho_workdrive/sources/common/base.mjs
New base export with props (app, db, timer, teamId), additionalProps(), _getLastDate/_setLastDate helpers, and run() delegating to startEvent.
Source: New file in folder
components/zoho_workdrive/sources/new-file-in-folder/new-file-in-folder.mjs
Version 0.2.1; spreads common base/props/methods; removes typedFolderId; folderId label/description updated, reloadProps added; resolves folderId via findMaxFolderId; switches to this.app.paginate/listFiles; uses created_time_in_millisecond for filtering/ts; updates summary text; removes local run().
Source: New folder
components/zoho_workdrive/sources/new-folder/new-folder.mjs
Version 0.1.1; spreads common base; removes typedFolderId; folderId label updated with reloadProps; resolves folderId via findMaxFolderId; uses this.app.paginate; switches to created_time_in_millisecond; updates summary; removes local run(); deploy triggers startEvent.
App: prop definitions and root listing
components/zoho_workdrive/zoho_workdrive.app.mjs
Label updates (Team ID, Parent ID). parentId.options and methods.listRootFolders accept includeSubfolders (default false/true respectively). Subfolder fetch now conditional; descriptions updated.
Package version
components/zoho_workdrive/package.json
Version bumped 0.2.6 → 0.2.7.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Action as Action (Download/Upload)
  participant Helpers as additionalFolderProps/findMaxFolderId
  participant App as Zoho WorkDrive App

  User->>Action: Open config UI
  Action->>Helpers: additionalProps(context)
  Helpers->>App: listRootFolders(includeSubfolders?)
  App-->>Helpers: Root folders (paged/options)
  loop For each selected folderIdN
    Helpers->>App: list subfolders of folderIdN
    App-->>Helpers: Subfolders (paged/options)
    Helpers-->>Action: Append folderIdN+1 prop (reloadProps)
  end
  User->>Action: Select Folder ID(+N), File ID/Name
  Action->>Helpers: findMaxFolderId(context)
  Helpers-->>Action: max index (N)
  Action->>App: listFiles(folderIdN) (paginated)
  App-->>Action: File options/results
Loading
sequenceDiagram
  autonumber
  participant Source as Source (New File/Folder)
  participant Common as Common Base
  participant Helpers as findMaxFolderId
  participant App as Zoho WorkDrive App
  participant DB as Source DB

  Common->>DB: _getLastDate()
  Source->>Helpers: findMaxFolderId(props)
  Helpers-->>Source: folderId index (N or 0)
  Source->>App: paginate(listFiles, { folderIdN }) 
  App-->>Source: Items (created_time_in_millisecond)
  Source->>Source: Filter items > lastDate
  Source->>DB: _setLastDate(max created_time_in_millisecond)
  Source-->>Source: Emit events (summary uses ID, ts=ms)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

I burrow through folders, hop by hop,
Paging softly so 429s stop.
New props sprout like clover in spring,
Millisecond bells now ring-ding-ding.
With synced burrow and shared base true,
I fetch, I sort—then celebrate you! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning Beyond the folderId pagination fix, the pull request also adds a dynamic fileName prop in the download-file action and introduces a new common base module with refactored source components (new-file-in-folder and new-folder), which are not directly related to resolving the HTTP 429 pagination issue. Consider isolating unrelated enhancements—such as the fileName prop addition and the base module refactor—into separate pull requests or clarify how these changes support the folderId pagination fix to maintain focus on the primary objective.
Description Check ⚠️ Warning The PR description only contains “Resolves #18457” and does not fill out the required WHY section from the repository’s template, leaving out the rationale, context, and design details needed to understand and evaluate the change. Please update the PR description by completing the WHY section of the template, explaining the motivation for the changes, the specific pagination issue being addressed, and how the new implementation resolves the HTTP 429 errors.
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.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly and accurately describes the primary change of the pull request—updating the folderId props to resolve a pagination issue—and aligns with the PR’s objective to fix the HTTP 429 errors caused by excessive pagination in Zoho Workdrive.
Linked Issues Check ✅ Passed The changes introduce a dynamic folderId prop mechanism via additionalFolderProps and findMaxFolderId, implement paginated loading with a configurable getLimit, and add an includeSubfolders flag to limit initial requests, all of which directly address the excessive folder pagination and HTTP 429 errors described in issue #18457.
✨ 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-18457

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
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

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

Caution

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

⚠️ Outside diff range comments (2)
components/zoho_workdrive/sources/new-file-in-folder/new-file-in-folder.mjs (1)

81-102: Use attributes.created_time (epoch ms) instead of created_time_in_millisecond.

Change item.attributes.created_time_in_millisecond to item.attributes.created_time to match the WorkDrive API’s v1 response. Numeric comparison and maxDate logic remain valid.

components/zoho_workdrive/actions/upload-file/upload-file.mjs (1)

58-63: Remove unused syncDir prop

The syncDir prop in components/zoho_workdrive/actions/upload-file/upload-file.mjs (lines 58–63) isn’t referenced in the run() method or elsewhere—delete it to avoid dead code.

🧹 Nitpick comments (2)
components/zoho_workdrive/common/additionalFolderProps.mjs (1)

63-79: Consider returning 0 instead of -Infinity for clarity.

The function initializes maxNum to -Infinity (line 64) as a sentinel value when no folder props are found. While the logic is correct and callers handle this properly (e.g., num < 1 checks), returning 0 or -1 would be more conventional and clearer as a "not found" indicator.

Apply this diff to improve clarity:

 function findMaxFolderId(obj) {
-  let maxNum = -Infinity;
+  let maxNum = 0;

   Object.keys(obj).forEach((key) => {
     const match = key.match(/^(folderId(\d*)|parentId)$/);
     if (match) {
       const num = match[2] === undefined || match[2] === ""
         ? 0
         : parseInt(match[2], 10);
       if (num > maxNum) {
         maxNum = num;
       }
     }
   });

   return maxNum;
 }
components/zoho_workdrive/actions/download-file/download-file.mjs (1)

89-93: Consider consistency with upload-file.mjs usage.

This file assigns findMaxFolderId as a method (line 90) and calls it as this.findMaxFolderId(this) (line 61), whereas upload-file.mjs (line 80) calls the imported function directly as findMaxFolderId(this). Both approaches work, but for consistency across the codebase, consider using the same pattern—either assign to methods or call the import directly.

Option 1: Call the import directly (matching upload-file.mjs):

Remove from methods and call directly in additionalProps:

  async additionalProps() {
    const folderProps = await additionalFolderProps.call(this);
    const props = {
      ...folderProps,
    };
    props.fileId = {
      type: "string",
      label: "File ID",
      description: "The unique ID of the file to download.",
      withLabel: true,
      options: async ({ page }) => {
-        const num = this.findMaxFolderId(this);
+        const num = findMaxFolderId(this);
        const limit = this.getLimit();
        // ... rest of options
      },
    };
    // ... rest of additionalProps
  },
  methods: {
-    findMaxFolderId,
    getLimit() {
      return LIMIT;
    },
  },

Option 2: Keep as method and update upload-file.mjs to match (would require changes outside this PR).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b8ba5c and 8daf91a.

📒 Files selected for processing (8)
  • components/zoho_workdrive/actions/download-file/download-file.mjs (3 hunks)
  • components/zoho_workdrive/actions/upload-file/upload-file.mjs (4 hunks)
  • components/zoho_workdrive/common/additionalFolderProps.mjs (1 hunks)
  • components/zoho_workdrive/package.json (1 hunks)
  • components/zoho_workdrive/sources/common/base.mjs (1 hunks)
  • components/zoho_workdrive/sources/new-file-in-folder/new-file-in-folder.mjs (5 hunks)
  • components/zoho_workdrive/sources/new-folder/new-folder.mjs (3 hunks)
  • components/zoho_workdrive/zoho_workdrive.app.mjs (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (6)
components/zoho_workdrive/sources/common/base.mjs (2)
components/zoho_workdrive/sources/new-file-in-folder/new-file-in-folder.mjs (1)
  • lastDate (81-81)
components/zoho_workdrive/sources/new-folder/new-folder.mjs (1)
  • lastDate (51-51)
components/zoho_workdrive/actions/upload-file/upload-file.mjs (4)
components/zoho_workdrive/actions/download-file/download-file.mjs (2)
  • num (61-61)
  • num (63-72)
components/zoho_workdrive/common/additionalFolderProps.mjs (2)
  • num (30-30)
  • num (69-71)
components/zoho_workdrive/sources/new-file-in-folder/new-file-in-folder.mjs (1)
  • num (72-72)
components/zoho_workdrive/sources/new-folder/new-folder.mjs (1)
  • num (42-42)
components/zoho_workdrive/common/additionalFolderProps.mjs (4)
components/zoho_workdrive/actions/download-file/download-file.mjs (3)
  • props (52-54)
  • num (61-61)
  • num (63-72)
components/zoho_workdrive/actions/upload-file/upload-file.mjs (1)
  • num (80-80)
components/zoho_workdrive/sources/new-file-in-folder/new-file-in-folder.mjs (1)
  • num (72-72)
components/zoho_workdrive/sources/new-folder/new-folder.mjs (1)
  • num (42-42)
components/zoho_workdrive/actions/download-file/download-file.mjs (1)
components/zoho_workdrive/common/additionalFolderProps.mjs (3)
  • props (2-2)
  • num (30-30)
  • num (69-71)
components/zoho_workdrive/sources/new-file-in-folder/new-file-in-folder.mjs (4)
components/zoho_workdrive/actions/download-file/download-file.mjs (2)
  • num (61-61)
  • num (63-72)
components/zoho_workdrive/actions/upload-file/upload-file.mjs (1)
  • num (80-80)
components/zoho_workdrive/common/additionalFolderProps.mjs (2)
  • num (30-30)
  • num (69-71)
components/zoho_workdrive/sources/new-folder/new-folder.mjs (6)
  • num (42-42)
  • folderId (43-45)
  • lastDate (51-51)
  • maxDate (52-52)
  • items (53-59)
  • createdTime (64-64)
components/zoho_workdrive/sources/new-folder/new-folder.mjs (4)
components/zoho_workdrive/actions/download-file/download-file.mjs (2)
  • num (61-61)
  • num (63-72)
components/zoho_workdrive/actions/upload-file/upload-file.mjs (1)
  • num (80-80)
components/zoho_workdrive/common/additionalFolderProps.mjs (2)
  • num (30-30)
  • num (69-71)
components/zoho_workdrive/sources/new-file-in-folder/new-file-in-folder.mjs (7)
  • num (72-72)
  • folderId (73-75)
  • lastDate (81-81)
  • maxDate (82-82)
  • items (83-89)
  • responseArray (91-91)
  • createdTime (94-94)
⏰ 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 (23)
components/zoho_workdrive/package.json (1)

3-3: LGTM! Version bump is appropriate for the pagination bug fix.

The patch version increment from 0.2.6 to 0.2.7 correctly follows semantic versioning for a bug fix that addresses the HTTP 429 rate-limit errors.

components/zoho_workdrive/zoho_workdrive.app.mjs (2)

142-148: LGTM! Core fix for 429 rate-limit issue.

The conditional subfolder loading prevents excessive pagination when includeSubfolders is false, directly addressing the 429 rate-limit errors described in issue #18457. The logic correctly skips the expensive paginateFolders call when not needed.


31-31: No external callers of listRootFolders—default mismatch is intentional and safe.

components/zoho_workdrive/actions/download-file/download-file.mjs (1)

60-71: LGTM! Dynamic folder selection and pagination logic.

The dynamic folder selection logic (lines 64-66) correctly identifies the deepest selected folder, mirroring the approach in upload-file.mjs. The pagination parameters (lines 69-70) properly use the getLimit() method, maintaining consistency with the LIMIT constant.

components/zoho_workdrive/sources/common/base.mjs (1)

35-37: All extending sources define startEvent(). No further action required.

components/zoho_workdrive/common/additionalFolderProps.mjs (1)

8-10: Verify pagination behavior of listFiles
The default LIMIT is 50, but I couldn’t find the listFiles definition to confirm if it supports overriding the page size or paginating through multiple pages. At lines 8–10 and 37–39, you fetch subfolders without pagination parameters—please verify whether this.app.listFiles accepts options like limit, page, or offset to ensure all subfolders are retrieved.

components/zoho_workdrive/sources/new-file-in-folder/new-file-in-folder.mjs (5)

1-9: LGTM! Clean refactoring to shared base.

The migration to a common base with spread syntax promotes consistency across sources and reduces duplication.


16-39: LGTM! Dynamic folder prop pattern aligns with pagination fix.

The reloadProps: true flag enables dynamic subfolder loading, which is central to the pagination fix described in the PR objectives. The updated description clearly communicates this behavior.


53-54: LGTM! Shared methods reduce duplication.

Spreading common methods eliminates local state management duplication across sources.


104-117: LGTM! Event payload consistent with timestamp changes.

The emitted event uses the same created_time_in_millisecond field for the ts property, maintaining consistency with the filtering logic.


71-79: Dynamic folder props mechanism verified. The additionalFolderProps function correctly generates folderId{n} properties and findMaxFolderId is properly imported and used—no further changes needed.

components/zoho_workdrive/sources/new-folder/new-folder.mjs (6)

1-7: LGTM! Consistent with new-file-in-folder.mjs.

The shared base pattern is applied consistently across sources.


14-37: LGTM! Dynamic folder props match pattern.

Consistent implementation of reloadProps: true for subfolder navigation.


40-49: Core pagination fix applied consistently.

The folder resolution logic matches new-file-in-folder.mjs exactly, ensuring consistent behavior across sources.


51-72: LGTM! Correct filter for folder detection.

The filter: "folder" parameter correctly scopes the pagination to folders only, distinguishing this source from the file detection source.


74-84: LGTM! Event payload consistent.

Correct use of "folder" terminology and consistent timestamp handling.


86-90: Verify deploy limit difference is intentional.

This source fetches 25 items on deploy while new-file-in-folder.mjs fetches 10. Is this difference intentional, or should they use the same limit for consistency?

components/zoho_workdrive/actions/upload-file/upload-file.mjs (6)

4-6: LGTM!

The imports are correctly structured and the functions are properly utilized in the additionalProps() method and the run() method.


11-11: LGTM!

Version bump is appropriate for the changes made.


65-67: LGTM!

The additionalProps() method correctly delegates to additionalFolderProps with the component context, enabling dynamic folder selection props.


28-40: LGTM!

The addition of reloadProps: true correctly triggers dynamic prop re-evaluation when the parent folder changes, enabling the cascading folder selection mechanism.


80-83: LGTM!

The findMaxFolderId logic correctly determines the deepest selected folder level and falls back to parentId when no dynamic folders are selected. This pattern is consistent with the implementation in other files across the component.


85-85: LGTM!

The computed parentId is correctly applied to the form data. This change enables users to select deeply nested folders without triggering the pagination issue that caused HTTP 429 errors.

@vunguyenhung vunguyenhung merged commit ddf0835 into master Oct 1, 2025
10 checks passed
@vunguyenhung vunguyenhung deleted the issue-18457 branch October 1, 2025 02:05
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] Zoho Workdrive 429 pagination issue

4 participants