fix(db): stop a missing embeddings key from blocking staging migrations - #1065
Merged
Merged
Conversation
The Database Compatibility Check has failed on every push to main since #1054, so staging has not been migrated since. The workflow runs migrate-remote-db.ts, which imports importer-lib for a CLI-flag helper, and importer-lib imports get-embedding — whose module-scope throw fired because that job holds no OpenAI key and has no reason to. Moves the check into the client factory. The rule is unchanged and still fails by name; only its timing moves, from "anything imports this" to "something asked for an embedding". Verified both ways: the import chain migrate-remote-db loads now resolves with the key unset, and reproduces the CI error on main. Note for #1007, which is still open: it proposes this same module-scope throw against a base that already has it, so merging it as written would reintroduce the failure. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
vincenttodd
approved these changes
Aug 11, 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.
The problem
The Database Compatibility Check has failed on every push to
mainsince #1054 merged, so staging has not been migrated since 11 Aug. That workflow is what applies committed migrations to staging; while it is red, staging drifts behindmain— the exact failure mode the workflow's own comments were written to prevent.It is not caused by any individual PR. It fires on
push: main, which is why PR checks stay green and the failure only appears after a merge.Root cause
migrate-remote-db.tsimportsimporter-libforgetArg, a CLI-flag helper.importer-libimportsgetEmbedding. And #1054 added a module-scope throw toget-embedding.ts:The workflow's env block has no
OPENAI_EMBEDDINGS_KEY, and correctly so — applying migrations has nothing to do with embeddings. So a migration job dies on a key it will never use, before it reaches a line of its own code.The fix
Move the check into the client factory. The rule is unchanged and still fails by name; only its timing moves, from anything imports this module to something asked for an embedding.
Verification
Both directions, against the real import chain:
migrate-remote-db.tsimports resolves withOPENAI_EMBEDDINGS_KEYunset.Two tests pin it: the module must import cleanly with no key, and
getEmbedding()must still reject by name when called without one.format:check,lint,type-check, and the full suite pass.Note for #1007
#1007 is still open and proposes this same module-scope throw. Its base already has it (#1054 landed the identical change), so merging it as written would reintroduce this failure. It can be closed as superseded, or rebased onto this.
After merge
The first push to
mainshould turn the Database Compatibility Check green and apply the migrations staging has been missing. Worth watching that run rather than assuming it.🤖 Generated with Claude Code