Skip to content

CI: migrations must work with the release still serving (the 4 Dec first-build 500: a dropped column during rollout) - #191

Merged
ndbroadbent merged 1 commit into
mainfrom
migration-safety
Dec 4, 2026
Merged

ndbroadbent merged 1 commit into
mainfrom
migration-safety

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

A sign-up blocker from the case studies: a new project's first POST /api/v1/builds answered 500, and a rerun 90 s later worked (visualci-com/pdfkit, 4 Dec 07:14:33 UTC, feedback fb_01a23fea24157d3c97e7fa1e90938e7e).

Cause (logs from talira infra)

  • The web pod logged API request failed error="no column found for name: setup_dismissed_at".
  • ArgoCD runs migrations before the rollout. Organization settings page; setup steps can be shown again once complete #172's migration (2026_12_06_000000_organization_settings) dropped organizations.setup_dismissed_at in the same deploy that stopped reading it.
  • For about 20 s (07:14:33 until the new pods were ready at 07:14:40-56), the old pods still selected that column, so every request that loaded an organization failed. pdfkit's first build happened to be one of them.
  • Nothing about new projects was involved: any request in that window would have failed.

What changes

  • scripts/ci/migration_safety.py, run in the required cli-version job, compares the migrations a change adds with app/src at the base commit (the release that will still be serving). It fails when a new migration:
    • drops, renames or retypes a column, or drops or renames a table, that the old code still names;
    • adds a NOT NULL column with no default to a table, since the old release's inserts would leave it out.
  • A name the old code uses for something else can be let through with -- contract: <name>: <why> in the migration.
  • AGENTS.md gets the rule (expand, then contract: add and copy now, stop reading now, drop in a later change), with why. This is deploy safety rather than backwards compatibility, because the old column still goes one release later.

Tests

  • scripts/ci/test_migration_safety.py has 5 unit tests: the 4 Dec migration; drops, renames and retypes; additions, constraints, defaults and comments passing; required columns without a default; the contract line.
  • Failing first: replaying Organization settings page; setup steps can be shown again once complete #172's commit (366dd65) against its base fails with drops or changes column setup_dismissed_at, which app/src still reads.
  • No false positives: replaying the 17 other commits that added migrations on main all pass.

The schema that's live is already consistent, since #172's code is deployed. Nothing to repair in production.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@visualci-com

visualci-com Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #610 · 424 unchanged · no changes

This PR vs base: 19 changed, 10 added since #511, across 3 builds

docspring/visualci · journeys · build #606 · 50 unchanged · no changes

This PR vs base: 2 changed, 8 added since #507, across 3 builds

Updated as builds change. Agents can review with VisualCI's MCP tools.

…till serving reads, or add a required column with no default; AGENTS.md says why (the 4 Dec first-build 500)
@ndbroadbent
ndbroadbent merged commit 5acaf6f into main Dec 4, 2026
16 checks passed
@ndbroadbent
ndbroadbent deleted the migration-safety branch December 4, 2026 10:07
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.

1 participant