Skip to content

The transcript backfill runs its own migration - #174

Merged
wschenk merged 1 commit into
mainfrom
claude/walking-thoughts-org-g0qlvt
Aug 8, 2026
Merged

The transcript backfill runs its own migration#174
wschenk merged 1 commit into
mainfrom
claude/walking-thoughts-org-g0qlvt

Conversation

@wschenk

@wschenk wschenk commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

The backfill refused to run on a correctly-deployed build:

sync_captures.transcript does not exist yet — deploy the app once so the schema migration runs

sync_captures.transcript is created lazily — inside the Neon repository's ensure() (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 EXISTS the app runs, so it no longer depends on a request having warmed the schema.

--dry-run still 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 --check passes on the script
  • Path verified by reading lib/sync/neon-repository.ts: ensure() is ready ??=, memoized per process, and every method awaits it — confirming the column cannot exist until a repository call runs

No-ticket: true

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mm4zPLAX77USAqyk12jgc1


Generated by Claude Code

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
@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
walking-thoughts Ready Ready Preview Aug 8, 2026 4:19pm

Request Review

@wschenk
wschenk merged commit 55beb2a into main Aug 8, 2026
3 checks passed
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.

2 participants