Skip to content

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Oct 10, 2025

Follow-up to #18634
Addresses #18632

Summary by CodeRabbit

  • Bug Fixes

    • Chat messages are now listed with newest first.
    • More reliable detection of new channel/chat events, reducing missed or duplicate triggers.
  • Documentation

    • Added links to official docs in Microsoft Teams sources’ descriptions.
  • Refactor

    • Unified timestamp handling across Teams sources for more accurate pagination and event detection.
  • Chores

    • Bumped versions for Microsoft Teams package and related actions.

Copy link

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

Copy link
Contributor

coderabbitai bot commented Oct 10, 2025

Walkthrough

Updates Microsoft Teams package version and action/source versions. Refactors source base to use a configurable timestamp field and optional sorted pagination. Adjusts several sources to pass tsField and flags. Changes chat messages API to request descending order by createdDateTime. Adds documentation links to some source descriptions.

Changes

Cohort / File(s) Summary
Actions: version bumps
components/microsoft_teams/actions/create-channel/create-channel.mjs, .../actions/list-channels/list-channels.mjs, .../actions/list-shifts/list-shifts.mjs, .../actions/send-channel-message/send-channel-message.mjs, .../actions/send-chat-message/send-chat-message.mjs
Bump exported action version fields (0.0.6→0.0.7; 0.0.9→0.0.10). No logic changes.
App: chat messages ordering
components/microsoft_teams/microsoft_teams.app.mjs
listChatMessages now requests /chats/{chatId}/messages?$orderby=createdDateTime desc. Signature unchanged.
Sources base: timestamp refactor
components/microsoft_teams/sources/common/base.mjs
Replace lastCreated with lastDate; add getTsField(). Update isNew, getNewPaginatedResources (add tsField, isSorted), and run() to use configurable timestamp field and sorted-iteration break condition.
Sources: adopt tsField + metadata
components/microsoft_teams/sources/new-channel-message/new-channel-message.mjs, .../sources/new-channel/new-channel.mjs, .../sources/new-chat-message/new-chat-message.mjs, .../sources/new-chat/new-chat.mjs, .../sources/new-team/new-team.mjs
Descriptions updated (doc links); versions 0.0.11→0.0.12. getResources now accepts tsField; calls getNewPaginatedResources with new params; some pass isSorted=true.
Source: metadata only
components/microsoft_teams/sources/new-team-member/new-team-member.mjs
Description updated (doc link); version 0.0.11→0.0.12. No logic changes.
Package version
components/microsoft_teams/package.json
Package version 0.1.6→0.1.7.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Source as Source (e.g., New Chat Message)
  participant Base as Base (common)
  participant App as MicrosoftTeams App
  participant MSGraph as Microsoft Graph

  User->>Source: Run trigger
  Source->>Base: getTsField()
  Base-->>Source: tsField (e.g., createdDateTime / lastModifiedDateTime)
  Source->>Base: getNewPaginatedResources(fn, params, lastDate, tsField, isSorted?)
  Base->>App: fn(params) // paginated fetch
  App->>MSGraph: GET resources (may include $orderby when applicable)
  MSGraph-->>App: Page of resources
  App-->>Base: Resources page
  loop For each resource
    Base->>Base: isNew(resource[tsField], lastDate)
    alt New
      Base-->>Source: Yield resource
      Base->>Base: Update lastDate
    else Not new
      opt If isSorted
        Base->>Base: Break iteration
      end
    end
  end
  Base-->>Source: Done
  Source->>Base: _setLastDate(lastDate)
Loading
sequenceDiagram
  autonumber
  participant App as MicrosoftTeams App
  participant MSGraph as Microsoft Graph

  App->>MSGraph: GET /chats/{chatId}/messages?$orderby=createdDateTime desc
  MSGraph-->>App: Messages (latest first)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • GTFalcao

Poem

Thump-thump goes my codey heart, so keen,
New timestamps hop where old had been.
Descending chats, a tidy scene—
Triggers sniff the freshest sheen.
Versions nudge, the garden’s clean,
A rabbit bows: shipped and serene. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description only lists related issue and PR URLs and does not use the required “## WHY” template section or explain the motivation and context of the changes. Please complete the description template by adding a “## WHY” section that explains the purpose and rationale for these pagination updates and how they address the referenced issue.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Microsoft Teams - pagination updates” clearly conveys the primary change of this pull request by referencing pagination improvements in the Microsoft Teams components and is concise and specific without extraneous detail.
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-2

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 10, 2025 17:15
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: 2

🧹 Nitpick comments (3)
components/microsoft_teams/sources/common/base.mjs (2)

31-44: Minor: clarify isSorted semantics

Consider renaming isSorted to isSortedDesc (or document) since you break on first non-new only when the list is sorted by tsField descending.


64-78: Persist lastDate only when valid to prevent resetting state

If no valid timestamps were processed, lastDate remains undefined; persisting undefined reprocesses all items next run.

Apply this diff:

-    this._setLastDate(lastDate);
+    if (Number.isFinite(lastDate)) {
+      this._setLastDate(lastDate);
+    }
components/microsoft_teams/microsoft_teams.app.mjs (1)

287-291: Prefer SDK query params over inline query string

Replace the inline $orderby in the path with a params object:

-    async listChatMessages({ chatId }) {
-      return this.makeRequest({
-        path: `/chats/${chatId}/messages?$orderby=createdDateTime%20desc`,
-      });
-    },
+    async listChatMessages({ chatId }) {
+      return this.makeRequest({
+        path: `/chats/${chatId}/messages`,
+        params: {
+          orderby: "createdDateTime desc",
+        },
+      });
+    },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b409f1 and b573217.

