Repository navigation
Commit baf3bd4
authored
Fix migration 0008 parser stack overflow on macOS bun:sqlite (#745)
* Fix migration 0008 parser stack overflow on macOS bun:sqlite
Migration 0008 inlined a 41-deep nested replace() chain (8 dash-collapse
replaces wrapping lower(33 single-char replaces wrapping the raw input))
to slugify header names into slot_keys. Bun's lemon SQL parser stack
overflows at PREPARE time on the compiled CLI binary on macOS, so users
upgrading on Mac couldn't start the CLI at all (the Linux test matrix
in CI never exercised the failing path).
Replace the deep chain with a temp __slug_norm table populated once at
the top of the migration via a series of shallow UPDATE statements (one
per replacement), then reference the precomputed slug via flat scalar
subqueries everywhere. Semantics verified equivalent against 25 inputs
covering case, punctuation, whitespace, dashes-only and unicode.
Add structural lint that scans every drizzle migration file and rejects
any nested-function call > 20 deep. Catches the regression class on
Linux CI without needing macOS in the matrix.
* Drop changeset, swap throw for typed expect to satisfy oxlint
- Remove .changeset/fix-migration-0008-parser-overflow.md: the existing
.changeset/executor-1.4.16.md (still in main, consumed when the open
Version Packages PR merges) is enough to ship 1.4.16 with this fix
included.
- Replace throw new Error(...) in migration-nesting.test.ts with a
shaped expect(...).toEqual({...}) that prints file/line/fn/depth in
the diff. Satisfies oxlint's no-error-constructor / no-try-catch-or-throw
rules without losing the diagnostic.1 parent 69af8b8 commit baf3bd4
2 files changed
Lines changed: 228 additions & 34 deletions
0 commit comments