decision(ops): hold a production build until its migrations are applied

Open
#758 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Active
Tech stack
nextjs, supabase, typescript

Research direction

Read docs/operations/deploy.md, docs/internal/hosted-instance.md, and docs/operations/self-hosting.md to understand the current release steps and document the selected option. Eddie must choose an option first; then update the release order and migration status check in those files. Done means the chosen setting or branch and safe promotion order are documented, and self-hosting guidance no longer implies that a push always promotes automatically.

Written by the indexing model from the issue text.

Description

area: ops decision enhancement impact: high priority: P0 size: XS

Context

Found by the Fable pre-production review on 2026-12-02 (main at cedc1914; every line reference below re-checked on main at cde5aa3b). Sources: platform triage report, new issue 2, and deploy readiness report, new issue 4 (merged here).

The hosted instance's production branch is main (docs/operations/deploy.md:206), so every merge builds a production deployment, and with Vercel's default settings that deployment takes the production domain as soon as it builds. The runbooks assume otherwise: docs/internal/hosted-instance.md:9-11 says to apply new migrations "before the deployment receives traffic", and deploy.md:89 says every release applies migrations "before promoting the matching deployment". That order only holds with Vercel's "Auto-assign Custom Production Domains" turned off, which makes each production build a staged deployment that waits for a manual promote (Vercel docs, "Staging and promoting a production deployment"). No runbook names that setting. docs/operations/self-hosting.md:122 says a push to main builds and promotes.

Expand then contract (deploy.md:89) protects the previous build on a new schema, not a new build on the old schema. main had 52 commits since 2026-11-25, 14 of them touching supabase/migrations/ (git log origin/main --since=2026-11-25).

Impact: every signed-in user after a merge that adds a migration. New code runs on the old schema until Eddie applies the migration; queries against a new column or function fail with errors that users see on every page that reads them. Nothing self-heals until the migration is applied. The signal exists: /app/admin shows "Database migrations: Behind" (src/app/super-admin/page.tsx:76, :199).

This is Eddie's choice, so the options are below. Eddie promotes production; agents never do (hosted-instance.md:25).

Option Pros Cons Effort Impact
Status quo: main builds and goes live on its own Nothing to change; one step per release New code serves before its migration is applied; hosted-instance.md:9-11 and deploy.md:89 describe an order that cannot happen XS (nothing) Every user after a migration merge sees errors until Eddie applies it; the window is as long as Eddie's reaction time
A. Turn off "Auto-assign Custom Production Domains"; each main build is staged, Eddie runs supabase migration list --remote and migration up --remote, then promotes Matches the runbooks as written; no new secret anywhere; a build whose CI failed is simply not promoted Every release needs a manual promote, even with no migration; a forgotten promote leaves production on the old build (safe, but stale) XS (docs plus one Vercel setting) Users never meet a schema mismatch; the cost is release latency, which self-heals at the next promote
B. Production branch becomes production; Eddie fast-forwards it from main after applying migrations Release is a visible git action; previews of main still build A second long-lived branch to keep in step; the #461 default-branch and ruleset setup (hosted-instance.md:29-30) needs a second protected branch; still manual S (docs, ruleset, Vercel setting) Same protection as A, with more moving parts that can drift
C. A CI job applies migrations on merge before Vercel builds No manual step Puts the production database password in GitHub Actions secrets; a migration runs before review of the deploy; CI and the Vercel build race unless ordered; against "agents and automation never promote production" M (workflow, secrets, ordering) Fast releases; a bad migration reaches production with nobody watching

Files each option touches:

Option Files
Status quo none
A docs/operations/deploy.md (step 5 and the release paragraph at :89), docs/internal/hosted-instance.md (Promote production), docs/operations/self-hosting.md:122
B the same docs, plus the repository ruleset and Vercel's production branch setting
C a new workflow under .github/workflows/, repository secrets, the same docs

Recommendation: A. The deciding argument: it makes the order the runbooks already promise true with one Vercel setting and no new secret, and keeps promotion with Eddie. Second choice: B, if a visible release branch is wanted later.

Plan

  1. Eddie picks an option on this issue.
  2. Write the chosen setting into deploy.md step 5 and hosted-instance.md, and the order as: staged build, supabase migration list --remote and migration up --remote, then promote.
  3. Name "Database migrations: Behind" on /app/admin as the signal to check before promoting.
  4. Say that a main commit whose CI failed is not promoted.

Acceptance criteria

  • The chosen option is recorded on this issue with the reason.
  • deploy.md step 5 and hosted-instance.md name the Vercel setting (or the production branch) and the release order.
  • A commit with a new migration cannot serve production before supabase migration list --remote shows it applied.
  • self-hosting.md "Upgrade" no longer says a push to main promotes on its own, or says why that is safe for self-hosters.
  • Playwright e2e: none needed, docs only.

Files and areas

docs/operations/deploy.md, docs/internal/hosted-instance.md, docs/operations/self-hosting.md.

Non-goals: applying migrations, changing Vercel settings (Eddie's), the production address work in #756.

Verification

npm run lint; the docs e2e spec still passes.


Branch: <issue-number>-staged-production-builds

Model: anthropic/claude-opus-5-5 | Reasoning effort: unknown

Dominant language
TypeScript
Stars
13
Forks
2
Avg merge
5h 20m
Merged PRs (30d)
287

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from eddiejaoude/StackDash

All issues in eddiejaoude/StackDash

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.