📒 Files selected for processing (14)
  • components/microsoft_teams/actions/create-channel/create-channel.mjs (1 hunks)
  • components/microsoft_teams/actions/list-channels/list-channels.mjs (1 hunks)
  • components/microsoft_teams/actions/list-shifts/list-shifts.mjs (1 hunks)
  • components/microsoft_teams/actions/send-channel-message/send-channel-message.mjs (1 hunks)
  • components/microsoft_teams/actions/send-chat-message/send-chat-message.mjs (1 hunks)
  • components/microsoft_teams/microsoft_teams.app.mjs (1 hunks)
  • components/microsoft_teams/package.json (1 hunks)
  • components/microsoft_teams/sources/common/base.mjs (2 hunks)
  • components/microsoft_teams/sources/new-channel-message/new-channel-message.mjs (2 hunks)
  • components/microsoft_teams/sources/new-channel/new-channel.mjs (2 hunks)
  • components/microsoft_teams/sources/new-chat-message/new-chat-message.mjs (2 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)
🧰 Additional context used
🧬 Code graph analysis (6)
components/microsoft_teams/sources/new-channel/new-channel.mjs (1)
components/microsoft_teams/sources/common/base.mjs (1)
  • tsField (65-65)
components/microsoft_teams/sources/new-channel-message/new-channel-message.mjs (1)
components/microsoft_teams/sources/common/base.mjs (1)
  • tsField (65-65)
components/microsoft_teams/sources/new-chat/new-chat.mjs (1)
components/microsoft_teams/sources/common/base.mjs (1)
  • tsField (65-65)
components/microsoft_teams/sources/new-chat-message/new-chat-message.mjs (1)
components/microsoft_teams/sources/common/base.mjs (1)
  • tsField (65-65)
components/microsoft_teams/sources/new-team/new-team.mjs (1)
components/microsoft_teams/sources/common/base.mjs (1)
  • tsField (65-65)
components/microsoft_teams/sources/common/base.mjs (1)
components/microsoft_teams/sources/new-team-member/new-team-member.mjs (2)
  • resources (39-39)
  • meta (41-41)
⏰ 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: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (18)
components/microsoft_teams/package.json (1)

3-3: Version bump LGTM

No issues; aligns with action/source version updates in this PR.

components/microsoft_teams/actions/send-channel-message/send-channel-message.mjs (1)

8-8: Version bump LGTM

No behavioral changes.

components/microsoft_teams/actions/send-chat-message/send-chat-message.mjs (1)

8-8: Version bump LGTM

No behavioral changes.

components/microsoft_teams/actions/create-channel/create-channel.mjs (1)

8-8: Version bump LGTM

No behavioral changes.

components/microsoft_teams/actions/list-channels/list-channels.mjs (1)

8-8: Version bump LGTM

No behavioral changes.

components/microsoft_teams/actions/list-shifts/list-shifts.mjs (1)

8-8: Version bump LGTM

No behavioral changes.

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

7-8: LGTM! Metadata updates are consistent.

The documentation link and version bump align with the broader refactoring effort across Microsoft Teams sources.

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

7-8: LGTM! Metadata updates are consistent.

Documentation link and version bump align with the PR's pagination updates.


22-31: LGTM! Timestamp field support correctly implemented.

The signature update to accept tsField and the sorting flag enable proper timestamp-based pagination for chat messages.

components/microsoft_teams/sources/new-channel-message/new-channel-message.mjs (3)

7-8: LGTM! Metadata updates are consistent.

Documentation link and version bump align with the PR's pagination updates.


31-33: LGTM! Semantic override for modification-based tracking.

Overriding getTsField() to return "lastModifiedDateTime" correctly signals that this source tracks updates rather than creation timestamps.


34-44: LGTM! Parameter naming semantically matches the timestamp field.

Using lastUpdated instead of lastCreated appropriately reflects that this source tracks lastModifiedDateTime. The sorting flag and tsField propagation enable proper pagination.

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

7-8: LGTM! Metadata updates are consistent.

Documentation link and version bump align with the PR's pagination updates.


13-19: LGTM! Timestamp field support correctly implemented.

The signature update to accept tsField enables proper timestamp-based pagination for teams.

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

7-8: LGTM! Metadata updates are consistent.

Documentation link and version bump align with the PR's pagination updates.


22-30: LGTM! Timestamp field support correctly implemented.

The signature update to accept tsField enables proper timestamp-based pagination for channels.

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

7-8: LGTM! Metadata updates are consistent.

Documentation link and version bump align with the PR's pagination updates.


13-19: LGTM! Timestamp field support correctly implemented.

The signature update to accept tsField enables proper timestamp-based pagination for chats.

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!

@GTFalcao GTFalcao moved this from Ready for PR Review to Ready for QA in Component (Source and Action) Backlog Oct 10, 2025
@vunguyenhung vunguyenhung moved this from Ready for QA to In QA in Component (Source and Action) Backlog Oct 13, 2025
@vunguyenhung vunguyenhung moved this from In QA to Ready for QA in Component (Source and Action) Backlog Oct 13, 2025
@vunguyenhung vunguyenhung moved this from Ready for QA to Ready for Release in Component (Source and Action) Backlog Oct 13, 2025
@vunguyenhung
Copy link
Collaborator

Hi everyone, all test cases are passed! Ready for release!

Test report
https://vunguyenhung.notion.site/Microsoft-Teams-pagination-updates-288bf548bb5e81ceb93eda3bb7a881db

@vunguyenhung vunguyenhung merged commit beb9842 into master Oct 13, 2025
10 checks passed
@vunguyenhung vunguyenhung deleted the issue-18634-2 branch October 13, 2025 01:58
@github-project-automation github-project-automation bot moved this from Ready for Release to Done in Component (Source and Action) Backlog Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants