Module: CollavreLinear::CommentSyncability

Defined in:
app/services/collavre_linear/comment_syncability.rb

Overview

Single source of truth for "may this Collavre comment be mirrored to Linear?".

Shared by CommentSyncObserver (deciding whether to enqueue outbound work) and OutboundCommentUpdateJob (re-checking at run time): a comment can be made private or moved out of the Main topic AFTER an update job is enqueued, and with multiple workers that update could run before the delete the observer enqueues for the same visibility change — leaking the now-hidden body. Both gates share this predicate so they can never drift.

Class Method Summary collapse

Class Method Details

.syncable?(comment) ⇒ Boolean

Only mirror a real, still-visible human chat post in the Main topic of a creative linked to a Linear issue. Excludes: inbound echoes; private notes; system/waiting notices (no user); AI agent turns (their comment starts as a "..." streaming placeholder and mutates in place); the placeholder itself; and comments moved out of Main or on unlinked creatives.

Returns:

  • (Boolean)


20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/services/collavre_linear/comment_syncability.rb', line 20

def syncable?(comment)
  return false if comment.skip_linear_sync
  return false if comment.private?
  return false if comment.user_id.nil?
  return false if comment.user&.ai_user?
  return false if comment.content.blank?
  return false if comment.content == ::Collavre::Comment::STREAMING_PLACEHOLDER_CONTENT
  return false unless comment.topic&.name == ::Collavre::Creative::MAIN_TOPIC_NAME
  return false unless comment.creative

  comment.creative.linear_issue_links.exists?
end