Skip to content

fix: write imported Plane comments through CommentService - #486

Merged
stefan-ernst merged 1 commit into
mainfrom
plane-comment-chokepoint
Nov 12, 2026
Merged

stefan-ernst merged 1 commit into
mainfrom
plane-comment-chokepoint

Conversation

@stefan-ernst

Copy link
Copy Markdown
Contributor

What

The Plane importer inserted comments rows with raw SQL. That bypasses the comment chokepoint (CommentService) and leaves imported comments without the canonical comment-created domain fact that TestNoDirectCommentTableWrites (WI-483) exists to protect.

  • Add CommentService.CreateImportedInTx, the in-transaction counterpart of CreateImported: it preserves the source's created_at and updated_at and records the comment-created fact with side effects suppressed. CreateInTx now delegates to it with updatedAt == createdAt.
  • Route internal/planeimport/batch.go through it. The per-batch transaction stays the durability unit, so the comment and its plane_import_mappings row remain atomic.

Why

The importer is a historical bulk loader and legitimately needs both source timestamps and transaction atomicity; the existing CreateInTx supports atomicity but not updated_at, and CreateImported supports updated_at but opens its own transaction. This closes both gaps without silencing the bypass guard.

Verification

  • go build/go vet clean.
  • ./test --core <worktree> go -tags=test ./internal/planeimport/... green (the loader test now asserts item.created count separately from the new item.comment_created fact).
  • ./test --core <worktree> go -tags=test -run TestNoDirectCommentTableWrites ./internal/services/ green.

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.
@stefan-ernst stefan-ernst changed the title fix(planeimport): write imported comments through CommentService fix: write imported Plane comments through CommentService Nov 12, 2026
@stefan-ernst
stefan-ernst merged commit 0ebcef9 into main Nov 12, 2026
18 of 19 checks passed
@stefan-ernst
stefan-ernst deleted the plane-comment-chokepoint branch November 12, 2026 16:04
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.

1 participant