Skip to content

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Oct 9, 2025

Resolves #18692

Summary by CodeRabbit

  • New Features
    • Added deploy and runtime hooks for “New Conversation Tag” events to enable automated processing at deploy time and during runs.
  • Bug Fixes
    • Improved event emission stability with safer handling of missing data.
    • Standardized timestamps to use emitted time and refined message summaries for “New Conversation Tag” events.
  • Chores
    • Bumped app package version to 0.8.2.
    • Updated source versions: New Conversation Created, New Conversation State Change, New Message Template Created, and New Conversation Tag.

@michelle0927 michelle0927 marked this pull request as ready for review October 9, 2025 18:35
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 6:38pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Oct 9, 2025 6:38pm

Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

Walkthrough

This update adds safety checks in the common event base to handle undefined emissions and default last timestamps. It revises the New Conversation Tag source with new deploy/run hooks, predicate changes, and emitted_at-based timestamps. Several files receive version bumps, including package.json and other Front sources.

Changes

Cohort / File(s) Summary
Core event handling guardrails
components/frontapp/sources/common/base.mjs
Adds optional chaining/fallback for last timestamp, skips items when _getEmit returns undefined, and reuses precomputed emit values.
New Conversation Tag: hooks and timestamp semantics
components/frontapp/sources/new-conversation-tag/new-conversation-tag.mjs
Version bump; adds hooks.deploy and run; changes _getParams() signature (removes lastTs); switches timestamp to emitted_at (rounded to seconds); updates summary text; startEvent predicates use emitted_at.
Version bumps (no behavior changes)
components/frontapp/package.json, components/frontapp/sources/new-conversation-created/new-conversation-created.mjs, components/frontapp/sources/new-conversation-state-change/new-conversation-state-change.mjs, components/frontapp/sources/new-message-template-created/new-message-template-created.mjs
Increments versions only; no logic changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Ops as Deploy/Runner
  participant NCT as NewConversationTag Source
  participant Base as Common Base.startEvent
  participant API as Front API
  participant DB as Store(lastTs)
  participant Sink as Emitter

  Ops->>NCT: hooks.deploy() / run()
  NCT->>Base: startEvent(threshold, predicate)
  Base->>API: fetch events
  API-->>Base: items[]

  rect rgba(230,245,255,0.6)
  note over Base: Compute initial lastTs via first _getEmit(item)?.ts || 0
  end

  loop For each item
    Base->>NCT: _getEmit(item)
    NCT-->>Base: emit | undefined
    alt emit is defined
      Base->>Sink: emit(event)
      Base->>DB: save lastTs = emit.ts
    else skip
      Base-->>Base: continue (no emission)
    end
  end

  DB-->>Ops: lastTs persisted
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I twitch my ears at guarded flows,
No undefineds—now everyone knows.
Tags hop in with emitted_at time,
Deploy and run, all in prime.
With versions bumped and errors tamed,
I thump the ground: stability reclaimed. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning Beyond the core fix in base.mjs, the pull request includes unrelated version bumps across multiple sources and extensive API changes in new-conversation-tag (parameter removal, new hooks, summary and timestamp format), which are not part of the bug fix objective described in issue #18692. Consider isolating the version bumps and new-conversation-tag API enhancements into separate pull requests so that this change only includes the minimal code necessary to resolve the deployment error.
Description Check ⚠️ Warning The pull request description only contains “Resolves #18692” and does not follow the repository’s required template or include any “WHY” section explaining the rationale or details of the bug fix. Please complete the description template by adding a “## WHY” section that explains the root cause of the bug, describes the changes made to address it, and outlines any testing steps or impacts on behavior.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly identifies that this pull request fixes a bug in the Front “New Conversation Tag” component, matching the main change in the changeset and providing enough context for reviewers to understand its purpose at a glance.
Linked Issues Check ✅ Passed The changes to components/frontapp/sources/common/base.mjs introduce a guard and fallback for undefined emits, which directly addresses the TypeError in issue #18692, ensuring lastTs is always defined and preventing deployment failures.
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-18692

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/frontapp/sources/common/base.mjs (1)

44-55: Critical: Preserve lastTs when no emit payload is produced

If _getEmit(responseArray[0]) returns undefined (e.g., filtered tag doesn’t match), the current fallback stores 0 in the DB. That wipes previously persisted progress, making subsequent runs reprocess the same history forever. Persist the previous timestamp or a reliable fallback (e.g., _getItemTs) instead of zero.

-        this._setLastTs(this._getEmit(responseArray[0])?.ts ?? 0);
+        const firstItem = responseArray[0];
+        const emit = this._getEmit(firstItem);
+        const fallbackTs = typeof this._getItemTs === "function"
+          ? this._getItemTs(firstItem)
+          : null;
+        this._setLastTs(emit?.ts ?? fallbackTs ?? lastTs);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d6e7fe and 03f6a27.

📒 Files selected for processing (6)
  • components/frontapp/package.json (1 hunks)
  • components/frontapp/sources/common/base.mjs (1 hunks)
  • components/frontapp/sources/new-conversation-created/new-conversation-created.mjs (1 hunks)
  • components/frontapp/sources/new-conversation-state-change/new-conversation-state-change.mjs (1 hunks)
  • components/frontapp/sources/new-conversation-tag/new-conversation-tag.mjs (3 hunks)
  • components/frontapp/sources/new-message-template-created/new-message-template-created.mjs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
components/frontapp/sources/new-conversation-tag/new-conversation-tag.mjs (1)
components/frontapp/sources/common/base.mjs (1)
  • lastTs (26-26)
⏰ 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

@vunguyenhung vunguyenhung merged commit fa3ebd7 into master Oct 13, 2025
10 checks passed
@vunguyenhung vunguyenhung deleted the issue-18692 branch October 13, 2025 01: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] Front "New Conversation Tag" throwing on deployment

3 participants