fix(install): check the schema instead of migrating in the function - #244
Merged
Conversation
The installer's first step applied migrations, which needs the `.sql` files beside `@meith/db`. On Vercel they are not in the function: nothing imports them, so nothing traces them in, and `outputFileTracingIncludes` cannot put them back because `next build` defaults to Turbopack and Next skips trace collection entirely for it. The board's own build command already migrates before it builds, so the schema was current and the installer was failing on a step with nothing left to do. It now confirms every table is there and stops with what is missing. The names come from the schema definitions — ordinary imported code, present wherever the board runs — so nothing reads a file. A serverless function was the wrong place for this regardless: several cold starts contend for one migration lock, and the function timeout bounds how long a migration may take. The failure copy goes through the catalog rather than being built in `@meith/db`, which has no business holding user-facing prose. Rendering it through `fromCopy` also fixes `install.raced.sealed` and `install.raced.inFlight`, which were already thrown as catalog keys and until now reached the operator as the literal key text. Docs move with it: the step is named in `docs/quickstart.md`, which every other route points at, and `docs/vercel.md` gains why the files cannot be in the function and why `MIGRATIONS_DIR` will not help there. A test holds the form's copy to the keys the server throws, so a key added without copy behind it fails rather than shipping as raw text. The schema check is exercised with tables renamed away, which is the path CI could never reach before: its boards install a full node_modules, so the migration files were always present.
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.
Third bug from the same deploy, after #240 and #243. The board now renders its own text and its own styling;
/installstep 1 fails:Cause
@meith/dbshipsmigrationsin itsfilesallowlist, and the package's JS is plainly in the function — the code ran far enough to raise this. The.sqlfiles andmeta/_journal.jsonare not, because they are data nothing imports.Nothing can put them there either.
next builddefaults to Turbopack in Next 16, and Next skips trace collection entirely for it —next/dist/build/index.js:1627:So
outputFileTracingIncludesnever runs. That also makes the@swc/helpersentry from MEI-120 inert — a second guard believed to be protecting the build that does not execute. Filed on MEI-133 for a separate look; not touched here.Why the step had nothing to do anyway
vercel.json's build command iscommunity migrate && forum-web build --at-root, which migrates in the build container where the files do exist. The schema was current before the app ever served a request.The fix
The step confirms every table is there and stops with the names of any that are not. The names come from the schema definitions — ordinary imported code, present wherever the board runs at all — so nothing reads a file. 72 tables are discoverable that way.
A serverless function was the wrong place for this regardless of the missing files: several cold starts contend for one migration lock, and the function timeout bounds how long a migration is allowed to take. The board migrates where it deploys —
community migratein the build command,docker-entrypoint.shbefore a container serves anything — so self-hosted behaviour is unchanged.Two things found on the way
@meith/db, which has no business holding user-facing prose and no translator to hold it with. It moved to the catalog.install.raced.sealedandinstall.raced.inFlightwere already thrown as catalog keys and rendered raw — an operator hitting either saw the literal stringinstall.raced.sealed. Rendering the step error throughfromCopyfixes that too; it falls back to the raw string, so every other thrown message is unchanged.Verification
pnpm verifygreen — 7,876 tests, 449 filesnode_modules, so the migration files were always presentdocs/vercel.mdanddocs/quickstart.md, per AGENTS.mdFixes MEI-133.
Generated by Claude Code