feat: bidirectional comment sync and attachment pull for Linear#2824
Open
aphexcx wants to merge 6 commits intosteveyegge:mainfrom
Open
feat: bidirectional comment sync and attachment pull for Linear#2824aphexcx wants to merge 6 commits intosteveyegge:mainfrom
aphexcx wants to merge 6 commits intosteveyegge:mainfrom
Conversation
…bd-1ob) Implements Linear comment and attachment synchronization: - Schema: add external_ref/updated_at to comments table, create attachments table - Types: extend Comment with ExternalRef/UpdatedAt, add Attachment struct - Tracker framework: add optional CommentSyncer and AttachmentFetcher interfaces - Linear client: add GraphQL queries for issue comments and attachments - Linear tracker: implement CommentSyncer and AttachmentFetcher - Sync engine: add comment sync (pull+push) and attachment pull phases - Storage: add CommentRefStore and AttachmentStore optional interfaces - CLI: add --no-comments, --no-attachments, --comments-only flags Design: optional interfaces ensure non-Linear adapters need no changes. Comments use external_ref matching to avoid duplicates. Attachments are metadata-only (URL, filename, size) — no file downloads.
- P1: Add Go migration (013_comment_sync_columns) for server-mode Dolt to ALTER TABLE comments/wisp_comments adding external_ref + updated_at columns and CREATE TABLE attachments - P2: Skip attachment pull when --comments-only is set - P2: Use per-issue cutoff for comment sync (zero time for issues that have never been synced, global cutoff only for previously-synced issues) - P2: Add CommentRefStore and AttachmentStore implementations to EmbeddedDoltStore (comment_ref.go, attachments.go) - MAJOR: Eliminate N+1 FetchIssue calls by building a shared ext issue cache once, used by both comment sync and attachment pull phases - MINOR: Fix variable shadowing (t -> ts) in linear/tracker.go where time.Parse shadowed the *Tracker receiver - MINOR: Remove unused Metadata struct from linear Attachment type (GraphQL query never requests it, so MimeType was always empty) - MINOR: Update last_comment_sync and last_attachment_sync timestamps unconditionally after successful sync pass, not just when items synced Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Collaborator
|
Heads up @aphexcx — we just merged #2862 which also registers migration 013 (dropping the We went with #2862 first because it was a smaller, self-contained schema fix that unblocked Your bidirectional comment sync work looks solid — the optional interface design is well thought out. Looking forward to seeing this land once the migration numbering is sorted and the remaining test plan items are checked off. Thanks for the contribution! |
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…(bd-1ob) P1: last_comment_sync / last_attachment_sync no longer advance on push-only or partial failures. P1: schema_test expects migration version 25 and attachments table. P2: Edited remote comments now update local text. Issue renames update attachments FK. Promote/demote preserves comment external_ref and updated_at. Attachments FK removed to allow wisp references. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
# Conflicts: # cmd/bd/jira.go # cmd/bd/linear.go # internal/linear/tracker.go # internal/storage/dolt/migrations.go # internal/storage/storage.go # internal/tracker/engine.go # internal/tracker/types.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CommentSyncer,AttachmentFetcher) so Jira/ADO/GitHub/GitLab adapters are unaffectedexternal_refon comments and attachments prevents duplicates across syncsSchema changes
comments/wisp_comments: addsexternal_ref VARCHAR(255)andupdated_at DATETIMEcolumnsattachmentstable (id, issue_id, external_ref, filename, url, mime_type, size_bytes, source, creator, created_at)013_comment_sync_columns) for server-mode Dolt; embedded SQL migrations (0024, 0025) for embedded modeNew CLI flags
--no-comments— disable comment sync--no-attachments— disable attachment pull--comments-only— sync only comments, skip issues and attachmentsArchitecture
tracker.CommentSyncerinterface:FetchComments(ctx, externalIssueID, since)+CreateComment(ctx, externalIssueID, body)tracker.AttachmentFetcherinterface:FetchAttachments(ctx, externalIssueID)storage.CommentRefStoreinterface: comment CRUD with external_ref trackingstorage.AttachmentStoreinterface: attachment CRUDDoltStoreandEmbeddedDoltStoreimplement the new storage interfacesTest plan
bd linear sync --dry-runshows comments and attachments to syncbd linear syncpulls comments from Linear, pushes local comments to Linear--no-commentsskips comment sync--comments-onlysyncs only comments, skips issues and attachments🤖 Generated with Claude Code