Repository navigation
fix(dev): match local Postgres to 18 with pre-migrate version gate, seed missing Anthropic server key - #7848
Conversation
…eed missing Anthropic server key
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughLocal setup now provides a server Anthropic API key placeholder, uses PostgreSQL 18 in Docker Compose, and checks the database server version before running migrations. ChangesLocal API Key Configuration
Local PostgreSQL Migration Setup
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to Local setup can proceed with PostgreSQL 18 after existing PostgreSQL 17 volumes are removed. No actionable issue remains in the supplied evidence. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation The Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes #7803
What & why
Fresh-checkout
./.superset/setup.local.shends withFailed steps: Validate .env, and before thatbun run db:migratefails outright against the local Docker Postgres. Two independent gaps:0122and0125rename namedNOT NULLconstraints (webhook_events_swap_*_not_null,automation_events_swap_*_not_null). Those only exist inpg_constrainton PG 18+; on 17RENAME CONSTRAINTfails, the whole migrate run rolls back, and the local DB ends up empty.SERVER_ANTHROPIC_API_KEYis required by 5 env schemas (packages/trpc,apps/api,apps/web,apps/admin,apps/marketing), but.env.local.exampleonly hadANTHROPIC_API_KEY. Sincestep_seed_env_placeholdersseeds from the example, no re-run could ever satisfy validation.Changes
docker-compose.yml—image: postgres:17→postgres:18; data mount moved to/var/lib/postgresql(the 18 image relocatedPGDATAto a versioned subdir and won't start with the old/datamount — confirmed against the official image docs). No other version pins exist in the repo..superset/setup.local.sh(local_migrate) — fail-fast gate beforedb:migrate: readsSHOW server_version_numviacompose execand aborts below180000with a message pointing atteardown.local.sh+ re-setup, instead of a rolled-back empty database..env.local.example— addedSERVER_ANTHROPIC_API_KEY=sk-ant-fake-local-devnext to the existing fake Anthropic key.packages/db/drizzle/0122+0125already ran in production, so per AGENTS.md they stay as-is; the fix is local-parity plus the version gate.How I tested it
bash -n+docker compose configclean.180006).bun run db:migrateagainst it:migrations applied successfully, 50 public tables, journal hashes recorded. Scratch stack torn down../.superset/setup.local.shon this checkout: stack healthy, migrations applied, dev account seeded — then reproduced the.envvalidation failure, applied the example fix, and re-ran validation standalone → green.Heads-up for reviewers / local devs
./.superset/teardown.local.sh(alreadydown -vs) and re-run setup. This wipes local dev data — seeding (db:seed-dev) restores the dev account..envfiles created from the old example lack the new key; re-running setup seeds it automatically, or appendSERVER_ANTHROPIC_API_KEY=sk-ant-fake-local-devmanually.Checklist
type(scope): subject)bun run lintandbun run typecheckpass (CI fails on lint warnings too)Summary by cubic
Fixes #7803: fresh-checkout
./.superset/setup.local.shfailed in two independent places —db:migrateerrored against local Postgres 17 (production runs 18, and migrations rename constraints that only exist on PG 18+), and env validation could never pass because requiredSERVER_ANTHROPIC_API_KEYwas missing from the example env. Local Postgres now matches 18, migrations fail fast when the version is below 18, and the example env seeds the missing key.Migration
./.superset/teardown.local.shand re-run setup (wipes local dev data;db:seed-devrestores the dev account)..envfiles needSERVER_ANTHROPIC_API_KEY=sk-ant-fake-local-devadded, or re-run setup to seed it.Written for commit 520ad3e. Summary will update on new commits.
Summary by CodeRabbit