Skip to content

fix(db): stop a missing embeddings key from blocking staging migrations - #1065

Merged
Jose-Gael-Cruz-Lopez merged 1 commit into
mainfrom
fix/embeddings-key-blocks-migrations
Aug 11, 2026
Merged

fix(db): stop a missing embeddings key from blocking staging migrations#1065
Jose-Gael-Cruz-Lopez merged 1 commit into
mainfrom
fix/embeddings-key-blocks-migrations

Conversation

@Jose-Gael-Cruz-Lopez

Copy link
Copy Markdown
Contributor

The problem

The Database Compatibility Check has failed on every push to main since #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 behind main — 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.ts imports importer-lib for getArg, a CLI-flag helper. importer-lib imports getEmbedding. And #1054 added a module-scope throw to get-embedding.ts:

migrate-remote-db.ts → lib/importer-lib.ts → src/utils/get-embedding.ts → throws at import

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:

  • With this change, importing exactly what migrate-remote-db.ts imports resolves with OPENAI_EMBEDDINGS_KEY unset.
  • Stashing it reproduces the CI error verbatim from the same import.

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 main should 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

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

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
internal-dashboard Ready Ready Preview Aug 11, 2026 11:02pm
nightcrawler Ready Ready Preview Aug 11, 2026 11:02pm

@Jose-Gael-Cruz-Lopez
Jose-Gael-Cruz-Lopez merged commit 7834283 into main Aug 11, 2026
9 checks passed
@Jose-Gael-Cruz-Lopez
Jose-Gael-Cruz-Lopez deleted the fix/embeddings-key-blocks-migrations branch August 11, 2026 23:12
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