Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Oct 9, 2025

Resolves #18634

Summary by CodeRabbit

  • Performance
    • Improved efficiency when fetching paginated Microsoft Teams resources by stopping early when no new items are found, reducing API calls and processing time.
  • Chores
    • Updated Microsoft Teams package version to 0.1.6.
    • Upgraded platform dependency to the latest major version.
    • Bumped patch versions for Microsoft Teams sources (New Channel, New Chat, New Channel Message, New Chat Message, New Team, New Team Member) to 0.0.11.

@vercel
Copy link

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

Walkthrough

Updates Microsoft Teams component package version and dependency. In the shared base pagination helper, adds early loop termination when encountering a non-new resource. Individual Microsoft Teams source files bump their internal version metadata with no logic changes.

Changes

Cohort / File(s) Summary
Package and deps
components/microsoft_teams/package.json
Version 0.1.5 → 0.1.6; updates dependency @pipedream/platform from ^1.2.0 to ^3.1.0.
Shared pagination logic
components/microsoft_teams/sources/common/base.mjs
In getNewPaginatedResources, breaks out early when a resource is not new, altering control flow to stop further pagination once a non-new item is found.
Source version bumps
components/microsoft_teams/sources/new-channel-message/new-channel-message.mjs, components/microsoft_teams/sources/new-channel/new-channel.mjs, components/microsoft_teams/sources/new-chat-message/new-chat-message.mjs, components/microsoft_teams/sources/new-chat/new-chat.mjs, components/microsoft_teams/sources/new-team-member/new-team-member.mjs, components/microsoft_teams/sources/new-team/new-team.mjs
Each source updates version from 0.0.10 to 0.0.11; no logic changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Trigger Source
  participant Base Helper (getNewPaginatedResources)
  participant MS Graph API

  Trigger Source->>Base Helper (getNewPaginatedResources): start with last checkpoint
  loop Paginate pages
    Base Helper->>MS Graph API: fetch next page of resources
    MS Graph API-->>Base Helper: page results (ordered)
    alt resource is new
      Base Helper->>Base Helper: collect resource
    else resource is not new
      Note over Base Helper: New behavior: break out early
      break Stop pagination
        Base Helper-->>Trigger Source: return collected new resources
      end
    end
  end
  Base Helper-->>Trigger Source: return collected new resources
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

I hopped through pages, one by one,
Then spied an old post—“I’m done!”
No more endless scrolls at night,
I nip the loop and take to flight.
Version bumps in tidy rows—
Less nibble, more signal, the garden grows. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning The change to break early when encountering a non-new resource directly addresses the objective to avoid full pagination for ordered Microsoft Teams resources in issue #18634, but it lacks explicit handling to maintain full pagination for any triggers that may not support ordering or filtering. Implement conditional logic to ensure triggers without intrinsic ordering continue full pagination while preserving the early break optimization for ordered resources as specified in issue #18634.
Out of Scope Changes Check ⚠️ Warning Alongside the pagination fix, the pull request includes multiple version bumps and a major dependency upgrade of “@pipedream/platform” which are not related to the pagination objectives described in issue #18634. Consider isolating version metadata updates and the dependency upgrade into a separate release or pull request to keep the pagination fix focused and reviewable.
Description Check ⚠️ Warning The pull request description only includes a reference to the issue and does not follow the repository template by providing a “## WHY” section to explain the rationale and context of the change. Please update the description to include the required “## WHY” heading and a brief explanation of the motivation for updating trigger pagination, referencing the storage and performance issues described in issue #18634.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes the main focus of updating pagination behavior in Microsoft Teams triggers by referencing pagination, matching the core change of stopping excessive resource iteration in triggers.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ 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-18634

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

Caution

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

⚠️ Outside diff range comments (1)
components/microsoft_teams/sources/common/base.mjs (1)

28-41: Enforce explicit descending ordering on all Graph API list endpoints
Add an $orderby parameter to each paginated request to guarantee newest-first sorting before breaking early. For example:

  • Messages: $orderby=lastModifiedDateTime desc
  • Chats and channels: $orderby=createdDateTime desc (or lastModifiedDateTime)
  • Teams, channels list, team members: if supported, use $orderby=createdDateTime desc; otherwise remove the early break and filter post-fetch.
    This ensures getNewPaginatedResources never skips newer items when the API’s default order is unspecified.
