Repository navigation
fix: write imported Plane comments through CommentService - #486
Merged
Merged
Conversation
The importer inserted comment rows with raw SQL, which bypassed the comment chokepoint and left imported comments without a comment-created domain fact. Add CommentService.CreateImportedInTx, the in-transaction counterpart of CreateImported that preserves the source's created_at and updated_at, and route the importer through it. The batch transaction stays the durability unit, so the mapping write and the comment remain atomic.
This was referenced Nov 12, 2026
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.
What
The Plane importer inserted
commentsrows with raw SQL. That bypasses the comment chokepoint (CommentService) and leaves imported comments without the canonical comment-created domain fact thatTestNoDirectCommentTableWrites(WI-483) exists to protect.CommentService.CreateImportedInTx, the in-transaction counterpart ofCreateImported: it preserves the source'screated_atandupdated_atand records the comment-created fact with side effects suppressed.CreateInTxnow delegates to it withupdatedAt == createdAt.internal/planeimport/batch.gothrough it. The per-batch transaction stays the durability unit, so the comment and itsplane_import_mappingsrow remain atomic.Why
The importer is a historical bulk loader and legitimately needs both source timestamps and transaction atomicity; the existing
CreateInTxsupports atomicity but notupdated_at, andCreateImportedsupportsupdated_atbut opens its own transaction. This closes both gaps without silencing the bypass guard.Verification
go build/go vetclean../test --core <worktree> go -tags=test ./internal/planeimport/...green (the loader test now assertsitem.createdcount separately from the newitem.comment_createdfact)../test --core <worktree> go -tags=test -run TestNoDirectCommentTableWrites ./internal/services/green.