feat(timeline): complete structured event migration with zero residual debt#1179
Merged
timothyfroehlich merged 8 commits intomainfrom Apr 18, 2026
Merged
Conversation
…rendering All 220 prod system events are migrated to event_data and content is NULLed. The legacy fallback is unreachable; removing it simplifies the render path and drops the docToPlainText dependency from the timeline component. Closes PP-6g8 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Updates to Preview Branch (feat/remove-timeline-content-fallback) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
Contributor
There was a problem hiding this comment.
Pull request overview
Removes the legacy docToPlainText(content) fallback path when rendering system timeline events, based on the assumption that all system events are now represented via structured event_data.
Changes:
- Drops the
docToPlainTextimport fromIssueTimeline.tsx. - Simplifies system-event rendering to only display
formatTimelineEvent(event.eventData).
Migrate deleteCommentAction from writing ProseMirror content to writing structured eventData. Adds comment_deleted to the TimelineEventData discriminated union with "author"/"admin" variants. Also updates all integration/unit tests to use eventData for system events, fixing a pre-existing bug where tests called .includes() on ProseMirrorDoc objects via `as any` casts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… and full test coverage - Add title_changed event type to TimelineEventData discriminated union - Extract updateIssueTitle service function (follows updateIssueStatus pattern) - Add exhaustive default case with satisfies never for runtime safety - Add CHECK constraint: system events require non-null event_data (migration 0026) - Fix createIssue missing actorId on initial assignment timeline event - Fix stale test fixture in delete-comment-audit using old content pattern - Clean up redundant double import in events.ts - Add integration tests for assignIssue (assign, unassign, no-op) - Add integration tests for updateIssueTitle (changed, no-op) - Add unit test for title_changed formatting - Add E2E assertion for assignment timeline event text Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The CHECK constraint (migration 0026) requires event_data to be non-null for system events. The seed data was still using plain content strings, causing the constraint to fail on Supabase branch DBs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The chk_system_event_data constraint fails on persistent preview/branch DBs that were seeded before the structured eventData migration — those rows have is_system=true with event_data IS NULL, so Postgres rejects the ALTER TABLE ADD CONSTRAINT. Delete them in the same migration so existing branch DBs can catch up cleanly.
The seed script was writing is_system=true rows with only content and no event_data, violating the CHECK constraint added in migration 0026. The comment said 'match service logic' but createIssue no longer emits this event — drift between seed and service. This unblocks the 'Migrate & Seed Branch DB' CI job on preview branches.
Replace awkward 'satisfies never as { type: string }' cast with a
dedicated assertUnreachableEvent(_event: never) helper. Same compile-time
exhaustiveness guarantee, no unsafe runtime cast.
Addresses Copilot review comment on types.ts:54.
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
Completes the migration from string-based timeline events to structured
eventDataJSON. After this PR merges, every system event write path produces typedeventData, the read path has no fallbacks, and DB constraints enforce data integrity.Follow-up to #1176 (initial migration). Started as a simple fallback removal (PP-6g8) but a full audit revealed 8 residual items. This PR fixes all of them.
Changes
New event type:
title_changed{ type: "title_changed"; from: string; to: string }toTimelineEventDataunionupdateIssueTitle()service function (followsupdateIssueStatuspattern: transaction, fetch old value, no-op check, timeline event)updateIssueTitleActionnow delegates to service function instead of directdb.updateFallback removal (commit 1)
docToPlainText(content)fallback fromIssueTimeline.tsxsystem event renderingeventData ? formatTimelineEvent(eventData) : null— no fallback pathcomment_deletedevent type (commit 2){ type: "comment_deleted"; deletedBy: "author" | "admin" }to uniondeleteCommentActionto writeeventDatainstead of ProseMirrorcontentType safety & DB integrity (commit 3)
defaultcase withsatisfies neverfor compile-time + runtime safetyCHECK (NOT is_system OR event_data IS NOT NULL)constraint (migration 0026)createIssuemissingactorIdon initial assignment timeline eventcontentpatternevents.tsTests
title_changedformattingassignIssue(assign, unassign, no-op) +updateIssueTitle(changed, no-op)delete-comment-audit.test.tsstale system event mockFiles changed (12)
src/lib/timeline/types.ts— union + formatter + exhaustive defaultsrc/lib/timeline/events.ts— clean import patternsrc/services/issues.ts—updateIssueTitleservice +createIssueactorId fixsrc/app/(app)/issues/actions.ts— delegate to service functionsrc/server/db/schema.ts— CHECK constraintdrizzle/0026_premium_katie_power.sql— migrationsrc/lib/timeline/format.test.ts— title_changed testsrc/test/integration/supabase/issue-services.test.ts— 5 new testssrc/test/unit/delete-comment-audit.test.ts— stale fixture fixe2e/smoke/issues-crud.spec.ts— assignment E2E assertionTesting
db:generate: "No schema changes" (migration consistent)Related Issues
Closes PP-6g8
🤖 Generated with Claude Code