🧹 Nitpick comments (1)
components/microsoft_teams/sources/new-team/new-team.mjs (1)

20-26: Consider using resource creation timestamp for metadata.

The generateMeta method uses Date.now() for the timestamp (line 24), which doesn't reflect the actual creation time of the team resource. If the team resource has a createdDateTime field, consider using it instead for more accurate metadata, similar to how other sources like new-channel and new-chat handle this.

This is a pre-existing issue, not introduced by this PR.

     generateMeta(team) {
       return {
         id: team.id,
         summary: team.displayName,
-        ts: Date.now(),
+        ts: team.createdDateTime ? Date.parse(team.createdDateTime) : Date.now(),
       };
     },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c888bba and ecfb2ec.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • components/microsoft_teams/package.json (2 hunks)
  • components/microsoft_teams/sources/common/base.mjs (1 hunks)
  • components/microsoft_teams/sources/new-channel-message/new-channel-message.mjs (1 hunks)
  • components/microsoft_teams/sources/new-channel/new-channel.mjs (1 hunks)
  • components/microsoft_teams/sources/new-chat-message/new-chat-message.mjs (1 hunks)
  • components/microsoft_teams/sources/new-chat/new-chat.mjs (1 hunks)
  • components/microsoft_teams/sources/new-team-member/new-team-member.mjs (1 hunks)
  • components/microsoft_teams/sources/new-team/new-team.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: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (7)
components/microsoft_teams/sources/new-channel-message/new-channel-message.mjs (1)

8-8: Version bump looks good.

The version update aligns with the package-level version bump and the pagination optimization in base.mjs.

components/microsoft_teams/sources/new-team/new-team.mjs (1)

8-8: Version bump looks good.

The version update is consistent with the package-level changes.

components/microsoft_teams/sources/new-channel/new-channel.mjs (1)

8-8: Version bump looks good.

The version update aligns with the package-level version bump and the pagination optimization in base.mjs.

components/microsoft_teams/sources/new-chat/new-chat.mjs (1)

8-8: Version bump looks good.

The version update aligns with the package-level version bump and the pagination optimization in base.mjs.

components/microsoft_teams/sources/new-chat-message/new-chat-message.mjs (1)

8-8: Version bump looks good.

The version update aligns with the package-level version bump and the pagination optimization in base.mjs.

components/microsoft_teams/package.json (1)

18-18: Verify compatibility with @pipedream/platform 3.x
The jump from ^1.x to ^3.x includes breaking changes. Confirm that your Microsoft Teams components:

  • Initialize and call the SDK via new PipedreamClient() and use namespaced methods (e.g. client.apps.list())
  • Handle pagination with getNextPage()/hasNextPage() instead of raw page_info
  • Use the props-based component model and the new HTTP/auth helpers ($ context or axios wrapper)
  • Align TypeScript types with the v3 SDK surface

Refer to Pipedream’s SDK Migration Guide (v1→v2+) and the “Migrating from Legacy Actions to Component Actions” docs to update your code accordingly.

components/microsoft_teams/sources/new-team-member/new-team-member.mjs (1)

22-29: Verify pagination behavior for team members: listTeamMembers returns conversationMember objects without a creation timestamp, so getNewPaginatedResources will paginate through all members on every run—confirm this is intended or switch to the /teams/{teamId}/members/delta endpoint for incremental sync.

Copy link
Collaborator

@GTFalcao GTFalcao left a comment

Choose a reason for hiding this comment

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

LGTM!

@JHawk0224
Copy link
Contributor

Thank you for working on this!

I also want to point out the related #18632 if you haven't already seen it

@vunguyenhung vunguyenhung merged commit c1ca75a into master Oct 10, 2025
10 checks passed
@vunguyenhung vunguyenhung deleted the issue-18634 branch October 10, 2025 04:33
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] Microsoft Teams - Triggers paginate through every resource on every run

4 participants