-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Front "New Conversation Tag" bug fix #18702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughThis 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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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 producedIf
_getEmit(responseArray[0])
returnsundefined
(e.g., filtered tag doesn’t match), the current fallback stores0
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
📒 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
Resolves #18692
Summary by CodeRabbit