The transcript backfill runs its own migration - #174
Merged
Conversation
sync_captures.transcript is created lazily, inside the repository's ensure() on first use — so deploying the app does not create it, and the backfill refused to run until some request happened to touch the thread repository. That ordering dependency is invisible from the outside and made the script look broken on a correctly-deployed build. It now runs the same idempotent ALTER the app runs, and says so when it actually adds the column — that DDL is the one write a --dry-run still makes, and adding an empty nullable column is exactly what the next request would have done anyway. No-ticket: true Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mm4zPLAX77USAqyk12jgc1
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
The backfill refused to run on a correctly-deployed build:
sync_captures.transcriptis created lazily — inside the Neon repository'sensure()(ready ??= …) on its first use. Deploying doesn't create it; some request has to happen to touch the thread repository first. That ordering dependency is invisible from the outside, so the script looked broken when nothing was wrong.It now runs the same idempotent
ALTER TABLE … ADD COLUMN IF NOT EXISTSthe app runs, so it no longer depends on a request having warmed the schema.--dry-runstill performs that one DDL statement, and now says so when it actually adds the column. Adding an empty nullable column is precisely what the app's next request would have done, and no Capture row is touched — but a dry run that writes silently is a bad contract, so it announces it.Test plan
node --checkpasses on the scriptlib/sync/neon-repository.ts:ensure()isready ??=, memoized per process, and every method awaits it — confirming the column cannot exist until a repository call runsNo-ticket: true
🤖 Generated with Claude Code
https://claude.ai/code/session_01Mm4zPLAX77USAqyk12jgc1
Generated by Claude Code